Recall & Review
beginner
What is a keepalive connection in nginx?
A keepalive connection allows nginx to reuse the same TCP connection for multiple requests between the client and server, reducing the overhead of opening new connections.
Click to reveal answer
beginner
Which nginx directive enables keepalive connections for upstream servers?
The directive
keepalive inside the upstream block enables keepalive connections to upstream servers.Click to reveal answer
intermediate
What does the
keepalive_timeout directive control in nginx?It controls how long nginx keeps an idle keepalive connection open before closing it.
Click to reveal answer
intermediate
How does enabling keepalive connections improve performance?
It reduces the time and CPU needed to establish new TCP connections by reusing existing ones, leading to faster response times and less resource use.
Click to reveal answer
beginner
What is the default behavior of nginx regarding keepalive connections if not configured?
By default, nginx closes the connection after each request unless keepalive is explicitly enabled.
Click to reveal answer
Which directive in nginx enables keepalive connections to upstream servers?
✗ Incorrect
The
keepalive directive inside the upstream block enables keepalive connections.What is the main benefit of using keepalive connections in nginx?
✗ Incorrect
Keepalive connections reuse TCP connections, reducing the overhead of opening new ones.
Which directive controls how long nginx keeps an idle keepalive connection open?
✗ Incorrect
keepalive_timeout sets the idle time before closing a keepalive connection.If keepalive is not enabled, what does nginx do after serving a request?
✗ Incorrect
By default, nginx closes the connection after each request unless keepalive is enabled.
Where should the keepalive directive be placed to enable connection reuse to backend servers?
✗ Incorrect
The
keepalive directive must be inside the upstream block to enable reuse of connections to backend servers.Explain what keepalive connections are in nginx and why they are useful.
Think about how opening new connections affects speed and resources.
You got /4 concepts.
Describe how to configure keepalive connections for upstream servers in nginx.
Focus on where and what directives to use.
You got /4 concepts.