<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈）]]></title><description><![CDATA[<h1>双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈）</h1>
<h2>TL;DR</h2>
<ul>
<li>在「混合线性注意力（GDN/SSM）+ 投机解码」的模型栈上，SGLang HiCache 用<strong>预设 write_through</strong> 时：主机池确实会被写满，但<strong>逐出后的旧前缀不会被重用</strong>——重发同一段 4 万 token 上下文，耗时跟冷启动一模一样（15.4s）。</li>
<li>改成 <strong><code>--hicache-write-policy write_back</code></strong> 后，同一探测：<strong>15.4s → 0.4s（38×）</strong>，再发一次 0.1s。</li>
<li>如果你的 HiCache「开了没感觉」，先看这两个开关再下结论。</li>
</ul>
<h2>环境</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项目</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>硬件</td>
<td>2×RTX 3090 NVLink（48GB 合并）</td>
</tr>
<tr>
<td>模型</td>
<td>Qwen3.8-27B（hybrid：16 层 Gated Attention + 48 层 Gated DeltaNet）+ DFlash2 草稿</td>
</tr>
<tr>
<td>引擎</td>
<td>SGLang main（2026-09 dev），TP=2、fp8_e4m3 KV、上下文 262K</td>
</tr>
<tr>
<td>附加</td>
<td>KV 池 354,788 tokens；host 池 709,577 tokens（+mamba/draft 池）</td>
</tr>
</tbody>
</table>
<h2>现象 A：write_through（预设）——池在涨，但没有复用</h2>
<p dir="auto">开启 <code>--enable-hierarchical-cache</code> 后：</p>
<ul>
<li>启动正常：<code>UnifiedRadixCache hybrid_ssm=True hicache_attached=True</code></li>
<li>主机池确实增长：<code>sglang:hicache_host_used_tokens</code> 一路涨到 <strong>592,658 / 709,577</strong></li>
<li>但做「逐出-回流」探测（见下）时：<strong>重取耗时 = 冷启动耗时</strong>（7.3s / 15.4s 一模一样），log 里<strong>零 prefetch 纪录</strong></li>
</ul>
<h3>探测法（推荐大家用同一招验证有没有真的复用）</h3>
<ol>
<li>冷跑一段 40K token 的唯一上下文 R（记 wall）</li>
<li>灌 10 段各 40K 的唯一内容作逐出压力（&gt; 装置池容量）</li>
<li>重发同一段 R → 比 wall；再发一次 → 0.1s 级才算正常</li>
</ol>
<p dir="auto">实测记录：</p>
<pre><code>R-cold  : 15.4s
... 10×40K 逐出 ...
R-rehost: 15.5s   ← write_through：与冷启动无异
R-again : 0.1s    ← 说明装置端机制没坏，是 host 没接手
</code></pre>
<h2>现象 B：write_back——复用立刻生效</h2>
<p dir="auto">只加一个开关：</p>
<pre><code>--enable-hierarchical-cache \
--hicache-write-policy write_back
</code></pre>
<p dir="auto">同一探测：</p>
<pre><code>R-cold  : 15.4s
... 14×40K 逐出 ...
R-rehost: 0.4s    ← 38×（从 host 回载）
R-again : 0.1s
</code></pre>
<p dir="auto"><code>hicache_host_used_tokens</code>：20,221 → 453,970 → 486,725（逐出时备份的语义生效）</p>
<h2>完整启动参数（我们现行主力）</h2>
<pre><code>sglang serve \
  --model-path &lt;Qwen3.8-27B-abliterated-AWQ-MTP&gt; \
  --trust-remote-code \
  --tp-size 2 --mem-fraction-static 0.90 \
  --kv-cache-dtype fp8_e4m3 \
  --chunked-prefill-size 4096 --max-prefill-tokens 16384 \
  --max-running-requests 3 --schedule-policy hrrn \
  --max-mamba-cache-size 15 --mamba-full-memory-ratio 0.9 \
  --speculative-algorithm DFLASH \
  --speculative-draft-model-path &lt;DFlash2-W4A16&gt; \
  --speculative-num-draft-tokens 8 --speculative-dflash-block-size 8 \
  --enable-hierarchical-cache --hicache-write-policy write_back
</code></pre>
<h2>注意事项</h2>
<ul>
<li>内存：host 池 ≈ 11.6GB/rank（709,577 tokens）+ mamba 池 2.39GB + draft 池 3.63GB；60GB 机器两 rank 合计 ≈35GB，请留好余裕（可用 <code>--hicache-ratio</code> / <code>--hicache-size</code> 调整）</li>
<li>我们在 <strong>SGLang dev 版</strong>上测试；版本不同行为可能不同</li>
<li>我们没挖到 write_through 不复用的根因（疑似非同步备份路径语义差异），欢迎懂内部机制的指点</li>
</ul>
<h2>同场加映（同日其他实测，负结果也贴）</h2>
<ul>
<li><strong>GSP-RM 关闭</strong>（driver 610、proprietary）：prefill 16K/50K 与 decode 全部持平（+1.5~2% 噪声级），未重现社群 +58% 的 prefill 增益 → 已回滚。环境：SGLang+610 vs 原案例 vLLM+595，供参考。</li>
<li><strong>KV cache fp8_e4m3 vs e5m2</strong>：单流 +25~30%（12/12 样本 116–134 vs 旧 90 级）——如果你还在 e5m2，值得换。</li>
<li><strong>chunked-prefill 2048→4096 + max-prefill 8192→16384</strong>：batch prefill +4~8.5%。</li>
<li><strong><code>--schedule-policy hrrn</code></strong>：长短混排时短请求延迟 −22%（13.5s→10.5s），吞吐无损。</li>
</ul>
]]></description><link>https://lcz.me/topic/1700</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 00:39:20 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1700.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Sep 2026 09:50:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈） on Mon, 14 Sep 2026 13:56:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johnnybegood" aria-label="Profile: johnnybegood">@<bdi>johnnybegood</bdi></a> 开 HiCache 后 decode 掉速**<br />
正常，方向是对的：HiCache 的收益大头在 prefill / 前缀复用，decode 会有个位数百分比的代价。我们刚做了开关对照（其他配置完全一致，单流 512 输出 x3 取中位）：</p>
<ul>
<li>开（write_back）≈133 t/s ｜ 关 ≈137 t/s，差约 3%</li>
<li>复用收益：同一段 4 万 token 重发 15.4s → 0.4s<br />
如果你那边掉得明显（比如 &gt;10%），按这三条查：①策略一定要用 --hicache-write-policy write_back（不然写了不重用、白占内存；我们实测 write_through 下重复请求还是全量 15.4s）；②主机内存余量要够（我们这套要一次分配约 33GB，紧张时会有换页/回收开销）；③高并发下逐出线程会和 decode 抢内存带宽，可以调小 ratio 或降并发试试。纯「长输出 + 短输入 + 无重复前缀」的场景收益本来就小，可以按需关掉换那约 3%。</li>
</ul>
]]></description><link>https://lcz.me/post/18148</link><guid isPermaLink="true">https://lcz.me/post/18148</guid><dc:creator><![CDATA[starryskyknight]]></dc:creator><pubDate>Mon, 14 Sep 2026 13:56:02 GMT</pubDate></item><item><title><![CDATA[Reply to 双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈） on Mon, 14 Sep 2026 13:55:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry" aria-label="Profile: terry">@<bdi>terry</bdi></a> 内存和 SSD 消耗（我们那台：双 3090 / TP=2 / 262K 上下文 / DFlash2，HiCache 只开「显存<img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=0650a1064dd" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:23px;width:auto;vertical-align:middle" title="↔" alt="↔" />主机内存」两级）**</p>
<ul>
<li>内存（开机一次性分配）：KV 主机池 11.63 GB/rank（709,577 tokens，默认 ratio=2，即 2x 显存池）+ Mamba/GDN 状态池 2.39 GB/rank + draft 池 3.63 GB/rank；TP=2 合计约 33 GB（实测整机可用内存 48 GB → 15 GB）。显存侧不额外增加（KV 本来就在显存）。</li>
<li>SSD：我们没启用（storage_backend=None），重启后缓存即失效、要重新预热。想要「重启不丢缓存」可以配 --hicache-storage-backend file 这类存储后端；容量按池子规模规划（我们这种是 GB 级），注意写入量和 SSD 寿命。内存不够的机器可以调小 --hicache-ratio 或 --hicache-size。</li>
</ul>
]]></description><link>https://lcz.me/post/18146</link><guid isPermaLink="true">https://lcz.me/post/18146</guid><dc:creator><![CDATA[starryskyknight]]></dc:creator><pubDate>Mon, 14 Sep 2026 13:55:09 GMT</pubDate></item><item><title><![CDATA[Reply to 双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈） on Mon, 14 Sep 2026 12:15:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/starryskyknight" aria-label="Profile: starryskyknight">@<bdi>starryskyknight</bdi></a> 我测过开了hicache , decode会掉速， 但是prefill 不错， 正常么？</p>
]]></description><link>https://lcz.me/post/18101</link><guid isPermaLink="true">https://lcz.me/post/18101</guid><dc:creator><![CDATA[johnnybegood]]></dc:creator><pubDate>Mon, 14 Sep 2026 12:15:54 GMT</pubDate></item><item><title><![CDATA[Reply to 双 3090 实测 SGLang HiCache：write_through 不会真的重用，write_back 才会（混合 GDN + 投机解码栈） on Mon, 14 Sep 2026 10:48:37 GMT]]></title><description><![CDATA[<p dir="auto">HiCache的内存和SSD消耗如何？</p>
]]></description><link>https://lcz.me/post/18092</link><guid isPermaLink="true">https://lcz.me/post/18092</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Mon, 14 Sep 2026 10:48:37 GMT</pubDate></item></channel></rss>