IntermediateInternals
How does Kafka use sendfile() for zero-copy transfer?
Reference answer
Kafka uses the sendfile system call so the OS can send data from the page cache to the network socket directly, a path often called zero-copy. Without it, sending file data to a socket takes four copies and two system calls; sendfile avoids this re-copying, so data is copied into the page cache once and reused on each consumption. Compression does not defeat this: a compressed batch remains compressed in the log and is transmitted to the consumer in compressed form. Sendfile is not used when SSL is enabled, because the TLS libraries operate in user space.
Expected key concepts: sendfile, zero-copy, page cache, network socket, four copies, compressed, SSL, user space, system calls, consumption
How did that feel?
Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.