Company
Date Published
Author
Wangchong Zhou
Word count
1789
Language
English
Hacker News points
None

Summary

Kong Cloud has been utilizing StatsD and Prometheus for monitoring and metrics collection but encountered performance issues with high CPU usage from the StatsD Prometheus exporter during peak request rates. The exporter, which translates StatsD metrics to Prometheus formats, was consuming excessive CPU resources, prompting a profiling analysis that revealed significant CPU time spent on regular expression processing. To address this, Kong Cloud developers refactored the exporter to implement a lightweight matcher using a finite state machine, tailored to their specific use cases which did not require the full complexity of regular expressions. This optimization reduced CPU consumption significantly by minimizing reliance on the Go regular expression library, thereby improving performance by concentrating processing power on system calls and the Go runtime instead. These enhancements led to a 40% reduction in processing time for matching functions and were integrated into the Prometheus StatsD Exporter version v0.8.0-rc1, released in October 2018. Kong Cloud, still in beta, offers seamless updates and is compatible with major cloud providers like AWS, Azure, and Google Cloud.