StackExchange.Redis 2.0.601 2 times slower than 1.2.6
I've made performance tests using 2 versions of library: 2.0.601 and 1.2.6
Performance test sets and releases 100K keys (used as distributed locks) in parallel, using 1 instance of ConnectionMultiplexer with recommended lazy initialization and settings:
options.SslProtocols = System.Security.Authentication.SslProtocols.Tls12;
options.AbortOnConnectFail = false;
options.ConnectTimeout = 20000;
options.SyncTimeout = 20000;
Also next settings were used for performance:
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.Expect100Continue = false;
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
ServicePointManager.EnableDnsRoundRobin = true;
ServicePointManager.ReusePort = true;
ThreadPool.SetMinThreads(200, 200);
Code to set and delete:
await this.connection.ConnectionMultiplexer
.GetDatabase(this.connection.RedisDatabase)
.StringSetAsync(
this.name,
clientId,
lockDuration,
When.NotExists,
CommandFlags.DemandMaster)
.ConfigureAwait(false);
await this.connection.ConnectionMultiplexer
.GetDatabase(this.connection.RedisDatabase)
.ScriptEvaluateAsync(
DeleteLockScript,
new RedisKey[] { this.Name },
new RedisValue[] { this.Id },
CommandFlags.DemandMaster)
.ConfigureAwait(false)
const string DeleteLockScript = @"
if redis.call('get', KEYS[1]) == ARGV[1] then
return redis.call('del', KEYS[1])
else
return 0
end
";
As results in attachment show - new version performs 2 times slower than old version. The questions are: What's wrong - performance of new version or my usage? Did you do any performance comparison with old version?
Thanks in advance. StackExchangeRedis_Distr_Locks_Test_Logs.zip
Hi @mgravell ,
We are also facing slowness issue with the 2.0.601. Is there a plan to provide fix in near future
Thanks, Vinayak
Tagging with performance - there has been progress here and it does depend on scenario. Tagging all these so we can look at all of the examples in a pass soon.
I've just closed out several issues here - you'll find a decent perf boost in the 2.5.x prelease (stable soon) that's very close to 1.2.6 while still being more correct and usually using less CPU as well. If anyone has a performance problem vs. 1.2.6 vs. 2.5.x, I'd really appreciate opening an issue with your scenario so I can profile further :)