High Performance StringSetAsync with response processing.
Hi.
I'm new to redis, and currently I am making some tests to see the performance when sending lots of records no a redis sentinel configuration.(1 master with one slave and 3 sentinels wich monitors the master).
The idea is to send 30 000 000 records to a redis db as fast as possible and then to wait for the result to see how many of them crashed or not.
The code I', using is :
private void TestPerformance() { int failedRecords = 0; for (int i = 1; i <= 30_000_000; i++) { try { Task result = DB.StringSetAsync(i.ToString(), i); result.ConfigureAwait(false); result.ContinueWith(task => { if (task.IsFaulted) logger.Error("Task faulted on"+i); if (task.Exception != null) logger.Error("An exception occurred :" + task.Exception.InnerException.Message); Interlocked.Increment(ref failedRecords); }); } catch (Exception ex) { logger.Error("Error:" + ex.Message); } } }
Is there a faster way to send messages and after sending them to wait for the responses ?