Currently I have a simple API server set up using Node.js and MongoDB but would like to start incorporating Redis for caching requests. Is it bad practice to set up the Redis instance on the same machine as the MongoDB server? Are there any Redis setup issues that I should be aware of if I were to scale the MongoDB servers in the future?
While Redis and MongoDB are indeed a good combination, they should not been installed on the same node, especially if the MongoDB database does not fit in memory.
MongoDB exploits the virtual memory mechanism of the OS, and its data structures (btrees) will offer honest performance even in case of swapping (due to memory locality). If the MongoDB database is bigger than memory, the machine will swap, and this is the expected behavior.
On the other hand, Redis is a single-threaded memory data store, whose data structures are tuned for random memory access. Everything must fit in memory. Its performance will be abysmal if the host starts to swap some Redis memory out.
If you put both on the same host, MongoDB will make the machine swap, and Redis will not be responsive anymore. One way to work the problem around would be to use cgroups (or a similar isolation mechanism) to prevent MongoDB to eat the memory of the machine, but it makes the configuration more complex. I would not recommend it.
Thw biggest problem you may find is resource contention between MongoDB wanting to page data in for its working set and redis wanting to use the same memory addresses as the OS will assign those pages.
From my own experience I have had redis and MongoDB running along side each other but I should stress that the reason they worked together was because of my MongoDB working set and the amount of data I was storing in redis.
What I am saying is that it all depends upon your usage of the two along with the metal you run them on. If you find you are using redis to store alot and then your working set in MongoDB is large as well on, say, a small server then you may well fnd the two will hit each other but if you leave enough room in your RAM for the two to sit happily next to each other then it should not be too much of a problem.