Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Memory leak under high concurrent load - reaching 95% utilization #3538

Open
Lydanne opened this issue Dec 24, 2024 · 0 comments
Open

Comments

@Lydanne
Copy link

Lydanne commented Dec 24, 2024

Expected Behavior

The application's memory usage should remain stable and properly handle high concurrency situations without uncontrolled memory growth.

Current Behavior

We are observing a significant memory leak under high concurrent load:

  • Memory utilization shows dramatic increases during peak traffic periods
  • Starting at around 65% utilization
  • Rapidly climbing to ~75% around Dec 16
  • Further jumping to ~90% around Dec 19
  • Finally reaching and maintaining at ~95% after Dec 22
  • Memory is not being released even after the traffic decreases

Concurrent metrics during the incident:

  • Normal concurrent requests: [Please specify baseline]
  • Peak concurrent requests: [Please specify peak number]
  • Number of active connections: [Please specify if available]

Possible Solution

The memory leak under high concurrency could be caused by:

  1. Connection pool not properly releasing connections
  2. Request handlers not properly cleaning up resources
  3. Async tasks or futures not being properly dropped
  4. Thread local storage accumulation
  5. Buffer allocations not being properly managed under load

Suggested investigation steps:

  1. Implement detailed request lifecycle logging
  2. Monitor thread pool and connection pool metrics
  3. Profile memory allocation patterns during high concurrency
  4. Review async resource cleanup mechanisms

Steps to Reproduce

  1. Start the application in a test environment
  2. Simulate high concurrent load (e.g., using wrk or Apache JMeter)
    • Target concurrent connections: [number]
    • Request rate: [requests/second]
  3. Monitor memory usage over time
  4. Observe memory growth pattern similar to production

Context

This memory leak is particularly problematic because:

  • It affects our ability to handle high traffic situations
  • Could lead to service outages during peak usage
  • Increases operational costs
  • May require frequent service restarts
  • Impacts service reliability and user experience

Your Environment

  • Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15)
  • Actix Web Version: 4.9.0
  • Monitoring Tool: aliyun
  • Environment: Production

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant