ruby on rails - Cache Money vs DB-level indices? -


What cache money mani eliminates the requirement of DB level indexes (usually used to improve query retrieval is done)?

caching = Your query is obtained from the query cache (RAM) if they are < / P>

Indexing = With the help of the database, a few questions (very) have been answered fast (a simplified definition, but enough here for my purpose).

Therefore, the speed of questions increases without having to kill the database in the cache, whereas the data going through the cache in the index is accelerated and the database is pressed.

The benefit you get from caching depends on the specifications of your application. If most questions ask for the same data, or you have fewer updates than read, then using the caching layer should prove to be a good idea. However, I have seen that even in the best scenarios, 15-20% of questions still reach the database. This means that you can not trust caching alone.

But most importantly - the database index is simple to define and usually requires zero maintenance until you become huge. Caching Otoho is very complex - for cash-money gem you will need to install, configure and maintain a memcatch. It is not rocket science, but still adds another layer of complexity at the top of your database. In other words, it is usually prematurely adaptable. I suggest that you start with the db index and add only one caching layer when you think you need it.

Comments