Redis for both data store (jobs) and fragment cache in Rails

℡╲_俬逩灬. 提交于 2019-12-24 14:07:54

问题


I am already using Redis (with Redis Cloud on Heroku) as a data store for Resque to process my background jobs. I would like to add some fragment caching to my app.

Questions:

  1. Do we need two separate instances of Redis to achieve this? One for the fragment caching (ephemeral data) and another for jobs (persistent data)? Or can the one Redis instances be configured to handle both scenarios?

  2. From a configuration and maintenance point of view, is it easier to simply have memcached for fragment caching and Redis for jobs? Is the main downfall to this having two paid services rather than one?


回答1:


Same redis can be used for both ephermal data(for fragmant caching) and persistent data given you have configured your redis to write that data to disk which i assume is there as the current redis is being used for persistent data. The evaluation of a separate redis instance can be done based on the volume of use after introduction of fragmant cache. If fragmant cache will significantly increase the load on redis then use a different redis which need not write to the disk itself.

From a configuration and maintenance point of view, both memcache and redis configuration, clustering are equally straightforward when you use it on your own machine or go with existing solution like elastic-cache. Given you are already using redis i would say expanding techstack always adds a little maintenance overhead given you will have additional stack to tweak and tune for better performance.



来源:https://stackoverflow.com/questions/32833021/redis-for-both-data-store-jobs-and-fragment-cache-in-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!