Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Memcached内存管理
Search
jiangbo
August 31, 2012
1.6k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Memcached内存管理
jiangbo
August 31, 2012
More Decks by jiangbo
See All by jiangbo
HDFS RAID
jiangbo
0
4k
HDFS
jiangbo
0
200
awk
jiangbo
4
330
vim
jiangbo
8
510
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Invisible Side of Design
smashingmag
301
52k
Building AI with AI
inesmontani
PRO
1
1.3k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
370
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
For a Future-Friendly Web
brad_frost
183
10k
Navigating Team Friction
lara
192
16k
Transcript
Memcached ଘཧ jiangbo$_ @mokeyj Friday, August 31, 12
Slab, Page, Chunk, Item Chunk ^ +------------------|------------------------------------------------------------+ | Memory |
| | +---------------|---------------------------------------------------------+ | | | +--------|---------------------+ +------------------------------+ | | | | |Page1 +-|---+ +-----+ +-----+ | |Page2 +-----+ +-----+ +-----+ | | | | | Slab |(1M) | 96B | | 68B | | 72B | | |(1M) | 92B | | 76B | | 84B | | | | | | 1 | +-----+ +-----+ +-----+ | | +-----+ +-----+ +-----+ | | | | | +------------------------------+ +------------------------------+ | | | +-------------------------------------------------------------------------+ | | | | +-------------------------------------------------------------------------+ | | | +------------------------------+ +------------------------------+ | | | | |Page1 +------+ +------+ | |Page2 +------+ +-------+ | | | | | Slab | (1M) | 128B | | 120B | | |(1M) | 128B | | 97B | | | | | | 2 | +------+ +------+ | | +------+ +-------+ | | | | | +------------------------------+ +------------------------------+ | | | +-------------------------------------------------------------------------+ | +-------------------------------------------------------------------------------+ Friday, August 31, 12
Item +---------------------------------------+ | key-value | cas | suffix | item
head | +---------------------------------------+ 实际ଘ์తਾ Item Size= data size + 32bytes item head Friday, August 31, 12
Chunk +------------------------------+ | data item | empty space | +------------------------------+
ଘ์ਾత࠷খ单ݩ Friday, August 31, 12
Page +-------------------------------------+ | chunk1 | chunk2 | chunk3 | chunk4
| +-------------------------------------+ ਃ请༻ଘత࠷খۭ间ɼ ᘍ认为1M Friday, August 31, 12
Slab +--------------------------------+ | Page1 | Page2 | Page3 | Page4
| +--------------------------------+ ҈chunkେখෆಉ䎞কଘ䎞ଟslabۭ间 Friday, August 31, 12
Slabॳ࢝Խ • ࠜਾෆಉతchunk_size䎞为ଟslabۭ间 • ॳ࢝࠷খchunk_sizeʢᘍ认为80=48+32ʣ • ࠜਾfactor҈ൺྫ递⃧ʢᘍ认1.25ʣ ࢀ⻅见 slabs.cதslabs_init() Friday,
August 31, 12
ਾଘ储 • 计ࢉitemେখɼፙ౸߹㭕తslab • ਗ਼ཧ该slabதత过ظchunk • ༗过ظchunkɼ则ਃ请৽ۭ间(slab_alloc) • ਃ请ۭ间ࣦ败ɼ༻LRUஞग़ ࢀ⻅见item.cதdo_item_alloc()
Friday, August 31, 12
ਃ请Slab • ဓSlotsྻදதਃ请 • ༗则ਃ请ҰPageత৽ۭ间 • ਃ请ۭ间ੋձઌஅslab_reasignɼᘍ认ෆ 䇖启 ࢀ⻅见slabs.cதslab_alloc() Friday,
August 31, 12
ଘ࿘费 • Item Size <= Chunk Size • Page Size%Chunk
Size ? • ቮ给slabతۭ间ᘍ认ෆճᏅ Friday, August 31, 12
Ҋྫੳ • ఆ⻓长问题导கେྔஞग़ Friday, August 31, 12
THX Friday, August 31, 12