microsoftarchive / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes
http://redis.io
Other
20.78k stars 5.37k forks source link

Redis cluster using multiple windows services on same machine takes too much time to promote a slave as master in case its master is down #553

Open rupendra-sharma opened 7 years ago

rupendra-sharma commented 7 years ago

Hi I have setup a Redis cluster by installing 6 Redis as windows services in which it has each of 3 masters has 1 salve. The data is shared between these 3 masters. While testing the fail-over scenarios, i have noticed that once the Master is down, rest of masters take too much time ( > 15 seconds) to promote its slave as master. Even I have increased the ConnectionRetry to 10 and the ConnectionTimeOut to 200000 MS but it does not work and the all requests get failed during the time taken in slave promotion. I am using StackExchange.Redis library to access Redis. The connection code is as following: string redisConnection = "localhost:7002,localhost:7003,localhost:7004,localhost:7005,localhost:7006,localhost:7007,ssl=false,allowAdmin=true,ConnectRetry=10,ConnectTimeout=200000"; ConnectionMultiplexer connection = ConnectionMultiplexer.Connect(redisConnection); return connection.GetDatabase();

The test code to get 10,000 Sets is as following:

        var keyList = new RedisKey[10000];

//Generate keys array

        for (int i = 0; i < 10000; i++)
        {
            var key = new RedisKey();
            key = prefix + i;
            keyList.SetValue(key, i);
        }

        foreach (var key in keyList)
        {
            Console.WriteLine(_cache.SetMembers(key)[0].ToString());
        }

Thanks Rupendra

rupendra-sharma commented 7 years ago

The Redis version used is 3.2.100 and StackExchange.Redis used is v1.2.4