Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis on web server front-end or database server back-end

Tags:

database

redis

I have two virtual private servers, first is web server front-end and second is database back-end. I want to use Redis for real-time stuff and my questions is: where should I install Redis? On web or database server?

like image 315
yojimbo87 Avatar asked Jan 25 '11 10:01

yojimbo87


2 Answers

Pros of installing Redis on your Database Server:

  • The database size of Redis can become large if you have a lot of data. If you are storing stats and storing a lot of them, then your database can become a memory hog. You would not want to keep all that data in memory on your web server, as that could take away memory from your HTTP server.
  • Its called the database server for a reason

Cons of installing Redis on your Database Server

  • There will be a higher network response time when polling the server for data, as it is not local
  • If the server goes down, then you would be out of data.

I personally would keep Redis on its own server, as you can be feeding it a lot of data, but it all depends on what environment you are working in. If you want speed to be the top priority (an extra 50ms or so would be unacceptable), then you should run it on your Web Server, as request times to 127.0.0.1 are a lot faster than an external network address, even if it is inside your local subnet. If not, then you should keep it off the web server.

like image 79
Colum Avatar answered Oct 11 '22 05:10

Colum


Well if Redis is being used as you said, and your web process does not use a lot of memory, I would put it on both and have replication to the db server. This would provide redundancy and performance. That data seems more important than simple cache data so redundancy would be nice.

If your web server has less free memory and that free memory is smaller than your data size, keep it all on the db server.

like image 37
Michael Papile Avatar answered Oct 11 '22 05:10

Michael Papile