CDN & cache
Serve the many from the edge and let only the few reach the origin: edge locations cache what they can and a shield absorbs the rest.
The CityScript
This is all there is to it. Change it in the editor and the city redraws.
%% C · CDN & cache
%% Each edge location caches what it can; a shield in front of the origin absorbs what is left.
%% Prices are made up for the example, to show a cost line: what a service costs, with its vendor, plan and spec.
city 48x32
district world "Edge locations" 3,3..45,10
district origin "Origin" 3,13..30,22
building pop-bru depot in world "Brussels"
floor pop-bru.f "Cache"
room pop-bru.cache cache "Edge cache"
room pop-bru.tls proxy "TLS" port=443 secret=tls-private-key
building pop-ams depot in world "Amsterdam"
floor pop-ams.f "Cache"
room pop-ams.cache cache "Edge cache"
room pop-ams.tls proxy "TLS" port=443 secret=tls-private-key
building pop-par depot in world "Paris"
floor pop-par.f "Cache"
room pop-par.cache cache "Edge cache"
room pop-par.tls proxy "TLS" port=443 secret=tls-private-key
building pop-fra depot in world "Frankfurt"
floor pop-fra.f "Cache"
room pop-fra.cache cache "Edge cache"
room pop-fra.tls proxy "TLS" port=443 secret=tls-private-key
building shield warehouse in origin "Origin shield"
floor shield.f "Shield"
room shield.cache cache "Shield cache"
cost 25 "CDN" vendor=Cloudflare plan=Pro
building web factory in origin "Web origin"
floor web.f "Origin"
room web.nginx proxy "nginx" port=80,443
cost 17 "Virtual server" vendor=Hetzner plan=CPX31 spec="4 vCPU, 8 GB RAM, 160 GB SSD"
room web.app service "App" port=3000
room web.assets storage "Static assets"
gate visitors at 0,6 port=443 "Visitors"
link pop-bru.cache -> shield.cache "cache miss" variant=dashed
link pop-ams.cache -> shield.cache "cache miss" variant=dashed
link pop-par.cache -> shield.cache "cache miss" variant=dashed
link pop-fra.cache -> shield.cache "cache miss" variant=dashed
link shield.cache -> web.nginx "origin fetch"
link web.nginx -> web.app "proxy" variant=emphasis
link web.nginx -> web.assets "static files"