Assuming I have my application set up such that I have a NodeJS server running on some remote machine, and I have my database running on another remote machine. Assuming that I want to set up a Redis server for caching, wouldn't hosting the Redis server on another separate machine from my NodeJS server add unnecessary overhead?

From my understanding, Redis is extremely fast because it is an in-memory database. But if the Redis server is on another machine from my NodeJS server, I would have to make a network request from my NodeJS server to the Redis server, and if it is a cache miss, I would have to make another network request to my database server (which is a total of 2 network requests). Wouldn't it be faster to just do without the Redis server caching, since I would be assured that only 1 network request is made to the database server? What is the typical way of setting up the Redis server in a production environment?

1 Answer 1


In a situation with one web app server, one database server and one Redis instance I would agree: Put the Redis instance on the same machine as the web service. Correctly configured, this also removes the need to put additional security layers around the Redis traffic.

But as soon as you start discussing load balancing and/or clustering, things get more complicated: In some situations it may well be faster to keep a common cache for all web servers even though it means an extra network hop and perhaps - in the case of a Redis cluster - even despite the additional traffic between Redis hosts. This is of course a matter of system design and practical testing.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .