Commit Graph

11 Commits

Author SHA1 Message Date
Vlad
a3fdc9cd82
Outdated comments, replace COUNTER_INIT_VAL with LFU_INIT_VAL, fix typo (#10888)
`COUNTER_INIT_VAL` doesn't exist in the code anymore so we can replace it with `LFU_INIT_VAL` entries
2022-06-21 08:14:31 +03:00
Binbin
0bfccc55e2
Fixed some typos, add a spell check ci and others minor fix (#8890)
This PR adds a spell checker CI action that will fail future PRs if they introduce typos and spelling mistakes.
This spell checker is based on blacklist of common spelling mistakes, so it will not catch everything,
but at least it is also unlikely to cause false positives.

Besides that, the PR also fixes many spelling mistakes and types, not all are a result of the spell checker we use.

Here's a summary of other changes:
1. Scanned the entire source code and fixes all sorts of typos and spelling mistakes (including missing or extra spaces).
2. Outdated function / variable / argument names in comments
3. Fix outdated keyspace masks error log when we check `config.notify-keyspace-events` in loadServerConfigFromString.
4. Trim the white space at the end of line in `module.c`. Check: https://github.com/redis/redis/pull/7751
5. Some outdated https link URLs.
6. Fix some outdated comment. Such as:
    - In README: about the rdb, we used to said create a `thread`, change to `process`
    - dbRandomKey function coment (about the dictGetRandomKey, change to dictGetFairRandomKey)
    - notifyKeyspaceEvent fucntion comment (add type arg)
    - Some others minor fix in comment (Most of them are incorrectly quoted by variable names)
7. Modified the error log so that users can easily distinguish between TCP and TLS in `changeBindAddr`
2021-06-10 15:39:33 +03:00
antirez
9f1b7ab2ed test-lru.rb: support for testing volatile-ttl policy. 2016-07-20 19:02:20 +02:00
antirez
ada70c7c53 LFU simulator: remove dead code. 2016-07-14 16:06:36 +02:00
antirez
fc92c667f7 LRU simulator: fix new entry creation decr time. 2016-07-14 15:55:17 +02:00
antirez
f50dc38bc2 LRU simulator: fix new entry creation. 2016-07-14 15:51:51 +02:00
antirez
09fcb00249 LFU: Simulation of the algorithm planned for Redis.
We have 24 total bits of space in each object in order to implement
an LFU (Least Frequently Used) eviction policy.

We split the 24 bits into two fields:

      8 bits      16 bits
    +--------+----------------+
    | LOG_C  | Last decr time |
    +--------+----------------+

LOG_C is a logarithmic counter that provides an indication of the access
frequency. However this field must also be deceremented otherwise what used
to be a frequently accessed key in the past, will remain ranked like that
forever, while we want the algorithm to adapt to access pattern changes.

So the remaining 16 bits are used in order to store the "decrement time",
a reduced-precision unix time (we take 16 bits of the time converted
in minutes since we don't care about wrapping around) where the LOG_C
counter is halved if it has an high value, or just decremented if it
has a low value.

New keys don't start at zero, in order to have the ability to collect
some accesses before being trashed away, so they start at COUNTER_INIT_VAL.
The logaritmic increment performed on LOG_C takes care of COUNTER_INIT_VAL
when incrementing the key, so that keys starting at COUNTER_INIT_VAL
(or having a smaller value) have a very high chance of being incremented
on access.

The simulation starts with a power-law access pattern, and later converts
into a flat access pattern in order to see how the algorithm adapts.
Currenty the decrement operation period is 1 minute, however note that
it is not guaranteed that each key will be scanned 1 time every minute,
so the actual frequency can be lower. However under high load, we access
3/5 keys every newly inserted key (because of how Redis eviction works).

This is a work in progress at this point to evaluate if this works well.
2016-07-14 15:21:48 +02:00
antirez
b19b2dff46 LRU: Fix output fixes to new test-lru.rb. 2016-07-11 16:26:02 +02:00
antirez
32a549432b LRU: test-lru.rb improved in different ways.
1. Scan keys with pause to account for actual LRU precision.
2. Test cross-DB with 100 keys allocated in DB1.
3. Output results that don't fluctuate depending on number of keys.
4. Output results in percentage to make more sense.
5. Save file instead of outputting to STDOUT.
6. Support running multiple times with average of outputs.
7. Label each square (DIV) with its ID as HTML title.
2016-07-11 16:23:50 +02:00
Aniruddh Chaturvedi
82154ffab5 Fix typo in unit test
Closes #2005
2014-09-29 06:49:09 -04:00
antirez
6972f18cbd Add test-lru.rb to utils.
This is a program useful to evaluate the Redis LRU algorithm behavior.
2014-03-21 09:52:05 +01:00