What is effect of BIOS C-state tuning on low-latency systems?
In the world of 1 million TPS, the BIOS is often where the battle is won or lost. While C-states (CPU Power States) are fantastic for your electricity bill and laptop battery, they are the silent killers of deterministic, low-latency performance.
If you are modeling a system for high-frequency workloads, C-states introduce a "stochastic tax" that makes sub-millisecond consistency impossible.
C-states are power-saving modes that the CPU enters when it thinks it’s idle.
C0: The CPU is fully powered and executing instructions (The Goal).
C1/C1E: The clock is stopped, but the CPU can wake up almost instantly ().
C3/C6/C7: Deep sleep. The cache is flushed, the voltage is lowered, and parts of the core are physically powered down.
At 1M TPS, a single transaction arrives every 1 microsecond. If your CPU has entered a deep C-state (like C6) to save power during a tiny lull in traffic, it can take 50 to 200 microseconds to "warm up" and start executing instructions again.
If your arrival rate () is per second and your CPU takes to wake up:
The first transaction triggers the wakeup.
While the CPU is "waking up," 100 more transactions arrive and sit in the NIC or OS buffer.
By the time the CPU is at C0, it is already facing a massive Queueing Delay.
This creates the classic "Sawtooth" Latency Profile: most requests are fast, but every few seconds, a batch of requests experiences a massive spike (the wake-up penalty).
In our previous discussion on SMT and Latch Spinning, we noted that threads often "spin" to avoid sleeping.
If C-states are ENABLED: When a thread finally stops spinning and calls a HLT (Halt) or MWAIT instruction to yield, the hardware may immediately drop that core into a deep C-state.
The Result: When the lock is finally released, the waiter can't just start running; it has to wait for the hardware to ramp up voltage and clocks. This turns a lock contention into a system stall.
C-states are often paired with P-states (SpeedStep/Turbo Boost). When a core wakes up from a C-state, it doesn't always jump to its max Turbo frequency immediately. It may start at a "base" frequency (e.g., 2.2GHz) and gradually ramp up to 4.0GHz as the load stays high.
The Impact: Your first 10,000 transactions in a burst are processed slower than the next 10,000. This creates intra-query skew that is impossible to solve in software.
If you cannot disable C-states (e.g., in a shared cloud environment), you must model your system using a Bimodal Distribution:
Mode 1 (Hot): Service time (CPU is awake).
Mode 2 (Cold): Service time .
At 1M TPS, even a 0.1% chance of hitting Mode 2 will destroy your P99.99 latency targets.
For 1M TPS, you want your CPUs to be "Always On, Always Hot." This means disabling C-states in the BIOS or using the Linux kernel parameter intel_idle.max_cstate=0 and processor.max_cstate=0. You are trading power efficiency for determinism.