Skip to content

Pipes and filters

Pipes and filters breaks a processing task into a sequence of independent steps (filters), each doing one job, connected by pipes that carry data from one step to the next. Each filter reads input, transforms it and writes output, without knowing anything about the filters before or after it.

It’s one of the oldest architecture styles. Unix shell pipelines are the classic example (cat log | grep ERROR | sort | uniq -c), and the same idea powers ETL jobs, stream processing platforms, compilers, image and video processing, and document ingestion for AI systems.

An order-processing pipeline1. Records flow from a source through a chain of filters, each connected by a pipe such as a queue, topic or stream. 2. Each filter does one thing and can be developed, tested, scaled and replaced independently. 3. Records that fail a filter go to a dead-letter destination for inspection, instead of stopping the whole pipeline. Sourceorders arrive Validatefilter Enrichfilter: add customer Sinkwarehouse, next systemAggregatefilter: daily totals Transformfilter: target format Dead lettersrejected records123
An order-processing pipeline Each filter does one job and knows only its input and output; pipes buffer between them, so each step can scale and fail on its own.
  1. Records flow from a source through a chain of filters, each connected by a pipe such as a queue, topic or stream.
  2. Each filter does one thing and can be developed, tested, scaled and replaced independently.
  3. Records that fail a filter go to a dead-letter destination for inspection, instead of stopping the whole pipeline.
  • Filters are independent and single-purpose. Each one has a clear input and output contract. Filters can be written in different languages or run on different infrastructure.
  • Pipes decouple and buffer. In a single process, pipes may be in-memory streams. In distributed systems they’re queues, topics or streams (for example Kafka, Pub/Sub, Kinesis), which absorb bursts and let filters run at different speeds.
  • Composition. New pipelines are built by rearranging or adding filters, much like Unix commands.
  • Parallelism. A slow filter can run as many instances, each reading from the same pipe.
  • Batch or streaming. The same style works for nightly batch jobs and continuous streams. Frameworks such as Apache Beam express one pipeline that can run either way.
  • Error handling per filter. Bad records go to a dead-letter queue with the reason, so one malformed record doesn’t halt everything.
  • Simple, testable steps: each filter can be unit-tested with sample input and output.
  • Reuse and recombination: the same filters appear in many pipelines.
  • Independent scaling: add capacity only where the bottleneck is.
  • Clear data lineage: it’s obvious which step changed what.
  • Not for interactive request-response work: pipelines are about throughput, not low-latency answers to a single user.
  • Overhead between steps: serializing data through many pipes costs time and money.
  • Shared state is awkward: filters that need to join or aggregate across records need careful design (windows, state stores).
  • End-to-end debugging across many asynchronous steps needs good tracing and correlation IDs.
  • Data integration and ETL or ELT, including feeding a data warehouse or lakehouse.
  • Stream processing: fraud scoring, clickstreams, IoT telemetry, log processing.
  • Media and document processing: image resizing, video transcoding, OCR, and chunking and embedding documents for RAG.
  • Compilers and any workflow that’s naturally a sequence of transformations.
  • Interactive workflows where a user waits for one answer.
  • Processes with many branches, loops and human decisions; a workflow or orchestration engine fits better.
  • Filters that know about each other, for example a filter that checks which step comes next. That defeats the point.
  • Giant filters that do five things, so they can’t be reused or scaled separately.
  • No idempotency: when a pipe redelivers a message, the filter processes it twice. See idempotency.
  • No dead-letter handling, so one bad record blocks or crashes the pipeline.
  • No schema contracts between filters, so an upstream change silently breaks downstream steps.

Glossary: idempotency, eventual consistency

Written and edited by Abhinav Taduka, enterprise software architect.