what is best config for nginx worker_rlimit_nofile and worker_connections 28672

Posted by Binh Nguyen on Server Fault See other posts from Server Fault or by Binh Nguyen
Published on 2012-10-04T05:42:36Z Indexed on 2012/10/04 15:41 UTC
Read the original article Hit count: 257

Filed under:
|

i have issue of web-brower response ( especially on ie ) very slow, some time time out, and sometime hang out up to 20 seconds for one file redirect 301 when test with "f12 derverloper tool of ie" .. it report wait/start time very long. but after got connected the elements on web weill be dowload and show out fast ( test at xaluan.com )

It most happen when active user on web more than 2100 ( use google real time live analytic ).

server running cenos 5 with ngix, apache, 32core cpu, 96G ram, raid 10 sas hdd..

== flowing is my config ==

user nobody;
# no need for more workers in the proxy mode
worker_processes 28; #old 32 #good at 24
error_log /var/log/nginx/error.log; #old add in end: info
worker_rlimit_nofile 22528;
events {
 worker_connections 22528;
 use epoll; # you should use epoll here for Linux kernels 2.6.x
}
http {
 server_name_in_redirect off;
 server_names_hash_max_size 10240;
 server_names_hash_bucket_size 1024;
 include mime.types;
 default_type  application/octet-stream;
 server_tokens off;
 disable_symlinks off;
 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
server_name_in_redirect off;
server_names_hash_max_size 10240;
server_names_hash_bucket_size 1024;
include mime.types;
default_type  application/octet-stream;
server_tokens off;
disable_symlinks off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 25; #old 5
gzip on; #old on
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_proxied any;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_comp_level 6;
gzip_buffers 16 8k;

ignore_invalid_headers on;
client_header_timeout 1m; #3m
client_body_timeout 1m; #3m
send_timeout 1m; #3m
reset_timedout_connection on;
connection_pool_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_max_body_size 100M; 
client_body_buffer_size 256k;
request_pool_size 32k;
output_buffers 4 32k;
postpone_output 1460;
proxy_temp_path /tmp/nginx_proxy/;
client_body_in_file_only on;
log_format bytes_log "$msec $bytes_sent .";

    limit_conn_zone $binary_remote_addr zone=limit_per_ip:1m;
    limit_conn limit_per_ip 20; 
    limit_req_zone $binary_remote_addr zone=allips:5m rate=200r/s;
    limit_req zone=allips burst=200 nodelay;


 include "/etc/nginx/vhosts/*";
}

===========

I have play around with worker config

1- tried increase as some one suggess:

worker_rlimit_nofile = worker_connections = worker_processes * 1024 = 32768

2- tried to set low: worker_processes = 28 and other worker at 22582

and other solution too .. but not work cause some time it make server load hight very quick

3- tried to comment out the # worker_rlimit_nofile . so it will be unlimited. it look like solved a bit about issue response time. but it also make server high load quick in peak time...

Please help thanks

PS: other apache you may have look for help me out thanks

Listen 0.0.0.0:8081
User nobody
Group nobody
ExtendedStatus On
ServerAdmin [email protected]
ServerName server.xaluan.com
LogLevel warn

# These can be set in WHM under 'Apache Global Configuration'
Timeout 100
TraceEnable Off
ServerSignature Off
ServerTokens ProductOnly
FileETag None
StartServers 15
<IfModule prefork.c>
MinSpareServers 20
MaxSpareServers 50
#MaxSpareServers 40
</IfModule>
ServerLimit 1572
MaxClients 1572
MaxRequestsPerChild 4000
# MaxRequestsPerChild 3000
KeepAlive On
KeepAliveTimeout 3
MaxKeepAliveRequests 300
#MaxKeepAliveRequests 130

© Server Fault or respective owner

Related posts about apache2

Related posts about nginx