Engineering Note

Caching Strategy That Actually Works: Redis, Fragment, Page Caching Explained

One caching change reduced a Rails endpoint from 1.8 seconds to under 200ms.

No database upgrade.

No new servers.

Just a different approach to handling repeated work.

A conversation I had recently with a startup team:

"Our Rails app is getting slower. Should we add more servers?"

Maybe.

But in their case, the problem wasn't compute.

It was repeated work.

Every request was generating the same data again and again.

The interesting part?

Less than 10% of the traffic was creating most of the database load.

So instead of scaling infrastructure first, we looked at caching.

Not all caching solves the same problem.

What worked for us:
* Redis for frequently accessed data and API responses
* Fragment caching for expensive UI components
* Page caching for content that rarely changed

One dashboard endpoint was taking around 1.8 seconds to load.

After introducing the right caching layer, response time dropped to under 200ms.

No database upgrade. No new servers.
Just less unnecessary work.

The lesson was simple:
Caching is not about making systems faster.
It is about avoiding work the system has already done.

And when applied at the right layer, it often delivers bigger gains than infrastructure scaling.