The Redis dict of all keys is implemented in hashtable wich will expand when key number reach any exponential of 2 after 4.

According to the size of a hashtable bucket, when bucket number expand from 110241024 to 210241024, there is a memory overhead burst of 32MB. when bucket number expand from 2m to 4m, the burst will be 64MB and so forth.

So when your Redis's used memory is approaching to the max memory you set, and the hashtable happens to expand, hundreds of MB of data would be evicted. Key number to be evicted will be counted to several million. And this will cause server hang for several seconds which leads to a slave failover. see issue #3852

Comment From: haorenfsa

already stated in #4583