Increasing Memory Usage
flute
nginx-forum at nginx.us
Thu Jul 30 07:21:36 MSD 2009
I'm using Nginx 0.7.61 with php-fpm(php 5.2.6) on Freebsd7.1-amd64。
When i starte nginx,the total memory usage beging Increase. Unitl used all memory.
use top with sort size,i'm look at the each nginx work process used more than 400M memory.
The solution is used 'kill -HUP'
http://ylem.guanxi.koubei.com/ylem/get?version=1.0&enc=5tGKrFjjiG4DONY0WlR1IZ0oHeSR1ZHTVJEzyXe_yDhNYfzLaR.D0wpSXWZ_iAy_YJZ9nmwW2x55Lmp0Xly1A1s-
why nginx used so many memory?
nginx.conf
pid /var/run/nginx.pid;
worker_rlimit_nofile 200000;
events {
worker_connections 20000;
use kqueue;
kqueue_changes 2048;
}
http {
include mime.types;
log_not_found off;
default_type text/html;
log_format main '$remote_addr $server_name [$time_local] '
'"user:$cookie_user;PHPSESSID:$cookie_PHPSESSID"'
'$request $status $body_bytes_sent $request_time $http_referer '
'"$http_user_agent" $http_x_forwarded_for' $proxy_host;
access_log off;
open_log_file_cache max=1000 inactive=20s min_uses=8 valid=1m;
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 8;
open_file_cache_errors on;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
server_names_hash_bucket_size 64;
gzip_static on;
gzip off;
server_tokens off;
userid on;
userid_name user;
userid_path /;
userid_expires 365d;
recursive_error_pages on;
upstream test.com {
server 127.0.0.1:8080 weight=2;
server 192.168.0.10:8080 weight=4;
}
client_body_buffer_size 128k;
server {
listen 80;
server_name test.com;
location /serverinfo/ {
stub_status on;
auth_basic "md";
auth_basic_user_file /usr/local/etc/nginx.pw;
}
location / {
FileETag on;
etag_format "%X%X";
if ($request_method = POST) {
error_page 404 = /phppost;
}
if ($uri ~* \.html$) {
root /data/www/html;
return 0;
}
if ($uri ~* (\.(js|swf|ico|gif|jpg|jpeg|png|css|xml|mp3))$) {
root /data/www/html;
expires 30d;
return 0;
error_page 404 = /error/404.html;
}
error_page 404 = /phpreq;
}
location /phppost {
internal;
access_log /logs/nginx/access.log main;
proxy_set_header Cookie "$http_cookie;Real_IP=$remote_addr";
proxy_method POST;
proxy_connect_timeout 60;
proxy_buffers 32 128k;
proxy_ignore_client_abort on;
proxy_pass http://127.0.0.1:8080;
}
location /phpreq {
internal;
access_log /logs/nginx/access.log main;
proxy_set_header Cookie "$http_cookie;Real_IP=$remote_addr";
proxy_buffers 128 32k;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
#proxy_busy_buffers_size 20480k;
proxy_headers_hash_max_size 8192;
proxy_ignore_client_abort on;
proxy_pass http://test.com;
}
location /10/ {
proxy_pass http://192.168.0.10:8080/;
}
location /11/ {
proxy_pass http://127.0.0.1:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4598,4598#msg-4598
More information about the nginx
mailing list