Note: Redis 6 expiration will no longer be based on random sampling but will take keys sorted by expire time in a radix tree, so all this problems are going away because of an architectural change. I talked about this in the latest 1/2 years in several conferences but never wrote anything. I'll follow up with an implementation inside the unstable branch soon since this need to stabilize and be tested a lot before Redis 6 goes stable.