# Nginx high load average

**URL:** <https://www.ruby-forum.com/t/nginx-high-load-average/225789>\
**Category:** NGINX\
**Created:** [January 29, 2013, 11:09pm UTC](https://www.ruby-forum.com/t/nginx-high-load-average/225789 "2013-01-29T23:09:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSkonishi\_takurou\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@SSkonishi\_takurou\_S](https://www.ruby-forum.com/u/SSkonishi_takurou_S)\
**Post date:** [January 29, 2013, 11:09pm UTC](https://www.ruby-forum.com/t/nginx-high-load-average/225789/1 "2013-01-29T23:09:53Z")

</div>

hello

i have server running as shared server Intel(R) Xeon(R) CPU E3-1225 V2 @  
3.20GHz 4 core and 16 g.b ram running onCentOS release 5.9 (Final)  
upload  
and download via php scripts like rapidshare

the problem is i have high connections on this server and i want to know  
how  
could i configure the nginx correctly

here is my current nginx.conf

user nobody;

# no need for more workers in the proxy mode

worker\_processes 1;

error\_log logs/error.log info;

worker\_rlimit\_nofile 8192;

events {  
worker\_connections 51200; # you might need to increase this setting  
for  
busy servers  
use epoll; # Linux kernels 2.4.x change to rtsig  
}

http {  
server\_names\_hash\_max\_size 2048;

include mime.types;  
default\_type application/octet-stream;

sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;

keepalive\_timeout 10;

gzip on;  
gzip\_min\_length 1100;  
gzip\_buffers 4 32k;  
gzip\_types text/plain application/x-javascript text/xml text/css;  
ignore\_invalid\_headers on;

client\_header\_timeout 3m;  
client\_body\_timeout 3m;  
send\_timeout 3m;  
connection\_pool\_size 1024;  
client\_header\_buffer\_size 4k;  
large\_client\_header\_buffers 4 32k;  
request\_pool\_size 4k;  
output\_buffers 4 32k;  
postpone\_output 1460;  
proxy\_temp\_path /home/proxy\_temp;  
include “/usr/local/nginx/conf/vhost.conf”;  
}

Posted at Nginx Forum:

> **[nginx high load average](https://forum.nginx.org/read.php?2,235709,235709#msg-235709)**
>
> hello i have server running as shared server Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz 4 core and 16 g.b ram running onCentOS release 5.9 (Final) upload and download via php scripts like rapidshare the problem is i have high connections on this...

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [January 30, 2013, 3:51am UTC](https://www.ruby-forum.com/t/nginx-high-load-average/225789/2 "2013-01-30T03:51:31Z")

</div>

‘worker\_processes’ should be equal to total numbers of CPU cores.

What does ‘high connections’ mean?

Please show the result of ‘cat /proc/net/sockstat’, and the content of ’  
/usr/local/nginx/conf/vhost.conf’.

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [January 30, 2013, 7:10am UTC](https://www.ruby-forum.com/t/nginx-high-load-average/225789/3 "2013-01-30T07:10:08Z")

</div>

It’s very unlikely that nginx is causing a high load average. If I  
separate it off from the php/database processing, I can run it on a low  
power, single threaded vps with 128MB memory.

What process is really using your CPU?

Steve

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [January 30, 2013, 6:44pm UTC](https://www.ruby-forum.com/t/nginx-high-load-average/225789/4 "2013-01-30T18:44:36Z")

</div>

this is a shared server like any other shared sites support download and  
upload files like movies and programs , stuff over 1 and 2 gigabyte for  
download and upload , i am trying to adjust the connections in the  
server to  
work good with nginx , and this is my vhost.conf

high connection mean alot of visitors established connection in my  
server

```
  4 TIME_WAIT
  9 SYN_RECV
  2 LISTEN
 40 LAST_ACK
988 ESTABLISHED

```

and this is vhost.conf

server {

access\_log off;

error\_log logs/vhost-error\_log warn;  
listen 80;  
server\_name [site.com](http://site.com) [www.site.com](http://www.site.com);

# uncomment location below to make nginx serve static files instead of

Apache

# NOTE this will cause issues with bandwidth accounting as files wont

be  
logged  
location  
~.\*.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$  
{  
root /home3/s9/public\_html;  
}

location / {  
proxy\_send\_timeout 90;  
proxy\_read\_timeout 90;

proxy\_buffer\_size 4k;

# you can increase proxy\_buffers here to suppress "an upstream

response

# is buffered to a temporary file" warning

proxy\_buffers 16 32k;  
proxy\_busy\_buffers\_size 64k;  
proxy\_temp\_file\_write\_size 64k;

proxy\_connect\_timeout 30s;

proxy\_redirect [http://www.site.com:81](http://www.site.com:81)[http://www.site.com](http://www.site.com);  
proxy\_redirect [http://site.com:81](http://site.com:81)[http://site.com](http://site.com);

proxy\_pass [http://192.168.0.1:81/](http://192.168.0.1:81/);

proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;

```
        # track uploads in the 'proxied' zone
        # remember connections for 30s after they finished
        track_uploads proxied 30s;

```

}  
location ^~ /progress {  
# report uploads tracked in the ‘proxied’ zone  
report\_uploads proxied;  
}  
}

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,235709,235745#msg-235745](http://forum.nginx.org/read.php?2,235709,235745#msg-235745)
