System Design (High-Level Design) Module 2 – Back-of-the-envelope estimation
Estimating traffic: users to requests per second
Turn daily active users and actions per user into average and peak requests per second, split reads from writes and pick a peak factor from the traffic shape.
What you will learn
- Calculate average and peak requests per second from daily active users and actions per user
- Separate read traffic from write traffic and justify the ratio you assume
- Choose a peak factor from the shape of the traffic and the window it applies to
- Check an estimate against a published total by the share it implies
Before you start
What you’ll learn · Before you start
What you will learn
- Calculate average and peak requests per second from daily active users and actions per user
- Separate read traffic from write traffic and justify the ratio you assume
- Choose a peak factor from the shape of the traffic and the window it applies to
- Check an estimate against a published total by the share it implies
Before you start
On this page
Fifty million people who each make 120 requests a day send 6 billion requests: 69,444 a second on average, and about 208,000 a second at a peak three times as busy. The first sizing question of almost every design is how much traffic it must carry: how many requests a second, of which kind, at the worst moment. Everything else follows from that answer.
A thousand requests a second fits comfortably on a few servers; a few hundred thousand writes a second needs a partitioned database and a careful write path. This lesson turns the numbers a product team gives you (users and what they do) into the numbers an engineer sizes things with (requests per second), and shows where the peak comes from instead of guessing it.
Users and their requests set the average rate
Start from daily active users (DAU): The number of different people who use a product on a typical day. It can never exceed the monthly active users, and it is the usual starting point of a traffic estimate.: the people who use the product on a typical day. If you are given monthly active users instead, assume what share of them come on a given day and say so, because daily users can never be more than monthly ones. Then count what each of them makes in a day. Count requests to your servers, not taps on a screen: one screen may load with several API calls, and an app may sync in the background.
From users to requests per second
Text description of the diagram
The diagram is a chain of boxes from top to bottom.
- Daily active users, multiplied by the reads and writes each user makes in a day, give the requests a day.
- The requests a day, divided by 86,400 seconds, give the average requests a second.
- The average, multiplied by a peak factor for a stated window such as the busiest hour or second, gives the peak requests a second.
- The peak splits into two boxes: peak reads a second and peak writes a second, each the peak multiplied by its share of the traffic.
In symbols, with the 86,400 seconds of a day from the lesson on units:
Follow one service, chat, down the chain one step at a time, with the assumptions of the program below:
The drawing shows the whole scene; its 7 steps are listed below.
Every step as text
- The users. Chat starts from its assumed 50 million daily active users, the people who use it on a typical day.
- Requests a day. Each user is assumed to make 80 reads and 40 writes a day, counted as requests to the servers. 50 million × 120 is 6 billion requests a day.
- The average. Spread evenly over the 86,400 seconds of a day, 6 billion requests are 69,444 a second. That is the average, night included.
- The peak. The assumed peak factor of 3 for the busiest window gives 208,333 requests a second, the number the design has to carry.
- Reads at the peak. 80 of every 120 requests are reads, 138,889 a second at the peak. Reads can be answered from copies, so caches and read replicas carry them.
- Writes at the peak. The other 40 of 120 are writes, 69,444 a second. Every write must reach the copy that owns its data, and a write rate this high pushes towards partitioning.
- The same chain, other numbers. The program runs the same chain for the news feed and for payments. The news feed peaks at 289 writes a second against 28,935 reads, so its design is about the read path instead.
This program applies the formula to three services with assumptions you can change, in 14 languages:
Python 3.14 · main.py
from typing import NamedTuple
DAY = 86_400 # seconds
class Service(NamedTuple):
"""Daily active users, reads and writes per user a day, and the peak factor."""
name: str
dau: int
reads: float
writes: float
peak_factor: float
class Estimate(NamedTuple):
daily: float
average: float
peak: float
peak_reads: float
peak_writes: float
SERVICES = [
Service("chat", 50_000_000, 80, 40, 3),
Service("news feed", 20_000_000, 50, 0.5, 2.5),
Service("payments", 30_000_000, 4, 2, 4),
]
def estimate(s: Service) -> Estimate:
"""Average and peak requests a second, the peak split into reads and writes."""
daily = s.dau * (s.reads + s.writes)
average = daily / DAY
return Estimate(
daily=daily,
average=average,
peak=average * s.peak_factor,
peak_reads=s.dau * s.reads / DAY * s.peak_factor,
peak_writes=s.dau * s.writes / DAY * s.peak_factor,
)
print(
f"{'Service':<11}{'per day':>15}{'average/s':>11}{'peak/s':>10}"
f"{'reads/s':>10}{'writes/s':>10}{'reads:writes':>14}"
)
for s in SERVICES:
e = estimate(s)
print(
f"{s.name:<11}{e.daily:>15,.0f}{e.average:>11,.0f}{e.peak:>10,.0f}"
f"{e.peak_reads:>10,.0f}{e.peak_writes:>10,.0f}{s.reads / s.writes:>12,.0f}:1"
) In Python: The format spec :>15,.0f rounds to a whole number, puts a comma between each group of three digits and pads to 15 characters in one step; NamedTuple gives each service named fields.
Recorded with CPython 3.14.8 on macOS 26 arm64. It runs in your browser with Pyodide 314.0.7 (CPython 3.14.2). To run it yourself: python3 main.py
JavaScript Node 24 · main.mjs
const DAY = 86_400; // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
const SERVICES = [
{ name: "chat", dau: 50_000_000, reads: 80, writes: 40, peakFactor: 3 },
{ name: "news feed", dau: 20_000_000, reads: 50, writes: 0.5, peakFactor: 2.5 },
{ name: "payments", dau: 30_000_000, reads: 4, writes: 2, peakFactor: 4 },
];
// Average and peak requests a second, the peak split into reads and writes.
function estimate({ dau, reads, writes, peakFactor }) {
const daily = dau * (reads + writes);
const average = daily / DAY;
return {
daily,
average,
peak: average * peakFactor,
peakReads: ((dau * reads) / DAY) * peakFactor,
peakWrites: ((dau * writes) / DAY) * peakFactor,
};
}
// A whole number with a comma between each group of three digits.
const group = (x) =>
Math.round(x)
.toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
const head = ["per day", "average/s", "peak/s", "reads/s", "writes/s"];
const widths = [15, 11, 10, 10, 10];
const pad = (cells) => cells.map((cell, i) => cell.padStart(widths[i])).join("");
console.log("Service".padEnd(11) + pad(head) + "reads:writes".padStart(14));
for (const s of SERVICES) {
const e = estimate(s);
const cells = [e.daily, e.average, e.peak, e.peakReads, e.peakWrites].map(group);
console.log(s.name.padEnd(11) + pad(cells) + `${group(s.reads / s.writes)}:1`.padStart(14));
} In JavaScript: No format spec for digit groups works in every runtime, so group rounds with Math.round and inserts the commas with a regular expression; pad lines the cells up from a list of widths.
Recorded with Node.js 24.21.0 LTS (V8 13.6) on macOS 26 arm64. It runs in your browser with QuickJS (quickjs-emscripten 0.32.0). To run it yourself: node main.mjs
Java 25 LTS · Main.java
import java.util.List;
import java.util.Locale;
public class Main {
static final int DAY = 86_400; // seconds
/** Daily active users, reads and writes per user a day, and the peak factor. */
record Service(String name, long dau, double reads, double writes, double peakFactor) {}
record Estimate(double daily, double average, double peak, double peakReads, double peakWrites) {}
/** Average and peak requests a second, the peak split into reads and writes. */
static Estimate estimate(Service s) {
double daily = s.dau() * (s.reads() + s.writes());
double average = daily / DAY;
return new Estimate(
daily,
average,
average * s.peakFactor(),
s.dau() * s.reads() / DAY * s.peakFactor(),
s.dau() * s.writes() / DAY * s.peakFactor());
}
public static void main(String[] args) {
Locale.setDefault(Locale.ROOT);
List<Service> services =
List.of(
new Service("chat", 50_000_000, 80, 40, 3),
new Service("news feed", 20_000_000, 50, 0.5, 2.5),
new Service("payments", 30_000_000, 4, 2, 4));
System.out.printf(
"%-11s%15s%11s%10s%10s%10s%14s%n",
"Service", "per day", "average/s", "peak/s", "reads/s", "writes/s", "reads:writes");
for (Service s : services) {
Estimate e = estimate(s);
System.out.printf(
"%-11s%,15.0f%,11.0f%,10.0f%,10.0f%,10.0f%,12.0f:1%n",
s.name(),
e.daily(),
e.average(),
e.peak(),
e.peakReads(),
e.peakWrites(),
s.reads() / s.writes());
}
}
} In Java: printf's , flag groups the digits of %,15.0f, and Locale.ROOT makes the separator a comma whatever the computer's locale; records hold a service and its estimate.
Recorded with OpenJDK 25.0.4.1 LTS (Eclipse Temurin) on macOS 26 arm64. To run it yourself: java Main.java
C++23 · main.cpp
#include <array>
#include <cstddef>
#include <format>
#include <print>
#include <string>
#include <string_view>
constexpr double day = 86'400; // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
struct Service {
std::string_view name;
double dau, reads, writes, peak_factor;
};
struct Estimate {
double daily, average, peak, peak_reads, peak_writes;
};
// Average and peak requests a second, the peak split into reads and writes.
Estimate estimate(const Service &s) {
const double daily = s.dau * (s.reads + s.writes);
const double average = daily / day;
return {daily, average, average * s.peak_factor,
s.dau * s.reads / day * s.peak_factor,
s.dau * s.writes / day * s.peak_factor};
}
// A whole number with a comma between each group of three digits.
std::string group(double x) {
std::string digits = std::format("{:.0f}", x);
for (auto i = static_cast<std::ptrdiff_t>(digits.size()) - 3; i > 0; i -= 3) {
digits.insert(static_cast<std::size_t>(i), ",");
}
return digits;
}
int main() {
constexpr std::array<Service, 3> services{{
{"chat", 50'000'000, 80, 40, 3},
{"news feed", 20'000'000, 50, 0.5, 2.5},
{"payments", 30'000'000, 4, 2, 4},
}};
std::println("{:<11}{:>15}{:>11}{:>10}{:>10}{:>10}{:>14}", "Service",
"per day", "average/s", "peak/s", "reads/s", "writes/s",
"reads:writes");
for (const Service &s : services) {
const Estimate e = estimate(s);
std::println("{:<11}{:>15}{:>11}{:>10}{:>10}{:>10}{:>12}:1", s.name,
group(e.daily), group(e.average), group(e.peak),
group(e.peak_reads), group(e.peak_writes),
group(s.reads / s.writes));
}
} In C++: std::format has no digit grouping without a locale, so group formats the rounded number and inserts a comma before every third digit from the right.
Recorded with Apple clang 21.0.0 (C++23) and GCC 16.2.0 on macOS 26 arm64. It runs in your browser with Clang in WebAssembly (YoWASP) 22.0.0-git20542-10. To run it yourself: clang++ -std=c++23 -O2 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined main.cpp -o main && ./main
C# 14 · .NET 10 · app.cs
using System.Globalization;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
const int Day = 86_400; // seconds
Service[] services =
[
new("chat", 50_000_000, 80, 40, 3),
new("news feed", 20_000_000, 50, 0.5, 2.5),
new("payments", 30_000_000, 4, 2, 4),
];
Console.WriteLine(
$"{"Service",-11}{"per day",15}{"average/s",11}{"peak/s",10}{"reads/s",10}{"writes/s",10}"
+ $"{"reads:writes",14}");
foreach (Service s in services)
{
Estimate e = EstimateOf(s);
Console.WriteLine(
$"{s.Name,-11}{e.Daily,15:N0}{e.Average,11:N0}{e.Peak,10:N0}{e.PeakReads,10:N0}"
+ $"{e.PeakWrites,10:N0}{s.Reads / s.Writes,12:N0}:1");
}
// Average and peak requests a second, the peak split into reads and writes.
static Estimate EstimateOf(Service s)
{
double daily = s.Dau * (s.Reads + s.Writes);
double average = daily / Day;
return new Estimate(
daily,
average,
average * s.PeakFactor,
s.Dau * s.Reads / Day * s.PeakFactor,
s.Dau * s.Writes / Day * s.PeakFactor);
}
// Daily active users, reads and writes per user a day, and the peak factor.
record Service(string Name, long Dau, double Reads, double Writes, double PeakFactor);
record Estimate(double Daily, double Average, double Peak, double PeakReads, double PeakWrites); In C#: The N0 format rounds to a whole number and groups the digits; with the invariant culture the separator is a comma on every computer. EstimateOf is a static local function.
Recorded with C# 14 on .NET 10.0.12 (SDK 10.0.401) on macOS 26 arm64. It runs in your browser with the .NET runtime for WebAssembly 10.0.12. To run it yourself: dotnet run app.cs
C23 · main.c
#include <stddef.h>
#include <stdio.h>
constexpr double day = 86400; // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
typedef struct {
const char *name;
double dau, reads, writes, peak_factor;
} Service;
typedef struct {
double daily, average, peak, peak_reads, peak_writes;
} Estimate;
// Average and peak requests a second, the peak split into reads and writes.
static Estimate estimate(const Service *s) {
const double daily = s->dau * (s->reads + s->writes);
const double average = daily / day;
return (Estimate){daily, average, average * s->peak_factor,
s->dau * s->reads / day * s->peak_factor,
s->dau * s->writes / day * s->peak_factor};
}
// A whole number with a comma between each group of three digits.
static void group(double x, char out[static 32]) {
char digits[24];
const int n = snprintf(digits, sizeof digits, "%.0f", x);
int j = 0;
for (int i = 0; i < n; i++) {
if (i > 0 && (n - i) % 3 == 0) {
out[j++] = ',';
}
out[j++] = digits[i];
}
out[j] = '\0';
}
int main(void) {
static const Service services[] = {
{"chat", 50000000, 80, 40, 3},
{"news feed", 20000000, 50, 0.5, 2.5},
{"payments", 30000000, 4, 2, 4},
};
printf("%-11s%15s%11s%10s%10s%10s%14s\n", "Service", "per day", "average/s",
"peak/s", "reads/s", "writes/s", "reads:writes");
for (size_t i = 0; i < sizeof services / sizeof services[0]; i++) {
const Service *s = &services[i];
const Estimate e = estimate(s);
const double values[] = {e.daily, e.average, e.peak,
e.peak_reads, e.peak_writes, s->reads / s->writes};
const int widths[] = {15, 11, 10, 10, 10, 12};
printf("%-11s", s->name);
for (size_t k = 0; k < sizeof values / sizeof values[0]; k++) {
char text[32];
group(values[k], text);
printf("%*s", widths[k], text);
}
puts(":1");
}
return 0;
} In C: printf's ' flag for digit groups is POSIX and follows the locale, so group builds the grouped text itself; the widths of the six columns sit in an array beside the values.
Recorded with Apple clang 21.0.0 (C23) and GCC 16.2.0 on macOS 26 arm64. It runs in your browser with Clang in WebAssembly (YoWASP) 22.0.0-git20542-10. To run it yourself: clang -std=c23 -O2 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined main.c -o main && ./main
PHP 8.5 · main.php
<?php
declare(strict_types=1);
const DAY = 86_400; // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
final readonly class Service
{
public function __construct(
public string $name,
public int $dau,
public float $reads,
public float $writes,
public float $peakFactor,
) {}
}
/**
* Average and peak requests a second, the peak split into reads and writes.
*
* @return array{daily: float, average: float, peak: float, peakReads: float, peakWrites: float}
*/
function estimate(Service $s): array
{
$daily = $s->dau * ($s->reads + $s->writes);
$average = $daily / DAY;
return [
'daily' => $daily,
'average' => $average,
'peak' => $average * $s->peakFactor,
'peakReads' => $s->dau * $s->reads / DAY * $s->peakFactor,
'peakWrites' => $s->dau * $s->writes / DAY * $s->peakFactor,
];
}
$services = [
new Service('chat', 50_000_000, 80, 40, 3),
new Service('news feed', 20_000_000, 50, 0.5, 2.5),
new Service('payments', 30_000_000, 4, 2, 4),
];
$head = ['Service', 'per day', 'average/s', 'peak/s', 'reads/s', 'writes/s', 'reads:writes'];
printf("%-11s%15s%11s%10s%10s%10s%14s\n", ...$head);
foreach ($services as $s) {
$cells = array_map(number_format(...), [...array_values(estimate($s)), $s->reads / $s->writes]);
printf("%-11s%15s%11s%10s%10s%10s%12s:1\n", $s->name, ...$cells);
} In PHP: number_format rounds to a whole number and groups the digits with commas by default, and the spread operator passes the list of cells to printf.
Recorded with PHP 8.5.11 (CLI) on macOS 26 arm64. It runs in your browser with php-wasm 0.2.0 (PHP 8.5.2). To run it yourself: php main.php
Rust 1.99 · main.rs
const DAY: f64 = 86_400.0; // seconds
/// Daily active users, reads and writes per user a day, and the peak factor.
struct Service {
name: &'static str,
dau: f64,
reads: f64,
writes: f64,
peak_factor: f64,
}
struct Estimate {
daily: f64,
average: f64,
peak: f64,
peak_reads: f64,
peak_writes: f64,
}
impl Service {
const fn new(name: &'static str, dau: f64, reads: f64, writes: f64, peak_factor: f64) -> Self {
Self {
name,
dau,
reads,
writes,
peak_factor,
}
}
/// Average and peak requests a second, the peak split into reads and writes.
fn estimate(&self) -> Estimate {
let daily = self.dau * (self.reads + self.writes);
let average = daily / DAY;
Estimate {
daily,
average,
peak: average * self.peak_factor,
peak_reads: self.dau * self.reads / DAY * self.peak_factor,
peak_writes: self.dau * self.writes / DAY * self.peak_factor,
}
}
}
const SERVICES: [Service; 3] = [
Service::new("chat", 50_000_000.0, 80.0, 40.0, 3.0),
Service::new("news feed", 20_000_000.0, 50.0, 0.5, 2.5),
Service::new("payments", 30_000_000.0, 4.0, 2.0, 4.0),
];
/// A whole number with a comma between each group of three digits.
fn group(x: f64) -> String {
let digits = format!("{x:.0}");
let mut out = String::new();
for (i, digit) in digits.chars().enumerate() {
if i > 0 && (digits.len() - i) % 3 == 0 {
out.push(',');
}
out.push(digit);
}
out
}
fn main() {
println!(
"{:<11}{:>15}{:>11}{:>10}{:>10}{:>10}{:>14}",
"Service", "per day", "average/s", "peak/s", "reads/s", "writes/s", "reads:writes"
);
for s in &SERVICES {
let e = s.estimate();
let [daily, average, peak, reads, writes] =
[e.daily, e.average, e.peak, e.peak_reads, e.peak_writes].map(group);
let (name, ratio) = (s.name, group(s.reads / s.writes));
println!(
"{name:<11}{daily:>15}{average:>11}{peak:>10}{reads:>10}{writes:>10}{ratio:>12}:1"
);
}
} In Rust: Rust's format strings have no digit grouping, so group walks the digits and pushes a comma before every third one from the right; estimate is a method of Service.
Recorded with rustc 1.99.0 (edition 2024) on macOS 26 arm64. It runs in your browser with a WebAssembly build on the WASI runner (browser_wasi_shim 0.4.2). To run it yourself: rustc --edition 2024 -O main.rs && ./main
TypeScript 6.0 · main.ts
const DAY = 86_400; // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
interface Service {
readonly name: string;
readonly dau: number;
readonly reads: number;
readonly writes: number;
readonly peakFactor: number;
}
const SERVICES: readonly Service[] = [
{ name: "chat", dau: 50_000_000, reads: 80, writes: 40, peakFactor: 3 },
{ name: "news feed", dau: 20_000_000, reads: 50, writes: 0.5, peakFactor: 2.5 },
{ name: "payments", dau: 30_000_000, reads: 4, writes: 2, peakFactor: 4 },
];
// Average and peak requests a second, the peak split into reads and writes.
function estimate({ dau, reads, writes, peakFactor }: Service) {
const daily = dau * (reads + writes);
const average = daily / DAY;
return {
daily,
average,
peak: average * peakFactor,
peakReads: ((dau * reads) / DAY) * peakFactor,
peakWrites: ((dau * writes) / DAY) * peakFactor,
};
}
// A whole number with a comma between each group of three digits.
const group = (x: number): string =>
Math.round(x)
.toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
const head = ["per day", "average/s", "peak/s", "reads/s", "writes/s"];
const widths = [15, 11, 10, 10, 10];
const pad = (cells: string[]): string => cells.map((cell, i) => cell.padStart(widths[i])).join("");
console.log("Service".padEnd(11) + pad(head) + "reads:writes".padStart(14));
for (const s of SERVICES) {
const e = estimate(s);
const cells = [e.daily, e.average, e.peak, e.peakReads, e.peakWrites].map(group);
console.log(s.name.padEnd(11) + pad(cells) + `${group(s.reads / s.writes)}:1`.padStart(14));
} In TypeScript: An interface types a service and the return type of estimate is inferred; destructuring the parameter reads the four numbers of a service in one line.
Recorded with TypeScript 6.0.3 (strict), run by Node.js 24.21.0 on macOS 26 arm64. It runs in your browser with QuickJS (quickjs-emscripten 0.32.0) after Sucrase 3.35.1. To run it yourself: npx -p typescript@6.0.3 tsc --noEmit --strict main.ts && node main.ts
Go 1.27 · main.go
package main
import (
"fmt"
"strconv"
"strings"
)
const day = 86_400 // seconds
// service holds the daily active users, the reads and writes per user a day, and the peak factor.
type service struct {
name string
dau, reads, writes, peakFactor float64
}
type estimate struct {
daily, average, peak, peakReads, peakWrites float64
}
// estimateOf gives average and peak requests a second, the peak split into reads and writes.
func estimateOf(s service) estimate {
daily := s.dau * (s.reads + s.writes)
average := daily / day
return estimate{
daily: daily,
average: average,
peak: average * s.peakFactor,
peakReads: s.dau * s.reads / day * s.peakFactor,
peakWrites: s.dau * s.writes / day * s.peakFactor,
}
}
// group writes a whole number with a comma between each group of three digits.
func group(x float64) string {
digits := strconv.FormatFloat(x, 'f', 0, 64)
var b strings.Builder
for i, d := range digits {
if i > 0 && (len(digits)-i)%3 == 0 {
b.WriteByte(',')
}
b.WriteRune(d)
}
return b.String()
}
func main() {
services := []service{
{"chat", 50_000_000, 80, 40, 3},
{"news feed", 20_000_000, 50, 0.5, 2.5},
{"payments", 30_000_000, 4, 2, 4},
}
fmt.Printf("%-11s%15s%11s%10s%10s%10s%14s\n",
"Service", "per day", "average/s", "peak/s", "reads/s", "writes/s", "reads:writes")
for _, s := range services {
e := estimateOf(s)
fmt.Printf("%-11s%15s%11s%10s%10s%10s%12s:1\n", s.name, group(e.daily), group(e.average),
group(e.peak), group(e.peakReads), group(e.peakWrites), group(s.reads/s.writes))
}
} In Go: fmt has no digit grouping, so group formats with strconv.FormatFloat and builds the text in a strings.Builder.
Recorded with Go 1.27.1 on macOS 26 arm64. It runs in your browser with the Go compiler in WebAssembly 1.27.1. To run it yourself: go run main.go
Swift 6.4 · main.swift
let day = 86_400.0 // seconds
/// Daily active users, reads and writes per user a day, and the peak factor.
struct Service {
let name: String
let dau: Double
let reads: Double
let writes: Double
let peakFactor: Double
}
struct Estimate {
let daily: Double
let average: Double
let peak: Double
let peakReads: Double
let peakWrites: Double
}
let services = [
Service(name: "chat", dau: 50_000_000, reads: 80, writes: 40, peakFactor: 3),
Service(name: "news feed", dau: 20_000_000, reads: 50, writes: 0.5, peakFactor: 2.5),
Service(name: "payments", dau: 30_000_000, reads: 4, writes: 2, peakFactor: 4),
]
/// Average and peak requests a second, the peak split into reads and writes.
func estimate(_ s: Service) -> Estimate {
let daily = s.dau * (s.reads + s.writes)
let average = daily / day
return Estimate(
daily: daily, average: average, peak: average * s.peakFactor,
peakReads: s.dau * s.reads / day * s.peakFactor,
peakWrites: s.dau * s.writes / day * s.peakFactor)
}
func pad(_ text: String, _ width: Int, left: Bool = true) -> String {
let spaces = String(repeating: " ", count: max(0, width - text.count))
return left ? spaces + text : text + spaces
}
/// A whole number with a comma between each group of three digits.
func group(_ x: Double) -> String {
let digits = Array(String(Int64(x.rounded())))
var out = ""
for (i, digit) in digits.enumerated() {
if i > 0 && (digits.count - i) % 3 == 0 {
out.append(",")
}
out.append(digit)
}
return out
}
let widths = [15, 11, 10, 10, 10]
func row(_ cells: [String]) -> String { zip(cells, widths).map { pad($0, $1) }.joined() }
let head = ["per day", "average/s", "peak/s", "reads/s", "writes/s"]
print(pad("Service", 11, left: false) + row(head) + pad("reads:writes", 14))
for s in services {
let e = estimate(s)
let cells = [e.daily, e.average, e.peak, e.peakReads, e.peakWrites].map(group)
print(pad(s.name, 11, left: false) + row(cells) + pad(group(s.reads / s.writes) + ":1", 14))
} In Swift: Without Foundation there is no number formatter, so group rounds to an Int64 and inserts the commas by hand; Int64 holds 6,000,000,000, which Int cannot in the WebAssembly build, where it has 32 bits.
Recorded with Apple Swift 6.4 on macOS 26 arm64. It runs in your browser with a WebAssembly build on the WASI runner (browser_wasi_shim 0.4.2). To run it yourself: swiftc -O main.swift -o main && ./main
Ruby 4.0 · main.rb
# frozen_string_literal: true
DAY = 86_400.0 # seconds
# Daily active users, reads and writes per user a day, and the peak factor. Each estimate is a
# method: average and peak requests a second, the peak split into reads and writes.
Service = Data.define(:name, :dau, :reads, :writes, :peak_factor) do
def daily = dau * (reads + writes)
def average = daily / DAY
def peak = average * peak_factor
def peak_reads = dau * reads / DAY * peak_factor
def peak_writes = dau * writes / DAY * peak_factor
end
SERVICES = [
Service.new('chat', 50_000_000, 80, 40, 3),
Service.new('news feed', 20_000_000, 50, 0.5, 2.5),
Service.new('payments', 30_000_000, 4, 2, 4)
].freeze
WIDTHS = [15, 11, 10, 10, 10].freeze
# A whole number with a comma between each group of three digits.
def group(value) = value.round.to_s.gsub(/\B(?=(\d{3})+$)/, ',')
def row(cells) = cells.zip(WIDTHS).map { |cell, width| cell.rjust(width) }.join
head = ['per day', 'average/s', 'peak/s', 'reads/s', 'writes/s']
puts 'Service'.ljust(11) + row(head) + 'reads:writes'.rjust(14)
SERVICES.each do |s|
cells = [s.daily, s.average, s.peak, s.peak_reads, s.peak_writes].map { |value| group(value) }
puts s.name.ljust(11) + row(cells) + "#{group(s.reads.fdiv(s.writes))}:1".rjust(14)
end In Ruby: Each estimate is a method of the Data class, and gsub with a lookahead inserts the commas; fdiv divides as floating point even when both counts are integers.
Recorded with CRuby 4.0.7 on macOS 26 arm64. It runs in your browser with ruby.wasm 2.10.1 (Ruby 4.0.0). To run it yourself: ruby main.rb
Kotlin 2.4 · Main.kt
import kotlin.math.roundToLong
const val DAY = 86_400.0 // seconds
// Daily active users, reads and writes per user a day, and the peak factor.
data class Service(
val name: String,
val dau: Double,
val reads: Double,
val writes: Double,
val peakFactor: Double,
)
data class Estimate(
val daily: Double,
val average: Double,
val peak: Double,
val peakReads: Double,
val peakWrites: Double,
)
// Average and peak requests a second, the peak split into reads and writes.
fun Service.estimate(): Estimate {
val daily = dau * (reads + writes)
val average = daily / DAY
return Estimate(
daily = daily,
average = average,
peak = average * peakFactor,
peakReads = dau * reads / DAY * peakFactor,
peakWrites = dau * writes / DAY * peakFactor,
)
}
// A whole number with a comma between each group of three digits.
fun Double.group() =
roundToLong()
.toString()
.reversed()
.chunked(3)
.joinToString(",")
.reversed()
val widths = intArrayOf(15, 11, 10, 10, 10)
fun row(cells: List<String>) = cells.mapIndexed { i, c -> c.padStart(widths[i]) }.joinToString("")
fun main() {
val services =
listOf(
Service("chat", 50_000_000.0, 80.0, 40.0, 3.0),
Service("news feed", 20_000_000.0, 50.0, 0.5, 2.5),
Service("payments", 30_000_000.0, 4.0, 2.0, 4.0),
)
val head = listOf("per day", "average/s", "peak/s", "reads/s", "writes/s")
println("Service".padEnd(11) + row(head) + "reads:writes".padStart(14))
for (s in services) {
val e = s.estimate()
val cells = listOf(e.daily, e.average, e.peak, e.peakReads, e.peakWrites).map { it.group() }
println(s.name.padEnd(11) + row(cells) + "${(s.reads / s.writes).group()}:1".padStart(14))
}
} In Kotlin: group reverses the digits, cuts them into chunks of three and joins them with commas; estimate is an extension function on Service.
Recorded with Kotlin 2.4.20 on Java 25.0.4.1 on macOS 26 arm64. It runs in your browser with a WebAssembly build on the WASI runner (browser_wasi_shim 0.4.2). To run it yourself: kotlinc Main.kt -include-runtime -d main.jar && java -jar main.jar
Dart 3.13 · main.dart
const day = 86400.0; // seconds
/// Daily active users, reads and writes per user a day, and the peak factor.
typedef Service = ({
String name,
double dau,
double reads,
double writes,
double peakFactor,
});
typedef Estimate = ({
double daily,
double average,
double peak,
double peakReads,
double peakWrites,
});
const List<Service> services = [
(name: 'chat', dau: 50000000, reads: 80, writes: 40, peakFactor: 3),
(name: 'news feed', dau: 20000000, reads: 50, writes: 0.5, peakFactor: 2.5),
(name: 'payments', dau: 30000000, reads: 4, writes: 2, peakFactor: 4),
];
/// Average and peak requests a second, the peak split into reads and writes.
Estimate estimate(Service s) {
final daily = s.dau * (s.reads + s.writes);
final average = daily / day;
return (
daily: daily,
average: average,
peak: average * s.peakFactor,
peakReads: s.dau * s.reads / day * s.peakFactor,
peakWrites: s.dau * s.writes / day * s.peakFactor,
);
}
/// A whole number with a comma between each group of three digits.
String group(double x) =>
x.round().toString().replaceAll(RegExp(r'\B(?=(\d{3})+(?!\d))'), ',');
const widths = [15, 11, 10, 10, 10];
String row(List<String> cells) =>
[for (var i = 0; i < cells.length; i++) cells[i].padLeft(widths[i])].join();
void main() {
const head = ['per day', 'average/s', 'peak/s', 'reads/s', 'writes/s'];
print('Service'.padRight(11) + row(head) + 'reads:writes'.padLeft(14));
for (final s in services) {
final e = estimate(s);
final cells = [e.daily, e.average, e.peak, e.peakReads, e.peakWrites];
final ratio = '${group(s.reads / s.writes)}:1';
print(
s.name.padRight(11) + row(cells.map(group).toList()) + ratio.padLeft(14),
);
}
} In Dart: Services are records with named fields typed double, so the whole-number literals in the list become doubles, and replaceAll with a lookahead puts the commas in. Dart's / returns a double even for two ints; ~/ is its integer division.
Recorded with Dart 3.13.5 on macOS 26 arm64. It runs in your browser with a WebAssembly build by dart2wasm 3.13.5. To run it yourself: dart run main.dart
What every language printed
Service per day average/s peak/s reads/s writes/s reads:writes chat 6,000,000,000 69,444 208,333 138,889 69,444 2:1 news feed 1,010,000,000 11,690 29,225 28,935 289 100:1 payments 180,000,000 2,083 8,333 5,556 2,778 2:1
Runs on this device, in your browser. The first run downloads Python (about 13.5 MB), which is kept for the next runs.
Runs on this device, in your browser. The first run downloads Python (about 13.5 MB), which is kept for the next runs. Runs on this device, in your browser. The first run downloads JavaScript (about 0.6 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 151 KB), made when the page was built. Edit runs your changes in the browser: the first edited run downloads the C and C++ compiler (about 29.1 MB), which is kept for the next runs. It is best on a computer. Runs on this device, in your browser. The first run downloads the C and C++ compiler (about 29.1 MB), which is kept for the next runs. It is best on a computer. Runs on this device: a .NET build of this program (about 5 KB), made when the page was built. The first run also downloads .NET (about 3.6 MB), which is kept for the next runs. Edit runs your changes in the browser: the first edited run downloads .NET (about 8.9 MB), which is kept for the next runs. Runs on this device, in your browser. The first run downloads .NET (about 8.9 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 9 KB), made when the page was built. Edit runs your changes in the browser: the first edited run downloads the C and C++ compiler (about 29.1 MB), which is kept for the next runs. It is best on a computer. Runs on this device, in your browser. The first run downloads the C and C++ compiler (about 29.1 MB), which is kept for the next runs. It is best on a computer. Runs on this device, in your browser. The first run downloads PHP (about 4.3 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 30 KB), made when the page was built. To change the code, copy it and run it with the command below. Runs on this device, in your browser. The first run downloads the JavaScript runner (about 0.9 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 718 KB), made when the page was built. Edit runs your changes in the browser: the first edited run downloads the Go compiler (about 18.7 MB), which is kept for the next runs. Runs on this device, in your browser. The first run downloads the Go compiler (about 18.7 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 1.7 MB), made when the page was built. To change the code, copy it and run it with the command below. Runs on this device, in your browser. The first run downloads Ruby (about 10.2 MB), which is kept for the next runs. Runs on this device: a WebAssembly build of this program (about 183 KB), made when the page was built. To change the code, copy it and run it with the command below. Runs on this device: a WebAssembly build of this program (about 16 KB), made when the page was built. To change the code, copy it and run it with the command below.Your run, in this browser
The three answers differ by more than an order of magnitude, and they point to different designs. That is the purpose of the exercise: not the exact numbers, but which part of the system the numbers say will be under pressure.
Checkpoint
Check: From users to requests per second
Reads and writes shape different parts of a system
Split every estimate into reads and writes, because they load different components. Reads can be answered from copies: a cache holds data close to the application to serve repeated reads faster (Cache-Aside pattern), and read replicas spread reads over several databases. Writes must reach the copy that owns the data, so heavy write traffic pushes towards partitioning, because a single server has finite storage, computing power and network bandwidth (Sharding pattern).
The ratio should come from how the product is used, not from habit:
- A news feed is read far more than it is written: a post is written once and read by many followers, and people scroll more than they post. The program assumes 100 reads per write, so the design is about the read path.
- Chat writes every message once and reads it once per recipient, so reads and writes stay within a small factor of each other, and both paths need attention.
- Payments have few reads per write compared with a feed, and every write must be durable and recorded exactly once. Their peak write rate, not their read rate, sets the hardest requirement.
Here are the program’s peaks again, side by side, with the part of the design that each service’s read-to-write ratio: The number of reads a system serves for every write. A high ratio points a design at caches and read replicas; a low one at the write path and partitioning. puts under pressure:
| Service | Peak reads a second | Peak writes a second | Under pressure |
|---|---|---|---|
| Chat, 2 reads a write | 138,889 | 69,444 | Both paths, the write path most |
| News feed, 100 reads a write | 28,935 | 289 | The read path: caches and replicas |
| Payments, 2 reads a write | 5,556 | 2,778 | Durable, exactly-once writes |
Key idea
Split the peak into reads and writes before you draw anything: reads can be served from copies, while every write must reach the copy that owns its data.
Checkpoint
Check: Reads and writes
A peak factor comes from the traffic’s shape
Traffic that people generate follows their days: low at night and higher while they are awake, with the busiest hours depending on the product. If you have real request counts, the peak factor: The rate in the busiest window divided by the average rate, for a stated window such as an hour or a second. Shorter windows and smaller services give larger factors. is simply the busiest window divided by the average window. Without them, assume a daily shape, say why, and derive the factor from it. The window matters as much as the shape: the busiest second is busier than the busiest minute, which is busier than the busiest hour.
Here is the shape the program below assumes, the share of a day’s requests in each hour, with an evening peak:
The day the peak-factor program assumes, hour by hour
Text description of the diagram
The chart has one bar for each hour of the day, from midnight on the left to 11 pm on the right. Each bar is the share of the day's requests that arrives in that hour, on a scale from 0 % to 9 %. A dashed line marks an average hour, 100 % ÷ 24 = 4.2 %.
- Midnight to 6 am, the night: 1.5 %, 1.0 %, 0.7 %, 0.6 %, 0.6 % and 0.9 %.
- 6 am to noon, the morning rise: 1.8 %, 3.2 %, 4.5 %, 5.0 %, 5.2 % and 5.3 %.
- Noon to 6 pm, the working day: 5.3 %, 5.2 %, 5.1 %, 5.0 %, 5.2 % and 5.4 %.
- 6 pm to midnight, the evening: 6.4 %, 7.4 %, 8.2 %, 7.9 %, 5.6 % and 3.0 %.
The busiest hour, from 8 to 9 pm, is drawn darker. It carries 8.2 % of the day's requests, 1.97 times an average hour, which is the hourly peak factor of this assumed day.
The script below assumes that daily curve, then simulates the busiest hour with requests that arrive at random,
independently of each other and at a steady average rate (a Poisson process: A model of arrivals that come at random and independently of each other, at a steady average rate. The number arriving in any one second then varies around that average.,
Gallager).
Its random numbers come from Python’s random module, seeded with a fixed number, so any one Python version
prints identical output on every run (Python documentation):
# How big is the peak? It depends on the window you measure it over, and on how big the service is.
# An assumed day: the share of daily requests that arrives in each hour (a quiet night, an evening peak).
import random
HOURLY_SHARE = [ # percent of the day's requests, midnight to midnight
1.5, 1.0, 0.7, 0.6, 0.6, 0.9, 1.8, 3.2, 4.5, 5.0, 5.2, 5.3,
5.3, 5.2, 5.1, 5.0, 5.2, 5.4, 6.4, 7.4, 8.2, 7.9, 5.6, 3.0,
]
assert round(sum(HOURLY_SHARE), 6) == 100
busiest = max(HOURLY_SHARE)
print(f"Busiest hour: {busiest}% of the day, {busiest / (100 / 24):.2f} times an average hour")
def busiest_windows(daily_requests, seed):
"""Simulate the busiest hour with requests arriving at random (a Poisson process) and return the peak
factors over that hour, its busiest minute and its busiest second, each relative to the day's average."""
rng = random.Random(seed)
day_average = daily_requests / 86_400
rate = daily_requests * busiest / 100 / 3_600 # requests per second during the busiest hour
per_second = [0] * 3_600
t = rng.expovariate(rate)
while t < 3_600:
per_second[int(t)] += 1
t += rng.expovariate(rate)
per_minute = [sum(per_second[m * 60:(m + 1) * 60]) / 60 for m in range(60)]
return day_average, rate / day_average, max(per_minute) / day_average, max(per_second) / day_average
print()
print(f"{'Requests a day':>15}{'average/s':>11}{'peak hour':>11}{'peak minute':>13}{'peak second':>13}")
for daily in [20_000_000, 2_000_000, 200_000]:
average, hour, minute, second = busiest_windows(daily, seed=7)
print(f"{daily:>15,}{average:>11,.1f}{hour:>10.2f}x{minute:>12.2f}x{second:>12.2f}x") Output
Busiest hour: 8.2% of the day, 1.97 times an average hour
Requests a day average/s peak hour peak minute peak second
20,000,000 231.5 1.97x 2.00x 2.31x
2,000,000 23.1 1.97x 2.05x 3.11x
200,000 2.3 1.97x 2.23x 6.91x
Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 peak_factor.py
Runs on this device, in your browser. The first run downloads Python (about 13.5 MB), which is kept for the next runs.
Your run, in this browser
Three results are worth carrying into every estimate:
- The daily shape sets the hourly factor. With this curve, the busiest hour carries about twice the traffic of an average hour, whatever the size of the service.
- Shorter windows have higher peaks. Within that hour, the busiest minute and the busiest second are higher again, because random arrivals bunch together.
- Small services are spikier. For the service with 200,000 requests a day, the busiest second was about seven times the daily average; for the one with 20 million, about 2.3 times. Bunching that adds a few requests is a large share of a small average.
Real traffic can be much burstier than this model, because people do not always act independently: a push notification, a goal in a match or the opening minute of a sale makes thousands act at once, and retries after an outage add more. Google’s SRE book asks capacity plans to cover both kinds of demand: the steady growth that comes from people adopting a product, and the jumps that launches, marketing pushes and other business events cause (SRE book, introduction). For a known event, estimate its peak on its own from the people expected and the time over which they arrive.
SQLite Online (SQL Playground) Import an exported request log as a CSV file and count requests per hour or per minute with SQL, to measure a real peak factor. Line Graph Maker Plot hourly request counts to see the shape of a day before you choose a factor.Checkpoint
Check: Where a peak factor comes from
Check the share an estimate implies
When a public total exists for the whole market, compare your estimate with it. The question is not whether the numbers match, because they should not, but whether the share your estimate implies is believable for the product you are designing.
Checking a payments estimate against published volumes
The Reserve Bank of India’s Payment System Indicators give the monthly volume of each payment system, UPI included, in lakh. One edition’s UPI row reads 2,45,089.58 lakh for a 31-day month. Spread over that month, it is the average rate of the whole network, and the payments estimate above can be set against it:
# Compare an estimate with a published total: is the share it implies believable?
LAKH = 10**5
DAY = 86_400
published = 2_45_089.58 * LAKH # a month's volume as the payment tables print it, in lakh
network = published / (31 * DAY) # spread over a 31-day month
ours = 30_000_000 * 2 / DAY # the payments estimate above: 30 million users, 2 payments each a day
print(f"Whole network: {network:,.0f} payments a second on average")
print(f"Our estimate: {ours:,.0f} payments a second on average, {ours / network:.1%} of the network") Output
Whole network: 9,151 payments a second on average Our estimate: 694 payments a second on average, 7.6% of the network
Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 sanity_check.py
Runs on this device, in your browser. The first run downloads Python (about 13.5 MB), which is kept for the next runs.
Your run, in this browser
For a new product, handling about one payment in every thirteen made across the whole country is far too high a share, so the number of daily users is the assumption to revisit. Festival sales and big cricket matches are the kind of known events that deserve their own peak estimate, made from the expected audience and the minutes in which it arrives.
Checkpoint
Check: Checking an estimate against a total
Four slips that skew a traffic estimate
Each slip below moves the result by a factor you can name, so check for all four before you size anything:
| Slip | What it does to the estimate |
|---|---|
| Monthly users counted as daily users | That inflates every rate by the ratio between them. |
| Taps counted instead of requests | One action can be several requests, and background sync adds more. |
| A peak factor without a window | “3 times” means little until you say whether it is the busiest hour or the busiest second. |
| The average used for capacity | The average is the lowest load your busiest hour will bring, not a target to size for. |
Checkpoint
Check: Slips in a traffic estimate
Practise: users to peak requests
Write the two functions of a traffic estimate: average and peak requests a second from users and their requests, split into reads and writes, and a peak factor measured from counts per window. Its five sample tests run here:
Exercise · Easy · Python
Turn users into average and peak requests per second
Write the two functions of a traffic estimate in estimate.py.
estimate(dau, reads_per_user, writes_per_user, peak_factor) returns a dictionary with four rates, all in requests per second:
"average": the day's requests,dau × (reads_per_user + writes_per_user), spread evenly over 86,400 seconds;"peak": the average multiplied bypeak_factor;"peak_reads"and"peak_writes": the peak split in the same proportion as reads and writes, so that the two add up to the peak.
For example, 1 million users who each make 8 reads and 2 writes a day, with a peak factor of 3, give an average of about 115.7 requests a second and a peak of about 347.2, of which 277.8 are reads.
peak_factor(counts) measures a peak factor from data: given a list of request counts, one per window (per hour, say), it returns the busiest window's count divided by the average count. An empty list raises ValueError.
Starter code · estimate.py
DAY = 86_400
def estimate(dau, reads_per_user, writes_per_user, peak_factor):
"""Return {"average", "peak", "peak_reads", "peak_writes"} in requests per second."""
# Replace this line with your code.
return {}
def peak_factor(counts):
"""Return the busiest window's count divided by the average count; raise ValueError for an empty list."""
# Replace this line with your code.
return 0 The sample tests · test_estimate.py
import math
from estimate import estimate, peak_factor
def raises_value_error(function, *args):
"""True when function(*args) raises ValueError."""
try:
function(*args)
except ValueError:
return True
return False
def test_average():
"""spreads the day's requests over 86,400 seconds"""
result = estimate(1_000_000, 8, 2, 3)
assert math.isclose(result["average"], 115.740741, rel_tol=1e-6)
def test_peak():
"""multiplies the average by the peak factor"""
result = estimate(1_000_000, 8, 2, 3)
assert math.isclose(result["peak"], 347.222222, rel_tol=1e-6)
assert math.isclose(estimate(86_400, 1, 0.5, 2)["peak"], 3, rel_tol=1e-9)
def test_split():
"""splits the peak into reads and writes that add up to it"""
result = estimate(1_000_000, 8, 2, 3)
assert math.isclose(result["peak_reads"], 277.777778, rel_tol=1e-6)
assert math.isclose(result["peak_writes"], 69.444444, rel_tol=1e-6)
assert math.isclose(result["peak_reads"] + result["peak_writes"], result["peak"], rel_tol=1e-9)
def test_peak_factor():
"""divides the busiest window by the average window"""
assert peak_factor([10, 10, 10, 10]) == 1
assert peak_factor([5, 15]) == 1.5
assert peak_factor([0, 0, 6]) == 3
def test_empty_counts():
"""refuses an empty list of counts"""
assert raises_value_error(peak_factor, []) A hint
Compute the daily total once, dau * (reads_per_user + writes_per_user), and divide by DAY for the average. For the split, the reads' share of the traffic is reads_per_user / (reads_per_user + writes_per_user). For the peak factor, max(counts) divided by sum(counts) / len(counts) is the whole calculation.
Results of the sample tests
| Test | Result | Details |
|---|
What your code printed
The sample tests run on this device, in your browser (Pyodide): nothing is sent to mysmartcopilot.com. The first run downloads Python (about 13.5 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.
Finish with practice on fresh numbers. A wrong answer brings an easier question on the same idea, and a right one a harder question:
Practice that adapts to you
Practise this lesson
14 questions about 5 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.
Interview questions
Warm-up (fresher): how do you turn daily active users into requests per second, and why is the average rate not the number to size a system for?
Multiply the daily active users by the requests each one makes in a day, counting calls to your servers rather than taps on a screen, and divide by the 86,400 seconds of a day: 10 million users making 30 requests each give 300 million requests a day, about 3,472 a second on average. That average covers the whole day, night included, so the busiest hour brings more: about twice as much with the evening-peaked day of this lesson, and the busiest second within that hour more again. Size for the peak of a stated window, split into reads and writes because they load different parts of the system, and estimate known events such as a sale or a match on their own, from the people expected and the minutes in which they arrive.
Model answers open with any pass: ₹79 for 1 week ($2.99), one payment that never renews.
-
Fresher to mid
A food-delivery app expects 5 million daily active users. Estimate the average and peak rates of menu browsing and of order placement, state every assumption, and say which number shapes the database design.
-
Mid to senior
Your app's busiest hour brings 2,000 requests a second. Marketing plans a push notification to 4 million users at 8 pm. Estimate the peak it causes and say what you would change before it is sent.
Key takeaways
- Average requests per second = DAU × requests per user per day ÷ 86,400; the peak is the average times a peak factor for a stated window.
- Split reads from writes: read-heavy traffic shapes caches and replicas, write-heavy traffic shapes partitioning and the write path.
- Derive the peak factor from the traffic’s shape: about 2 for the busiest hour of the daily curve assumed here, more for shorter windows and for small services, and a separate estimate for known events.
- Sanity-check an estimate by the share of a published total it implies.
- Before you size anything, check that the users are daily, the requests are requests and the factor has a window.
Terms in this lesson
- daily active users (DAU)
- The number of different people who use a product on a typical day. It can never exceed the monthly active users, and it is the usual starting point of a traffic estimate.
- peak factor
- The rate in the busiest window divided by the average rate, for a stated window such as an hour or a second. Shorter windows and smaller services give larger factors.
- Poisson process
- A model of arrivals that come at random and independently of each other, at a steady average rate. The number arriving in any one second then varies around that average.
- read-to-write ratio
- The number of reads a system serves for every write. A high ratio points a design at caches and read replicas; a low one at the write path and partitioning.
References
- Site Reliability Engineering, chapter 1: Introduction (demand forecasting and capacity planning) (Google (O'Reilly Media))
- Cache-Aside pattern (Azure Architecture Center) (Microsoft)
- Sharding pattern (Azure Architecture Center) (Microsoft)
- random, generate pseudo-random numbers (Python Software Foundation)
- Discrete Stochastic Processes, chapter 2: Poisson processes (MIT OpenCourseWare (Robert Gallager))
- Payment System Indicators (Reserve Bank of India)
Related tools
Report a problem with this lesson
Kept only in this browser. Your Learn progress