Replace log-written metrics
In the search of another performance bottlenecks of controller we've realized that writing metrics into logs significantly decreases controller throughput, especially given that the controller has not a big memory/heap size. Moreover, it would be cleaner to separate logs from metrics.
The proposal is to send metrics directly to an external endpoint without an additional disk IO, e.g. sending to statsd could be a good option.
cc @mhenke1
UPD: as per suggestion of @markusthoemmes Kamon could be a good option http://kamon.io/documentation/get-started/
Note we have two prs open to generate similar metrics with proper frameworks, one including open tracing. We should adopt and build on that mode rather than introduce a third mechanism.
The difference is some cases subtle, but it is existent. I wouldn't use tracing to implement counter metrics for example.
@vvraskin can you share data that you’ve gathered to help inform the discussion?
Sure, but please don't consider the numbers as an official report or so, there could be some interference with logstash, possible overhead from active ack received from the previous run or the limited heap size. They are rather to show the magnitude, not the absolute values.
With metrics generation:
vadim@dummyhost:/vadim# docker run --pid=host --userns=host --rm -v $(pwd):/data williamyeh/wrk -t 12 -c 1024 -d300s http://10.253.253.136:10001/api/v1/namespaces/_/actions/noopThroughput --latency -s post.lua --timeout 10
Running 5m test @ http://10.253.253.136:10001/api/v1/namespaces/_/actions/noopThroughput
12 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.36s 2.20s 9.92s 83.14%
Req/Sec 744.57 377.66 4.70k 68.69%
Latency Distribution
50% 115.52ms
75% 1.86s
90% 5.19s
99% 8.22s
923136 requests in 5.00m, 249.18MB read
Socket errors: connect 0, read 0, write 0, timeout 2040
Non-2xx or 3xx responses: 1394
Requests/sec: 3076.42
Transfer/sec: 850.33KB
Metrics generation replaced by hard-coded values :
vadim@dummyhost:/vadim# docker run --pid=host --userns=host --rm -v $(pwd):/data williamyeh/wrk -t 12 -c 1024 -d300s http://10.253.253.136:10001/api/v1/namespaces/_/actions/noopThroughput --latency -s post.lua --timeout 10
Running 5m test @ http://10.253.253.136:10001/api/v1/namespaces/_/actions/noopThroughput
12 threads and 1024 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.15s 2.13s 10.00s 85.34%
Req/Sec 839.71 415.38 2.44k 66.45%
Latency Distribution
50% 98.28ms
75% 594.14ms
90% 4.75s
99% 8.44s
1467155 requests in 5.00m, 395.99MB read
Socket errors: connect 0, read 0, write 0, timeout 421
Non-2xx or 3xx responses: 916
Requests/sec: 4889.16
Transfer/sec: 1.32MB
I think we addressed this.