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
Embracing the Ebb and Flow
colly
88
5.2k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Google's AI Overviews - The New Search
badams
0
1.6k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
520
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
400
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
The SEO Collaboration Effect
kristinabergwall1
1
560
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
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