Modernizing Meta's Ads Service with an Open-Source Kernel Scheduler
Key point
Meta leveraged the sched_ext framework to build a kernel scheduler optimized for ads workloads, reducing latency by 28% and improving power efficiency.
Details
Meta's ads service handles an average of 5 million requests per second, and more than 400 billion requests per day. In this process, even a few milliseconds of degradation in p99 latency (tail latency) has a massive negative impact on ad performance and advertiser ROI.
The existing Linux kernel's general-purpose schedulers (CFS, EEVDF) had a limitation in that they allocated threads to CPUs without understanding the characteristics of the workload. In particular, the EEVDF scheduler, introduced in Linux kernel v6.6, caused latency regressions in the ads service, generating technical debt.
To address this, Meta introduced sched_ext, a BPF-based extensible scheduling framework. This allowed them to implement custom scheduling policies specialized for ads workloads.
The new policy soft-partitions CPUs into two pools.
- Latency-critical request path threads
- Less sensitive general task threads
This approach keeps related tasks on the same CPU, improving L3 cache locality and reducing DRAM access costs. As a result, it achieved a 28% reduction in p99 latency in the ads retrieval stage, and delivered business value by saving 3.28MW of power and increasing the number of ad rankings by 1.1%.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.