Skip to main content
← PROBLEMS / ARCHITECTURE
An end-to-end domain learning journey

Priority-Aware Load Shedding
Under Overload.

A shared Envoy/Spring thread pool sheds 40% of traffic indiscriminately during a burst, dropping revenue-critical /checkout requests alongside replaceable /telemetry pings.
Start the journey5 stages
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When a mobile push notification spikes `/v1/telemetry/events` from 2,000 to 35,000 RPS against a 20,000 RPS fleet (, tag requests with criticality tiers at ingress, enforce priority-aware LIFO/adaptive load shedding, and isolate thread/connection pools via bulkheads.

TL;DR30-second simplified summary
▾

Core Mechanics: When a mobile push notification spikes /v1/telemetry/events from 2,000 to 35,000 RPS against a 20,000 RPS fleet (20 pods, 200 threads/pod), every endpoint shares the same ingress and worker pools.

Visual & Structural Flow: Depicts 35k RPS Telemetry Flood vs. Priority Admission (Telemetry (35k) -> Checkout (500) -> Envoy Edge -> Fleet (20k cap)); Edge Classification, AIMD Limiter, and Tier-0 Bulkhead (Envoy Classifier -> AIMD Limiter -> Tier-0 Bulkhead -> 20-Pod Backend Fleet (20,000 RPS)).

Trade-Offs & Production: Static global rate limits either reject legitimate telemetry when the cluster has spare off-peak capacity, or still allow Tier-3 bursts to exhaust the shared cap before Tier-0 arrives. Criticality-tiered admission control is a core pattern in high-scale gateways and storage engines: API Gateways & BFFs: Protect login, checkout, and payment webhooks during bot or push-notification storms.

Failure Modes & Application: Criticality-tiered admission control is a core pattern in high-scale gateways and storage engines: API Gateways & BFFs: Protect login, checkout, and payment webhooks during bot or push-notification storms.

Full walkthrough · 5 stages
01
STAGE 01 · WHY IT MATTERSL4 · FUNDAMENTALS

Why priority-blind load shedding drops revenue-critical traffic.

Why this matters: The mechanism: understand how Why priority-blind load shedding drops revenue-critical traffic works from first principles.

Think of Why priority-blind load shedding drops revenue-critical traffic as the intuition layer for Priority-Aware Load Shedding Under Overload: The mechanism: understand how Why priority-blind load shedding drops revenue-critical traffic works from first principles.

When a mobile push notification spikes /v1/telemetry/events from 2,000 to 35,000 RPS against a 20,000 RPS fleet (20 pods, 200 threads/pod), every endpoint shares the same ingress and worker pools. Without criticality classification, a $500 /v1/checkout/confirm request competes 1:1 for threads with replaceable analytics pings.

02
STAGE 02 · IMPACTL5 · APPLIED DESIGN

How shared queues and global rate limits cause 42% checkout failure.

Why this matters: The problem: see what breaks without How shared queues and global rate limits cause 42% checkout failure under real concurrency or scale.

Under 15x telemetry overload, priority-blind defenses fail in two ways:

  1. Indiscriminate 503 Drops: Telemetry consumes ~90% of worker threads, dropping 42% of /v1/checkout/confirm (500 RPS) and /v1/auth/token (1,500 RPS).
  2. Large FIFO Queue Timeouts: Tomcat's default acceptCount=100 queues requests for seconds; by the time a checkout request reaches a thread, the client has already timed out.
Shared Pool Collapse vs. Tiered Shedding

35k RPS Telemetry Flood vs. Priority Admission

Telemetry (35k)Checkout (500)Envoy EdgeFleet (20k cap)1. 35,000 RPS push spike (Tier-3)2. 500 RPS checkout (Tier-0)3. Naive: shared pool -> 42% 5034. Priority Shed: 429 Retry-After5. Checkout gets 99.99% capacity

Shedding Tier-3 telemetry at the Envoy edge in <1 ms preserves 99.99% availability for Tier-0 checkout and auth.

Engineering Decision Framework
Problem
How to implement Priority-Aware Load Shedding Under Overload without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
When a mobile push notification spikes /v1/telemetry/events from 2,000 to 35,000 RPS against a 20,000 RPS fleet (, tag requests with criticality tiers at ingress, enforce priority-aware LIFO/adaptive load shedding, and isolate thread/connection pools via bulkheads.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Priority-Aware Load Shedding Under Overload experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
STAGE 03 · NAIVE SOLUTIONL5 · APPLIED DESIGN

Why static global RPS caps and large FIFO queues break.

Why this matters: The problem: see what breaks without Why static global RPS caps and large FIFO queues break under real concurrency or scale.

Think of Why static global RPS caps and large FIFO queues break as the intuition layer for Priority-Aware Load Shedding Under Overload: The problem: see what breaks without Why static global RPS caps and large FIFO queues break under real concurrency or scale.

Static global rate limits either reject legitimate telemetry when the cluster has spare off-peak capacity, or still allow Tier-3 bursts to exhaust the shared cap before Tier-0 arrives. Similarly, raising Tomcat acceptCount or thread counts just adds queueing delay and context-switching overhead.

Request & State Flow

Why static global RPS caps and large FIFO queues break

CallerService EntryCore ProcessorState Store1. Submit bounded request2. Apply domain invariant3. Persist or read state4. Return verified response
04
STAGE 04 · ENTERPRISE SOLUTIONL6 · SCALE & TRADE-OFFS

Enterprise solution: Criticality Tiers, AIMD Concurrency, and Bulkheads.

Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.

Combine edge classification, adaptive concurrency, and pool isolation:

  • 4 Criticality Tiers at Ingress: Tag routes at Envoy with X-Priority-Tier: CRITICAL_PLUS (Tier 0: /checkout, /auth), CRITICAL (Tier 1), SHEDDABLE_PLUS (Tier 2), and SHEDDABLE (Tier 3: /telemetry).
  • Adaptive Concurrency (AIMD / Gradient): Measure p95 RTT vs. baseline min_rtt rather than static RPS; when concurrency approaches saturation, shed Tier 3 first (429 + Retry-After), then Tier 2.
  • LIFO Short Queues + Thread Bulkheads: Reserve dedicated connection/thread pools for Tier 0 and process short burst queues LIFO so fresh requests succeed before deadlines expire.
Priority Admission Pipeline

Edge Classification, AIMD Limiter, and Tier-0 Bulkhead

Envoy ClassifierTag Tier 0..3 (<1ms)AIMD LimiterShed Tier 3 -> 2 firstTier-0 BulkheadReserved 20% pool20-Pod BackendFleet (20,000 RPS)Checkout 99.99% SLA

1.Criticality Tagging: Assign Tier-0 to /checkout and /auth at the gateway; tag /telemetry as Tier-3 SHEDDABLE.

2.Adaptive Concurrency: Envoy gradient controller shrinks concurrency limit as p95 RTT rises above min_rtt.

3.Fast-Fail <1ms: Shed Tier-3 at the edge with HTTP 429 + Retry-After before touching backend threads or DB.

Priority-aware shedding uses 100% of spare capacity during normal traffic and drops only low-priority tiers under overload.

# Envoy Adaptive Concurrency + Route Header Tagging
http_filters:
  - name: envoy.filters.http.adaptive_concurrency
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.http.adaptive_concurrency.v3.AdaptiveConcurrency
      gradient_controller_config:
        sample_aggregate_percentile:
          value: 95
        concurrency_limit_params:
          max_concurrency_limit: 4000
        min_rtt_calc_params:
          interval: 60s
05
STAGE 05 · SYSTEM DESIGN APPLICATIONSL7 · STAFF / PRINCIPAL

Where priority-aware load shedding protects production SLAs.

Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Criticality-tiered admission control is a core pattern in high-scale gateways and storage engines:

  • API Gateways & BFFs: Protect login, checkout, and payment webhooks during bot or push-notification storms.
  • Multi-Tenant SaaS Backends: Shed background exports and analytics before interactive UI queries.
  • Distributed Queues & Microservices: Propagate priority headers so downstream databases also shed low-priority batch work.
Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why is adaptive concurrency (AIMD / gradient control) paired with criticality tiers superior to a static global RPS cap?

Recommended Learning Flow