mirror of
https://github.com/fluencelabs/redis
synced 2025-06-23 14:01:34 +00:00
LRU: Make cross-database choices for eviction.
The LRU eviction code used to make local choices: for each DB visited it selected the best key to evict. This was repeated for each DB. However this means that there could be DBs with very frequently accessed keys that are targeted by the LRU algorithm while there were other DBs with many better candidates to expire. This commit attempts to fix this problem for the LRU policy. However the TTL policy is still not fixed by this commit. The TTL policy will be fixed in a successive commit. This is an initial (partial because of TTL policy) fix for issue #2647.
This commit is contained in:
@ -558,10 +558,9 @@ struct evictionPoolEntry; /* Defined in evict.c */
|
||||
typedef struct redisDb {
|
||||
dict *dict; /* The keyspace for this DB */
|
||||
dict *expires; /* Timeout of keys with a timeout set */
|
||||
dict *blocking_keys; /* Keys with clients waiting for data (BLPOP) */
|
||||
dict *blocking_keys; /* Keys with clients waiting for data (BLPOP)*/
|
||||
dict *ready_keys; /* Blocked keys that received a PUSH */
|
||||
dict *watched_keys; /* WATCHED keys for MULTI/EXEC CAS */
|
||||
struct evictionPoolEntry *eviction_pool; /* Eviction pool of keys */
|
||||
int id; /* Database ID */
|
||||
long long avg_ttl; /* Average TTL, just for stats */
|
||||
} redisDb;
|
||||
@ -1606,7 +1605,7 @@ void disconnectAllBlockedClients(void);
|
||||
void activeExpireCycle(int type);
|
||||
|
||||
/* evict.c -- maxmemory handling and LRU eviction. */
|
||||
struct evictionPoolEntry *evictionPoolAlloc(void);
|
||||
void evictionPoolAlloc(void);
|
||||
|
||||
/* Git SHA1 */
|
||||
char *redisGitSHA1(void);
|
||||
|
Reference in New Issue
Block a user