<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>HTTP请求 | 锤子前端</title><description>Now vibe coding, so learning hammer FE ?</description><link>https://channel.meo-ai.com</link><item><title>《200毫秒：一次HTTP请求的完整旅程》</title><link>https://channel.meo-ai.com/posts/677</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/677</guid><pubDate>Sat, 18 Jul 2026 15:24:57 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《200毫秒：一次HTTP请求的完整旅程》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23%E5%90%8E%E7%AB%AF&quot; title=&quot;#后端&quot;&gt;#后端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23NodeJS&quot; title=&quot;#NodeJS&quot;&gt;#NodeJS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E7%BD%91%E7%BB%9C%E5%8D%8F%E8%AE%AE&quot; title=&quot;#网络协议&quot;&gt;#网络协议&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23TCP&quot; title=&quot;#TCP&quot;&gt;#TCP&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23TLS&quot; title=&quot;#TLS&quot;&gt;#TLS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23DNS&quot; title=&quot;#DNS&quot;&gt;#DNS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23HTTP&quot; title=&quot;#HTTP&quot;&gt;#HTTP&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Postgres&quot; title=&quot;#Postgres&quot;&gt;#Postgres&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Linux%E5%86%85%E6%A0%B8&quot; title=&quot;#Linux内核&quot;&gt;#Linux内核&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Web%E6%80%A7%E8%83%BD&quot; title=&quot;#Web性能&quot;&gt;#Web性能&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;&lt;br /&gt;这是一个交互式可视化网站，以旧金山咖啡店一次点击购买为起点，逐帧追踪HTTP请求在211.4毫秒内穿越北美大陆的完整生命周期。从触摸板电容变化到屏幕像素刷新，文章以精确的时间轴拆解了硬件中断、浏览器事件循环、DNS解析、TCP/TLS握手、内核网络栈、Node.js事件循环、Postgres事务提交、光纤传输、Wi-Fi重传、GPU渲染等每个环节，揭示了&quot;冷启动&quot;请求中60%时间消耗在握手、35%在传输、而服务器实际计算仅占1.4%的惊人事实。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;&lt;br /&gt;1. 一次点击触发7层软件栈（触摸板→HID→窗口服务器→Chrome→渲染器→JavaScript→fetch）才发出第一个字节，而电容变化到网络请求离开仅需5毫秒&lt;br /&gt;2. DNS查询通过UDP在2毫秒内完成，依赖Anycast路由将请求导向最近的解析器；TLS 1.3将握手从2个RTT压缩到1个，但仍需127毫秒建立加密隧道&lt;br /&gt;3. 4,700公里光纤需6次穿越大陆，每次31毫秒；Wi-Fi碰撞重传仅需1.2毫秒，却足以容纳整个Postgres查询往返（0.35毫秒）&lt;br /&gt;4. 服务器端50微秒内完成从网卡DMA→NAPI轮询→TCP重组→epoll唤醒→Node.js读取→TLS解密→HTTP解析→路由到handler的全流程&lt;br /&gt;5. Postgres通过连接池、预编译语句和WAL组提交将INSERT优化至2.1毫秒，fsync强制刷盘是唯一的同步阻塞点&lt;br /&gt;6. 响应返回后，Chrome还需经历kqueue唤醒、TLS解密、React重渲染、样式计算、布局、绘制、合成，最终等待4.4毫秒VSync才显示&quot;Order confirmed&quot;&lt;br /&gt;7. 第二次&quot;热请求&quot;可复用TCP连接和TLS会话票证，将耗时从211毫秒降至约95毫秒，节省的116毫秒全是首次建立的连接成本&lt;br /&gt;&lt;br /&gt;URL：&lt;a href=&quot;https://200ms.thenodebook.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://200ms.thenodebook.com/&quot;&gt;https://200ms.thenodebook.com/&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://200ms.thenodebook.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;A single HTTP request, traced in real time through DNS, TCP, TLS, the kernel, Node&apos;s event loop, and Postgres — then back to the pixel. Scroll distance equals time.&quot;&gt;
  
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;The Nodebook&lt;/div&gt;
  &lt;img class=&quot;link_preview_image&quot; alt=&quot;200 Milliseconds — the complete life of one HTTP request, visualized&quot; src=&quot;/static/https://cdn4.telesco.pe/file/t14I1JhXbyzPs7gW4Yn8zJrTsax5z-Qb3M9gn0ONO53sIhEFWNIdP7_FhiW_o9ERCu-nSn5dK1SLk_9hkMfrB9pv93oWF6rcqg4vWWyrZ-HqQ3QZLy9hSlzkaqJxBenvOvKXT3Ew3A8HJnaEG7XJDmFA6OMVe5KIeM9Xw0nQNXUyRqCkYsGcmEopxeUxp6vBfTOe-9vyA9HG1JaewSc0SD7AsIHV9gpUaBjXqHvPTxfe457Yh3t_UK7DFhn9O9rZwEc8u3MMzQsQOBHZNMEdH0bAF8QztT4BkTRcLD8x-YzCWrTadmhslK12wNVgsmPJ_HQ3RceRazGqAGbaYdT-7w.jpg&quot; width=&quot;1200&quot; height=&quot;630&quot; loading=&quot;eager&quot; /&gt;
  &lt;div class=&quot;link_preview_title&quot;&gt;200 Milliseconds — the complete life of one HTTP request, visualized&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;A single HTTP request, traced in real time through DNS, TCP, TLS, the kernel, Node&apos;s event loop, and Postgres — then back to the pixel. Scroll distance equals time.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item><item><title>《Node.js官方发布Axios迁移Fetch指南》</title><link>https://channel.meo-ai.com/posts/640</link><guid isPermaLink="true">https://channel.meo-ai.com/posts/640</guid><pubDate>Fri, 22 May 2026 10:24:20 GMT</pubDate><content:encoded>&lt;span class=&quot;post-title-source&quot;&gt;《Node.js官方发布Axios迁移Fetch指南》&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;标签：&lt;a href=&quot;/search/result?q=%23%E5%90%8E%E7%AB%AF&quot; title=&quot;#后端&quot;&gt;#后端&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23NodeJS&quot; title=&quot;#NodeJS&quot;&gt;#NodeJS&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23FetchAPI&quot; title=&quot;#FetchAPI&quot;&gt;#FetchAPI&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23Axios&quot; title=&quot;#Axios&quot;&gt;#Axios&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23%E4%BB%A3%E7%A0%81%E8%BF%81%E7%A7%BB&quot; title=&quot;#代码迁移&quot;&gt;#代码迁移&lt;/a&gt; &lt;a href=&quot;/search/result?q=%23HTTP%E8%AF%B7%E6%B1%82&quot; title=&quot;#HTTP请求&quot;&gt;#HTTP请求&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;总结：&lt;br /&gt;Node.js官方博客发布了一个将Axios代码自动迁移到原生WHATWG Fetch API的codemod工具，详细说明了迁移理由、Node.js版本要求、支持的转换方法及具体代码示例，同时坦诚标注了暂不支持的高级特性。&lt;br /&gt;&lt;br /&gt;文章要点：&lt;br /&gt;1. 迁移四大理由：Fetch是Node.js原生内置，无需额外依赖；性能针对现代运行时做了优化；严格遵循Web标准，浏览器和Node.js代码可复用；移除第三方库减少安全风险&lt;br /&gt;2. 版本门槛：Node.js v18起Fetch可用但为实验性，v21起才稳定；如果包还兼容v18以下，迁移必须升主版本号并修改package.json的engines字段&lt;br /&gt;3. 支持的转换方法覆盖很全，包括get、post、put、patch、delete、head、options、request以及postForm/putForm/patchForm等表单提交方式&lt;br /&gt;4. 转换后的Fetch代码会用&lt;code&gt;Object.assign(res, { data: await res.json() })&lt;/code&gt;来模拟Axios的&lt;code&gt;response.data&lt;/code&gt;结构，让迁移后的代码改动最小化&lt;br /&gt;5. 目前暂不支持拦截器、取消令牌和&lt;code&gt;axios.create()&lt;/code&gt;实例配置等高级特性，这些场景需要手动处理&lt;br /&gt;6. 官方对Axios维护者表达了感谢，认可其对生态的贡献&lt;br /&gt;&lt;br /&gt;URL：&lt;br /&gt;&lt;a href=&quot;https://nodejs.org/en/blog/migrations/axios-to-fetch&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;https://nodejs.org/en/blog/migrations/axios-to-fetch&quot;&gt;https://nodejs.org/en/blog/migrations/axios-to-fetch&lt;/a&gt;&lt;a class=&quot;tgme_widget_message_link_preview&quot; href=&quot;https://nodejs.org/en/blog/migrations/axios-to-fetch&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; title=&quot;Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.&quot;&gt;
  &lt;i class=&quot;link_preview_right_image&quot; style=&quot;background-image:url(&apos;https://cdn4.telesco.pe/file/ej4bjz94abCNm6Z7pgT3GobaAe9h2LJm8ruR90FMRPeDllVqIXw5gGim3Fc0MThsmjooNygiTaow8YTMjOtc9bJx3hgP4qySOpjVqdrrPjgViylh0__axb4VR2v8YmJU1Kr9xujmBzeDQPOvPvOXyfnXcKQKXcO76nHt2Xmy8rZxT5LnYK_GmDR4_svaziYKtU3D94FNcvan-nt3Ov12uF5FPyEsuH4ZBZddlobQkmiydyc7pkDCGRxS-mSnoXtsAUZggk4_8y0RW7l_rxjAkEIzC_wZFX-Pglg-6M1H_0oesby_f9m9Gb_HagcrzJvB32hd_bD1gGTSunA94NEMJg.jpg&apos;)&quot;&gt;&lt;/i&gt;
  &lt;div class=&quot;link_preview_site_name accent_color&quot;&gt;nodejs.org&lt;/div&gt;
  
  &lt;div class=&quot;link_preview_title&quot;&gt;Node.js — Axios to WHATWG Fetch&lt;/div&gt;
  &lt;div class=&quot;link_preview_description&quot;&gt;Node.js&lt;i class=&quot;emoji&quot; style=&quot;background-image:url(&apos;//telegram.org/img/emoji/40/C2AE.png&apos;)&quot;&gt;&lt;b&gt;®&lt;/b&gt;&lt;/i&gt; is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.&lt;/div&gt;
&lt;/a&gt;</content:encoded></item></channel></rss>