跳到主要內容

Linux PSI:CPU 沒滿卻變慢?找出記憶體與 I/O 壓力 / Linux PSI: Finding Hidden Contention

現象:AI 推論、編譯或大量 I/O 同時跑時,CPU 可能沒有 100%,但延遲突然變長。只看 top 很難知道工作卡在 CPU、記憶體還是 I/O。

Phenomenon: During inference, builds, or heavy I/O, latency can jump while CPU is below 100%. top alone cannot identify whether work waits on CPU, memory, or I/O.

PSI pressure-stall flowrunnable workis delayedkernel aggregatessome / full stall/proc/pressure/*time windowscorrelate with p95tune reversibly

圖 1|PSI 將想執行卻被延遲的時間彙整成可觀察訊號。

Figure 1 | PSI turns delayed progress into an observable signal.

機制:PSI 量的是有工作卻前進不了 / Mechanism: PSI measures stalled progress

Pressure Stall Information(PSI)統計任務因資源競爭而停滯的時間。some 表示至少部分任務受阻;full 表示一段時間內所有非閒置工作都受阻。Linux 將 CPU、記憶體與 I/O 分別放在 /proc/pressure/。

Pressure Stall Information (PSI) measures time lost to contention. some means some tasks are stalled; full means all non-idle work is stalled for an interval. Linux exposes CPU, memory, and I/O separately under /proc/pressure/.

影響:先分辨壓力類型 / Impact: classify pressure first

邊緣 LLM 若 memory some 持續升高,可能是回收、匿名頁或記憶體頻寬造成延遲;若 io some 升高,增加 CPU 配額未必有效。平均值是時間窗統計,應與請求 p95、cgroup 使用量和核心日誌對齊。

For an edge LLM, sustained memory some may indicate reclaim, anonymous-page, or bandwidth pressure. If io some rises, more CPU quota may not help. Align windowed averages with p95 latency, cgroup usage, and kernel logs.

可操作步驟:建立低風險基線 / Actionable steps: build a safe baseline

cat /proc/pressure/cpu; cat /proc/pressure/memory; cat /proc/pressure/io; cat /sys/fs/cgroup/$CGROUP/memory.current; cat /sys/fs/cgroup/$CGROUP/memory.events

先連續記錄 5 分鐘,把 avg10 與服務 p95 畫在同一時間軸。不要立刻加 swap、提高配額或移除限制;先判斷是主機還是 memcg 壓力,再用可回復的小批次驗證。

Record five minutes and align avg10 with p95 latency. Do not immediately add swap, raise quotas, or remove limits; locate host versus memcg pressure, then test a reversible small-batch change.

查核與限制:依本機 Linux 6.18.55 Documentation/accounting/psi.rst 查核(2026-11-15),並對照官方文件。命令只讀取狀態。

Verification and limits: Checked against local Linux 6.18.55 Documentation/accounting/psi.rst on 2026-11-15 and official documentation. Commands are observational.

Linux PSI documentation · cgroup v2 documentation · /proc documentation

留言

這個網誌中的熱門文章

text-to-cad: 讓 AI 驅動的參數化 CAD 建模成為現實 / text-to-cad: Bringing AI-Driven Parametric CAD Modeling to Reality

一個讓 AI 代理能生成、預覽並迭代 3D CAD 模型的開源框架 / An open-source harness for AI agents to generate, preview, and iterate 3D CAD models. 🔎 工具速覽 / AT A GLANCE Category AI-Powered CAD Tooling / AI 驅動 CAD 工具 Pricing Free (Open Source) / 免費(開源) BestFor Robotics engineers and product designers using AI coding agents / 使用 AI 程式碼代理的機器人工程師與產品設計師 GitHub Stars ⭐ 93 🚀 引言 / Introduction text-to-cad 是一個強大的開源框架,旨在填補大型語言模型(LLM)與專業 3D 建模之間的鴻溝。它允許開發者利用 Claude Code 或 Codex 等 AI 代理,透過程式碼生成精確的參數化幾何模型,並提供即時預覽與迭代能力。 text-to-cad is a powerful open-source harness designed to bridge the gap between Large Language Models (LLMs) and professional 3D modeling. It enables developers to leverage AI agents like Claude Code or Codex to generate precise parametric geometry via code, providing real-time preview and iteration capabilities. 🛠️ 核心功能 / Key Features 與 Codex 或 Claude Code 等代理...

kimiflare:將 Moonshot Kimi-K2.6 直接部署於 Cloudflare 的終端 AI 編碼助手 | kimiflare: A Terminal Coding Agent Powered by Moonshot Kimi-K2.6 on Cloudflare

無需中繼,在你的 Cloudflare 帳戶中直接運行強大的 Kimi 終端編碼智能體。 | No middleman, run the powerful Kimi terminal coding agent directly on your own Cloudflare account. 🔎 工具速覽 / AT A GLANCE Category AI Coding Agent / Developer Tool Pricing Free (Open-weight model / Cloudflare Workers AI pricing) BestFor Developers seeking a private, high-context terminal AI assistant with direct infrastructure control. GitHub Stars ⭐ 36 🚀 引言 / Introduction kimiflare 是一款為開發者量身打造的終端編碼智能體,它將 Moonshot 的 1 兆參數開源模型 Kimi-K2.6 與 Cloudflare Workers AI 完美結合。不同於傳統 AI 工具,kimiflare 讓流量直接在你的 Cloudflare 帳戶中流動,徹底擺脫第三方代理或 AI 閘道的束縛,實現最高等級的控制力與隱私。 | kimiflare is a terminal coding agent tailored for developers, seamlessly combining Moonshot's 1T-parameter open-source model Kimi-K2.6 with Cloudflare Workers AI. Unlike traditional AI tools, kimiflare routes traffic directly through your Cloudflare account, eliminating the n...

Orca Skills: 開源賦能,加速雲安全工作流

加速雲安全工作流 - Orca Skills 整合多種工具與插件,打造高效安全環境 | Accelerate Cloud Security Workflows with Orca Skills, a Suite of Tools and Plugins 🔎 工具速覽 / AT A GLANCE Category 开源安全工具 Pricing 开源免费 BestFor 雲安全团队、DevSecOps工程师 GitHub Stars ⭐ 33 🚀 引言 / Introduction 在雲端環境中,確保安全不僅是一種技術挑戰,更是對工作效率的一場考驗。Orca Skills 是一款專為加速 Orca 云平台安全工作流而設計的开源插件工具包。透過整合多種工具和插件,幫助我們在複雜的安全環境下保持高效率。 🛠️ 核心功能 / Key Features Orca Skills 提供了一系列功能強大的安全工作流工具,包括警報處理、影響分析、配置源頭追溯等。這些工具不僅能夠幫助我們快速定位問題,還能確保在解決問題時避免造成不必要的後續問題。 💡 技術亮點 / Tech Highlights Orca Skills 真正的亮點在于其開放性與兼容性。它不僅支持Anthropic Claude Code、Cursor 和 Codex,還能夠與 MCP(Orca Security)集成,為安全團隊提供全面的支持。 📦 快速上手 / Quick Start 要快速開始使用 Orca Skills,首先需要安裝所需環境和工具。接下來,配置 MCP 以實現與 Orca Cloud Platform 的集成。最後,測試各個技能插件以確保其正常運行。 中英文對照: 要快速開始使用 Orca Skills 首先需要安裝所需環境和工具 接著配置 MCP 以實現與 Orca 云平台的集成 最...