Ngix Performace as a Reverse Proxy

Sergey Budnevitch sb at
Fri Oct 26 12:04:27 UTC 2012

On 26  Oct2012, at 08:36 , Niall Gallagher - Yieldbroker <Niall.Gallagher at> wrote:

> Hi,
> We have been doing some testing with Nginx as a reverse proxy. We have been comparing it to a number of solutions which it easily beats, like IIS and Apache with mod_proxy etc. However, as an experiment we have been comparing it to an adapted NIO server written in Java. This seems to be out performing Nginx in the reverse proxy role by a factor of 3 times. We are convinced our configuration is wrong. Both run on the same box (at different times) with the same sysctl settings (see below). We also saw some spikes, up to 3 seconds per request at times, and some at 10 over a 1 million request test of 1000 concurrent clients.
> We are using a fairly straight forward configuration for Nginx. Since we have two processors on the box we tried worker_processes of 4 with worker_connections of 6000, then we tried worker_processes of 40 with worker_connections of 5000. No change. We need to be able to support responsive Ajax requests with strategies like HTTP streaming and long polling in our setup.
> Any ideas what we can do to boost our throughput and latency?

Buffers. nginx should not write/read anything to/from disk while proxing
for maximum performance. Check your average request and response sizes
and tune buffers sizes accordingly (look at proxy_buffers, 
proxy_buffer_size, proxy_max_temp_file_size documentation).

More information about the nginx mailing list