StackExchange.Redis
StackExchange.Redis copied to clipboard
threads hanging on production when using transaction
Hello, I have a synchronous method which does the following -
var transaction = _connectionMultiplexer.GetDatabase(0).CreateTransaction();
var returnValueTask = transaction.HashSetAsync(key, KeyValuePairsToHashEntries(keyValuePairs));
transaction.KeyExpireAsync(key, expiry);
var success = transaction.Commit(); if (!success) throw new Exception("transaction failed");
return returnValueTask.Result;
I've load tested it locally (100 threads doing the same to either the same key or different keys ) everything seems to be working fine, but we've seen in production env that pretty frequently the transactions don't seem to complete ( or take very long to complete ).
Am I doing something wrong in the code ? ( other than the method being synchronous which is a prerequisite ). Could you suggest an alternative to simulate atomic writing of both the hash and the expiry ?
Thanks in advance !