excessive RAM consumption - memory leak

Igor Sysoev is at rambler-co.ru
Wed Feb 20 23:42:51 MSK 2008


On Wed, Feb 20, 2008 at 08:49:12PM +0100, Todd HG wrote:

> I am using Nginx 0.5.35 on a server that has a Xeon 5130 dual core, 4 GB
> of RAM, and 10,000 RPM HD. Nginx serves millions of large images per
> day. Sometimes tens of millions in a day. Over the past week the server
> has been experiencing record traffic. I am looking for a way to reduce
> the amount of RAM consumed by Nginx, but still deliver images at the
> same rate. The CPU cycles are at an acceptable level, but yesterday
> Nginx nearly consumed all 4 GB of RAM before I had to reboot the server
> under very heavy traffic. All this server does is serve images files
> like jpeg, etc. Some of my configuration is below:
> 
> Since this is a dual core CPU I am using:
> 
> worker_processes  2;
>         worker_connections  12000;
>         use epoll; # This is a RedHat Enterprise Server 4
> 
> I also have:
> 
>     gzip on;
>     sendfile       on;
>     tcp_nopush     on;
>     tcp_nodelay    on;
>     keepalive_timeout  75 20;
>     server_names_hash_bucket_size 128;
> 
> I have tried reducing the keepalive_timeout to close the connection
> sooner, so that resources might be freed sooner, but it has no noticable
> effect.
> 
> Can someone make some suggestions how I could handle the same traffic,
> but manage the RAM usage better.

Do you use the standard nginx without any external modules ?
Does nginx serve static files only without any proxy, fastcgi, perl, etc.
processing ?

What does

ps ax -o pid,ppid,%cpu,vsz,wchan,command|egrep '(nginx|PID)'

show ?


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list