Preview Bản nháp chờ review — title, nội dung, link có thể sửa trước khi bỏ nhãn.

Hai cách tổ chức (cùng tinh thần concurrency models / Jenkov-style):

Parallel workers — mỗi worker làm trọn một job (pool request/thread)
Assembly line    — mỗi stage một phần; ranh giới hay là I/O non-block
                   (reactive, event-driven, channel giữa stage)

Parallel workers

  • Dễ hiểu; scale = thêm worker — competing consumers, thread pool.
  • Shared state (cache, pool, DB) → race, contention.
  • Order nondeterministic — khớp order budget lỏng.

Assembly line

  • Stage + non-block: khớp event loop, coroutine, pipeline.
  • Ít shared mutable; message/copy giữa stage.
  • Có thể log/order; logic một job xé nhiều class (callback hell nếu viết dở).

Chọn nhanh

Nhiều I/O chờ, ít thread          → assembly / event loop / async
Job độc lập + API sync/block      → parallel workers + pool
Cần order per key                 → stream partition, không workers xáo
Shared mutable lớn                → cẩn workers; message-passing line dễ reason
Máy đã full multi-tenant load     → đừng “parallelize 1 task” đắt

Map series

Deal I/O trên ít thread → nghiêng assembly/async. Job độc lập + block API → workers. Hệ thật hay lai.

Một câu

Làm trọn song song, hay chia đoạn khi chờ — khác topology, khác chỗ kẹt.