Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1kbgz Tributary Backpressure

From Leeroopedia
Knowledge Sources
Domains Streaming, Flow_Control
Last Updated 2026-10-14 00:00 GMT

Overview

A flow control mechanism where a node checks if downstream consumers have unprocessed inputs before producing new values, preventing fast producers from overwhelming slow consumers.

Description

Backpressure is the reactive streams concept of regulating data flow to match the slowest consumer. In Tributary's streaming model, each node has an input queue (deque) per upstream connection. Before executing, a node checks if any downstream node's input queue is non-empty (or its active input slot is occupied). If so, the node withholds new production, returning StreamNone instead.

When backpressure is too restrictive for a use case, it can be disabled via tick policies:

  • drop: The node always fires; if downstream is busy, new values are dropped (lossy).
  • replace: The node always fires; if downstream is busy, old values are replaced (latest-wins).

This solves the problem of unbounded buffering: without backpressure, a fast source would fill memory with queued values while a slow sink processes them. Backpressure ensures bounded latency and memory usage.

Usage

Use this principle when designing streaming pipelines where producer and consumer rates may differ. Default behavior (no drop/replace) provides backpressure. Use drop for lossy real-time streams where freshness matters more than completeness, and replace for latest-value-is-best scenarios (e.g., price ticks).

Theoretical Basis

Backpressure implements a bounded buffer between producer and consumer. The producer checks the buffer state before writing:

# Abstract backpressure model (NOT real implementation)
def backpressure(node):
    if node.drop or node.replace:
        return False  # no backpressure, always fire
    # check if all downstream queues are empty
    for downstream, port in node.downstream:
        if len(downstream.input[port]) > 0:
            return True  # backpressure: don't fire
    return False

The three tick policies correspond to three buffering strategies:

policy={blockdefault: wait for downstreamdropif full: discard new valuereplaceif full: overwrite old value

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment