FAQ
All our Redis master instances have maxmemory set to 80% of total RAM. Each
of these master also have a slave. RDB is disabled on the master (yet still
enabled on the slaves) to minimize disk I/O waste. The maxmemory policy
used is volatile-lru.

We noticed that Redis is using a lot of memory. I read somewhere that the
best percentage for maxmemory is 45% of total RAM since almost the same
amount (45% more) will be used for performing replication.

With mexmemory already set to 80% and redis already using almost all of
that, would adjusting it down to 45% impact performance? What would be the
implications for doing so?

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redis-db@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Josiah Carlson at Nov 17, 2015 at 7:45 pm
    Replies inline.
    On Tue, Nov 17, 2015 at 7:41 AM, wrote:

    All our Redis master instances have maxmemory set to 80% of total RAM.
    Each of these master also have a slave. RDB is disabled on the master (yet
    still enabled on the slaves) to minimize disk I/O waste. The maxmemory
    policy used is volatile-lru.
    Just in case you didn't know, volatile-lru will only delete keys that have
    an expiration set.

    We noticed that Redis is using a lot of memory. I read somewhere that the
    best percentage for maxmemory is 45% of total RAM since almost the same
    amount (45% more) will be used for performing replication.
    I am curious to know where you read that, because those numbers and
    information are at best misleading, and are most certainly wrong.

    Generally speaking, Redis doesn't really use any additional memory for
    slaving, except for initial slave connection that can cause a full snapshot
    to be created. During snapshot creation, memory use can double, but that
    depends on how long it takes to perform the snapshot, how many write
    operations you are performing at the same time, etc. You can look at your
    Redis log to see how much additional memory is used during the snapshot
    and/or bgrewriteaof process to get an idea of how much memory is actually
    being used to slave/snapshot/rewrite the AOF.

    With mexmemory already set to 80% and redis already using almost all of
    that, would adjusting it down to 45% impact performance?
    Not Redis itself; it will just delete your data earlier. Your clients may
    need to hit the DB more often, depending on your app.

    What would be the implications for doing so?
    Less memory used by Redis, less data stored in Redis, hit rates will go
    down if you are using Redis as a cache, and your working set is bigger than
    45% of memory.

      - Josiah

    --
    You received this message because you are subscribed to the Google Groups
    "Redis DB" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to redis-db+unsubscribe@googlegroups.com.
    To post to this group, send email to redis-db@googlegroups.com.
    Visit this group at http://groups.google.com/group/redis-db.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Redis DB" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
    To post to this group, send email to redis-db@googlegroups.com.
    Visit this group at http://groups.google.com/group/redis-db.
    For more options, visit https://groups.google.com/d/optout.
  • Chilumbu George at Nov 18, 2015 at 7:36 am
    Each of the Redis Instance in the cluster has total RAM of 15G. And each
    Redis instance has "maxmemory" set to 12G (80% of total RAM).

    However, we noticed in our xymon monitoring system that Redis is using swap
    (sometimes all the swap 100%) even if it seems that there is still free
    memory. Is this because setting maxmeory in Redis to 80% means that when
    all 80% memory is used, Redis will start using swap (or push other
    processes to use swap) instead of maybe just deleting some data? I really
    do not understand why Redis is using swap at all.

    The system snappiness is set to =0 on all Redis instances. So far, i was
    just able to release the swap and did not adjust the system value for
    snappiness.

    Below is what is being logged by our monitoring system xymon:

    redis-2-1.memory (ip_address) yellow (1089813 seconds)
    yellow Wed Nov 18 14:16:38 CST 2015 - Memory low
                  Memory Used Total Percentage
    &green Physical 15234M 16043M 94%
    &green Actual 11733M 16043M 73%
    &yellow Swap 839M 953M 88%


    redis-2-1.memory (ip_addresss) red (1077170 seconds)
    red Wed Nov 18 10:46:21 CST 2015 - Memory CRITICAL
                 Memory Used Total Percentage
    &green Physical 15193M 16043M 94%
    &green Actual 11698M 16043M 72%
    &red Swap 953M 953M 100%



    On Wednesday, November 18, 2015 at 3:45:14 AM UTC+8, Josiah Carlson wrote:

    Replies inline.

    On Tue, Nov 17, 2015 at 7:41 AM, <chilumb...@gmail.com <javascript:>>
    wrote:
    All our Redis master instances have maxmemory set to 80% of total RAM.
    Each of these master also have a slave. RDB is disabled on the master (yet
    still enabled on the slaves) to minimize disk I/O waste. The maxmemory
    policy used is volatile-lru.
    Just in case you didn't know, volatile-lru will only delete keys that have
    an expiration set.

    We noticed that Redis is using a lot of memory. I read somewhere that the
    best percentage for maxmemory is 45% of total RAM since almost the same
    amount (45% more) will be used for performing replication.
    I am curious to know where you read that, because those numbers and
    information are at best misleading, and are most certainly wrong.

    Generally speaking, Redis doesn't really use any additional memory for
    slaving, except for initial slave connection that can cause a full snapshot
    to be created. During snapshot creation, memory use can double, but that
    depends on how long it takes to perform the snapshot, how many write
    operations you are performing at the same time, etc. You can look at your
    Redis log to see how much additional memory is used during the snapshot
    and/or bgrewriteaof process to get an idea of how much memory is actually
    being used to slave/snapshot/rewrite the AOF.

    With mexmemory already set to 80% and redis already using almost all of
    that, would adjusting it down to 45% impact performance?
    Not Redis itself; it will just delete your data earlier. Your clients may
    need to hit the DB more often, depending on your app.

    What would be the implications for doing so?
    Less memory used by Redis, less data stored in Redis, hit rates will go
    down if you are using Redis as a cache, and your working set is bigger than
    45% of memory.

    - Josiah

    --
    You received this message because you are subscribed to the Google Groups
    "Redis DB" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to redis-db+u...@googlegroups.com <javascript:>.
    To post to this group, send email to redi...@googlegroups.com
    <javascript:>.
    Visit this group at http://groups.google.com/group/redis-db.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Redis DB" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
    To post to this group, send email to redis-db@googlegroups.com.
    Visit this group at http://groups.google.com/group/redis-db.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupredis-db @
categoriesredis
postedNov 17, '15 at 3:41p
activeNov 18, '15 at 7:36a
posts3
users2
websiteredis.io
irc#redis

2 users in discussion

Chilumbu George: 2 posts Josiah Carlson: 1 post

People

Translate

site design / logo © 2022 Grokbase