What Are Architecture Patterns? Pipe-Filter and Microkernel Architecture
Architecture patterns provide reusable solutions, and this article explains the Pipe‑Filter pattern—where data passes through independent filters like a production line, used in web frameworks, compilers, and serverless functions—and the Microkernel pattern, which separates a minimal core from plug‑in modules to enhance extensibility, maintainability, and configurability.
According to Wikipedia, an architecture pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context.
This article introduces two classic software architecture patterns: the Pipe‑Filter pattern and the Microkernel pattern.
1. Pipe‑Filter Architecture Pattern
The Pipe‑Filter pattern is analogous to an industrial production line: data flows through a series of independent filters connected by a pipe. Each filter processes the input and passes the result to the next filter until the final output is produced.
Typical use cases include web frameworks (e.g., Koa’s onion model), big‑data processing pipelines, compilers, and Unix command pipelines.
In a web system, the request processing flow often follows the Pipe‑Filter style: HTTP parsing → security checks (XSS, CSRF) → session parsing → authentication → routing, etc. Each step can be implemented as a separate filter.
Filters can be combined using the Composite pattern, allowing multiple simple filters to be assembled into a more complex one.
1.3 Serverless and FaaS
Serverless architectures rely on Function‑as‑a‑Service (FaaS). A Fn Actuator loads, schedules, and executes functions, which can be executed serially, in parallel, or in various composite ways.
Fn serial: each function’s output becomes the next function’s input.
Fn parallel: all functions run concurrently and their results are aggregated.
Fn serial composition: multiple functions are wrapped into a single function preserving input/output contracts.
Fn parallel composition: parallel functions are wrapped into a new function with custom input/output.
Fn complex composition: free combination of the above.
Fn types include pure functions, remote service calls (HTTP/RPC), and scripts (SQL or shell).
2. Microkernel Architecture Pattern
The Microkernel (or plug‑in) architecture separates a minimal core system from extensible plug‑in modules. The core provides generic services such as lifecycle management and plug‑in registration, while plug‑ins implement specific features (e.g., routing, security, HTTP codec).
Key components:
Core System – stable, generic functionality.
Plug‑in Modules – feature‑specific, isolated, and replaceable.
2.3 Core System Design Points
Plug‑in management: installation (e.g., npm install), enabling/disabling via configuration, communication through the core, and uninstallation.
Application management: separate lightweight main process from plug‑in processes to improve stability; modern browsers use multiple processes (Browser, Render, GPU, Network, Plug‑in).
2.4 Plug‑in Module Design Points
Metadata definition (name, description, version).
Plug‑in should be pluggable and configurable.
Each plug‑in should have a single responsibility.
2.5 Microkernel Application Cases
VS Code – core plus extensions.
Rule engines – core execution engine with configurable rules.
Koa web framework – minimal core with middleware acting as plug‑ins/filters.
Both patterns aim to reduce system complexity, improve maintainability, extensibility, and configurability by decomposing large problems into smaller, composable units.
Youzan Coder
Official Youzan tech channel, delivering technical insights and occasional daily updates from the Youzan tech team.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.