We need a Rails caching solution that works with a multi-dyno formation on Heroku. Specifically, we need worker dynos processing long-running tasks to write to a cache that our web dynos can read from.
Apparently the only way to implement a shared cache across dynos is by using Memcached. However I'm having trouble finding objective instructions on how to get this done. (The Heroku docs are written by Memcached add-on vendors like MemCachier that are promoting their product.)
My questions:
- Is a 3rd party add-on necessary, or can Memcached be implemented directly on a dyno within the formation?
- Is using Memcached via an outside service even practical? If the whole point of Memcached is high-performance in-memory access, doesn't the network latency of an external service negate that?
- If using add-ons, is there a reason to choose MemCachier vs Memcached Cloud?
Due diligence - I work at Redis Labs, the company that provides the Memcached Cloud addon.
- I'm not familiar with anyone running any datastore/database directly off a dyno - Heroku's and 3rd-party addons are available exactly for that.
- Yes, using a remote Memcached is the common way to go with a web app that needs to scale to multiple dynos. Despite not being colocated on the same server, you'll still get the responses from you Memcached in <1 msec.
- Choose the addon that gives you most value for your money - not only in terms of RAM per $ but also with regards to robustness and functionality - refer to this comparison for more information.