• antirez's avatar
    Impovements for: Redis timer, hashes rehashing, keys collection. · a8a981a8
    antirez authored
    A previous commit introduced REDIS_HZ define that changes the frequency
    of calls to the serverCron() Redis function. This commit improves
    different related things:
    
    1) Software watchdog: now the minimal period can be set according to
    REDIS_HZ. The minimal period is two times the timer period, that is:
    
        (1000/REDIS_HZ)*2 milliseconds
    
    2) The incremental rehashing is now performed in the expires dictionary
    as well.
    
    3) The activeExpireCycle() function was improved in different ways:
    
    - Now it checks if it already used too much time using microseconds
      instead of milliseconds for better precision.
    - The time limit is now calculated correctly, in the previous version
      the division was performed before of the multiplication resulting in
      a timelimit of 0 if HZ was big enough.
    - Databases with less than 1% of buckets fill in the hash table are
      skipped, because getting random keys is too expensive in this
      condition.
    
    4) tryResizeHashTables() is now called at every timer call, we need to
       match the number of calls we do to the expired keys colleciton cycle.
    
    5) REDIS_HZ was raised to 100.
    a8a981a8
redis.c 92.5 KB