TL;DR
During load testing of a Rust service, unexpected memory retention was observed, leading to concerns about memory leaks. The investigation revealed that the issue stemmed from the allocator rather than the application code itself.
✦ Why It Matters
Evaluate and potentially switch your Rust service's memory allocator to optimize performance under load today.
Key Takeaways
Full Summary
While testing a Rust service under a bursty workload, memory usage increased significantly and did not decrease after processing events, raising suspicions of a memory leak. The service was designed to handle 100 active events at a time using a semaphore, spawning short-lived Tokio tasks for I/O operations.
Despite the expectation that memory would be released post-processing, it remained near the container limit. The investigation concluded that the allocator was responsible for the memory retention, not the application logic.
This highlights the need for developers to consider allocator behavior when diagnosing memory issues. Understanding how different allocators manage memory can lead to better performance and resource management in Rust applications.
The findings suggest that engineers should evaluate their choice of allocator based on workload characteristics.
Related