Nginx runs out of memory with large value for 'keepalive_requests'
prajos
nginx-forum at forum.nginx.org
Thu Jul 12 09:48:55 UTC 2018
Hi all,
I'm using nginx as a Revers proxy to a service (A). nginx receives a large
number of persistent connections from a single client service(B).
Service B sends a lot of requests (2K rps) over these persistent
connections.
The amount of memory nginx uses seems to increase as a function of
'keepalive_requests 2147483647' . The memory used keeps raising until the
machine runs out of memory (4GB, aws instance). While a smaller
''keepalive_requests 8192' doesn't create the exact problem.
Some additional observations:
When I reload nginx the memory usage comes down and then slowly starts
building up.
when I test nginx with a gatling test tool as a client, this behaviour is
not observed.
When I use the actual service(B), this behaviour seems to reappear.
I curious to know what exactly is happening and how can I fix this issue of
high memory usage ?
my nginx server side configuration looks like:
server {
listen 443 ssl default_server;
...
...
location / {
# keepalive_timeout 14400s;
# keepalive_requests 2147483647; ----> over 10 hrs, memory usages go to 4
GB
keepalive_timeout 600s;
keepalive_requests 8192;
proxy_pass http://ingress;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
..
}
Thanks for all the help,
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280505,280505#msg-280505
More information about the nginx
mailing list