Cloudflare's system design

0/2
☰
Cloudflare · system design

Cloudflare is one data center copied into 335+ cities — each answers for the same addresses and every server runs every service — steered by a small control plane that pushes configuration everywhere in seconds.

+ The whole system in one paragraph

Every Cloudflare data center announces the same IP addresses, so the internet brings each visitor to the nearest of 335+ cities. There, every server runs every service: firewall, cache, customer code. A small control plane copies each settings change to every server within seconds. That speed is also the risk: a bad file in 2025 reached every server at once.

335+
cities with Cloudflare servers, in 125+ countries (2026)[1]
115M
HTTP requests a second, on average — peaks above 150M (Sep 2026)[2]
31.4 Tbps
the largest DDoS attack it reported in 2025 (Nov 2025)[3]

In this lesson

2 chapters · ~9 min · a quick check in each

Everything is on this page — just scroll down ↓

Chapter 1 of 2

The whole system

1
Requirements

What it must do — and how well

Before any box, the job. Yellow notes are what Cloudflare must do for every site behind it; blue notes are how well it must do it.

ⓘ Details & sources

Yellow = what the system must do. Blue = how well it must do it.[1][3][11][16]

Answer from the citynearest to everyvisitor.Stop attacks beforethey reach thesite's server.Apply each site'sown rules to everyrequest.Run customers' codenext to their users.Absorb attacks asbig as 31.4 Tbps(Nov 2025).Any server, anycity, can take anyrequest.A setting is liveeverywhere inseconds.Keep serving if thecore goes dark.
2
Architecture

Every city, the same data center

One Cloudflare data center — all 335+ are the same. A request runs left to right through every layer on one server; settings flow down from a small control plane on top.

ⓘ Details & sources

Bottom: one edge data center — all 335+ are the same. Top: the control plane. Click any piece; play a flow.[4][8][11][12]

Watch it happen:
Control plane — a few core data centersOne edge data center — the same in 335+ cities1222223new rule24replicate5read5feature fileYour browseror app, anywhereAnycast IProuter, every cityDDoS dropXDP: L4Drop, UnimogDDoS detectordecides locallyHTTP + TLSdecrypt + parseFL2 proxyWAF · bots · rulesWorkerscustomer codePingora cachehit, or ask originOriginthe site's serverLocal configQuicksilver copyDashboard, APIyou change a settingQuicksilverroot · change logClickHouselogs, bot features
clientedge / CDNload balancerserviceworkercachedatabaseexternal dashed border = simplified model
12345
Step 1 of 5

Every data center announces the same IP addresses, so internet routing takes you to the nearest of 335+ cities.

3
Sequence

What happens when you open a site behind Cloudflare

The request everyone makes. Almost all of it — WAF rules and a bot score included — happens in the nearest city; the site's own server only hears about you on a cache miss.

ⓘ Details & sources

From DNS to the response, inside the nearest city. Only a cache miss ever reaches the customer's server.[5][7][8][14]

Your browserCloudflare DNS1. Where is the site?Cloudflare DNSYour browser2. An IP every city announcesYour browserNearest city3. Connect: routing picks the nearest cityNearest city4. Drop attack packets, pick a serverNearest cityFL2 proxy5. Decrypt, pass the requestFL2 proxy6. WAF, bot score, this site's rulesFL2 proxyPingora cache7. In the cache?Pingora cacheOrigin8. Miss: fetch from the originOriginPingora cache9. ResponsePingora cacheYour browser10. The answer, from the nearest city

10 steps. Follow the flow one step at a time — what happens first, and what comes next.

5
Pipeline

From one click to every server, in seconds

A setting is written once in the core as the next entry of a numbered log, then copied to every server's disk, where requests read it in microseconds — no trip to the core.

ⓘ Details & sources

Quicksilver: one ordered log in the core, copied down a tree to a local store on every server.[11][12][13][16]

A setting changesdashboard, API, or Cloudflare's own teams1writeQuicksilver rootcore: one numbered log2replicateIntermediate nodesin every data center3replicateEvery serverits own copy, on disk4readRead locallymicroseconds, no trip to the core5secondsLive everywherep99: 2.29 seconds (2019)6

6 steps. Follow the flow one step at a time — what happens first, and what comes next.

Curious? Go deeper+ 5 optional
4
Architecture

The cache: one pool per city, tiers, and purge

Every hit is a request the customer's server never sees. On a miss a city asks an upper-tier city before the origin; a purge empties every city in under 150 ms at the median (2024).

ⓘ Details & sources

Top: a file from the city's cache, an upper tier, or the origin. Bottom: a purge reaches every server in every city.[9][19][42][43][6]

