Technology

Uber's Hybrid Core Allocation

Uber Engineering's hybrid core allocation system blends dedicated and shared CPUs for better efficiency and reliability.

StartupHub.ai Staff

By StartupHub.ai Staff, reviewed by Daniel Singer, Editor

3 min read

Diagram illustrating NUMA-aware allocation of dedicated and shared CPU cores on a host.
Illustration of NUMA-aware allocation for dedicated and shared CPU cores.Credit: Uber Engineering
Visual TL;DR
Old CPU AllocationDriver
strict dedicated cores, one-minute averages insufficient for bursty workloads
From the article 4 mentionsUber's engineering team has refined its approach to CPU resource management with the introduction of hybrid core allocation within its Odin container orchestration system.
Odin Container OrchestrationCore
Uber's system for managing containerized applications and their resources
From the articleUber's engineering team has refined its approach to CPU resource management with the introduction of hybrid core allocation within its Odin container orchestration system.
Hybrid Core AllocationContext
blends dedicated and shared CPUs for better efficiency and reliability
From the article 5 mentionsThis library is then wrapped into a Kubernetes CRI plugin, enabling Odin to adopt Kubernetes without sacrificing host-level efficiency, despite Kubernetes' current lack of native support for hybrid core allocation.
Dedicated CoresContext
guaranteed CPU resources for critical workloads
From the article 9+ mentionsHistorically, Uber relied on a vertical CPU scaler that assumed CPU usage could be gauged by one-minute averages and that allocated cores were exclusively dedicated.
Shared Core PoolContext
pooled per host, over-allocated using a defined ratio
From the article 9 mentionsThe hybrid model assigns workloads both guaranteed dedicated cores and an optional pool of shared cores.
NUMA ConsiderationsContext
optimizing allocation across Non-Uniform Memory Access architectures
From the article 4 mentionsEfficient memory access is critical on multi-socket systems with Non-Uniform Memory Access (NUMA).
Vertical Scaling LogicContext
refining how CPU scaling decisions are made
From the articleA key feature is in-place vertical scaling on the host level, crucial for stateful fleets with local disks.
Linux cpu.sharesCore
From the article 3 mentionsLinux's cpu.shares mechanism dynamically distributes this shared CPU time based on allocation size, ensuring fair contention handling.
Improved EfficiencyEffect
better utilization of CPU resources across hosts
From the article 2 mentionsThis configuration balances workload performance with host agent efficiency.
Handles Bursty WorkloadsEffect
adapts to dynamic, high-demand CPU patterns more effectively
From the articleThis evolution moves away from strict dedicated CPU assignments to a more flexible model designed to handle bursty workloads more effectively.
Contents(5)

Uber's engineering team has refined its approach to CPU resource management with the introduction of hybrid core allocation within its Odin container orchestration system. This evolution moves away from strict dedicated CPU assignments to a more flexible model designed to handle bursty workloads more effectively.

Historically, Uber relied on a vertical CPU scaler that assumed CPU usage could be gauged by one-minute averages and that allocated cores were exclusively dedicated. These assumptions proved insufficient for dynamic, high-demand CPU patterns. The new system, detailed on Uber Engineering, integrates shared core allocation alongside dedicated resources, offering a middle ground.

From Dedicated to Shared

The hybrid model assigns workloads both guaranteed dedicated cores and an optional pool of shared cores. These shared cores are pooled per host and can be over-allocated using a defined ratio. Linux's cpu.shares mechanism dynamically distributes this shared CPU time based on allocation size, ensuring fair contention handling.

The system's vertical scaler is upgraded to calculate optimal allocations of both dedicated and shared cores for each workload. An empirical study using Linux cpuset.cpus and cpu.shares revealed that while the Linux scheduler generally balances workloads effectively, the actual ratio can become skewed during severe contention. The formula used for shares is round((dedicated_CPUs + shared_CPUs_for_contention) × 100), allowing for precise, percentage-based allocation.

NUMA Considerations and Allocation Strategy

Efficient memory access is critical on multi-socket systems with Non-Uniform Memory Access (NUMA). Uber observed that the Linux scheduler typically prioritizes CPUs closest to a process's memory. While shared libraries can complicate this, the kernel generally optimizes for local memory usage, reducing the need for explicit NUMA pinning.

Uber's strategy allocates dedicated cores within the same NUMA node while distributing shared pools across multiple nodes. This configuration balances workload performance with host agent efficiency. The odin-agent manages this distribution, aiming to balance shared cores evenly across nodes and prioritizing heavier dedicated CPU load nodes for additional shared cores. Dedicated cores are kept on the same NUMA node as their associated shared cores to minimize latency.

A key feature is in-place vertical scaling on the host level, crucial for stateful fleets with local disks. This allows resources to be adjusted on the fly without the costly and disruptive process of moving entire workloads, enhancing fleet reliability.

Vertical Scaling Logic

The scaler determines core counts based on average dedicated CPU usage and the deviation for shared cores, which are reserved for occasional bursts. The total shared CPU pool on a host is typically over-allocated relative to the sum of shared CPUs assigned to individual workloads. During contention, cpu.shares are proportionally set to ensure fair distribution.

Bridging Kubernetes Gaps

To align with cloud-native patterns, Uber extracted its cgroups management code into a standalone library. This library is then wrapped into a Kubernetes CRI plugin, enabling Odin to adopt Kubernetes without sacrificing host-level efficiency, despite Kubernetes' current lack of native support for hybrid core allocation.

Limitations and Future Improvements

Current CPU allocation decisions are made at the host level. Moving this decision-making to a higher-level workload scheduler, with a fleet-wide view, could offer further optimization. The system also faces potential CPU allocation fragmentation over time, which the host agent could address through periodic defragmentation passes.

This hybrid approach allows for efficient CPU resource utilization, balanced load distribution, and maintained stability under varying demands, significantly improving resource management in distributed systems.

Mentioned in this story

Markets

Sources

TopicsUber EngineeringOdinCPULinuxKubernetesNUMAContainer OrchestrationResource Management

StartupHub.ai StaffDaniel SingerWritten by StartupHub.ai Staff, Editorial teamReviewed by Daniel Singer, EditorAbout

StartupHub.ai Staff, Editorial team

The staff writers of StartupHub.ai, ranging from investment analysts to avid AI tool users, early adopters and critical enthusiasts. Backgrounds span engineering, business and the arts. We hold every piece to rigorous standards of research and review.

Daniel Singer, Editor

Daniel Singer is an AI expert who has been writing about, covering and building AI technology since 2018.

More from Daniel Singer

Get the free daily brief every morning

Every morning the day's AI news, new AI startups and new funding rounds. Free and takes a few minutes to read, unsubscribe at any time.

Join 64,000 other subscribers.

Test your Agent Readiness now

Paste your website. How well ChatGPT, Claude and the other agents can read and use a site, in about a minute.

The videos behind the news, one flip at a time

The feed mixes the videos from our articles with startup demos and you flip through them like TV channels for free with no signup.