Home/Labs/Push vs Pull Backpressure
All 280 Labs
INTERACTIVE LAB🔁

Push vs Pull Backpressure Lab (Interactive)

Outrun the consumer threefold and watch push OOM the heap while Kafka lag banks the surplus safely. Compare server-initiated push, consumer-initiated pull, and hybrid ping-and-payload delivery under producer spikes, measuring buffer growth, lag, latency, and lost events.

Push vs Pull Delivery & Backpressure

Out-run your consumer by 3x and watch push crash heaps while pull banks lag in the log.

Events produced (60 s)
6000K
consumer drained 1800K
Broker log lag
4200.0K events
durable in partition log
Delivery latency
117 ms
poll interval is the tax
Connection overhead
stateless batch RPCs
200.0 poll RPCs/s (500 records each)
Natural backpressure: poll(max_records=500) means the worker only ever holds one batch in memory. The 4200K surplus sits durably in the Kafka partition log; consumers drain at exactly 30K ev/s and the lag (monitored by consumer lag / Kafka Streams) catches up when capacity scales out.

How It Works Under the Hood

Delivery direction decides who owns flow control. Push systems like WebSockets and RabbitMQ dispatch instantly, giving sub-5 ms latency, but when a producer at 100K events/s meets a consumer at 10K, socket buffers and heaps saturate until the worker crashes and in-flight messages are lost. Pull systems like Kafka invert control: consumers poll fixed batches at their own pace, so surplus traffic accumulates durably as lag in the partition log. Hybrid architectures push a 200-byte wake signal and pull heavy payloads from a CDN on demand.

Core Architectural Principles

  • Pull consumers self-pace with poll(max_records), yielding natural backpressure and zero OOM.
  • Push requires explicit credit-based flow control or the consumer buffer becomes the outage.
  • Hybrid pushes metadata instantly and defers bandwidth-heavy payload fetches to the client.
Interview Round Script

Frame the choice by workload: push at the user edge for chat, gaming, and trading UIs where milliseconds are the product; pull in backend pipelines where durability and batching dominate, and explain Kafka deliberately chose pull for consumer-controlled flow. Finish with the hybrid pattern for mobile media, showing you can reason about battery, egress, and buffer limits together.

Key Trade-Offs

Push buys instant delivery with stateful connections; pull buys stability and batching at the cost of polling latency.

Related Curriculum Chapter

Push vs Pull Delivery Models in Distributed Systems

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs