2013-06-28 66 views
0

我需要監督實時應用程序。此應用程序每秒接收60個連接,每個應用程序使用53個度量。statsd後丟失值的20%

所以我的模擬客戶端發送了3180個度量標準。 我需要lower,upper,average,median和count_ps值。這就是爲什麼我使用「時間」類型。

當我在statsd的結尾查看一個指標的count_ps時,我只有40個值而不是60. 我沒有找到有關statsd容量的信息。也許我超負荷吧^^

所以你能幫我嗎,我有什麼選擇?

我不能減少度量標準,但我不需要「時間」類型提供的所有信息。我可以限制「時間」嗎?

謝謝!

我的配置:

1)貓存儲schemas.conf

# Schema definitions for Whisper files. Entries are scanned in order, 
# and first match wins. This file is scanned for changes every 60 seconds. 
# 
# [name] 
# pattern = regex 
# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ... 

# Carbon's internal metrics. This entry should match what is specified in 
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings 
[carbon] 
pattern = ^carbon\. 
retentions = 60:90d 

[stats] 
pattern = ^application.* 
retentions = 60s:7d 

2)貓dConfig.js

{ 
    graphitePort: 2003 
, graphiteHost: "127.0.0.1" 
, port: 8125 
, backends: [ "./backends/graphite", "./backends/console" ] 
, flushInterval: 60000 
, debug: true 
, graphite: { legacyNamespace: false, globalPrefix: "", prefixGauge: "", prefixCounter: "", prefixTimer: "", prefixSet: ""} 
} 

3)貓存儲aggregation.conf

# Aggregation methods for whisper files. Entries are scanned in order, 
# and first match wins. This file is scanned for changes every 60 seconds 
# 
# [name] 
# pattern = <regex> 
# xFilesFactor = <float between 0 and 1> 
# aggregationMethod = <average|sum|last|max|min> 
# 
# name: Arbitrary unique name for the rule 
# pattern: Regex pattern to match against the metric name 
# xFilesFactor: Ratio of valid data points required for aggregation to the next                    retention to occur 
# aggregationMethod: function to apply to data points for aggregation 
# 
[min] 
pattern = \.lower$ 
xFilesFactor = 0.1 
aggregationMethod = min 

[max] 
pattern = \.upper$ 
xFilesFactor = 0.1 
aggregationMethod = max 

[sum] 
pattern = \.sum$ 
xFilesFactor = 0 
aggregationMethod = sum 

[count] 
pattern = \.count$ 
xFilesFactor = 0 
aggregationMethod = sum 

[count_legacy] 
pattern = ^stats_counts.* 
xFilesFactor = 0 
aggregationMethod = sum 

[default_average] 
pattern = .* 
xFilesFactor = 0.3 

4)客戶:

#!/usr/bin/env python 
import time 
import random 
import statsd 
import math 

c = statsd.StatsClient('localhost',8125) 
k = 0 
nbData = 60 
pause = 1 

while True : 
     print k 
     k += pause 
     tps1 = time.clock() 
     for j in range (nbData): 
       digit = j%10 + k*10 + math.sin(j/500) 
       c.timing('TPS.global', digit) 
       c.timing('TPS.interne', digit) 
       c.timing('TPS.externe', digit) 
       for i in range(5): 
         c.timing('TPS.a.'+str(i), digit) 
         c.timing('TPS.b.'+str(i), digit) 
         c.timing('TPS.c.'+str(i), digit) 
         c.timing('TPS.d.'+str(i), digit) 
         c.timing('TPS.e.'+str(i), digit) 
         c.timing('CR.a.'+str(i), digit) 
         c.timing('CR.b.'+str(i), digit) 
         c.timing('CR.c.'+str(i), digit) 
         c.timing('CR.d.'+str(i), digit) 
         c.timing('CR.e.'+str(i), digit) 
     tps2 = time.clock() 
     print 'temps = ' + str(tps2 - tps1) 
     if k >= 60: 
      k = 0 
     if pause-tps2 + tps1 < 1: 
     time.sleep(pause-tps2 + tps1) 

編輯:添加客戶端代碼

回答

0

如果沒有更多的背景下,很難說,有什麼可怎麼回事。向StatsD發送數據時是否使用採樣? StatsD在運行什麼硬件?你的模擬全部在本地主機上嗎?你是否在有損連接上運行它?

目前沒有辦法將時間指標限制爲僅限某些類型。

對不起,沒有更直接的幫助。如果問題仍然存在,請考慮放入Freenode IRC的#statsd並在此處詢問。

0

你的CARBON_METRIC_INTERVAL設置爲?我懷疑它需要匹配StatsD flushInterval