Skip to content

Free guide

Choose an architecture for the actual workload

Compare a simple application, a background worker and independent services using demand, latency, failure modes and team ownership.

Why it matters

A product manager can negotiate how long a user may wait. A developer can choose where processing runs, how work catches up and how operators find a stuck job.

Core concepts

Start with a boundary you can operate

A monolith deploys as one application and can have clear internal modules. Independent services offer independent releases and scaling, with added network calls and coordination. An external integration can begin as a module with an explicit interface.

Queue long work

A queue holds work for a background worker. A scheduled job runs on a clock. An event starts work because something happened. Decide how retries stop, how failed work is inspected and how two workers avoid applying the same effect twice.

Measure backlog age

A queue smooths bursts but does not add capacity. At 12 arriving jobs and 10 completed jobs per minute, backlog grows by 2 per minute. A thousand idle workers cannot cure a partner API limit. Track oldest-job age alongside work completed.

Cache deliberately

A cache stores a cheaper-to-read copy. Decide how long a stale answer is acceptable, how it gets invalidated and what happens when the cache is empty. Cloud compute, storage, network connections and managed databases each have separate limits and costs.

Try it step by step

  1. Define a latency target for the interaction and a separate deadline for the finished work.
  2. Estimate peak arrival rate, sustainable service rate and backlog drain time.
  3. Give every component a monitored signal and an owner. Record why you chose this design and when to revisit it.

Write an architecture decision record with constraints, options, trade-offs, decision and a measurable review trigger.

Worked example

Fictional example: A nightly file brings 600 rows in one minute. A single worker processes 30 per minute. When no other work arrives, it takes 20 minutes to clear. A 15-minute deadline requires a faster path, a smaller batch or a changed deadline.

Common mistake

Splitting one process into services before locating the slow resource. The same downstream limit can still cap throughput.

Practice exercise

Assume 600 waiting rows, 30 completions per minute and 10 new arrivals per minute. Calculate the drain time. Answer: 600 / (30 − 10) = 30 minutes. Explain when the queue would never shrink.

Check your understanding

A queue receives 40 jobs per minute and finishes 35. What happens over a steady hour?

  1. It drains
  2. It adds about 300 jobs
  3. It stays level
Show answer

It adds about 300 jobs. Five extra jobs per minute over sixty minutes creates 300 waiting jobs.

Takeaway

Calculate what the bottleneck can finish before adding another component.

Further reading

Browse more lessons