<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>I-O on Horeb</title><link>https://horeb.top/tags/i-o/</link><description>Recent content in I-O on Horeb</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><copyright>© 2026 JekYUlll</copyright><lastBuildDate>Fri, 29 May 2026 10:30:05 +0000</lastBuildDate><atom:link href="https://horeb.top/tags/i-o/index.xml" rel="self" type="application/rss+xml"/><item><title>Nginx 源码解析（九）：缓冲区与零拷贝</title><link>https://horeb.top/posts/infra-nginx-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90%E4%B9%9D%E7%BC%93%E5%86%B2%E5%8C%BA%E4%B8%8E%E9%9B%B6%E6%8B%B7%E8%B4%9D/</link><pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate><guid>https://horeb.top/posts/infra-nginx-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90%E4%B9%9D%E7%BC%93%E5%86%B2%E5%8C%BA%E4%B8%8E%E9%9B%B6%E6%8B%B7%E8%B4%9D/</guid><description>&lt;p&gt;响应 1000 并发静态文件请求时，单进程 CPU 都花在哪？大部分在拷贝上：磁盘→内核→用户→内核→网卡。每一跳都是宝贵的内存带宽和 CPU 缓存污染。Nginx 用两类手段解决：一是 &lt;code&gt;sendfile&lt;/code&gt; 零拷贝，完全绕过用户态；二是在必须拷贝的地方，用 &lt;code&gt;ngx_buf_t&lt;/code&gt; / &lt;code&gt;ngx_chain_t&lt;/code&gt; 这套设计把拷贝量压到最低，且让 buffer 在 filter 链中复用。&lt;/p&gt;</description></item></channel></rss>