Ngix Performace as a Reverse Proxy
Niall Gallagher - Yieldbroker
Niall.Gallagher at yieldbroker.com
Sun Oct 28 22:26:04 UTC 2012
According to documentation for proxy_buffering
"For Comet applications based on long-polling it is important to set proxy_buffering to off, otherwise the asynchronous response is buffered and the Comet does not work."
I have tried the following and am not getting better results, however its still being outperformed by the Java HTTP proxy by about 10% - 15%.
worker_cpu_affinity 01 10;
However spikes of up to 20 seconds are still frequent under high load.
From: nginx-bounces at nginx.org [mailto:nginx-bounces at nginx.org] On Behalf Of Sergey Budnevitch
Sent: Friday, 26 October 2012 11:04 PM
To: nginx at nginx.org
Subject: Re: Ngix Performace as a Reverse Proxy
On 26 Oct2012, at 08:36 , Niall Gallagher - Yieldbroker <Niall.Gallagher at yieldbroker.com> wrote:
> 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).
nginx mailing list
nginx at nginx.org
More information about the nginx