streaming-architect
Architect-level streaming design — event schema and keys, delivery guarantees and what exactly-once really buys, watermarks and late data, state and checkpointing, replay from a log, and the operational cost of a always-on pipeline. Use when data must move and be processed continuously.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- streaming-architect
- license
- MIT
- metadata
- { "crusor-path": "data-engineering-architect/event-streams-architect/streaming-architect", "crusor-domain": "data-engineering-architect", "crusor-origin": "original", "crusor-sources": "kafka.apache.org/documentation; nightlies.apache.org/flink/flink-docs-stable; docs.aws.amazon.com/streaming", "crusor-triggers": "streaming, kafka, kinesis, event stream, pub sub, real time, flink, exactly once, watermark, event driven pipeline, consumer group", "crusor-verified-on": "2026-10-30" }
- description
- Architect-level streaming design — event schema and keys, delivery guarantees and what exactly-once really buys, watermarks and late data, state and checkpointing, replay from a log, and the operational cost of a always-on pipeline. Use when data must move and be processed continuously.
- compatibility
- Kafka, Kinesis, Pulsar, Flink, Spark Structured Streaming, Redpanda
03 SKILL.md 正文
Streaming Architect
A stream is an append-only log plus consumers that must be replayable. Design the log first; the processing framework is a detail you can replace.
When to use
- Freshness in seconds or minutes drives a named action.
- Multiple consumers need the same event flow.
- An operational system must react as events happen.
When NOT to use
- A five-minute batch satisfies the decision →
batch-pipeline-architect. - The payload is large blobs — stream a pointer, not the file.
- There is one consumer and no replay need: a queue is enough.
Decision 1 — The log
- Partition key decides ordering and parallelism: choose it for the ordering you actually need (per user, per account), not for even spread alone.
- Retention is a design number: long enough to replay a bad deploy and rebuild state. "Seven days" is a default, not a decision.
- Topic per event type, versioned schema, no mixed payload shapes.
- Compaction for entity state topics (latest value per key); delete retention for event topics.
Decision 2 — Delivery semantics
| Guarantee | Reality |
|---|---|
| at-most-once | may lose events, never duplicates |
| at-least-once | duplicates possible — consumers must be idempotent |
| exactly-once | transactional within the framework's boundary only |
- Choose at-least-once plus idempotent sinks for almost everything; it is simpler and survives retries.
- "Exactly once" ends at the system boundary: an external API call is not covered.
- Deduplicate on a stable event id, stored with the sink write.
Decision 3 — Time
- Event time is when it happened; processing time is when you saw it. Aggregations must say which they use.
- Watermarks bound how long you wait for late data; the allowed lateness is a product decision with a cost.
- Late events either update a window (allowed lateness) or go to a side output — never silently dropped.
- Windows: tumbling for reporting, sliding for detection, session for behaviour; each has different state cost.
Decision 4 — State and recovery
- Stateful operators checkpoint to durable storage at an interval that bounds reprocessing on failure.
- The state store size sets the recovery time; large state needs incremental checkpoints.
- Consumer group rebalances stop the world briefly — plan for them, and use cooperative rebalancing.
- Restore drill: kill an operator and measure time to catch up.
Decision 5 — Replay and change
- A new consumer starts at earliest or latest — decide per consumer and record it.
- Rebuilding a derived table means replaying into a new sink, not mutating the live one.
- Schema evolution: additive optional fields are safe; removing or renaming needs a version and a migration path.
- Backpressure is real: monitor consumer lag, not just throughput.
Decision 6 — Cost and operations
- Streaming bills by provisioned throughput or running time — an idle cluster is a line item.
- Alert on consumer lag (time-based, not message count), checkpoint failures, and partition skew.
- One hot partition ruins parallelism; check key distribution.
- Poison messages go to a DLQ with the payload and the error.
Failure modes at scale
- Duplicate charges from a non-idempotent sink after a rebalance.
- Consumer lag measured in messages, hiding an hour of real delay.
- A single hot key serialising 40% of traffic.
- Watermark set so tight that every late event is discarded.
- State restored from a week-old checkpoint because nobody tested recovery time.
Verification receipts
- Topic inventory: key, retention, partitions, schema version.
- Duplicate-injection test: replay 10% of events, downstream counts unchanged.
- Lag dashboard in seconds, with an alert on the SLO.
- Recovery drill: operator killed, catch-up time measured.
- Late-event policy exercised with an out-of-order event.
04 同仓库更多 Skills
interaction-patterns-architect
Architect-level interaction design in code — choosing established patterns over invented ones, feedback and latency behaviour, destructive-action safeguards, navigation and overlay conventions, and the state model behind every interactive surface. Use when a screen has to behave, not just look.
design-system-ops-architect
Architect-level operation of a design system in code — token pipelines and versioning, component API and variant policy, the catalogue as the contract, adoption metrics, and the governance that stops a system from forking into three. Use when a component library must survive several teams.
design-handoff-architect
Architect-level design handoff — what must be specified before implementation starts, tokens over raw values, responsive and content-limit contracts, state matrices, and the review loop that catches drift between design and code. Use when a design is about to become code.
content-microcopy-architect
Architect-level UI content — where strings live, voice and terminology consistency, error and empty-state copy as part of the interface, translation-ready authoring, and the content model a product needs before it multiplies screens. Use when the words in the interface matter as much as the pixels.
ui-ux-implementation-architect
Architect-level direction for turning a design into working UI — the handoff contract, component ownership versus screen-level layout, interaction and state conventions, design QA gates, and the review habits that keep an implementation faithful without frozen pixels. Use before any specific UI implementation skill.
test-strategy-architect
Architect-level test strategy — allocating assertions across unit, integration, contract and end-to-end layers, designing for testability through dependency boundaries, fixture and data strategy, and the flake and coverage policies that keep a suite trustworthy. Use when defining how a codebase is tested.