Watch it happen:
Nearest city — one cache across many servers12miss34indexdeleteevery cityA visitorasks for a fileCache proxyPingora, any serverThe city's cachedisks of many serversUpper-tier cityasked before originOriginthe site's serverCacheDBan index on each serverCustomerpurge via APIPurge Workercustomer's nearest cityDurable Objectqueues, then broadcasts
clientserviceworkercachedatabaseexternal dashed border = simplified model
1234
Step 1 of 4

Your request can land on any server in the city — the router and Unimog spread connections — and the cache proxy there handles it.

6
Architecture

DNS, both sides: Cloudflare's nameservers and 1.1.1.1

DNS turns a name into an address. Cloudflare plays both sides: it answers for its customers' domains and, as 1.1.1.1, looks up any domain for anyone — ~67M queries a second (2025).

ⓘ Details & sources

Top: a customer's records reach every city. Bottom: your phone asks 1.1.1.1. Same servers, same anycast trick.[21][22][16][23][24][25][3]

Watch it happen:
Core — where records are editedEvery city — the same DNS servers, on anycast12every city23cached?on a missannounceDashboard, APIadd or edit a recordDNS databasePostgreSQL, 1.7B recordsQuicksilverzones → every cityAddress configwhich city announces whatAny resolverwhere is shop.com?Authoritative DNSrrDNS (Go), local copyYour phoneDNS set to 1.1.1.11.1.1.1 resolverBigPineapple, RustShared cachesame domain, same serversOther nameserversroot, .com, the site's
clientservicecachedatabaseexternal dashed border = simplified model
1234
Step 1 of 4

A customer adds a record for shop.com in the dashboard or the API. It's saved in Cloudflare's central DNS database, on PostgreSQL: about 1.7 billion records in 2024.

7
Architecture

Zero Trust: the office network, without the VPN

A company's employee traffic, without a VPN: the laptop tunnels to the nearest city, where Gateway filters it and Access checks who you are before you reach a private app.

ⓘ Details & sources

The laptop tunnels to the nearest city. Gateway filters, Access checks who you are, Tunnel reaches the private app.[26][27][28][29][30][31][32]

Watch it happen:
Nearest Cloudflare city — every serviceCompany network — outbound only13log in3allowed44allowedEmployee laptopCloudflare One ClientGatewayDNS, network, HTTP rulesAccessidentity + device checkIdentity providerOkta, Entra ID…The internetwebsites, SaaS appsCloudflare Tunnelcloudflared dials outInternal appno public IP address
clientserviceworkerexternal dashed border = simplified model
1234
Step 1 of 4

The laptop runs the Cloudflare One Client (formerly WARP). It sends the device's traffic, and its DNS over HTTPS, through an encrypted tunnel — WireGuard or MASQUE, two tunnel protocols — to the nearest Cloudflare city.

8
Architecture

The developer platform: code and data on the same network

Customer code runs as a Worker — a V8 isolate — on the server nearest the user, next to three stores: KV for reads everywhere, Durable Objects for one truth, R2 for files.

ⓘ Details & sources

Workers run in isolates in the nearest city. KV for reads everywhere, Durable Objects for one truth, R2 for files.[10][33][34][36][37][38][39][40][41][35]

Watch it happen:
One server: one runtime1readmissconfig, loginsby namewritemetadatabytesruns onlocateCloudflare's ownAccess, WARP, GatewayA userbrowser or appYour Workera V8 isolate, ~5 ms startOther customersisolates, same processKV edge cachehot reads, every cityKV central storethe source of truthDurable Objectone per name, worldwideStorage relay3 of 5 followers confirmR2 metadatabuilt on Durable ObjectsR2 object storageencrypted bytes
clientserviceworkercachedatabasestorage dashed border = simplified model
12
Step 1 of 2

A request reaches the nearest city, and the runtime on that server runs your Worker — a V8 isolate, not a container. In 2018 one started in about 5 ms.

9
In numbers

Why isolates, not containers

Every server runs every customer's code, so each copy must be tiny and start at once. In 2018 an isolate needed ~3 MB and ~5 ms; a Lambda function, 35 MB and up to seconds cold.

ⓘ Details & sources

Cloudflare's 2018 numbers: isolates share one engine, so each new one costs megabytes and milliseconds.[10]

Memory for one function (2018)AWS Lambda, Node.js, doing nothing35 MBA Workers isolate~3 MBTime to start a new one (2018)A new container, cold start0.5 to 10 sA Workers isolate~5 ms
Quick check

Cloudflare averages 115M HTTP requests a second. Roughly how many is that in one day (86,400 seconds)?

Pick one — or just keep scrolling, it's not graded.

Keep going — it's free

Create your free account to unlock the rest of Cloudflare's system design, keep your progress and pick up right where you left off.

  1. 2Growth & failures
Questions & comments

Ask anything about this system, or share how you'd design it.

Log in to join the conversation