Pipeline and serverless
Two more styles complete the catalogue. The pipeline style is one of the oldest ideas in software: small steps that each do one thing, connected in a line. Serverless is one of the newest: functions that run only when an event arrives, on infrastructure you never see. They meet in practice, because many serverless systems are pipelines of functions triggered by events.
1. The idea
Pipeline (pipes and filters)
Work flows one way through a chain of filters, joined by pipes. Each filter is independent and usually stateless; it knows nothing about the others except the data format in its pipe. Four kinds of filter recur:
| Filter | Job | Example |
|---|---|---|
| Producer | Starts the flow | Reads order files from a bucket |
| Transformer | Changes the data | Converts currencies to euros |
| Tester | Checks a condition and passes or drops data | Rejects rows with no customer ID |
| Consumer | Ends the flow | Writes to the data warehouse |
Unix shell pipes, compilers (lex, parse, optimise, generate), ETL jobs, stream processors such as Apache Flink and Kafka Streams, and CI/CD pipelines all follow this style. It's usually a single deployment (one quantum) with very simple structure.
Serverless
You deploy functions (or containers) and the platform runs them on demand: it starts instances when events arrive, scales them, and stops them when idle. You pay per request and per unit of compute time, not for servers. AWS Lambda, Azure Functions, Google Cloud Run functions and Cloudflare Workers are the common platforms. As an example of the limits involved, AWS Lambda (checked October 2026) runs an invocation for at most 15 minutes, with 128 MB to 10,240 MB of memory, and a new account starts with 1,000 concurrent executions per region. It charges $0.20 per million requests plus about $0.0000167 per GB-second of compute (x86, first tier, US regions).
Serverless is a deployment and operations model as much as a style. Functions are usually small and event-driven, so a serverless system often looks like event-driven architecture (Module 14) or a pipeline, with managed queues, storage and databases around it.
How they rate
| Characteristic | Pipeline | Serverless | Microservices |
|---|---|---|---|
| Partitioning | technical | domain | domain |
| Quanta | 1 | 1 to many | 1 to many |
| Cost | ★★★★★ | ★★★★★ | ★★★★★ |
| Simplicity | ★★★★★ | ★★★★★ | ★★★★★ |
| Scalability | ★★★★★ | ★★★★★ | ★★★★★ |
| Elasticity | ★★★★★ | ★★★★★ | ★★★★★ |
| Fault tolerance | ★★★★★ | ★★★★★ | ★★★★★ |
| Evolvability | ★★★★★ | ★★★★★ | ★★★★★ |
| Deployability | ★★★★★ | ★★★★★ | ★★★★★ |
| Testability | ★★★★★ | ★★★★★ | ★★★★★ |
| Performance | ★★★★★ | ★★★★★ | ★★★★★ |
Our qualitative ratings, 1 to 5 stars, more is better (for cost, more stars = cheaper). They compare styles in general; your context can move any of them.
2. How it works
An order-file pipeline, then one more filter
A nightly job loads 10,000 order rows into the warehouse. Watch the rows move through the filters, and what it takes to add fraud scoring.
Serverless under a burst: cold starts and the database
An image-upload API on functions goes from idle to 300 requests at once. The platform scales instantly; what's behind it may not.
3. Try it yourself
Functions or always-on containers: where's the crossover?
Compare a function's bill with two or more always-on containers (two for availability, each serving up to 200 requests a second at an assumed $60 a month). Peak traffic is taken as three times the average. Function prices are AWS Lambda's published x86 rates without the free tier; container prices are an assumption, so read the shape, not the cents.
4. Trade-offs
Pipeline: simplicity vs scale
Filters are easy to write, test and reorder. But the whole pipeline is usually one deployment: the slowest filter sets the pace, and one crash stops the line. Put queues between filters (or use a stream processor) when stages need to scale separately.
Serverless: no servers vs less control
No patching, no capacity planning, scaling to zero. In return: execution time limits, cold starts, vendor-specific triggers and configuration, and harder local testing.
Pay per use vs pay for capacity
Spiky or low traffic is far cheaper on functions. Steady, high traffic is usually cheaper on always-on containers or servers; the lab shows the crossover moving with request time.
Infinite scale vs finite dependencies
Functions scale to hundreds of instances in seconds. Databases, third-party APIs and licences don't. Scale is only as good as the slowest dependency.
5. In real projects
Pipelines hide in plain sight. Data ingestion, document processing (upload → virus scan → thumbnail → text extraction → index), and build pipelines are all pipelines. Making the stages explicit, with a clear format between them, makes them testable one stage at a time.
Protect what's behind the functions. Cap concurrency per function, put a connection pooler or proxy in front of relational databases (for example Amazon RDS Proxy or PgBouncer), and use queues so bursts become backlogs rather than outages.
Cold starts are manageable. Keep packages small, initialise lazily, choose fast-starting runtimes, and for latency-critical paths use the platform's warm-capacity features (provisioned concurrency on Lambda, minimum instances on Cloud Run).
Say it in the interview
- "When would you choose serverless?" For spiky or low, event-driven workloads where scaling to zero saves money and the team doesn't want to run servers. Not for steady high load, long-running work or latency-critical paths without warm capacity.
- "How would you design this ETL job?" As a pipeline: a producer, testers that drop bad rows to a dead-letter store, transformers, and a consumer, each a separate, testable filter with a defined record format between them.
- "What breaks first when a function-based API spikes?" Usually the database: hundreds of new function instances open hundreds of connections. A pooler and a concurrency cap fix it.
- Serverless for a steady 5,000 requests a second "because it scales".
- Functions that open a new database connection each, with no pooler.
- A pipeline whose filters share mutable state.
6. Remember it
How this hook works: what "stations in a line, machines on demand" means
What the slogan means, phrase by phrase
- "Stations in a line"
- Filters joined by pipes, data flowing one way, each filter unaware of the others.
- "machines on demand"
- Serverless: instances start per event and you pay per use.
Why this picture fits: a car wash adds a wax station without touching the rest, and a pay-per-wash machine costs nothing when no cars come.
The story → the concept
| The car wash | The styles |
|---|---|
| Soak, scrub, rinse, dry | Producer, transformers, testers, consumer |
| The conveyor | Pipes |
| Machines that start when a car arrives | Functions invoked by events |
| The first car waits while machines warm up | Cold start |
The trap it saves you from
Forgetting that the car park (the database) behind the wash doesn't grow when the machines do.
7. Common mistakes
8. Design exercise (30 minutes)
- Draw a pipeline (10 min). For "users upload invoices as PDFs", list the filters from upload to searchable data, labelling each producer, transformer, tester or consumer.
- Make it serverless (10 min). Which filters become functions, which events trigger them, and where do queues go?
- Find the bottleneck (10 min). At 500 uploads a minute, which dependency breaks first? Add the cap, pooler or queue that protects it.
9. Self-check quiz
A pipeline filter drops rows that have no customer ID. What kind of filter is it?
A function-based API goes from idle to 300 concurrent requests. What usually fails first?
Which workload suits serverless best?
What is a cold start?
What does the pipeline style make especially easy?
10. Go deeper
| Resource | Time | Why |
|---|---|---|
| Pipes and Filters pattern (Azure Architecture Center) | 15 min | The pattern with scaling and resilience considerations. |
| Lambda quotas (AWS) | reference | The limits that shape a serverless design. |
| Lambda pricing (AWS) | reference | Per-request and per-GB-second prices used in the lab. |
| Serverless Architectures (Mike Roberts, on martinfowler.com) | 45 min | A thorough look at the benefits and drawbacks. |