Patterns

Static files on object storage and a CDN

Serve pages and media from the edge and keep files in Object Storage, so the origin only handles what must be fresh.

Put a CDN in front of the origin and keep uploaded files in Object Storage.

Move up when#

  • Page views and video take most of the App Server's CPU and the egress line is large.

  • Every user in the world waits for a round trip to one origin.

The Design#

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 15.0k Users the Simulation solves this Design to Apdex 0.98, p99 465 ms, 0.0% errors and $7.06/s Burn, of which $0.01/s is egress.
WhereSettingValueWhy
App ServerInstance sizelargeEvery page view reaches this App Server, including the ones that are the same for everyone.
DatabaseInstance sizelargeLarge, with the files already out of its rows.

Research this Design needs: Object storage.

Drag to pan. Hold Ctrl or Cmd and scroll to zoom.

At 15.0k Users the Simulation solves this Design to Apdex 0.99, p99 277 ms, 0.0% errors and $7.46/s Burn.
WhereSettingValueWhy
CDNTTL (s)3600Page shells and assets change rarely, so the edge can keep them for the longest time on offer.
CDNPurge on deployOnA release empties the edge, so users do not see the last release's pages until the TTL runs out.
App ServerInstance sizelargeUnchanged. It now sees only what the edge misses.
DatabaseInstance sizelargeUnchanged.

Research this Design needs: Content delivery, Object storage.

In the first picture every page view reaches the App Server. In the second, Users reach the CDN first. It answers what it has cached and sends misses and every other request kind to the origin.

Why it works#

The CDN's hit ratio is the share of page views it answers without touching your servers. The App Server and Database load bars fall, and p99 falls with them because the hit is answered near the user.

Two settings matter. A long TTL raises the hit ratio, and purge on deploy empties the edge when you release so no one sees old pages. A cache key with less in it raises hits further but can leak one user's page to another.

What it costs#

The CDN does not cache API reads, writes, logins or checkouts. A long TTL without a purge serves stale pages after a deploy. A purge makes the origin take a burst of misses while the edge refills. Object Storage reads wait longer for the first byte than a Database query.

In Quorum#

Research Content delivery for the CDN and Object storage for Object Storage. The glossary defines a CDN and egress. CDN push and pull covers the pattern. The next rung is to add a cache.