Redis Swapping?

52 views
Skip to first unread message

BeagleGuy

unread,
Oct 2, 2010, 11:54:58 PM10/2/10
to Redis DB
based on this screen shot: http://www.dropmocks.com/mBvx1

does redis need twice the memory I actually think it does? I believe
it spawns another process to save to disk, does that mean it actually
copies the memory and I should always assume if I have 16 gigs of ram
8 is the max for a single redis process?

Favo Yang

unread,
Oct 3, 2010, 3:42:50 AM10/3/10
to redi...@googlegroups.com
It use copy-on-write, so kernel will takes care of using minimal RSS for changed pages during fork. You may want to tweak vm.overcommit_memory, if your dataset close to physical memory. I don't have such Redis setup, so at least theoretically.

If you can not overcommit_memory for some reason, but still keep as large as memory Redis setup. One choice is using RDB, disable BG_SAVE, and dump database manually via SAVE. But it's will blocking any read / write and may take minutes if you have 16G data. Another way is using AOF, and use multiple redis (to use the multiple cores), then schedule log rewrite yourself, then you can make sure only one redis are copy-on-write fork itself at the same time.


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.


Sam Stokes

unread,
Oct 4, 2010, 7:07:30 AM10/4/10
to Redis DB
As Favo says, you want to set the kernel setting vm.overcommit_memory
to 1: see http://code.google.com/p/redis/wiki/FAQ#Background_saving_is_failing_with_a_fork()_error_under_Linux_eve

Even then, the forked save process consumes some additional RAM,
though not as much as 100% of the parent. I've found with a Redis
database of about 10GB, saves can take up to 2GB extra RAM, but I only
found that by trial and error and imagine it's very dependent on the
usage profile.

On Oct 3, 8:42 am, Favo Yang <favoy...@gmail.com> wrote:
> It use copy-on-write <http://en.wikipedia.org/wiki/Copy-on-write>, so kernel
> > redis-db+u...@googlegroups.com<redis-db%2Bunsubscribe@googlegroups.c om>
> > .

Aníbal Rojas

unread,
Oct 4, 2010, 8:41:44 AM10/4/10
to redi...@googlegroups.com


Couple warnings:

• if you have a lot of updates, and they span a big set of pages this will affect memory usage.
• Also virtualized hardware like EC2 can add some noise in this process.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.

To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.

Pedro Melo

unread,
Oct 3, 2010, 3:43:08 AM10/3/10
to redi...@googlegroups.com
Hi,

If your system supports copy-on-write (COW) virtual memory, no. It
will only duplicate pages of the save-to-disk process that are written
to by the main redis-server process.

You screenshot shows a very small SHR (memory shared with other
processes), but I don't know if that column counts COW, or only shared
libraries. I believe it is the latter. I don't of a way to see how
much of a process space is being shared via COW though.

Bye,
--
Pedro Melo
http://www.simplicidade.org/
xmpp:me...@simplicidade.org
mailto:me...@simplicidade.org

Reply all
Reply to author
Forward
0 new messages