Counting views without slowing the site down

Almost every news site counts how many times an article is read, and shows a “most read” or “trending” list. It sounds trivial. But it’s one of the most common reasons a busy site gets slow — because the feature that tracks your popularity is triggered hardest by exactly the stories that are popular.

Why a naive view counter is dangerous

The obvious way to count views is to record one every time someone opens an article. On a quiet site that’s fine. On a news site, a story that takes off means thousands of those records being written in the same minute — a write storm aimed at your database at the worst possible time. Then the “most read” widget asks the database to sort through all of that on every homepage load, adding its own weight on top.

The symptoms

  • Popular articles get slower the more popular they are.
  • Database load spikes exactly when a story is trending.
  • The “trending” block on the homepage drags down the one page everyone sees.

It’s a nasty feedback loop: success makes the site slower, which costs you the readers success brought in.

What counting right looks like

Without getting into the plumbing, the principles are straightforward. Counting a view should never make the reader wait — it should happen out of the way, not block the page. The totals that power “most read” should be prepared in advance and served ready, not recalculated from scratch for every visitor. And the whole thing should be built to stay cheap precisely when traffic is high, instead of getting more expensive the moment it matters.

Why we built our own

The view counters you can install off the shelf are usually built for ordinary sites, not for a newsroom where a single story can out-traffic the rest of the site combined. So we built our own, designed around one goal: count every view and power real-time “most read” lists without ever becoming the thing that slows the site. We won’t bore you with how it works under the hood — what matters is that the counting disappears into the background and stays there, even on the biggest day.