A question about chunk size factor ?

Steven Grimm sgrimm at facebook.com
Mon Nov 12 08:32:41 UTC 2007


The change was made to reduce the average amount of space wasted on =20
items that don't exactly match the chunk sizes. With the powers-of-2 =20
scheme, if your item eats 1 byte more than will fit in a chunk, you =20
will end up with (just over) 50% memory efficiency for that item, =20
wasting nearly half the space because the item will only fit in a =20
chunk that's nearly twice as big as needed. With a power of less than =20=

2, you still waste some space, but less of it, and you can fit more =20
items in a given amount of cache memory.

The value of 1.25 was chosen as a reasonable default value for most =20
applications; it's tunable on the command line in recognition of the =20
fact that different factors might be closer to optimal for different =20
data sets.

At some point someone will probably come up with a memory allocator =20
that does more efficient packing of objects, but the slab allocator =20
has the advantage of being lightning-fast and immune to traditional =20
memory fragmentation. Its memory efficiency is not great but it =20
remains more or less constant no matter how many items are created and =20=

destroyed, rather than degrading over time.

-Steve


On Nov 11, 2007, at 7:38 PM, dtohuy326 wrote:

> Hello all,
>    I have a question about chunk size factor.That is
> when memcached version changed from v1.1.13 to v1.2.0,
> the chunk size factor change form '2' to '1.25'.Why to
> do this change=A1HIs factor '1.25' a experienced
> suitalbe valuse=A1H or 1.25^n is more easy to calculate?
> or have some other reason=A1HIt confused me a long time.
> Expect you for the answer.
> --
> best regard
> dtohuy
>
>
>
>      =20
> =
__________________________________________________________________________=
___________
> =B0=A8=A4W=C5=E9=C5=E7=A5=FE=B7sYahoo!=A9_=BC=AF=B9q=A4l=ABH=BDc2.0=A1C =
=20
> http://tw.mg0.mail.yahoo.com/dc/landing



More information about the memcached mailing list