Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:12:11+00:00 2026-06-13T01:12:11+00:00

assuming all keys in a redis instance have an expire set, volatile-lru and allkeys-lru

  • 0

assuming all keys in a redis instance have an expire set, volatile-lru and allkeys-lru are similar. But is there a significative performance difference between the 2 when a key is removed?

Bonus question:

between 2 distinct instances configured with the allkeys-lru policy, having the same content and same configuration, except:

  • Instance A has all its keys with an expire set (different values of expire)
  • Instance B has none key with an expire set

Aside the overhead of memory in instance A due to the expires bits, is there a performance difference between the 2 when a key is removed by the allkeys-lru algorithm?

In both cases, I’m talking about instances of redis 2.4.x on linux 64 bits with maxmemory = 3Gb with 4-5000 keys when the maxmemory is reached (most of the keys are hashes).

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:12:12+00:00Added an answer on June 13, 2026 at 1:12 am

    redis.c, line 2311, unstable branch:

    /* volatile-lru and allkeys-lru policy */
    else if (server.maxmemory_policy == REDIS_MAXMEMORY_ALLKEYS_LRU ||
        server.maxmemory_policy == REDIS_MAXMEMORY_VOLATILE_LRU)
    {
        for (k = 0; k < server.maxmemory_samples; k++) {
            sds thiskey;
            long thisval;
            robj *o;
    
            de = dictGetRandomKey(dict);
            thiskey = dictGetKey(de);
            /* When policy is volatile-lru we need an additonal lookup
             * to locate the real key, as dict is set to db->expires. */
            if (server.maxmemory_policy == REDIS_MAXMEMORY_VOLATILE_LRU)
                de = dictFind(db->dict, thiskey);
            o = dictGetVal(de);
            thisval = estimateObjectIdleTime(o);
    
            /* Higher idle time is better candidate for deletion */
            if (bestkey == NULL || thisval > bestval) {
                bestkey = thiskey;
                bestval = thisval;
            }
        }
    }
    

    It seems like all things being equal allkeys-lru would be strictly speaking faster, but not by a significant magnitude. Chances are we are talking about not much more than a fraction of a microsecond faster.

    The second question got pretty much already answered, but just in case: it looks like it makes no difference to allkeys-lru how many keys are set to expire, or if any are. Both Instance A and B in your example would see the same performance when a key is purged by the lru algorithm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming that all foreign keys have the appropriate constraint, is there a simple SQL
Assuming all my Gradle plugin user going to have a MYAPP_HOME sys variable set
Assuming there are buttons with all the letters from the alphabet set as Text.
Assuming all you have is the binary data and no pre-canned functions, is there
Hi I'm looking to obtain all the (parent) categories with their children accordingly (assuming
Assuming I have a numerical string: var foo = 0; Assume I want to
Assuming that I have this: enum { A = 0x2E, B = 0x23, C
Assuming I have a ASP.NET MVC 3 application that runs in a web farm
assuming I have the following array: views = [ { :user_id => 1, :viewed_at
Assuming i have a post model with created_at, title, and id. How can i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.