• antirez's avatar
    activeExpireCycle() smarter with many DBs and under expire pressure. · 48f4f771
    antirez authored
    activeExpireCycle() tries to test just a few DBs per iteration so that
    it scales if there are many configured DBs in the Redis instance.
    However this commit makes it a bit smarter when one a few of those DBs
    are under expiration pressure and there are many many keys to expire.
    
    What we do is to remember if in the last iteration had to return because
    we ran out of time. In that case the next iteration we'll test all the
    configured DBs so that we are sure we'll test again the DB under
    pressure.
    
    Before of this commit after some mass-expire in a given DB the function
    tested just a few of the next DBs, possibly empty, a few per iteration,
    so it took a long time for the function to reach again the DB under
    pressure. This resulted in a lot of memory being used by already expired
    keys and never accessed by clients.
    48f4f771
redis.c 103 KB