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?
✗ Incorrect
The
keepalive directive inside the upstream block sets how many idle connections nginx keeps open for reuse.What is the main advantage of connection pooling in nginx upstreams?
✗ Incorrect
Connection pooling reuses existing connections, which reduces the time needed to establish new connections and lowers latency.
Where do you place the
keepalive directive to enable connection pooling?✗ Incorrect
The
keepalive directive must be set inside the upstream block to enable connection pooling.If you set
keepalive 16; in an upstream block, what does it mean?✗ Incorrect
This setting keeps up to 16 idle connections open for reuse to improve performance.
Does connection pooling with
keepalive work the same way for HTTP/2 upstream connections?✗ Incorrect
HTTP/2 multiplexes multiple streams over a single connection, so nginx does not use the
keepalive directive for HTTP/2 upstreams.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.