]> git.saurik.com Git - redis.git/commit
Impovements for: Redis timer, hashes rehashing, keys collection.
authorantirez <antirez@gmail.com>
Sun, 13 May 2012 19:52:35 +0000 (21:52 +0200)
committerantirez <antirez@gmail.com>
Mon, 14 May 2012 15:43:23 +0000 (17:43 +0200)
commita8a981a834f1e8704ed2250ec14646e01760756b
tree99e847a5f1eb68c8aa0c7ee6ae42cedc9d33839a
parentf7f2b2610e8181c13657c35e4f3cd06c94ba3ff9
Impovements for: Redis timer, hashes rehashing, keys collection.

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.
src/debug.c
src/redis.c
src/redis.h