statsdaemon icon indicating copy to clipboard operation
statsdaemon copied to clipboard

timer count sampling and persist

Open ploxiln opened this issue 6 years ago • 3 comments

This started with the motivation of making timer ".count" keys persist like counters, and also it seems like they're intended to honor the sampling so they should do that too. But the next annoying bit is how postfix needs to be removed and re-added for timers, so maybe postfix should be added last ... but then receive-counter should probably keep its current behavior of not getting the prefix/postfix ... and then when trying to add code concisely it becomes apparent that much of packetHandler() can just be removed ...

It's best to look at each commit individually for a good explanation. I would also be willing to break out some separate pull-requests (and then this one would depend on most of those going in first).

~~According to our benchmarks, handling timers got a bit slower, because now it adds to two maps instead of one. Some other stuff got a bit better.~~ EDIT: refactored, and updated benchmark results.

benchmark                         old ns/op      new ns/op      delta
BenchmarkManyDifferentSensors     1340102699     1366014386     +1.93%
BenchmarkOneBigTimer              1247196564     1250918558     +0.30%
BenchmarkLotsOfTimers             1340196338     1371868042     +2.36%
BenchmarkMsgParserUDP             1224           1217           -0.57%
BenchmarkMsgParserTCP             1101           1097           -0.36%
BenchmarkParseLineCounter         888            871            -1.91%
BenchmarkParseLineGauge           881            836            -5.11%
BenchmarkParseLineTimer           853            834            -2.23%
BenchmarkParseLineSet             777            769            -1.03%
BenchmarkPacketHandlerCounter     79.9           72.0           -9.89%
BenchmarkPacketHandlerGauge       71.3           73.1           +2.52%
BenchmarkPacketHandlerTimer       126            97.3           -22.78%
BenchmarkPacketHandlerSet         123            102            -17.07%

benchmark                         old allocs     new allocs     delta
BenchmarkManyDifferentSensors     35058          38064          +8.57%
BenchmarkOneBigTimer              33             36             +9.09%
BenchmarkLotsOfTimers             25017          28017          +11.99%
BenchmarkMsgParserUDP             15             15             +0.00%
BenchmarkMsgParserTCP             14             14             +0.00%
BenchmarkParseLineCounter         13             13             +0.00%
BenchmarkParseLineGauge           13             13             +0.00%
BenchmarkParseLineTimer           12             12             +0.00%
BenchmarkParseLineSet             12             12             +0.00%
BenchmarkPacketHandlerCounter     0              0              +0.00%
BenchmarkPacketHandlerGauge       0              0              +0.00%
BenchmarkPacketHandlerTimer       0              0              +0.00%
BenchmarkPacketHandlerSet         0              0              +0.00%

benchmark                         old bytes     new bytes     delta
BenchmarkManyDifferentSensors     1556072       1664552       +6.97%
BenchmarkOneBigTimer              1400          1512          +8.00%
BenchmarkLotsOfTimers             839976        930824        +10.82%
BenchmarkMsgParserUDP             596           596           +0.00%
BenchmarkMsgParserTCP             549           549           +0.00%
BenchmarkParseLineCounter         440           440           +0.00%
BenchmarkParseLineGauge           432           432           +0.00%
BenchmarkParseLineTimer           464           464           +0.00%
BenchmarkParseLineSet             460           460           +0.00%
BenchmarkPacketHandlerCounter     0             0             +0.00%
BenchmarkPacketHandlerGauge       0             0             +0.00%
BenchmarkPacketHandlerTimer       80            80            +0.00%
BenchmarkPacketHandlerSet         65            65            +0.00%

ploxiln avatar Jul 27 '18 20:07 ploxiln

squashed in two little cleanup commits

ploxiln avatar Jul 27 '18 22:07 ploxiln

I'm actually going to do more work on this ...

ploxiln avatar Jul 31 '18 03:07 ploxiln

refactored a bit, updated benchmark results

ploxiln avatar Jul 31 '18 21:07 ploxiln