Reserval of memory?

Brad Fitzpatrick brad@danga.com
Wed, 4 Feb 2004 14:22:06 -0800 (PST)


So you're getting 72% efficiency.  All of LJ's memcaches are around
69-70%.

See the file doc/memory_management.txt in the memcached distribution for
details on the slab allocation.

We plan to change it at some point so we have one global LRU and store the
items in chunks, but that may kill performance, so we haven't been too
eager to put all the effort into it to get disappointed.

The reason we use a slab allocator instead of just using malloc() is
because earlier experience with malloc() showed the memory allocator
locking up and getting confused, unable to find enough contiguous memory
for even small items, after weeks/months of production.  A slab allocator
is guaranteed to never lock up, at the cost of wasting memory.  (not that
malloc() is perfectly efficient either.....)

- Brad


On Sat, 31 Jan 2004, Nick wrote:

> I have two memcacheds setup to use 512MB, one has been running for about one month, the other for only a week.  But no matter how long they're running, they stats command never shows them using more than ~370MB of memory to store items.  Is this because memcached is reserving this memory? Or is this memory used for other purposes to handle the storage of these items.  I show the memcacheds using just about all 512MB in the operating system, but they never seem to get close to the limit_maxbytes. Each server has anywhere from 1.3 to 1.4million items currently stored in it, under curr_items.  Does that mean there's roughly 114 bytes to store each item in the daemon?
>
>
> Nick
>
> STAT pid 776
> STAT uptime 170166
> STAT time 1075610968
> STAT version 1.1.9
> STAT rusage_user 690:410000
> STAT rusage_system 853:650000
> STAT curr_items 1316421
> STAT total_items 7998033
> STAT bytes 369595318
> STAT curr_connections 321
> STAT total_connections 247576
> STAT connection_structures 734
> STAT cmd_get 31288079
> STAT cmd_set 7994951
> STAT get_hits 28654473
> STAT get_misses 2633606
> STAT bytes_read 1774989064
> STAT bytes_written 9845509166
> STAT limit_maxbytes 536870912