← Back to Blog
Story / Founder

How I Diagram a Caching Layer Before Slow Pages Reach Users

How I Diagram a Caching Layer Before Slow Pages Reach Users

A slow page is rarely one slow box. It is a request that travels through several places that could have answered it sooner, and did not. That is why I draw a caching layer diagram before a slow page reaches users: one page that shows every layer a request can stop at, what each layer holds, how long it stays fresh, and how it gets cleared. ByteDiagram is our product, made by us, and it only appears in the tool notes near the end.

This post is about the whole path a page takes, from the browser to the database. If your question is narrower, and you are deciding whether an app-tier store is worth adding at all, read why I draw the cache path before I add Redis first. That post stays inside the application. This one steps back and looks at every layer at once.

Why a slow page needs a layer map, not one cache box

When a page feels slow, the first instinct is often to add a cache. The trouble is that a page already passes through several caches, whether anyone drew them or not. The browser has one. A CDN or reverse proxy may have one. The application may keep its own. Each of them can answer the request, pass it on, or hand back something stale.

MDN's guide to HTTP caching explains why the position of a cache matters. A cache keeps a copy of a response and hands it back on later requests, and a copy that sits nearer the user comes back sooner. Every reused copy is work the origin skips: it does not parse and route the request, rebuild the session, query the database or render the template.

That list is a good outline of what a miss costs. A caching layer diagram turns it into something a team can point at. Instead of arguing about whether "the cache" works, people can ask which layer answered, and which one should have.

The layers I put on the page

I keep the cast small and draw it left to right, in the order a request meets it:

  • The browser, which keeps a private cache for one user.
  • The edge: a CDN or reverse proxy that keeps a shared cache in front of the origin.
  • The application, with any cache it keeps for computed results or query output.
  • The database, which is where a request ends when every layer before it misses.

The split between the first two is not my invention. MDN separates caches into two kinds. A private cache belongs to one client, usually the browser, so it may keep a response made for that one person. A shared cache stands in the middle, between users and the origin, and keeps responses that many users can receive.

MDN also names the kind of shared cache most teams control: managed caches, deployed by the service's own developers to offload the origin. Its examples are reverse proxies, CDNs, and service workers combined with the Cache API. On my diagram, every managed cache gets its own box, because each one has its own rules for what it keeps.

For how the edge itself is built, with points of presence and an origin shield, see a CDN architecture diagram drawn layer by layer. On a caching layer diagram, the whole edge is one box with one set of rules.

Three questions I ask of every layer

Each box on the page gets the same three labels. If I cannot fill one in, that gap is usually where the slow page comes from.

What does it hold? Name the responses or values the layer keeps: whole HTML pages, static assets, API responses, or computed fragments. A layer that holds "everything" usually holds nothing on purpose.

How long does it stay fresh? MDN describes stored responses as either fresh or stale, and the test is age: the time since the response was generated. It compares this to the TTL in other caching systems. In HTTP, Cache-Control: max-age sets how long a response counts as fresh. For the application layer, I write the TTL the team has actually chosen, or leave the field blank until someone does.

How does it leave? This is the label people skip, and it causes the most surprises. According to MDN, HTTP itself gives you almost no standard way to remove a cached copy on demand, although a managed cache such as a CDN can usually purge one from its dashboard, through an API, or by restarting. MDN also points out that a copy held by some intermediate server with a long max-age cannot be pulled back at all. On the diagram, every layer gets a leave path: expiry, revalidation, purge, or a new URL.

A caching layer diagram for one page request: browser private cache, CDN or reverse proxy shared cache, app cache and database from left to right, with green hit arrows returning to the browser from the CDN and the app cache, a dashed amber miss line continuing to the next layer, cards under each layer for what it holds, how long it stays fresh and how it leaves, a dashed private boundary note for logged-in pages, and a time to first byte marker at the browser

The figure above is an example drawn for this article, not a production system of mine. A request runs left to right through four boxes: browser private cache, CDN or reverse proxy shared cache, app cache, and database. Green arrows show a hit returning to the browser from the CDN and the app cache, and a dashed amber line shows each miss continuing to the next layer. Under each box, a card answers the three questions: what it holds, how long it stays fresh, and how it leaves. The app-cache TTL is left blank on purpose, and a marker at the browser shows where time to first byte is measured.

Where personal pages must not be cached

One line on the diagram matters more than the rest: the line between pages that are the same for everyone and pages that belong to one user. MDN is direct about the risk. If personalized content is stored in a cache other than a private cache, other users may be able to retrieve it.

The guide also notes that a cookie alone does not make a response private. If a response is built for one user and must stay in that user's browser, mark it with the private directive. For HTML that is personalized after a login, MDN's example pairs no-cache with private.

On the page, I draw this as a dashed boundary around the shared layers with a plain label: logged-in pages stop at the browser. It is the first thing I check in a review, because a fast page that shows one user's data to another is not a performance win.

