How many memories should be assigned to Redis on master-slave mode?

123 views
Skip to first unread message

cwh...@gmail.com

unread,
Nov 24, 2014, 5:26:27 AM11/24/14
to redi...@googlegroups.com
There are two similar machines with 128G memory to be designated to install Redis, one is master, the other is slave,  also start two Sentinel  processes on master machine and one Sentinel process on slave machine. i.e besides these processes above and Linux system processed,  there rarely are no other process on both machines.
I want only use Redis as a cache, so set save property to an empty string, set appendonly property to no, also set maxmemory property to 100G.
But i still have three questions as follows:
1. In order to use maximum memory, whether or not setting maxmemory property to 110G or greater?
2. In order to only use Redis as a cache, whether or not need to set other property?
3. The sentinel subcommand can be executed via Redis-cli, such as 'SENTINEL get-master-addr-by-name master-name', how to execute it?

Josiah Carlson

unread,
Nov 24, 2014, 12:14:09 PM11/24/14
to redi...@googlegroups.com
If this is just a cache, and you don't care about data inegrity why are you using master/slave replication? Why not just have 2 shards, set maxmemory to 120 gigs on both of them, then have 240 gigs of usable memory? What do you think you are gaining using Sentinel + master/slave replication for a non-persistent cache?

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

cwh...@gmail.com

unread,
Nov 24, 2014, 8:13:08 PM11/24/14
to redi...@googlegroups.com
Hi Josiah,
Thanks for your reply.
I want to get the no interrupting Redis service via using HA architecture(Sentinel + master/slave replication). If using shard, i worry about the service interrupt once.
If i have some improper ideas,  hopefully anyone give me guide.
Thanks again.

Josiah Carlson

unread,
Nov 25, 2014, 1:46:56 PM11/25/14
to redi...@googlegroups.com
If you want to run actual HA, you should put sentinels on the same machines as your clients.

As for how much memory to leave extra (MAXMEMORY 100G, 110G, etc.), that will depend on how fast your network link is between your master and slave, as well as how fast your disk is on your master. The extra memory is there for when the slave connects/re-connects to your master and your master has to snapshot + send to the slave.

A few years ago, a BGSAVE on one of my 35G memory Redis servers took 20 minutes to BGSAVE. While writes were coming in, memory would bloat by another 20 gigs, making the total memory used by the master and the snapshot process over 55 gigs (it was on a 68 gig machine, so we were okay). When picking a maxmemory, you have to be aware of how long the snapshot process may take, how long it may take to transfer to a second machine, and how many writes will occur.

I would start at a maxmemory of 70 gigs, then increase it by 5 gigs periodically if you find that slave reconnections don't force memory usage too high.

 - Josiah

Greg Andrews

unread,
Nov 25, 2014, 5:55:49 PM11/25/14
to redi...@googlegroups.com
Hi hope Josiah will forgive me for expanding on the last thing he said:

I would start at a maxmemory of 70 gigs, then increase it by 5 gigs periodically if you find that slave reconnections don't force memory usage too high.

I.e., do test slave disconnections and reconnections so you can watch your master save the full dataset to disk, transfer the file to the slave, and the slave load from file, then stream the writes that occurred during the save/transfer/load until the slave has caught up with the master.

Then you will see the effects on the master machine, on the slave machine, and on the network between them, and you can adjust the maxmemory accordingly.  (perhaps even adjust the machines and network)  You want to know in advance how well (or badly) your machines behave during this process.  The situation is much worse when it surprises you with an outage.

Repeating the test in a few months, when your data is larger and there are more writes to the master, is also a good idea.

  -Greg

Josiah Carlson

unread,
Nov 25, 2014, 6:13:18 PM11/25/14
to redi...@googlegroups.com
Expanding is great. You saved me 10-20 minutes explaining when the OP invariably asks more questions ;)

 - Josiah


--

cwh...@gmail.com

unread,
Nov 26, 2014, 2:54:55 AM11/26/14
to redi...@googlegroups.com
Hi Josiah and GregA,
Thanks for your great explanations.
I set the max memory to 110G, and filled the max memory fully, then disconnect slave. It looks like the slave re-connection process elapsed proximate fifty minutes,  background saving, transfer to slave and slave loading occupied twenty, twelve and thirteen minutes respectively.
I will continue to test via reducing the max memory.

BTW,  anyone can help the question as follows:
Can the sentinel subcommand, such as 'SENTINEL get-master-addr-by-name master-name', be executed via Redis-cli? 

Reply all
Reply to author
Forward
0 new messages