This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Slab Profile Support
thinkingfish edited this page Jul 13, 2012
·
3 revisions
The “naturally grown” slab classes work well for generic workload. In some cases, however, you may want to tune them to host objects of specific sizes only. Twemcache supports that via a new command line option: “-z <size1,…,sizeN>”. What it does is in stead of deciding a series of chunk sizes by minimum/maximum chunk size and growth factor, it only generates slab classes that can store objects of the sizes specified. This makes slab profile a good way to trade flexibility for increased memory efficiency.
Here is an example:
$ src/twemcache -z 128,512,1024,20480 [Thu Jul 12 21:29:15 2012] mc.c:1185 twemcache-2.4.0 started on pid 9373 with 4 worker threads [Thu Jul 12 21:29:15 2012] mc.c:1192 configured with debug logs disabled, asserts disabled, panic disabled, stats enabled, klog enabled [Thu Jul 12 21:29:15 2012] mc_slabs.c:74 slab size 1048576, slab hdr size 32, item hdr size 54, item chunk size 128, total memory 67108864 [Thu Jul 12 21:29:15 2012] mc_slabs.c:81 class 1: items 8191 size 128 data 74 slack 96 [Thu Jul 12 21:29:15 2012] mc_slabs.c:81 class 2: items 2047 size 512 data 458 slack 480 [Thu Jul 12 21:29:15 2012] mc_slabs.c:81 class 3: items 1023 size 1024 data 970 slack 992 [Thu Jul 12 21:29:15 2012] mc_slabs.c:81 class 4: items 51 size 20480 data 20426 slack 4064