HTML and static files get different rules

A slow page is often two problems sharing one URL: the HTML document and everything it loads. MDN treats them differently, and so does my diagram.

For static files such as JavaScript, CSS and images, the common practice MDN describes is cache busting: put a version number or hash in the URL so it changes whenever the content changes. That lets the file be cached for a long time, for example with max-age=31536000 and the immutable directive, which tells the browser revalidation is not required.

The main HTML document cannot be cache busted that way, because its URL cannot be decorated in the same way. For it, MDN suggests no-cache together with Last-Modified and ETag. A stale copy is then checked with a conditional request, and if nothing changed, the server answers 304 Not Modified with no body, so the transfer is very small.

On the diagram that becomes two lanes through the same boxes: a long-lived lane for hashed assets and a revalidated lane for HTML. Seeing both lanes side by side makes it obvious when a team has given the HTML the asset rules, or the other way round.

Mark where the slowness is measured

A caching layer diagram is a plan, not a measurement. It still helps to mark where the measurement happens, so the team argues about the same number. For the HTML document, I put a marker at the browser for time to first byte.

web.dev defines TTFB as the time between starting navigation to a page and the moment the first byte of the response begins to arrive. As a rough guide, it says most sites should aim for a TTFB of 0.8 seconds or less, and it treats values above 1.8 seconds as poor. It also notes that TTFB is not a Core Web Vitals metric, so a site does not strictly have to meet the "good" threshold as long as it does not hold back the metrics that matter.

That is why the marker sits at the browser and not inside a box. A reader can then trace which layer answered and ask whether the request should have stopped earlier. The diagram does not produce the number; your monitoring does. The page just shows where to look.

What stays off the diagram

Vendor feature lists stay off. So do hit-rate percentages and latency figures that nobody has measured, because a confident number on a diagram tends to outlive the guess that produced it. Blank fields are more honest than invented ones.

Load balancing stays off too, unless it changes which cache a request reaches. For that neighbour, see how a load balancer sits in front of the app tier. If the slow page belongs to a shop, an eCommerce architecture diagram shows the wider set of services the cache layers sit inside.

How I draw it in ByteDiagram

You can draw this page in any diagramming tool. If you want to try it in ByteDiagram, these are the pieces that fit, all checked in the guest canvas on 12 November 2026.

The Templates panel ("Start from a template") includes quick starts such as "Web App Stack" and "Microservices". The Icons panel groups built-in icons into categories including Databases, Messaging & Streaming, AWS Services, Azure and Google Cloud. For the boundary between private and shared layers, use the "Section" shape; the panel describes it as a "Dashed zone for grouping steps". The "Auto-arrange" button tidies the boxes after edits.

The Timeline helps when the order of a hit and a miss is the confusing part. You drag its bars to control when each element appears, then use Play, Pause and loop playback to replay the path. I would show the hit first, then the miss that falls through to the database.

When the page is ready, its Export menu includes PNG, SVG and Animated GIF (checked 12 Nov 2026). A still PNG or SVG suits a performance review document; an Animated GIF only helps when people keep mixing up the order. You can try this without an account: the guest canvas edits locally, and its top bar reads "Local only". For the full walkthrough of playing a diagram in order, see how to animate an architecture diagram step by step.

FAQ

What is a caching layer diagram?

It is one page that shows every place a request can be answered before it reaches the database: usually the browser, a CDN or reverse proxy, and an application cache. For each layer it notes what is stored, how long it stays fresh, and how it is cleared, so a slow page can be traced to a layer.

Which caching layers should the diagram include?

Draw the layers in the order a request meets them: the browser private cache, any shared cache such as a CDN or reverse proxy, the application cache, and the database. Leave out layers you do not run, and give each layer you do run its own box and rules.

How do I keep personalized pages out of shared caches?

Mark them on the diagram first. MDN warns that personalized content stored in a shared cache may reach other users, and that a cookie alone does not make a response private. Send the private directive, for example no-cache with private for logged-in HTML, so it stays in the browser.

How is a caching layer diagram different from a CDN diagram?

A CDN diagram explains how the edge itself is built, with points of presence and origin shields. A caching layer diagram treats the whole edge as one box and shows how it sits between the browser, the application cache and the database along a single page request.

Sources

Checked on 12 November 2026.

Draw the layers before users feel them

Pick the slowest page you know and draw the path it takes: browser, edge, application, database. Give every layer the same three labels, draw the private boundary for logged-in pages, and split HTML from static files. Leave a field blank rather than guess. Then review that one page before anyone adds another cache.

Map your caching layers on one page

ByteDiagram is our own tool. Lay out the browser, edge, app and database, ring the shared layers with a dashed section, and export a still PNG or SVG for the performance review.

Visit ByteDiagram