#zero-copy
Posts
-
Digging into Kafka's Source 8: The Read Path — Fetch Requests, Long Polling and Zero-Copy
We follow a consumer's Fetch request through the Kafka 4.5.0-SNAPSHOT broker — KafkaApis.handleFetchRequest() → ReplicaManager.fetchMessages() → UnifiedLog.read() → LogSegment.read() — until it becomes a slice of a file (FileRecords), how it waits in the purgatory (DelayedFetch) for up to fetch.max.wait.ms when there is not enough data, and how FileChannel.transferTo() finally sends it to the socket without passing through the JVM. Request logs, JMX and JFR examples show incremental fetch sessions, why consumers and followers share one Fetch, and why zero-copy disappears under TLS.
-
Digging into nginx's Source 10: Filters and Static Files — How a Response Flows Out
We follow one static file from the handler to the socket in the nginx 1.31.9 source. The static handler that never reads the file and only records "from this byte to that byte of the file" in an ngx_buf_t, the header and body filter chains glued together with two function pointers and the ngx_modules.c order that decides them, the copy filter and ngx_output_chain that decide whether to read the file into memory, and the write filter that holds data back and then sends it with writev + sendfile — all checked with gdb, strace and the debug log.
-
Digging into Apache httpd's Source 11: Filters and Bucket Brigades — How a Response Flows Out
What shape a response takes inside httpd on its way from the handler to the socket, followed for someone opening the source for the first time. APR-util's buckets and brigades (a ring), PIPE and FILE buckets that change shape when read, filters lining up in six tiers and ap_pass_brigade, chunked encoding and sendfile, and what the core output filter does when the socket is full — all checked with the log of a filter module written for this post.