<?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[Ollama 并发请求排队严重，OLLAMA_NUM_PARALLEL 和 keep_alive 到底怎么配？]]></title><description><![CDATA[<p dir="auto">Agent 场景下多个任务同时调 Ollama，请求排队等很久。并发参数、模型保活这些环境变量怎么组合设置才合理？（已采纳，感谢 <a class="plugin-mentions-user plugin-mentions-a" href="/user/workflow_hauler" aria-label="Profile: workflow_hauler">@<bdi>workflow_hauler</bdi></a> 的详细解答）</p>
]]></description><link>https://bbs.zhidahengtong.com/topic/118/ollama-并发请求排队严重-ollama_num_parallel-和-keep_alive-到底怎么配</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 07:04:26 GMT</lastBuildDate><atom:link href="https://bbs.zhidahengtong.com/topic/118.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 Nov 2026 03:43:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ollama 并发请求排队严重，OLLAMA_NUM_PARALLEL 和 keep_alive 到底怎么配？ on Sat, 28 Nov 2026 03:44:00 GMT]]></title><description><![CDATA[<p dir="auto">三个变量配合着调：</p>
<ol>
<li><strong>OLLAMA_NUM_PARALLEL</strong>：同时处理的请求数。默认自动（按显存算，12GB 卡通常给 1-4）。多路并发会切分上下文预算，每路的可用 ctx 会变小——设 4 路 ctx 8K 的话每路实际只剩 2K，Agent 长上下文场景要留意；</li>
<li><strong>OLLAMA_KEEP_ALIVE</strong>：模型驻留时间。默认 5 分钟，多任务间歇性调用一定设 <code>30m</code> 甚至 <code>-1</code>（常驻）——反复冷加载 20GB 模型才是排队元凶；</li>
<li><strong>OLLAMA_MAX_LOADED_MODELS</strong>：同时驻留几个模型，多模型切换场景设 2。</li>
</ol>
<p dir="auto"><strong>Agent 场景推荐组合</strong>：NUM_PARALLEL=2 + KEEP_ALIVE=30m。并发一路给主任务、一路给后台小任务，上下文不被切碎。</p>
<p dir="auto">验证生效：请求时看响应里的 eval_count 时间戳，或 <code>ollama ps</code> 看驻留状态。</p>
]]></description><link>https://bbs.zhidahengtong.com/post/100</link><guid isPermaLink="true">https://bbs.zhidahengtong.com/post/100</guid><dc:creator><![CDATA[workflow_hauler 2]]></dc:creator><pubDate>Sat, 28 Nov 2026 03:44:00 GMT</pubDate></item></channel></rss>