Hello,

I had a look at slab allocation, and saw two strange things:

The first one concern the special value for chunk minimal size when
chunk_factor is 2:
/* Factor of 2.0 means use the default memcached behavior */
    if (factor == 2.0 && size < 128)
        size = 128;

I think I understand the purpose of this one: having a chunk size
aligned on power of 2. But why am I forced to do so ? As I can tune
chunk_size with -n option, why having -f 2 -n x with x being less than
72 (128 - sizeof(item)) isn't authorized ?

The other point is that slab classes stop at POWER_BLOCK / 2:
    while (++i < POWER_LARGEST && size <= POWER_BLOCK / 2) {

It means some slab classes are missing whereas they may be useful.
Imagine I have the default settings. Classes grow with factor 1.25
until class 38 (478568 bytes) and then class 39 is 1MB. So each time I
store an item of size around half a MB, it uses a 1 MB chunk. Is it on
purpose, or is it some code that remains from time where chunk factor
was not tunable ?

Regards,
Colin

Reply via email to