StackExchange.Redis StringSet Maximum array size

For Redis users and for StackExchange.Redis driver users, I am trying to initialize the cache by doing a bulk insert. For this, I tried using a StringSet with a 20000 KeyValue array and it failed to disconnect.

My understanding is using an array, it is executing an MSET command which should be faster than 20K SET commands. It? Does anyone face this problem? How to solve it?

Thank you for your help.

+3


source to share


1 answer


The difference between multiple SETs and MSETs isn't as big as you might think - around 10 bytes per element throughput, and if you're using pipelining (maybe even a variant of the FireAndForget command): zero latency. But you can also easily switch to batches of (say) 100 elements: again, this will have an additional overhead of about 10 bytes per batch, which is nothing, and those batches can also be pipelined if you want. In any pipelined case, SE.Redis does some work to minimize packet fragmentation, etc. Basically, the change I would make here is: don't send massive batches. Send several small batches. A huge batch will not do you the good you imagine.



+2


source







All Articles