Using Redis as a cache storage for for multiple application on the same server

Behrooz picture Behrooz · Nov 30, 2014 · Viewed 15.4k times · Source

I want to use Redis as a cache storage for multiple applications on the same physical machine.

I know at least two ways of doing it:

  1. by running several Redis instances on different ports;
  2. by using different Redis databases for different applications.

But I don't know which one is better for me.

What are advantages and disadvantages of these methods?

Is there any better way of doing it?

Answer

Itamar Haber picture Itamar Haber · Nov 30, 2014

Generally, you should prefer the 1st approach, i.e. dedicated Redis servers. Shared databases are managed by the same Redis process and can therefore block each other. Additionally, shared databases share the same configuration (although in your case this may not be an issue since all databases are intended for caching). Lastly, shared databases are not supported by Redis Cluster.

For more information refer to this blog post: https://redislabs.com/blog/benchmark-shared-vs-dedicated-redis-instances