PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] How the slabs are allocated in Memcached server?

 November 13, 2022     memcached, node.js     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing