← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Backpressure

Messaging Intermediate
debt(d8/e7/b7/t7)
d8 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production until users hit it' (d9), slightly better at d8 because detection_hints.automated is no and the rpush/queue.push pattern is suggestive but not conclusive — missing backpressure typically only manifests under production load spikes via OOM.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7), because the quick_fix involves bounding queues, adding 503 responses to producers, monitoring, and consumer scaling — these touch producer, consumer, and infrastructure layers.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7), because applies_to spans web, cli, and queue-worker contexts, and flow-control decisions shape how every producer/consumer pair is written across the system.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7), because the misconception explicitly states devs believe unlimited queues are safer — the intuitive 'don't drop work' instinct is exactly backwards from the correct 'bounded + reject' design.

About DEBT scoring →

TL;DR

Backpressure signals upstream producers to slow down when downstream consumers can't keep up — preventing queue overflow, memory exhaustion, and system collapse under load.

Explanation

Without backpressure: fast producer + slow consumer → queue grows indefinitely → OOM or unbounded latency. Backpressure strategies: (1) Block producer (synchronous — producer waits until consumer is ready). (2) Drop messages (circuit breaker — shed load). (3) Buffer with size limit (bounded queue — producer blocks or errors when full). (4) Rate limiting producer. (5) Signal via protocol (TCP flow control, Reactive Streams, gRPC flow control). In PHP: Redis list maxlength, queue bounded size, Swoole channel with capacity, HTTP 429 Too Many Requests. ReactiveX / RxPHP: Observable with backpressure operators.

Common Misconception

Unlimited queue size is safer — an unbounded queue causes OOM and system collapse. A bounded queue with explicit backpressure is safer.

Why It Matters

Without backpressure, a slow consumer causes unbounded queue growth that takes down the entire system — backpressure is the feedback mechanism that keeps systems stable under load.

Common Mistakes

  • Infinite queue — hides the problem until OOM.
  • No backpressure to HTTP clients — API accepts more than it can process.
  • Blocking the event loop with backpressure — use async/non-blocking where possible.

Code Examples

✗ Vulnerable
// Unbounded Redis list — can grow until OOM:
$redis->rpush('jobs', $job); // No limit
✓ Fixed
// Bounded with backpressure:
$len = $redis->llen('jobs');
if ($len >= 10000) {
    throw new ServiceUnavailableException('Queue full — apply backpressure');
    // HTTP 503 to caller — let them retry
}
$redis->rpush('jobs', $job);

Added 23 Mar 2026
Views 60
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 2 pings M 0 pings T 1 ping W 0 pings T 0 pings F 2 pings S 2 pings S 3 pings M 1 ping T 0 pings W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 0 pings F 1 ping S 0 pings S 1 ping M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Scrapy 9 Amazonbot 8 Perplexity 8 Google 6 Bing 3 Unknown AI 2 ChatGPT 2 Ahrefs 2 Claude 1 Meta AI 1 PetalBot 1
crawler 41 crawler_json 2
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Medium
⚡ Quick Fix
Set bounded queue size. Return 503 or block producer when full. Monitor queue depth. Add consumer scaling when depth exceeds threshold.
📦 Applies To
web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
rpush|queue.*push
Auto-detectable: ✗ No
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File
CWE-400 CWE-770


✓ schema.org compliant