Skip to content

Commit

Permalink
Use slab class growth factor for slab size limit
Browse files Browse the repository at this point in the history
Re Colin:
"When using a growth factor smaller than 2.0, the normal growth stops once
the chunk size reach half the page size (1 MB by default)."

This adds two more slab classes by default, but makes memcached a little
more efficient for larger values. This will create a *lot* more slabs if
you are increasing the page limit via -I

However, if you're lowering the memory limit, this helps keep things
efficient.
-Dormando
  • Loading branch information
Colin Pitrat authored and dustin committed Oct 30, 2009
1 parent 95c8220 commit 780a257
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slabs.c
Expand Up @@ -116,7 +116,7 @@ void slabs_init(const size_t limit, const double factor, const bool prealloc) {

memset(slabclass, 0, sizeof(slabclass));

while (++i < POWER_LARGEST && size <= settings.item_size_max / 2) {
while (++i < POWER_LARGEST && size <= settings.item_size_max / factor) {
/* Make sure items are always n-byte aligned */
if (size % CHUNK_ALIGN_BYTES)
size += CHUNK_ALIGN_BYTES - (size % CHUNK_ALIGN_BYTES);
Expand Down

0 comments on commit 780a257

Please sign in to comment.