Stop validation workers from creating an unbounded reorder queue
Parallel validation improves throughput until one slow record delays output. Later completed records accumulate while the writer waits for order.
- Focused work estimate
- 5h 30m + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Parallel processing · Ordering · Memory bounds
Estimated field mix
- Performance engineering50%
- Data engineering50%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional wholesaler imports supplier rows into a staging catalog. The current prototype reads the entire file into memory and restarts from zero after a failure. Build the prototype and generated CSV fixture locally before measuring improvements.
Setup prerequisites
- Generate a deterministic 250,000-row synthetic CSV with quoted newlines, invalid records and a stated maximum record size.
- Create a disposable staging database and an import process constrained to 256 MiB; record runtime and available CPU.
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
- PBATCH-101 · Generate a catalog file that includes difficult CSV boundaries
- PBATCH-102 · Measure peak import memory across parsing, validation and writes
- PBATCH-103 · Attribute import time to parsing, validation and database waits
- PBATCH-104 · Stream records without buffering the rest of the catalog
- PBATCH-105 · Batch staging writes without changing duplicate-SKU behavior
Acceptance criteria
- Define a bounded in-flight window and preserve required source ordering without retaining unlimited completed work.
- Propagate cancellation and fatal validation failure through every active stage.
- Select worker concurrency from repeated measurements that include serialization and coordination overhead.
Implementation constraints
- If the measured validation stage is not CPU-bound, document that result and retain a simpler bounded path instead of adding workers without benefit.
Verification to include
- Delay the first record while later records complete and assert both in-flight and retained-result bounds.
- Fail one worker during the import and verify controlled shutdown, deterministic checkpoint state and no silent record loss.
Deliverables
- Concurrency decision, bounded ordering implementation and fault tests
Rollout and recovery
Keep a single-worker configuration available; drain or cancel active work before changing concurrency during a rehearsal.
Value of the work
For the engineer: Practice streaming, backpressure, allocation analysis and resumable work while retaining exact import semantics.
For the team: Develop a repeatable import performance and recovery exercise that exposes memory, throughput and data-quality tradeoffs.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.