# Very urgent. speed problem

**URL:** <https://www.ruby-forum.com/t/very-urgent-speed-problem/195076>\
**Category:** NGINX\
**Created:** [September 16, 2010, 1:27pm UTC](https://www.ruby-forum.com/t/very-urgent-speed-problem/195076 "2010-09-16T13:27:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masteryo\_Team](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ec9cab/32.png) [@Masteryo\_Team](https://www.ruby-forum.com/u/Masteryo_Team)\
**Post date:** [September 16, 2010, 1:27pm UTC](https://www.ruby-forum.com/t/very-urgent-speed-problem/195076/1 "2010-09-16T13:27:41Z")

</div>

Hello guys

any help will be appreciate it

I have new server with 1 Gbit port speed and I installed nginx on it.  
The  
server only for downloading data.

Now there are  
TCP Connections in ESTABLISHED State

2060.0 con

the currently traffic use : 140.6 Mb/s  
see MRTG [http://server07.animedown.tv/mrtg/](http://server07.animedown.tv/mrtg/)

I have 4MB speed in my computer. if I download file by flashget/download  
manager program , the speed will be around 100 KB/s.

in the same server if I download through apache the speed will be around  
400

- 500 KB/s

you can test download speed by your self

FROM Nginx:  
[http://server07.animedown.tv/s1/ArbicSub/S/Death\_Note/Death\_Note\_01.avi/1a287429aff39b5b711836924b994e94/4c930ccd](http://server07.animedown.tv/s1/ArbicSub/S/Death_Note/Death_Note_01.avi/1a287429aff39b5b711836924b994e94/4c930ccd)

FROM Apache:  
[http://server07.animedown.tv:81/s1/ArbicSub/S/Bleach/Bleach\_001.avi](http://server07.animedown.tv:81/s1/ArbicSub/S/Bleach/Bleach_001.avi)

[root@ ~]# /opt/nginx/sbin/nginx -V  
nginx version: nginx/0.7.61  
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)  
configure arguments: --prefix=/opt/nginx  
–sbin-path=/opt/nginx/sbin/nginx  
–conf-path=/opt/nginx/conf/nginx.conf  
–error-log-path=/opt/nginx/logs/error\_log  
–pid-path=/opt/nginx/logs/nginx.pid --lock-path=/var/lock/nginx.lock  
–http-log-path=/opt/nginx/logs/access\_log --user=apache --group=apache  
–http-proxy-temp-path=/opt/nginx/logs/proxy  
–http-client-body-temp-path=/opt/nginx/logs/client-body  
–http-fastcgi-temp-path=/opt/nginx/logs/fastcgi --with-http\_sub\_module  
–with-debug --add-module=/opt/nginx/addons/ngx\_http\_secure\_download  
–with-md5=/opt/md

user apache apache;  
worker\_processes 25;  
worker\_rlimit\_nofile 32768;  
pid /opt/nginx/logs/nginx.pid;  
lock\_file /var/lock/subsys/nginx;  
error\_log /opt/nginx/logs/error\_log error;

events {  
worker\_connections 1024;  
use epoll;  
}

http {

include /opt/nginx/conf/mime.types;  
default\_type text/plain;

# aio on;

sendfile off;  
output\_buffers 1 256k;  
directio 4m;

# ssi off;

# ssi\_silent\_errors on;

# gzip off;

tcp\_nopush on;  
tcp\_nodelay on;  
expires off;  
auth\_basic off;

# TUNING

client\_header\_timeout 30;  
client\_body\_timeout 60;  
send\_timeout 30;  
connection\_pool\_size 512;  
client\_header\_buffer\_size 1k;  
client\_body\_buffer\_size 32m;  
large\_client\_header\_buffers 4 4k;  
request\_pool\_size 8k;  
postpone\_output 1460;  
keepalive\_timeout 75 30;  
reset\_timedout\_connection on;  
server\_names\_hash\_bucket\_size 128;

# PROXY

proxy\_buffering off;  
proxy\_cache off;  
proxy\_connect\_timeout 3000;  
proxy\_send\_timeout 3000;  
proxy\_read\_timeout 3000;  
proxy\_buffer\_size 2048k;  
proxy\_buffers 2 2048k;  
proxy\_busy\_buffers\_size 2048k;

# proxy\_max\_temp\_file\_size 0;

# proxy\_buffering on;

# proxy\_temp\_file\_write\_size 128k;

# proxy\_temp\_path /opt/nginx/logs/proxy\_temp;

# geo $GEOIP\_COUNTRY\_CODE {

# include geoip.conf;

# default XX;

# }

# DEFAULT

server {  
listen 127.0.0.1:80 default;  
access\_log /opt/nginx/logs/access\_log combined;  
#location /sts {  
# stub\_status on;  
# access\_log off;  
# allow all;  
#}  
location / {  
root /var/www;  
deny all;  
}  
}

server {  
listen 67.159.60.93:80;  
server\_name [server07.animedown.tv](http://server07.animedown.tv) \*.server07.animedown.tv;  
error\_log off;  
access\_log off;

autoindex on;  
index index.shtml index.html index.php;  
location ~\* .php$ {  
proxy\_redirect off;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Host $http\_host;  
proxy\_set\_header X-URI $uri;  
proxy\_set\_header X-ARGS $args;  
proxy\_set\_header Host $http\_host;  
proxy\_set\_header Refer $http\_refer;  
proxy\_pass [http://67.159.60.93:81](http://67.159.60.93:81);  
}

location /s1/php {  
root /data;  
}  
location /s1/ArbicSub {  
root /data;  
secure\_download on;  
secure\_download\_secret masteryo;  
secure\_download\_path\_mode file;  
secure\_download\_fail\_location /error;  
add\_header Content-Disposition “attachment; filename=$uri”;  
#internal;  
}  
location /s2/php {  
root /data;  
}  
location /s2/ArbicDub {  
root /data;  
secure\_download on;  
secure\_download\_secret masteryo;  
secure\_download\_path\_mode file;  
secure\_download\_fail\_location /error;  
add\_header Content-Disposition “attachment; filename=$uri”;  
#internal;  
}

location /mrtg {  
index index.shtml;  
root /var/www;  
}

}

}

---

<div class="post-metadata">

**Author:** ![Masteryo\_Team](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ec9cab/32.png) [@Masteryo\_Team](https://www.ruby-forum.com/u/Masteryo_Team)\
**Post date:** [September 16, 2010, 3:41pm UTC](https://www.ruby-forum.com/t/very-urgent-speed-problem/195076/2 "2010-09-16T15:41:11Z")

</div>

Hi,

I’ve not had a detailed look at the config, but I think you’re possibly  
suffering by having

client\_body\_buffer\_size 32m;

Perhaps try something like :

client\_body\_buffer\_size 32k;

or see how it works with the default (8k or 16k depending on the  
platform).

Also, 25 worker processes is probably way too high. Try 1 per processor  
core, or possibly even fewer.

You might also want to experiment with sendfile on.

Good luck!

Marcus.
