Main ¡Points
- How ¡virtual ¡machines ¡work ¡
- Why ¡network ¡and ¡disk ¡I/O ¡is ¡slow ¡ ¡
- What ¡we ¡can ¡do ¡about ¡it ¡
Main Points How virtual machines work Why network and disk - - PowerPoint PPT Presentation
Main Points How virtual machines work Why network and disk I/O is slow What we can do about it Server 4. 9. Request Reply Parse Request Format Reply
1. Network Socket Read
Hardware Server Kernel Network Interface
2. Copy Arriving Packet (DMA) 3. Kernel Copy 4. Parse Request 9. Format Reply 10. Write and Copy to Kernel Buffer 12. Format Outgoing Packet and DMA Request Buffer Reply Buffer
Disk Interface
7. Disk Data (DMA) 6. Disk Request 5. File Read 8. Kernel Copy
Hardware Virtual Disk
Guest Kernel
Timer Handler Guest PC Guest SP Guest Flags Guest Interrupt Table Syscall Handler
Host User Mode Guest Kernel Mode
Guest file system and other kernel services
Guest User Mode Host User Mode
Guest Process ... trap ... Guest Program Counter Guest Exception Stack Guest Process
Host Kernel
Timer Handler Host PC Host SP Host Flags Host Interrupt Table Syscall Handler
Host KernelMode
Host Exception Stack Physical Disk
Guest Virtual Address Space Guest Page Table Guest Virtual Address Guest Physical Address Host Physical Memory Host Page Table Guest Physical Address Host Physical Address Guest Physical Address Space
Guest Virtual Address Space Guest Page Table Guest Virtual Address Guest Physical Address Host Physical Memory Shadow Page Table Host Physical Address Host Page Table Guest Physical Address Host Physical Address Guest Physical Address Space
Intel ¡X520 ¡ 10G ¡NIC ¡ Intel ¡RS3 ¡RAID ¡ 1GB ¡flash-‑backed ¡cache ¡ Sandy ¡Bridge ¡CPU ¡ 6 ¡cores, ¡2.2 ¡GHz ¡
+ ¡ + ¡ = ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡$1,200 ¡
50ns ¡/ ¡64B ¡pkt ¡ 25 ¡us ¡/ ¡1KB ¡write ¡
100 ¡MbE ¡ 1 ¡GbE ¡ 10 ¡GbE ¡ 40 ¡GbE ¡ 100 ¡GbE ¡ 400 ¡GbE ¡ 100 ¡M ¡ 1 ¡G ¡ 10 ¡G ¡ 100 ¡G ¡ 1 ¡T ¡ 1990 ¡ 1995 ¡ 2000 ¡ 2005 ¡ 2010 ¡ 2015 ¡ 2020 ¡ Ethernet ¡Bandwidth ¡[bits/s] ¡ Year ¡of ¡Standard ¡Release ¡
HW ¡ 13% ¡
HW ¡18% ¡
Kernel ¡84% ¡ Kernel ¡62% ¡
App ¡ 3% ¡ App ¡20% ¡
SET ¡ GET ¡
% ¡OF ¡1KB ¡REQUEST ¡TIME ¡SPENT ¡
API ¡ Mul@plexing ¡ Naming ¡ Resource ¡limits ¡ Access ¡control ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Copying ¡ Protec@on ¡
10G ¡NIC ¡ 50ns ¡/ ¡64B ¡packet ¡ RAID ¡Storage ¡ 25 ¡us ¡/ ¡1KB ¡write ¡ 9 ¡us ¡ 163 ¡us ¡
Webserver ¡
Redis ¡
NIC ¡packet ¡filters ¡ Network ¡
Rate ¡limiters ¡
VNIC 1 VNIC 2
Naming ¡ Resource ¡limits ¡ Access ¡control ¡
API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Copying ¡ Protec@on ¡
Library ¡
Naming ¡ Resource ¡limits ¡ Access ¡control ¡
Naming ¡ Resource ¡limits ¡ Access ¡control ¡
API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Protec@on ¡
create_storage(1G)
/tmp/lockfile /var/lib/key_value.db /etc/config.rc …
Naming ¡ Resource ¡limits ¡ Access ¡control ¡
API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Protec@on ¡
API ¡ I/O ¡Processing ¡
9 ¡us ¡ 163 ¡us ¡ 4 ¡us ¡ 31 ¡us ¡
Arrakis ¡ Linux ¡ Arrakis ¡ Linux ¡(ext4) ¡
HW ¡18% ¡ HW ¡33% ¡ Kernel ¡62% ¡ libIO ¡35% ¡ App ¡20% ¡ App ¡32% ¡ HW ¡13% ¡ HW ¡77% ¡ Kernel ¡84% ¡
libIO ¡ 7% ¡ App ¡15% ¡ App ¡ 3% ¡
1x ¡ 9x ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ 100 ¡ 120 ¡ Throughput ¡ [k ¡transac@ons/s] ¡
SET ¡opera@ons ¡
1.8x ¡ 2x ¡ 3.1x ¡ 0 ¡ 200 ¡ 400 ¡ 600 ¡ 800 ¡ 1000 ¡ 1200 ¡ 1 ¡ 2 ¡ 4 ¡
Throughput ¡ (k ¡transac^ons/s) ¡
Number ¡of ¡CPU ¡cores ¡ Linux ¡ Arrakis ¡ 10Gb/s ¡interface ¡limit ¡ 1x ¡ 1x ¡ 1x ¡
Ac@on ¡ALU ¡ Match ¡Table ¡ Parser ¡ M+A ¡Stage ¡1 ¡ M+A ¡2 ¡
Extracted ¡ Header ¡Fields ¡ Packet ¡ Modified ¡Fields ¡
¡ ¡ ¡ ¡IF ¡udp.port ¡== ¡kvs ¡
¡ ¡ ¡ ¡core ¡= ¡HASH(kvs.key) ¡% ¡2 ¡ ¡ ¡ ¡ ¡DMA ¡hash, ¡kvs ¡TO ¡Cores[core] ¡
¡ ¡ ¡
Ingress ¡ Pipeline ¡ Egress ¡ Pipeline ¡ DMA ¡ Pipeline ¡ Queues ¡
4 ¡ 7 ¡ Hash ¡Table ¡
Core ¡1 ¡ Core ¡2 ¡
Receive-‑side ¡scaling: ¡
core ¡= ¡hash(connec@on) ¡% ¡N ¡
Client ¡1 ¡ K ¡= ¡3, ¡4 ¡ Client ¡2 ¡ K ¡= ¡1, ¡4, ¡7 ¡ Client ¡3 ¡ K ¡= ¡1, ¡7, ¡8 ¡
Core ¡1 ¡ Core ¡2 ¡
1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ Hash ¡Table ¡
Client ¡1 ¡ K ¡= ¡4, ¡3 ¡ Client ¡2 ¡ K ¡= ¡1, ¡4, ¡7 ¡ Client ¡3 ¡ K ¡= ¡1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