memcached on systems with small RAM

54 views
Skip to first unread message

Hans Kramer

unread,
Apr 27, 2015, 6:00:49 AM4/27/15
to memc...@googlegroups.com
Hi,

I am using memcached on a system with very modest RAM: 64Mb to be precise (an Artila Matrix 504).
I have specified -M 1 -t 1 to reduce the memory allocated by memcached. 
Now RSS is always modest and around an explainable value, however, VSZ is at least 20Mb and with every
thread I add VSZ increases with at least 6 Mbytes. If I understand this correctly, this relative "high" VSZ, increases the oom_score
a lot. Hence I would like to reduce unnecessary alloc as much as possible. 
I have briefly looked at the memcached source and I cannot any significant mallocs. Is this perhaps coming from the libevent
library?

Any insights will be helpful.

Kind regards

Hans

dormando

unread,
Apr 27, 2015, 7:24:28 PM4/27/15
to memc...@googlegroups.com
You'll run into a few problems... -m 1 won't work the way you think since
it'll force-allocate one slab page per slab class. we don't have a
fallback mode to cut that down.

We also don't do anything to detune the thread stack size (which is
probably 2mb still?), plus a handful of allocations around each worker
thread (the new event base, connection buffers, etc).

That still seems sort of high, but thread stacks + etc would account for
quite a bit of it. You can also try reducing the size of the hash table..
that could show up as VSZ if you haven't written anything into it yet.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to memcached+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

Hans Kramer

unread,
Apr 28, 2015, 3:53:44 AM4/28/15
to memc...@googlegroups.com
Thanks, I will look into that.

Hans

Perrin Harkins

unread,
Apr 28, 2015, 8:43:36 AM4/28/15
to memc...@googlegroups.com
You might want to look at alternatives in that kind of setup. For example, BerkeleyDB is quite a bit faster than memcached when your cache is just on one local system. The advantages of memcached come into play when you have a large cache across multiple machines.

- Perrin

--

Hans Kramer

unread,
Apr 28, 2015, 9:08:09 AM4/28/15
to memc...@googlegroups.com
Doesn't BerkelyDB write to disk? (of course I could use a tmpfs...... hmmm )
And I us  the auto expire of items in memcache....

Thanks for the tip, I definitely will consider it!

Hans

--

---
You received this message because you are subscribed to a topic in the Google Groups "memcached" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/memcached/c-jJSFKZ1d0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to memcached+...@googlegroups.com.

Perrin Harkins

unread,
Apr 28, 2015, 9:28:15 AM4/28/15
to memc...@googlegroups.com
It does write to disk, so maybe it's not appropriate for your use. It is widely used in embedded systems though.

Hans Kramer

unread,
Apr 28, 2015, 10:07:35 AM4/28/15
to memc...@googlegroups.com
Thanks Perrin,

it's definitely an alternative!

Hans
Reply all
Reply to author
Forward
0 new messages