Introduction
In large-scale cloud environments, optimizing "hotspot" functions—those consuming significant CPU resources—can lead to substantial infrastructure cost savings. However, profiling modern microservices is challenging due to their multilingual nature (e.g., C++, Java, Python), massive scale across thousands of containers, and the performance overhead typically imposed by traditional profiling tools. To address these challenges, we present Atys, a distributed profiling framework designed for high efficiency and low overhead in production environments.
System Architecture
Atys utilizes a distributed architecture to minimize network congestion and central processing bottlenecks. The system consists of three primary components: a central Controller, a Prometheus Server for data storage and visualization, and Local Profilers deployed on individual worker nodes.
The Controller manages profiling tasks, while the Prometheus server handles the storage of aggregated hotspot data. The Local Profilers are responsible for the heavy lifting of data collection and initial processing at the node level.
Methodology and Local Profiler Workflow
The core innovation of Atys lies in its Local Profiler, which implements several strategies to reduce overhead:
- Language-agnostic Adaptation: Atys dynamically selects the appropriate profiling kernel (e.g.,
async-profilerfor Java,py-spyfor Python, orPerffor C++) based on the target service's runtime. - Function Selective Pruning (FSP): By identifying that a small percentage of threads (often the top 25%) account for the vast majority of CPU usage, Atys prunes inactive background threads to accelerate data processing.
- Frequency Dynamic Adjustment (FDA): Using Jensen-Shannon (JS) divergence, Atys monitors the stability of hotspot distributions. It reduces sampling frequency when hotspots are stable and increases it when shifts are detected, optimizing CPU usage.
As shown in the workflow, the Agent coordinates the profiling kernel to sample the target service. The resulting stack traces are aggregated into compact flamegraphs locally before being uploaded as hotspot functions to the Prometheus client. This local aggregation reduces data transmission by approximately 99% compared to sending raw traces.
Evaluation and Key Results
Atys was evaluated using industry-standard benchmarks, including Specjbb2015 (Java) and VGG16 Inference (Python), on a 13-node cluster.
- Efficiency and Accuracy: The FSP strategy reduced aggregation time by 6.8% while maintaining a tiny 0.58% error rate for the top 50 hotspot functions. This confirms that focusing on the "working" threads is sufficient for accurate profiling.
- Cost Savings: The FDA scheme achieved an 87.6% reduction in CPU overhead compared to constant high-frequency sampling, providing results comparable to a 10,000Hz baseline.
- Scalability: In stress tests, the central server managed 1,000 concurrent service instances while using only 175MB of memory and less than 6% CPU, proving it can handle the load of a modern data center.
Conclusion
Atys provides a non-invasive, scalable solution for hotspot detection in complex cloud ecosystems. By moving data processing to the edge and employing intelligent sampling adjustments, it significantly lowers the "profiling tax" without sacrificing the visibility required for performance optimization. Future work will explore extending Atys to monitor memory and I/O-bound hotspots and further automating parameter calibration for new services.
Summary updated