Issue
I've decided to use Memcached package to my Nodejs application.I wish to understand about the slab allocator in Memcached server.How the slabs are allocated and how the values are stored in the slab?
Solution
Memcached splits allocated memory into 'Pages' of fixed size(1 MB). Each page is further divided in 'Chunks' and associated with some 'Slab'.
A 'Slab' will be associated with multiple 'Pages' having 'Chunks' of same size to hold values in some range with max value as chunk size. Given this analogy a chunk size can be maximum of page size i.e. 1MB. This explains why the maximum size of value to be stored in memcache is limited by 1MB.
Let us take an example to make it clear. Yo want to store a value of 1001 bytes; memcached will look up the slab which holds values between 1000 and 2000 bytes. It then finds a page with an empty chunk and inserts the value into that chunk. You can find similar discussion here.
Hope it helps!
Answered By - arunk2 Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.