Recall & Review
beginner
What does the
sendfile directive do in nginx?The
sendfile directive enables nginx to use the operating system's sendfile() system call to transfer files directly from disk to the network socket, improving performance by avoiding copying data between user space and kernel space.Click to reveal answer
beginner
What is the purpose of the
tcp_nopush directive in nginx?The
tcp_nopush directive controls how nginx sends TCP packets. When enabled, it delays sending partial packets to send larger packets at once, reducing overhead and improving network efficiency.Click to reveal answer
intermediate
How do
sendfile and tcp_nopush work together in nginx?When
sendfile is enabled, tcp_nopush helps by delaying packet sending until a full packet is ready. This combination improves file transfer speed and reduces CPU usage.Click to reveal answer
beginner
How do you enable
sendfile and tcp_nopush in nginx configuration?In the nginx configuration file, add these lines inside the
http block:<br>sendfile on; tcp_nopush on;
Click to reveal answer
beginner
What is a real-life analogy for
sendfile and tcp_nopush working together?Imagine sending a big package by mail.
sendfile is like using a direct conveyor belt to move the package without extra handling. tcp_nopush is like waiting to fill the box completely before sealing it, so fewer boxes are sent and shipping is efficient.Click to reveal answer
What does enabling
sendfile in nginx do?✗ Incorrect
Sendfile uses the OS system call to send files directly, improving performance.
What is the effect of enabling
tcp_nopush in nginx?✗ Incorrect
Tcp_nopush delays sending to optimize packet size and reduce overhead.
Which nginx block typically contains
sendfile on; and tcp_nopush on; directives?✗ Incorrect
These directives are usually set in the http block for global effect.
What is a benefit of using
sendfile with tcp_nopush?✗ Incorrect
They work together to optimize file sending and reduce CPU load.
If
sendfile is off, what happens?✗ Incorrect
Without sendfile, data moves through user space, which is slower.
Explain how
sendfile and tcp_nopush improve nginx performance when serving static files.Think about how data moves from disk to network and how packets are sent.
You got /3 concepts.
Describe how to enable
sendfile and tcp_nopush in nginx and where to place these directives.Consider nginx configuration structure and applying global settings.
You got /3 concepts.