# OS tuning an nginx webserver machine

**URL:** <https://www.ruby-forum.com/t/os-tuning-an-nginx-webserver-machine/218097>\
**Category:** NGINX\
**Created:** [March 21, 2012, 3:56am UTC](https://www.ruby-forum.com/t/os-tuning-an-nginx-webserver-machine/218097 "2012-03-21T03:56:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 21, 2012, 3:56am UTC](https://www.ruby-forum.com/t/os-tuning-an-nginx-webserver-machine/218097/1 "2012-03-21T03:56:03Z")

</div>

Hi all,

Recently I resorted to tuning my nginx webserver box for more  
performance.  
I went ahead an changed

sudo ip route change default via 1.25.29.1 dev eth0 initcwnd 10

sudo sysctl -w net.ipv4.tcp\_slow\_start\_after\_idle=0

This changed exposed a much better performance than anticipated. And  
since  
most of my pages are httpd cached, the load times went down from 2.3 – 3  
seconds to 1.5-2 seconds

While browsing I came across another  
benchmarking[http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast/](http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast/)

echo “2048 64512” \> /proc/sys/net/ipv4/ip\_local\_port\_range

echo “1” \> /proc/sys/net/ipv4/tcp\_tw\_recycle

echo “1” \> /proc/sys/net/ipv4/tcp\_tw\_reuse

echo “10” \> /proc/sys/net/ipv4/tcp\_fin\_timeout

echo “65536” \> /proc/sys/net/core/somaxconn

echo “65536” \> /proc/sys/net/ipv4/tcp\_max\_syn\_backlog

echo “262144” \> /proc/sys/net/netfilter/nf\_conntrack\_max

worker\_processes 16;

worker\_rlimit\_nofile 262144;

daemon off;

events {

use epoll;

worker\_connections 16384;

}

error\_log error.log;

pid /dev/null;

http {

sendfile on;

tcp\_nopush on;

keepalive\_requests 100;

open\_file\_cache max=100;

gzip off;

gzip\_min\_length 1024;

access\_log off;

server {

```
listen *:8080 backlog=16384;

location / {

  root html;

  index index.html;

}

```

}

}

But the type of machines that the tester has used does not allow me to  
believe the results.  
[http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast/](http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast/)

Have someone else gone along the same path? Are these system variable  
changes recommended by the nginx community?

-Quintin
