Networking Essentials hard
The `sendfile` system call optimizes static file serving (e.g., Nginx) by:
- A It proactively compiles the entire static file directory into the application's executable binary to eliminate the need for any high-latency disk-based read operations.
- B It utilizes a specialized, high-performance Javascript runtime inside the kernel to dynamically evaluate and optimize the file's binary structure before transmission.
- C It relies on a specialized client-side header that instructs the browser to download the file directly from the nearest globally-available persistent CDN cache.
- D It enables the kernel to transfer data directly from the Disk Page Cache to the Network Socket Buffer, bypassing the expensive step of copying data into user-space memory.
Answer: D. It enables the kernel to transfer data directly from the Disk Page Cache to the Network Socket Buffer, bypassing the expensive step of copying data into user-space memory.
When a standard program sends a file, the computer must copy the data four times: (1) Disk to Kernel, (2) Kernel to App Memory, (3) App Memory to Kernel Socket, (4) Kernel Socket to Network Card. This also requires several 'Context Switches' which waste CPU cycles. The `sendfile` system call implements 'Zero-Copy' by telling the kernel: 'Just take this file from the disk cache and shove it directly into the network buffer'. This drastically reduces CPU usage and memory bandwidth, allowing a single web server to saturate a 100 Gbps network link using very little power.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What is the downside of enabling 'Sticky Sessions' (Session Affinity) on a Load Balancer?
- In WebRTC (P2P Mesh), why is a STUN server required?
- What is the fundamental difference between a Network Switch and a Router?
- In Cloud Networking (AWS), what is the limitation of VPC Peering compared to a Transit Gateway?
- Which protocol is ideal for real-time multiplayer gaming positions or Voice over IP (VoIP), and why?
- What is the purpose of the 'Time To Live' (TTL) field in an IP packet?