Linux CPU Isolation and NUMA Tuning: A Practical Guide to Exclusive Compute for Critical Workloads

Overview You’re running a high-frequency trading system online. P99 latency sits at 2ms normally, but occasionally spikes to 20ms. CPU usage isn’t high, memory is sufficient, network is fine. After investigation, you discover the CPU scheduler migrated a critical thread to another core, L3 cache missed entirely, and latency jumped 10x. This kind of problem can’t be solved by adding resources. The issue is “sharing” — all processes share CPU cores, the scheduler distributes freely, and nobody knows which threads are latency-sensitive....

July 13, 2026 · 18 mins · 3724 words · Xu Baojin

cgroup v2 Complete Guide: From Architecture Principles to Production Practices

Overview In today’s era of cloud-native and containerized technologies, Linux cgroups (control groups) serve as the kernel-level foundation for resource isolation and limiting. From Docker container memory limits to Kubernetes Pod CPU Requests/Limits, the underlying mechanism relies on cgroups. However, cgroup v1’s multi-hierarchy architecture, inconsistent controller behavior, and confusing thread model have caused numerous operational headaches in production. cgroup v2, as a complete reimagining of v1, adopts a unified hierarchy architecture that fundamentally addresses v1’s design flaws....

July 23, 2024 · 23 mins · 4791 words · XuBaojin

Linux Process Scheduler: CFS Principles and Tuning

Overview The process scheduler is a core component of the operating system kernel — it determines which process runs on which CPU and for how long. Linux has used CFS (Completely Fair Scheduler) as its default scheduler since 2.6.23, and after years of evolution, introduced EEVDF (Earliest Eligible Virtual Deadline First) to replace CFS in the 6.6 kernel. This article provides an in-depth analysis of CFS principles, nice/cgroup CPU control, real-time scheduling, CPU affinity, and other core topics, with production tuning experience....

May 29, 2024 · 10 mins · 2121 words · XuBaojin

Linux Memory Management Mechanisms and Tuning in Practice

Overview Memory is one of the most precious resources in a Linux system. Understanding how the kernel manages memory not only helps you troubleshoot OOM and memory leak issues in production, but also enables better decisions in capacity planning and performance tuning. This article starts from the virtual memory model and covers core topics including Page Cache, Swap policies, OOM Killer principles, cgroup v2 memory limits, slab/shmem tuning, with multiple production case studies....

May 9, 2024 · 13 mins · 2564 words · XuBaojin

systemd Service Management Deep Guide

systemd Architecture Overview systemd is the de facto standard init system for modern Linux distributions, having replaced SysVinit as the default init in most mainstream distributions since 2015. It is not merely a “service starter” but a complete system and service manager. Core Unit Types systemd manages system resources through units, with each unit type corresponding to a specific resource type: Unit Type Extension Purpose service .service System services (daemons) socket ....

February 13, 2024 · 9 mins · 1787 words · XuBaojin