Nginx Issue

My nginx is taking more memory. kindly advice me soon

                                                        By Thanks

Posted at Nginx Forum:

On Thu, 2010-03-04 at 07:59 -0500, gmk.jaga wrote:

My nginx is taking more memory. kindly advice me soon

http://catb.org/~esr/faqs/smart-questions.html#beprecise

Cliff

On Fri, 2010-03-05 at 11:13 -0500, gmk.jaga wrote:

Hi,

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

The nginx is taking more cache memory while running continuously.

“cache memory”? What command are you using to get this?

    proxy_max_temp_file_size 0;
    proxy_connect_timeout 30;

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

As an aside, it appears you could simplify your config a bit (and make
it more efficient as well):

server {
listen 80;
client_max_body_size 50M;
server_name www.sample.com;
send_timeout 20;

location / {
    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;

    try_files $uri $uri/ @backend;
}

location @backend {
    root /home/public;
    rewrite maintenance.html break;
    proxy_pass http://Sample;
}

}

Regards,
Cliff

We are getting the catch memory details from this cmd.

free

Thanks.

Posted at Nginx Forum:

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:

Hello!

On Fri, Mar 12, 2010 at 06:44:03AM -0500, gmk.jaga wrote:

We are getting the catch memory details from this cmd.

free

Amount of memory reported in “cached” column by free corresponds
to memory used for page cache, i.e. cache memory used for files
read from disk.

As long as you have [at least some] free memory - it is normal
that cached will grow. Any free memory available in system will
be used by your OS to cache files.

Maxim D.