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

big memory usage, memory leak? #63

Closed
adammakowskidev opened this issue Sep 8, 2023 · 1 comment · Fixed by darkweak/souin#366
Closed

big memory usage, memory leak? #63

adammakowskidev opened this issue Sep 8, 2023 · 1 comment · Fixed by darkweak/souin#366

Comments

@adammakowskidev
Copy link

Hi
For educational purposes I am building a small CDN server, I am using Caddy and your cache plugin for this.
I have a problem, the cache-handler uses too much RAM in my opinion.
I use loader.io to benchmark. When benchmark run and server handle traffic, memory usage in server grows very fast.

At startup, the server uses about 300mb of RAM.
When I turn on benchmark loader.io with settings:

  1. Mantain client load - 0 to 500
  2. Accept-Encoding - gzip,deflate,br
  3. loader.io only loads a CSS file of about 1kb in size.

At the end of the test the server handles about 120k requests per minute and RAM consumption rises to 1.3GB.
It should be noted that with nginx only 1 CPU the server can handle 250k requests per minute with a larger number of connections, so performance is not at the highest level.

I added your plugin to Caddy using the command - caddy add-package github.com/caddyserver/cache-handler
Server - 2 CPU ARM Ampere Altra, 4GB ram, Ubuntu 22.
Caddy version 2.7.4

My caddy config

Global

{
	order cache before rewrite
	cache
}

# Import all websites configs
import websites/*

Website

cdn1.domain1.com {
	cache {
		cache_name xxx
       		stale 1m
        	ttl 1h
        	default_cache_control public
    	}
	encode {
		zstd
		gzip 4
		minimum_length 300
	}
	reverse_proxy https://www.domain2.com {
		header_up Host {upstream_hostport}
	}
}

Have any of you tested Caddy and cache-handler in this way? In what could there be a problem?
Greetings

@adammakowskidev
Copy link
Author

Also after a few hours after the benchmarks caddy stopped working on the server....

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

Successfully merging a pull request may close this issue.

1 participant