July 12, 2018 05:48AM
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,
Subject Author Posted

Nginx runs out of memory with large value for 'keepalive_requests'

prajos July 12, 2018 05:48AM

Re: Nginx runs out of memory with large value for 'keepalive_requests'

Maxim Dounin July 12, 2018 08:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready