← Lessons

quiz vs the machine

Silver1100

System Design

QPS and Traffic Estimation

Going from a user count to the queries per second your servers actually have to field.

4 min read · intro · beat Silver to climb

From users to queries

Queries per second, or QPS, is the rate of requests a system must handle. You derive it from daily activity, not by guessing a number out of the air.

The basic formula

  • Take daily active users and the requests per user per day.
  • Multiply to get total daily requests.
  • Divide by the number of seconds in a day, about 86400.

So one million users doing ten requests each per day is ten million requests, divided by 86400, roughly 120 QPS on average.

Watch the spread

Average QPS hides the truth. Traffic clusters in busy hours, so real peaks can be several times the average. A common rule is to plan for a peak that is two to ten times the daily average.

Knowing both average and peak QPS lets you size servers for the worst minute, not the comfortable average that never reflects reality.

Key idea

QPS comes from users times requests divided by seconds per day, and you must inflate the average to a peak before sizing.

Check yourself

Answer to earn rating on the learn ladder.

1. How do you compute average QPS from daily requests?

2. Why size for peak QPS rather than average?