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

Cache-handler memory leak with redis storage #118

Open
andriimredocly opened this issue Dec 17, 2024 · 1 comment
Open

Cache-handler memory leak with redis storage #118

andriimredocly opened this issue Dec 17, 2024 · 1 comment

Comments

@andriimredocly
Copy link

I noticed a constant memory growth of the container holding Caddy server in our production environment. We used Caddy as a reverse proxy only and recently started using it as a cache for HTTP requests. Since that moment we see constant growth of memory in the Caddy server under the same load. In 3-4 days the app memory usage grows from 500-700MB to 5GB+

Image

I also provided a way to reproduce this issue locally https://github.com/andriimredocly/caddy-possible-memory-leak.
It consists of a Caddy server with a minimal possible config for reverse proxying and caching. The upstream web server is just a Nginx application that responds with the same simple HTML and cache headers to all requests. The Redis container is also deployed to store the cached responses.
The tool to emulate the load is wrk (https://github.com/wg/wrk) a popular open-source tool to do the load testing. The lua script generates unique URLs for each request. Maybe because each request has a unique URL - some data is stored in Caddy server memory, but this does not sound like an expected behavior.

Resources usage from locally launched application
Image

When the cache is disabled, the memory remains consistently low (<100MB), so this clearly indicates an issue with the cache-handler.

@darkweak
Copy link
Collaborator

Hey @andriimredocly thank you for this well redacted issue. I'll investigate on that and write the patch in the PR darkweak/souin#589.

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

2 participants