Nginx Issue

gmk.jaga nginx-forum at nginx.us
Fri Mar 5 19:13:43 MSK 2010


Hi,

I am facing memory leak problem with nginx in my servers.

The nginx is taking more cache memory while running continuously.

I have hardly found any solutions to fix this memory leak problem. 

Can any one please help me out in resolving this issue.

FYI - i have given my server nginx configuration and server detail below for references.

Thanks You!

Jaga

-----------------


Server Configuration 

Processor                     : 2x AMD Quad core 2382 @ 2.70Hz

Ram                               : 32GB memory 

OS                                 : CentOS release 5.3 (Final)



Nginx Version

nginx version: nginx/0.7.64
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
configure arguments: --with-poll_module --with-select_module --with-rtsig_module


Sample Configuration  File

# user and group to run as
user root;

# number of nginx workers
worker_processes  4;


# pid of nginx master process
pid /var/run/nginx.pid;

# Number of worker connections. 1024 is a good default
events {
  worker_connections 4000;
  #use poll;
  multi_accept on;
  accept_mutex on;
  accept_mutex_delay 50ms;
  epoll_events 1024;
}

# start the http module where we config http access.
http {
  # pull in mime-types. You can break out your config
  # into as many include's as you want to make it cleaner
  include /usr/local/nginx/conf/mime.types;

  # set a default type for the rare situation that
  # nothing matches from the mimie-type include
  default_type  application/octet-stream;



  # configure log format

log_format main '"Status" $status "Bytes" $bytes_sent "u Addr:" $upstream_addr  "u status" $upstream_status  "U Response" $upstream_response_time "MSec" $msec  ';

log_format error '"Status" $status "Bytes" $bytes_sent "u Addr:" $upstream_addr  "u status" $upstream_status  "U Response" $upstream_response_time "MSec" $msec  ';

  # main access log
  #access_log  /var/log/nginx/nginx_access.log main;
  access_log off;

  # main error log
  error_log   /var/log/nginx/nginx_error.log error;

  # no sendfile on OSX
  sendfile on;
  keepalive_timeout  5;
  # These are good default values.
  tcp_nopush        on;
  tcp_nodelay       on;
  # output compression saves bandwidth
  gzip            off;

  client_body_timeout 1s;

upstream Sample {

    server 127.0.0.1:9000 weight=3;
    server 127.0.0.1:9001 weight=3;
    server 127.0.0.1:9002 weight=3;
    server 127.0.0.1:9003 weight=3;
    server 127.0.0.1:9004 weight=3;

    server 192.168.1.2:9000 weight=3;
    server 192.168.1.2:9001 weight=3;
    server 192.168.1.2:9002 weight=3;
    server 192.168.1.2:9003 weight=3;
    server 192.168.1.2:9004 weight=3;

    server 192.168.1.3:9000 weight=3;
    server 192.168.1.3:9001 weight=3;
    server 192.168.1.3:9002 weight=3;
    server 192.168.1.3:9003 weight=3;
    server 192.168.1.3:9004 weight=3;

    server 192.168.1.4:9000 weight=3;
    server 192.168.1.4:9001 weight=3;
    server 192.168.1.4:9002 weight=3;
    server 192.168.1.4:9003 weight=3;
    server 192.168.1.4:9004 weight=3;


}


server {

    listen 80;

    client_max_body_size 50M;

    server_name www.sample.com;

    root /home/public;

    # access_log  /var/log/nginx.vhost.access.log  main;
    send_timeout 20;

    location ~* ^.+\.(jpg|jpeg|JPG|JPEG|GIF|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
        root /home/public;
        expires 7d;

        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_max_temp_file_size 0;
        proxy_connect_timeout 30;

        if (!-f $request_filename) {
	  rewrite maintenance.html break;
          proxy_pass http://Sample;
        }
    }

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,59889,60377#msg-60377




More information about the nginx mailing list