Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7441821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:04:40+00:00 2026-05-29T11:04:40+00:00

Does anybody know how much overhead per single item is required? When I insert

  • 0

Does anybody know how much overhead per single item is required?
When I insert 1 byte key the ‘stats’ command shows 65 bytes being consumed per item.

Is this expected and fixed?

Thanks,
Piotr

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:04:40+00:00Added an answer on May 29, 2026 at 11:04 am

    Yes, Memcache’s own data structures eat up more than 50 byte per item. It depends a little on your data and key, so assume 60+ bytes when on a 64 bit machine.

    One can see it when looking at memcache’s code: https://github.com/memcached/memcached/blob/master/memcached.h

    Here’s what makes up an item:

    /**
     * Structure for storing items within memcached.
     */
    typedef struct _stritem {
        struct _stritem *next;
        struct _stritem *prev;
        struct _stritem *h_next;    /* hash chain next */
        rel_time_t      time;       /* least recent access */
        rel_time_t      exptime;    /* expire time */
        int             nbytes;     /* size of data */
        unsigned short  refcount;
        uint8_t         nsuffix;    /* length of flags-and-length string */
        uint8_t         it_flags;   /* ITEM_* above */
        uint8_t         slabs_clsid;/* which slab class we're in */
        uint8_t         nkey;       /* key length, w/terminating null and padding */
        /* this odd type prevents type-punning issues when we do
         * the little shuffle to save space when not using CAS. */
        union {
            uint64_t cas;
            char end;
        } data[];
        /* if it_flags & ITEM_CAS we have 8 bytes CAS */
        /* then null-terminated key */
        /* then " flags length\r\n" (no terminating null) */
        /* then data with terminating \r\n (no terminating null; it's binary!) */
    } item;
    

    There are 3 pointers, which on a 64 bit machine sum up to 3 * 8 = 24 byte. There there a two time stamps, which should be 32 bit, so they make 8 byte in total. the following int should be 8 byte, the short should be 2, and u_int8 should be a single byte, so they sum up to 14.

    This makes a total of 46 bytes.

    If CAS is enable there is a 64 bit CAS value, which adds up 8 bytes: 54 Byte in total

    Now it gets messy: Following is character data, where flags and length of data are printed as decimals (code can be found at https://github.com/memcached/memcached/blob/master/items.c, line 80). Given that flag is “0”, key is one char, and data is empty, this makes:

    • 1 Byte key + 1 Byte 0
    • 1 Byte “Space”, 1 Byte flag “0”, 1 Byte “Space”, 1 Byte “0”
    • 2 Byte “\r\n” ( a line feed)
    • 2 Byte for termination data

    That’s another 10 Byte, making a total of 64 Byte for the smallest possible memcache item size (CAS enabled, you may disable it using the -C option).

    If you get 65 Byte, maybe your client set a flag of “10” or such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know how much texture memory will be available for OpenGL on the
Does anybody know whether I can use multiple data sources in a single stateless
does anybody know a command to bind scroll to top/ jump to top function
Does anybody know how much memory is used by a numpy ndarray? (with let's
Does anybody know any good resources for learning how to program CIL with in-depth
Does anybody know a technique to discover memory leaks caused by smart pointers? I
Does anybody know of any sample databases I could download, preferably in CSV or
Does anybody know of a way to list up the loaded plugins in Vim
Does anybody know the logic behind making DataSourceSelectArguments sealed? I've implemented a custom DataSource
Does anybody know a good tutorial about Squid plug-in development?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.