Course contentsShow
← System Design
Lesson 1072 of 1,91927. Circuit Breakers and BulkheadsFree lesson

CPU and Memory Bulkheads: Resource Quotas

Using containerization and quotas to isolate CPU and memory, preventing resource exhaustion across tenants or services.

CPU and Memory Bulkheads: Resource Quotas

What You'll Learn

You'll learn how containerization and resource quotas isolate CPU and memory allocation, preventing one service or tenant from exhausting shared resources and crashing neighbors.

The Resource Exhaustion Problem

In multi-tenant or microservices environments, services share physical hardware. Without isolation, a single misbehaving service—whether due to bugs, traffic spikes, or malicious activity—can consume all available CPU or memory, starving other services and causing cascading failures.

How Resource Quotas Work

Resource quotas act as bulkheads at the infrastructure level. Using containerization platforms (like Kubernetes, Docker, or cloud-native schedulers), you assign each service:

  • CPU limits: Maximum CPU cores or time slices (e.g., "0.5 cores")
  • Memory limits: Maximum RAM allocation (e.g., "512 MB")
  • Requests vs Limits: Guaranteed minimums (requests) and hard caps (limits)

When a service hits its CPU limit, it gets throttled. When it exceeds memory limits, it gets killed or forced to swap. Critically, other services remain unaffected—the bulkhead contains the damage.

The Apartment Building Analogy

Think of shared infrastructure like apartment utilities. Without resource quotas, one tenant running space heaters in every room could overload the building's electrical system, causing blackouts for everyone. Resource quotas are like individual circuit breakers per apartment—one tenant's overload trips only their breaker, not the entire building's.

Why This Matters

Resource quotas prevent the "noisy neighbor" problem in cloud environments, ensure fair resource sharing, and maintain system stability even when individual components fail or misbehave. Combined with thread pool and connection pool bulkheads, they provide defense-in-depth isolation.

Key Takeaway:
CPU and memory bulkheads use containerization and resource quotas to enforce hard limits on resource consumption, isolating failures and preventing one service from starving others of critical compute resources.