Skip to the content.

Estimate request cost (ms CPU) and multiply by concurrency to size CPU/RAM

What it means:


Step-by-step:

  1. Estimate request cost
  1. Estimate concurrency
  1. Compute total CPU requirement

[ \text{Total CPU time needed per second} = \text{Request CPU time (ms)} \times \text{Concurrency} ]

  1. Size RAM

Summary:

CPU/RAM sizing = (per-request resource usage) × (expected concurrent requests)


Use queue length and worker processing time to compute worker count for background jobs

Context:


Step-by-step:

  1. Queue length (Q)
  1. Worker processing time (T)
  1. Compute worker count (W)

Formula: [ W = \frac{\text{Queue length} \times \text{Processing time per job}}{\text{Target processing window}} ]

[ W = \frac{1000 \times 2}{100} = 20,workers ]

  1. Adjust for concurrency

Summary

Concept Formula / Rule
CPU sizing CPU cores ≈ (request CPU ms × concurrency) / 1000
RAM sizing RAM ≈ (per-request memory × concurrency)
Worker count Workers ≈ (queue length × processing time) / desired processing window or Workers ≥ arrival rate × processing time

💡 Analogy:

  1. CPU sizing:
  1. Queue + worker sizing: