Reverse Proxy Advanced Topics
[ 104 ]
That isn't too many concurrent connections at all. Let's adjust the number of buffers
down, and ensure that NGINX will start transferring something to the client while
the rest of the response is read into the remaining proxy_buffers space:
http {
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
}
Four 32 KB buffers is 131,072 bytes (4 32 1024) per connection.
The 768 MB we allocated to NGINX is 805,306,368 bytes (768 1024 1024).
Dividing the two, we come up with 805306368 / 131072 = 6144 active connections.
For a reverse-proxy machine, we may therefore want to scale up by adding more
memory (6 GB RAM will yield us approximately 37,000 connections) or scale out by
adding more 1 GB machines behind a load balancer, up to the number of concurrent,
active users we can expect.
Caching
Caching can be described with the following figure: