Tech, ExplainedGaming, streaming and media
Part

Website caching

Readers leave a slow site.

INSIDE: NEWSROOM CMSHOW IT WORKS · A BOARD RESULTS STORY IN PUNE20,000 readersopen theresults storyin one minuteThe firstrequest buildsthe page in0.8 secondsThe cache savesa copy of thefinished pageThe next 19,999readers receivethe copy in 0.05seconds eachThe editorfixes theheadline, andthe CMS clearsthe old copyThe next requestbuilds a freshpage, which iscached againALSO TALKS TOContent delivery network (CDN)↗ CLOUD HOSTINGNewsroom CMSINSIDE: NEWSROOM CMSHOW IT WORKS · A BOARD RESULTS STORY IN PUNE20,000 readersopen the resultsstory in one minuteThe first request buildsthe page in 0.8 secondsThe cache saves a copy ofthe finished pageThe next 19,999 readersreceive the copy in 0.05seconds eachThe editor fixes theheadline, and the CMSclears the old copyThe next request builds afresh page, which iscached againALSO TALKS TOContent delivery network (CDN)↗ CLOUD HOSTINGNewsroom CMSINSIDE: NEWSROOM CMS · ABOARD RESULTS STORY IN PUNE20,000 readers open the results story inone minute↓The first request buildsthe page in 0.8 seconds↓The cache saves a copyof the finished page↓The next 19,999 readers receive the copyin 0.05 seconds each↓The editor fixes the headline, and theCMS clears the old copy↓The next request builds a fresh page,which is cached againALSO TALKS TOContent delivery network (CDN)↗ CLOUD HOSTINGNewsroom CMS
The first reader's request builds the results story in 0.8 seconds and saves a copy; the next 19,999 readers receive the copy in 0.05 seconds, until an edit clears it.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

Website caching means keeping ready-made copies of a website's pages, so that the server does not have to build each page again for every reader. A cache is a store of such copies. Caching makes a site load faster, and it lets the same servers handle far more readers. For a news site, this matters because readers leave a page that loads slowly.

Why does a page need building at all? A news page is not stored as one finished file. When a reader asks for it, the server collects the story from a database, adds the headline, the photos, the list of related stories and the ad spaces, and assembles them into a page. This can take most of a second. That is fine for a few readers. It is too slow when thousands of readers ask for the same page in the same minute.

Here is how it works on a busy day. Say the Maharashtra state board publishes its Class 10 results, and a Marathi news site in Pune publishes a story with the link. In the first minute, 20,000 students and parents open the story. The first request reaches the server, which takes 0.8 seconds to build the page. The caching tool then saves a copy of the finished page. The next 19,999 readers receive that copy, each in about 0.05 seconds. The database is asked once, not 20,000 times.

Then the editor corrects a mistake in the headline. The old copy is now wrong. So the newsroom CMS tells the cache to delete it. This is called clearing, or purging, the cache. The next reader's request builds a fresh page, and the cache saves that one.

Caching happens in several places. The page cache on the publisher's own server is the one described here. A content delivery network (CDN) keeps copies on servers in many cities, so that a reader in Nagpur receives the page from a nearby server. The reader's own browser also keeps copies of the logo and the fonts, so that it does not download them again. And inside the server, an in-memory cache keeps the most-used data, such as the list of top stories, in memory instead of on disk.

What is not cached? Parts that differ for each reader, such as the ads and the paywall message, are added separately, after the copy is served. If they were saved in the copy, every reader would see the first reader's ads.

Search engines also measure how fast a page loads, and they may rank slower pages lower. So caching affects how many readers arrive through search, not only how long they stay.

Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.