1

doing a R/W test with redis cluster (servers): 1 master + 2 slaves. the following is the key WRITE code:

var trans = redisDatabase.CreateTransaction();
Task<bool> setResult = trans.StringSetAsync(key, serializedValue, TimeSpan.FromSeconds(10));
Task<RedisResult> waitResult = trans.ExecuteAsync("wait", 3, 10000);
trans.Execute();
trans.WaitAll(setResult, waitResult);

using the following as the connection string:

[server1 ip]:6379,[server2 ip]:6379,[server3 ip]:6379,ssl=False,abortConnect=False

running 100 threads which do 1000 loops of the following steps:

  1. generate a GUID as key and random as value of 1024 bytes
  2. writing the key (using the above code)
  3. retrieve the key using "var stringValue = redisDatabase.StringGet(key, CommandFlags.PreferSlave);"
  4. compare the two values and print an error if they differ.

running this test a few times generates several errors - trying to understand why as the "wait" with (10 seconds!) operation should have guaranteed the write to all slaves before returning.

Any idea?

2 Answers 2

1

WAIT isn't supported by SE.Redis as explained by its prolific author at Stackexchange.redis lacks the "WAIT" support

Sign up to request clarification or add additional context in comments.

1 Comment

Indeed you have, and they were etched into my heart and mind - hence I could reference them <3
0

What about improving consistency guarantees, by adding in some "check, write, read" iterations?

  1. SET a new key value pair (master node)
  2. Read it (set CommandFlags to DemandReplica.
  3. Not there yet? Wait and Try X times. 4.a) Not there yet? SET again. go back to (3) or give up 4.b) There? You're "done"

Won't be perfect but it should reduce probability of losing a SET??

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.