Closed algrebe closed 8 years ago
I love this! Thanks @algrebe. I added a test case and noticed a logic flaw, some stats were skipped, so I changed the implementation a bit. See https://github.com/quipo/statsd/commit/7f04a7d3e9aaae37cae7acf589ef8c8dfe595863
@quipo nice catch ! I noticed that when I reset the array, I forgot to include the \n
and just used len(stat)
. Thank you for the test case !
I had created a ticket https://github.com/quipo/statsd/issues/30 , which can be closed now since you've merged it.
Introduced package level variable MaxStatsSize which is 16kb by default. BufferedClient flushes to SendEvents rather than SendEvent. SendEvents tries to pack as many stats as it can until MaxStatsSize is reached, separated by \n. This leads to decreased udp traffic.
Previously without this fix, my processes were generating udp traffic at around 40k packets per second. With this change it has gone down to around 2k packets per second. Since one can fine tune more, I made the MaxStatsSize variable, so that it can be changed based on users network capabilities.