I have a use-case where I need to fetch all the keys from AWS Elastic cache(redis), I thought of using multiGet to just avoid the network calls, but taking more time as compare to sending parallel requests below is the details
I am using springboot+jedis and I have 5000 keys in redis
redisTemplate.opsForValue().get(key))
// taking 100 ms
return redisTemplate.opsForValue().multiGet(keys);
// All 5000 , taking around 24 second
Batches in to 500 and sending parallel using spring asyc task with 10 threads taking around ~5sec
return redisTemplate.opsForValue().multiGet(batchedkeys);
So I am not able understand what is the best way to fetch all the keys, as I read here that redis has single worker and multiple I/O threads. so single request with multi keys should have overall less response time as compare to multiple request with single keys due to reduced network calls. Pls correct me if my assumption is wrong