2

I'm planing topology of enterprise application according to 3-tier architecture, my solution contains caching server (Redis) in order to manage cached data.

What is the best tier to host the Caching Server in? Business Tier or Data Tier, and why?

Niklaus Wirth
  • 820
  • 1
  • 7
  • 21

1 Answers1

2

Caching is more effective the closer it is to the presentation. The coarser the cache, the less re-computation you have to do. Unfortunately, the closer it is to the presentation, the more difficult cache invalidation becomes, as determining the conditions in which a cache is "invalid" requires more and more underlying knowledge of the system state and business rules.

A cache below the database tier (disk block or database block level caching) just needs to known when the block itself changes.

A cache at the Database Tier requires less knowledge, because you can cache per database entity. Every time that entity changes, or a related entity changes at an identity level, you invalidate the cache.

A cache at the business tier requires underlying knowledge of the data elements that make up those business objects, and what could cause those business objects to be invalidated.

And as you move all the way to the presentation tier, you have to understand all the business and data changes that could impact any given UI element so that you can invalidate it.

Rob Conklin
  • 8,806
  • 1
  • 19
  • 23