GreenStepsChatt/greensteps

Cache a user's total trash bags and points spent

开放

#189 创建于 2018年5月18日

 (1 条评论) (0 个反应) (0 位负责人)Ruby (30 个派生)auto 404
backendhelp wantedready

仓库指标

星标
 (12 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

This calculation is done multiple times per page load for the user dashboard 😬

We should use the Rails built-in low level caching API and we need to determine if we are okay to use the Rails default cache store. If not I'm thinking the Memcashier Heroku add on is a good option (with the dalli gem, not the old memcached). A couple things to consider when determining which cache store to use:

  • How big is the size limit of the cache? What is the application's current memory footprint? Do we have enough room left over for an in memory cache?
  • Heroku has an "ephemeral filesystem" and I think this might mean that we can't use the default cache store regardless of our current memory usage. In fact I'm pretty sure they say this in their guide somewhere.
  • How many database connections are available with our set up? How does this compare to the number of connections that we'll have to the memcache server? If the cache server has a small number relative to the number of database connections, then is it possible that it will take longer for the request to grab a connection to the memcache server than it would for it to just execute the query? I think not, but we should think about it more / check and see.

We should also get some before and after measurements to ensure that the caching is actually helping. Maybe we can start using New Relic.

贡献者指南