0
0
Nginxdevops~5 mins

Connection pooling to upstream in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is connection pooling in the context of nginx upstream servers?
Connection pooling is a technique where nginx reuses existing connections to upstream servers instead of opening a new connection for every client request. This improves performance by reducing connection overhead.
Click to reveal answer
beginner
Which nginx directive enables connection reuse to upstream servers?
The directive keepalive inside the upstream block enables connection pooling by keeping connections open for reuse.
Click to reveal answer
intermediate
How do you configure nginx to keep 32 connections alive to an upstream server?
Inside the upstream block, add keepalive 32; to allow nginx to keep 32 idle connections open for reuse.
Click to reveal answer
beginner
What is the benefit of using connection pooling with upstream servers in nginx?
It reduces the time and resources spent establishing new TCP connections, lowers latency, and improves throughput by reusing existing connections.
Click to reveal answer
intermediate
Can connection pooling be used with HTTP/1.1 and HTTP/2 upstream connections in nginx?
Connection pooling with keepalive works with HTTP/1.1 upstream connections. For HTTP/2, nginx handles multiplexing differently and does not use the same keepalive directive.
Click to reveal answer
Which nginx directive controls the number of idle connections kept alive to upstream servers?
Akeepalive
Bproxy_pass
Cworker_connections
Dclient_max_body_size
What is the main advantage of connection pooling in nginx upstreams?
ACaching static files on the server
BIncreasing the number of worker processes
CReusing existing connections to reduce latency
DEncrypting client connections
Where do you place the keepalive directive to enable connection pooling?
AInside the <code>server</code> block
BInside the <code>location</code> block
CInside the <code>http</code> block
DInside the <code>upstream</code> block
If you set keepalive 16; in an upstream block, what does it mean?
ANginx keeps up to 16 idle connections open to upstream servers
BNginx limits total connections to 16
CNginx closes connections after 16 seconds
DNginx uses 16 worker processes
Does connection pooling with keepalive work the same way for HTTP/2 upstream connections?
AOnly if HTTP/2 is disabled
BNo, HTTP/2 uses multiplexing and does not rely on keepalive
CYes, it works exactly the same
DOnly for HTTPS connections
Explain how connection pooling works in nginx and why it improves performance.
Think about how opening fewer new connections saves time.
You got /4 concepts.
    Describe how to configure nginx to keep 20 idle connections alive to an upstream server.
    Remember the keepalive directive goes inside the upstream block.
    You got /3 concepts.