Memcache and Slab Size

Posted on 2009-04-20
Last Modified: 2013-11-14
I'm trying to better understand how memcache's slabs work. Currently I'm storing thousands of very small items in memcache, and many are expiring way too soon. When I look at the stats, it shows memcache still has plenty of available memory.

So I'm wondering.. When memcache receives an item, and decides it should go into slab 7, does it evict items in slab 7 if that slab is full , even though memcache itself still has plenty of available memory? Or does it create a new slab, and store the item in there, leaving the existing items in slab 7 untouched?
Question by:headzoo
    LVL 23

    Expert Comment

    LVL 23

    Expert Comment

    I object I answer the quesion and did not get a response.

    LVL 23

    Accepted Solution

    if the user used memcache command with -L or -f it would let the user the result the user is looking for.

    You can tune the growth factor to reduce this effect by using the -f command line option. This will adapt the growth factor applied to make more effective use of the chunks and slabs allocated. For information on how to determine the current slab allocation statistics, see Section, memcached Slabs Statistics.
    If your operating system supports it, you can also start memcached with the -L command line option. With this option enabled, it will preallocate all the memory during startup using large memory pages. This can improve performance by reducing the number of misses in the CPU memory cache.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Having issues meeting security compliance criteria because of those pesky USB drives? Then I can help you! This article will explain how to disable USB Mass Storage devices in Windows Server 2008 R2.
    This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
    This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now