Fix: hlds_linux Using 100% CPU

March 11, 2026 Daemon666 8 min read 19 vues

top shows hlds_linux eating a whole core and you assume something is wrong. Often nothing is: the Half-Life engine deliberately busy-waits to hold a high server FPS, and a busy-wait is 100% of a core by definition. The real question is whether that CPU is buying you stable frames or being wasted. This guide separates "working as designed" from "actually broken" and fixes the broken cases.

1. Decide whether it is even a problem

Check FPS and CPU together on the server console and host:

stat
top -H -p $(pgrep -f hlds_linux)

If stat shows a high, stable FPS (say 1000) and the box is otherwise responsive, the 100% is your busy-wait doing its job — that is the cost of high server FPS on this engine, and "fixing" it means accepting lower FPS. If instead FPS is low and CPU is pinned, or CPU is pinned with an empty server, you have a genuine problem.

2. Empty-server spin

A server that pins a core with zero players is the clearest red flag. Causes:

  • An aggressive -pingboost mode busy-waiting hard even when idle.
  • A plugin running a tight set_task loop or a per-frame hook doing real work every frame.
  • sys_ticrate set absurdly high (e.g. 4000+) so the engine spins to hit an impossible frame count.

Lower the ticrate to something sane and re-measure:

sys_ticrate 1000

3. Tune or drop -pingboost

The -pingboost launch modes trade CPU for FPS. Mode 0 (or omitting it) uses the gentlest sleep; higher modes busy-wait. If idle CPU is the complaint, step down:

./hlds_run -game cstrike -pingboost 0 -sys_ticrate 1000 \
  -ip 0.0.0.0 -port 27015 +maxplayers 20 +map de_dust2

Measure FPS after each change. You are looking for the lowest CPU that still holds the FPS you need — see the server FPS guide for the FPS side of this same trade-off.

4. Hunt a runaway plugin

If dropping pingboost does not calm an idle server, a plugin is doing per-frame work. Pause AMXX and watch CPU:

amxx pause GamePlugins

If CPU falls immediately, a plugin is the cause. Bisect with the plugin-isolation method — a stats plugin polling a database every frame, a HUD updater with no rate limit, or a broken set_task repeating far too often are the usual offenders.

5. Move to ReHLDS and pin a core

ReHLDS reaches a given FPS with meaningfully less CPU than stock HLDS pingboost tricks, so the same 1000 FPS costs you less core. On a multi-core host, also pin each server to its own core so a spike on one instance does not starve another:

taskset -c 1 ./hlds_run -game cstrike -sys_ticrate 1000 \
  +maxplayers 20 +map de_dust2

On a shared VPS you may simply be fighting noisy neighbours; there the only real fixes are ReHLDS efficiency and a better host.

6. Read steal time before you blame the engine

Before you spend an evening tuning, check whether the CPU is even yours to spend. On a VPS, the %st (steal) column in top shows time the hypervisor took from your vCPU:

top    # watch the %st column while the server runs

High steal means the number you see for hlds_linux is inflated by contention you do not control — the process looks pinned partly because it keeps getting scheduled off and has to catch up. On a dedicated box steal is essentially zero and 100% genuinely reflects the busy-wait. This one column decides whether the fix is "tune pingboost/ticrate" (your box, your problem) or "move hosts" (someone else's box, not fixable in a cvar).

Common errors

  • 100% CPU but high, stable FPS and a responsive box — working as designed. Busy-wait equals a full core. Lower sys_ticrate/pingboost only if you want to trade FPS for CPU.
  • 100% CPU on an empty server — pingboost too aggressive, ticrate too high, or a per-frame plugin. Start with ticrate and pingboost.
  • CPU climbs over time — a plugin leak or a task scheduling more tasks than it clears. Bisect plugins.
  • Multiple servers each fighting for CPU — pin them to separate cores with taskset and cap ticrate per instance.

Verification

After changes, watch an idle server and a loaded one:

stat
top -p $(pgrep -f hlds_linux)

Healthy looks like: near-zero real work on an empty server if you dropped pingboost, or a full core that buys a stable high FPS if you kept it — and under a full match, CPU that scales with players and never starves the host. If pausing all plugins drops CPU to near idle, you found a plugin; if it does not, the cost is engine/timer and ReHLDS plus a lower ticrate is your lever.

Contributeurs: Daemon666 ✦
Partager :