I use the following command to clear the Ledis index.
from redis import StrictRedis
db_value = 7
redis = StrictRedis(host=HOST, **cloud_cfg, db=db_value)
redis.flushdb()
After I clear the index, I use following command:
from redis import StrictRedis
db_value = 7
redis = StrictRedis(host=HOST, **cloud_cfg, db=db_value)
res = redis.mget(['1', '2', '3', '4', '5', '6', '7', '8', '9'])
It takes 4 second.
But when I use mget in DB 8.
It only need 0.193 second.
My questions are:
1. Why my DB become slow after flushdb?
2. How can I fix it?
more information:
redis version(python): 4.5.4
ledis version(server): 1.3.8
I find that change mget_threshold
to large than the number of mget is more useful.
--update--
I found that my ledis config has been customized, so it may not serve as a good reference.
However, the core idea behind this modification is that the original mget, when facing misses, uses an iterator for processing, which may not be very fast.
Therefore, we aim to increase the number of get operations to skip the iterator.