jmx_exporter
jmx_exporter copied to clipboard
Improve performance of duplicate sample lookup
Maintain a lookup index for sample keys (name, labels) and use that to check for duplicate sample during scraping instead of O(n) list of samples
Also guard non-trivial computation behind Logger level check
Please also remove the old
findExisting()
method as it's not used anymore.
Good catch. Fixed.
@fstab - kind reminder to review this PR. thanks
This improvement has proved to be very valuable for us. We work with a large system with kafka and kafka streams and the amount of metrics are quite large. When we upgraded from 0.16.1 to 0.17.3 there was a significant drop in performance while using 15sec scraping. The response times were quite high and it simply unusable with 15sec scraping. During our profiling we saw that most of the time spent was on findExisting()
function. After applying the above fix 15sec scraping is again usable. I hope this gets merged to trunk and added to the next release.
@fstab I know you are busy, but I feel this should be prioritized. On a real Kafka broker, this change decreased collection time by ~40%.
Before the change...
time_namelookup: 0.004212s
time_connect: 0.004593s
time_appconnect: 0.058974s
time_pretransfer: 0.059085s
time_redirect: 0.000000s
time_starttransfer: 27.566052s
----------
time_total: 27.618721s
After the change...
time_namelookup: 0.006547s
time_connect: 0.007784s
time_appconnect: 0.062182s
time_pretransfer: 0.062339s
time_redirect: 0.000000s
time_starttransfer: 17.136378s
----------
time_total: 17.226715s
Thanks a lot, and sorry for the long delay.