Why default maxmemory in configuration is 0

3,950 views
Skip to first unread message

Howard

unread,
Oct 23, 2013, 10:16:46 PM10/23/13
to redi...@googlegroups.com
Hello,

Given that the vm is not supported now, why not give the maxmemory some value like memcached, so user will have a clear understanding that this value must be set and avoid the case of swapping the data to disk by the OS?

CharSyam

unread,
Oct 23, 2013, 10:55:35 PM10/23/13
to redi...@googlegroups.com
hmm. first of all, we should know about vm feature in redis.

generally, vm feature means in redis 2.2
redis handle disk like os virtual memory.

but in 2.6, redis just use os memory.
so when maxmemory is 0 in 64bit, it will just use os swapping if you use over memory bigger than physical. but in 32bit, it will be set 3GB.

so "redis doesn't support vm feature" doesn't means redis can't use os swap memory.



2013/10/24 Howard <howa...@gmail.com>
Hello,

Given that the vm is not supported now, why not give the maxmemory some value like memcached, so user will have a clear understanding that this value must be set and avoid the case of swapping the data to disk by the OS?

--
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.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.

Howard

unread,
Oct 24, 2013, 2:36:18 AM10/24/13
to redi...@googlegroups.com
Yes I know redis will use swap when needed.

But as redis is an in-memory db, disk suck and no one want to use disk anyway. 
So, why not set a default value like 128M so as to alert people when thinking how many memory they need, they will think carefully and set the maxmemory.

For now, beginner might just think without swap to disk is fine.

Josiah Carlson

unread,
Oct 24, 2013, 7:32:55 PM10/24/13
to redi...@googlegroups.com
You claim that setting the maximum memory to 128 megs (or something else) will help people. I would claim that it wouldn't. If people install Redis and don't update the default configuration, with 128 maxmemory limit, then trying to use any more than that will either prevent writes, or it will cause data loss. Neither is desirable for most users.

On the other hand, leaving the default to 0, generally the user won't lose any data. They may run into performance problems if Redis starts swapping, but Redis makes no guarantees about performance (it only offers expectations).

If you recently ran into an issue where the default of "no limit" caught you, then might I recommend that you add monitoring via Munin, Monit, Nagios, etc., add notifications if/when memory use goes too high, and possibly also add notifications on the client side if your client-side performance goes bad (or periodically check your slowlog via cron job).

Regards,
 - Josiah

CharSyam

unread,
Oct 24, 2013, 7:42:00 PM10/24/13
to redi...@googlegroups.com
I agree with Josiah :)



2013/10/25 Josiah Carlson <josiah....@gmail.com>
Reply all
Reply to author
Forward
0 new messages