0
0
Nginxdevops~5 mins

Keepalive connections in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Akeepalive
Bproxy_pass
Clisten
Dserver_name
What is the main benefit of using keepalive connections in nginx?
AIncreasing the number of open connections
BEncrypting data automatically
CBlocking slow clients
DReusing TCP connections to reduce overhead
Which directive controls how long nginx keeps an idle keepalive connection open?
Aworker_processes
Bclient_max_body_size
Ckeepalive_timeout
Dproxy_connect_timeout
If keepalive is not enabled, what does nginx do after serving a request?
AKeeps the connection open indefinitely
BCloses the connection
CSends a redirect
DLogs an error
Where should the keepalive directive be placed to enable connection reuse to backend servers?
AInside the upstream block
BInside the server block
CInside the location block
DInside the http block
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.