Reputation: 521
I have a performance issue in one of my microservice project, that is high latency in connecting or performing command to redis. After some investigation, I came into this:
According to Redis documentation, redis algorithm for expiring keys is:
In my project, 30 keys per second are created or updated, which has a ttl of 10 minutes, that is about one third of all stored keys.
Does this mean in most execution of an algorithm we fulfil the condition of third step and redis consume most of its resource on expiring key? If this so, can I customize or override default behaviour of this algorithm by changing some config? Or is there any alternative solution?
Upvotes: 0
Views: 1709
Reputation: 141
If your additional keys are non-volitile then they shouldn't be in the consideration of 25% or more being expired.
The default redis config has active-expire-effort 1
on the range of 1-10. Increase would only allocate more CPU to cleanup. However, increasing may also not have an effect if the expiry isn't the root cause for your latency. From the information here, it seems key expiry might not be the issue given ~18k volatile keys you would have.
In terms of alternatives, you might consider further troubleshooting.
Upvotes: 1