Main Points How virtual machines work Why network and disk - - PowerPoint PPT Presentation

main points
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Main ¡Points

  • How ¡virtual ¡machines ¡work ¡
  • Why ¡network ¡and ¡disk ¡I/O ¡is ¡slow ¡ ¡
  • What ¡we ¡can ¡do ¡about ¡it ¡
slide-2
SLIDE 2

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

slide-3
SLIDE 3

Virtual ¡Machines

  • Most ¡data ¡centers ¡insert ¡an ¡extra ¡“virtual ¡machine” ¡

layer ¡

  • Modify ¡host ¡opera@ng ¡system ¡so ¡that ¡it ¡can ¡run ¡a ¡

“guest” ¡opera@ng ¡system ¡as ¡a ¡(user-­‑level) ¡applica@on ¡

  • Guest ¡opera@ng ¡system ¡thinks ¡it ¡is ¡running ¡on ¡raw ¡

hardware ¡

  • Runs ¡at ¡user-­‑level ¡
  • Applica@on ¡(guest ¡user-­‑level) ¡thinks ¡it ¡is ¡running ¡on ¡

guest ¡OS ¡running ¡on ¡raw ¡hardware ¡

  • Has ¡guest ¡OS ¡to ¡itself ¡
slide-4
SLIDE 4

Virtual ¡Machine ¡Pros/Cons

  • Separa@on ¡of ¡data ¡center ¡management ¡from ¡

applica@on’s ¡choice ¡of ¡opera@ng ¡system ¡

  • Mul@ple ¡web ¡servers ¡per ¡physical ¡machine ¡
  • Each ¡with ¡a ¡different ¡OS ¡ ¡
  • Easy ¡to ¡migrate ¡virtual ¡machine ¡
  • Easy ¡to ¡limit ¡access ¡by ¡guest ¡OS ¡to ¡other ¡nodes ¡
  • Cost ¡of ¡redirec@on ¡
  • For ¡virtual ¡memory ¡mapping ¡and ¡I/O ¡
  • Emerging ¡hardware ¡support ¡to ¡reduce ¡cost ¡
slide-5
SLIDE 5

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

slide-6
SLIDE 6

Ques5on

  • How ¡many ¡crossings ¡are ¡needed ¡to ¡handle ¡a ¡web ¡

request ¡on ¡a ¡server ¡running ¡on ¡a ¡guest ¡OS ¡running ¡

  • n ¡a ¡virtual ¡machine? ¡
  • Network ¡I/O ¡interrupt ¡delivered ¡to ¡host ¡kernel ¡
  • Transfers ¡control ¡to ¡guest ¡OS ¡to ¡handle ¡interrupt ¡
  • Return ¡from ¡interrupt ¡back ¡to ¡host ¡kernel ¡
  • Resumes ¡applica@on ¡
  • System ¡call ¡trap ¡to ¡read ¡from ¡network, ¡to ¡host ¡kernel ¡
  • Transfers ¡control ¡to ¡guest ¡OS ¡to ¡handle ¡system ¡call ¡
  • Return ¡from ¡system ¡call ¡back ¡to ¡host ¡kernel ¡
  • Resumes ¡applica@on ¡
slide-7
SLIDE 7

Virtual ¡Machines ¡and ¡Virtual ¡Memory

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

slide-8
SLIDE 8
slide-9
SLIDE 9

Shadow ¡Page ¡Tables

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

slide-10
SLIDE 10

Hardware ¡Support ¡for ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ Virtual ¡Machine ¡Transla5on

  • x86 ¡recently ¡added ¡hardware ¡support ¡for ¡running ¡

virtual ¡machines ¡at ¡user ¡level ¡

  • Opera@ng ¡system ¡kernel ¡ini@alizes ¡two ¡sets ¡of ¡

transla@on ¡tables ¡

  • One ¡for ¡the ¡guest ¡OS ¡
  • One ¡for ¡the ¡host ¡OS ¡
  • Hardware ¡translates ¡address ¡in ¡two ¡steps ¡
  • First ¡using ¡guest ¡OS ¡tables, ¡then ¡host ¡OS ¡tables ¡
  • TLB ¡holds ¡composi@on ¡
slide-11
SLIDE 11

Containers

  • Provide ¡applica@ons ¡the ¡illusion ¡of ¡their ¡own ¡virtual ¡

machine ¡

  • Own ¡process ¡ID ¡table ¡
  • Own ¡network ¡socket ¡addresses ¡
  • Own ¡file ¡descriptor ¡table ¡
  • Running ¡directly ¡on ¡Linux ¡or ¡other ¡OS ¡
  • By ¡modifying ¡system ¡call ¡handling ¡
  • No ¡system ¡call ¡redirec@on ¡
  • No ¡virtual ¡machine ¡redirec@on ¡
slide-12
SLIDE 12

Ar Arrakis: ¡High ¡I/O ¡Performance ¡OS

  • Server ¡I/O ¡performance ¡ma[ers ¡
  • Key-­‑value ¡stores, ¡web ¡& ¡file ¡servers, ¡lock ¡managers, ¡… ¡
  • Can ¡OSes ¡deliver ¡hardware ¡performance? ¡
  • Example ¡system: ¡Dell ¡PowerEdge ¡R520 ¡

Intel ¡X520 ¡ 10G ¡NIC ¡ Intel ¡RS3 ¡RAID ¡ 1GB ¡flash-­‑backed ¡cache ¡ Sandy ¡Bridge ¡CPU ¡ 6 ¡cores, ¡2.2 ¡GHz ¡

+ ¡ + ¡ = ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡$1,200 ¡

Today’s ¡I/O ¡devices ¡are ¡fast ¡

50ns ¡/ ¡64B ¡pkt ¡ 25 ¡us ¡/ ¡1KB ¡write ¡

slide-13
SLIDE 13

Networks: ¡Fast ¡and ¡Growing ¡Faster

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 ¡

12ns ¡inter-­‑arrival ¡@me ¡for ¡ 64B ¡packets ¡at ¡40Gbps ¡

slide-14
SLIDE 14

Can’t ¡we ¡just ¡use ¡Linux?

slide-15
SLIDE 15

Kernel ¡

Linux ¡ ¡I/O ¡Performance

Redis ¡

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 ¡

Data ¡ Path ¡

10G ¡NIC ¡ 50ns ¡/ ¡64B ¡packet ¡ RAID ¡Storage ¡ 25 ¡us ¡/ ¡1KB ¡write ¡ 9 ¡us ¡ 163 ¡us ¡

Kernel ¡media^on ¡ is ¡too ¡heavyweight ¡

slide-16
SLIDE 16
  • Skip ¡kernel ¡& ¡deliver ¡I/O ¡directly ¡to ¡applica@ons ¡
  • Reduce ¡OS ¡overhead ¡

¡

  • Keep ¡classical ¡server ¡OS ¡kernel ¡features ¡
  • Process ¡protec@on ¡
  • Resource ¡limits ¡
  • I/O ¡protocol ¡flexibility ¡
  • Global ¡naming ¡
  • The ¡hardware ¡can ¡help ¡us… ¡

Ar Arrakis ¡Goals

slide-17
SLIDE 17

Webserver ¡

Redis ¡

  • Standard ¡on ¡network, ¡emerging ¡on ¡storage ¡

¡ Provided ¡in ¡hardware: ¡

  • Mul@plexing ¡
  • E.g., ¡Virtual ¡network ¡cards ¡(VNICs) ¡
  • Protec@on ¡
  • A[ach ¡VNICs ¡to ¡applica@on ¡memory ¡
  • Packet ¡filters, ¡logical ¡disks: ¡

Allow ¡only ¡eligible ¡I/O ¡from ¡apps ¡

  • I/O ¡Scheduling ¡
  • Rate ¡limiters, ¡packet ¡schedulers ¡

Hardware ¡I/O ¡Virtualiza5on

NIC ¡packet ¡filters ¡ Network ¡

Rate ¡limiters ¡

VNIC 1 VNIC 2

slide-18
SLIDE 18

Kernel ¡

Naming ¡ Resource ¡limits ¡ Access ¡control ¡

Redis ¡

How ¡to ¡skip ¡the ¡kernel?

Redis ¡ I/O ¡Devices ¡

API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Copying ¡ Protec@on ¡

Data ¡ Path ¡

Library ¡

slide-19
SLIDE 19

Kernel ¡

Naming ¡ Resource ¡limits ¡ Access ¡control ¡

Kernel ¡

Naming ¡ Resource ¡limits ¡ Access ¡control ¡

Redis ¡

Ar Arrakis ¡I/O ¡Architecture

Redis ¡ I/O ¡Devices ¡

API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Protec@on ¡

Data ¡Path ¡ Control ¡Plane ¡ Data ¡Plane ¡

slide-20
SLIDE 20

Ar Arrakis ¡ ¡Control ¡Plane

  • Access ¡control ¡
  • Do ¡once ¡when ¡configuring ¡data ¡plane ¡
  • Enforced ¡via ¡NIC ¡filters, ¡logical ¡disks ¡
  • Resource ¡limits ¡
  • Program ¡hardware ¡I/O ¡schedulers ¡
  • Global ¡naming ¡
  • Virtual ¡file ¡system ¡s@ll ¡in ¡kernel ¡
  • Storage ¡implementa^on ¡in ¡applica^ons ¡
slide-21
SLIDE 21

Redis ¡

Storage ¡Space ¡Alloca5on

Kernel ¡ Disk ¡space ¡

Free ¡space ¡ Free ¡space ¡ Used ¡ Virtual ¡Storage ¡Area ¡ Free ¡space ¡

create_storage(1G)

HW ¡

  • ps ¡
slide-22
SLIDE 22

Virtual ¡Storage ¡Area ¡ ¡

/tmp/lockfile /var/lib/key_value.db /etc/config.rc …

Kernel ¡ VFS ¡ emacs ¡

  • pen(“/etc/config.rc”) ¡

Redis ¡

Fast ¡ HW ¡ops ¡

Global ¡Naming

Logical ¡ disk ¡ Indirec^on ¡

slide-23
SLIDE 23

Kernel ¡

Naming ¡ Resource ¡limits ¡ Access ¡control ¡

Redis ¡

Ar Arrakis ¡I/O ¡Architecture

Redis ¡ I/O ¡Devices ¡

API ¡ Mul@plexing ¡ I/O ¡Scheduling ¡ I/O ¡Processing ¡ Protec@on ¡

Data ¡Path ¡ Control ¡Plane ¡ Data ¡Plane ¡ Redis ¡

API ¡ I/O ¡Processing ¡

slide-24
SLIDE 24

Re Redis ¡ ¡Latency

  • Reduced ¡(in-­‑memory) ¡GET ¡latency ¡by ¡65% ¡
  • Reduced ¡(persistent) ¡SET ¡latency ¡by ¡81% ¡

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% ¡

slide-25
SLIDE 25

Re Redis ¡ ¡Throughput

1x ¡ 9x ¡ 0 ¡ 20 ¡ 40 ¡ 60 ¡ 80 ¡ 100 ¡ 120 ¡ Throughput ¡ [k ¡transac@ons/s] ¡

SET ¡opera@ons ¡

Arrakis ¡ Intel ¡RS3 ¡ [25us] ¡ Linux ¡ Intel ¡RS3 ¡ [25us] ¡ Arrakis ¡ ioDrive2 ¡ [15us] ¡

slide-26
SLIDE 26

me memc mcached ¡Scalability

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 ¡

slide-27
SLIDE 27

Fl FlexNIC: ¡ : ¡ A ¡Model ¡for ¡Integrated ¡NIC/SW ¡Processing

  • Must ¡be ¡implementable ¡at ¡line ¡rate ¡with ¡low ¡cost ¡
  • Match+ac@on ¡pipeline: ¡

Ac@on ¡ALU ¡ Match ¡Table ¡ Parser ¡ M+A ¡Stage ¡1 ¡ M+A ¡2 ¡

. ¡. ¡. ¡

Extracted ¡ Header ¡Fields ¡ Packet ¡ Modified ¡Fields ¡

slide-28
SLIDE 28

Match+Ac5on ¡Programs: ¡Ac5ons

Supports: ¡ Does ¡not ¡support: ¡

Match: ¡

¡ ¡ ¡ ¡IF ¡udp.port ¡== ¡kvs ¡

Ac^on: ¡

¡ ¡ ¡ ¡core ¡= ¡HASH(kvs.key) ¡% ¡2 ¡ ¡ ¡ ¡ ¡DMA ¡hash, ¡kvs ¡TO ¡Cores[core] ¡

  • Loops ¡
  • Complex ¡calcula@ons ¡
  • Keeping ¡large ¡state ¡
  • Steer ¡packet ¡
  • Calculate ¡hash/Xsum ¡
  • Ini@ate ¡DMA ¡opera@ons ¡
  • Trigger ¡reply ¡packet ¡
  • Modify ¡packets ¡
slide-29
SLIDE 29

FlexNIC: ¡M+A ¡for ¡NICs

¡ ¡ ¡

¡

  • Efficient ¡applica@on ¡level ¡processing ¡in ¡the ¡NIC ¡
  • Improve ¡locality ¡by ¡steering ¡to ¡cores ¡based ¡on ¡app ¡criteria ¡
  • Transform ¡packets ¡for ¡efficient ¡processing ¡in ¡SW ¡
  • DMA ¡directly ¡into ¡and ¡out ¡of ¡applica@on ¡data ¡structures ¡
  • Send ¡acknowledgements ¡on ¡NIC ¡

Ingress ¡ Pipeline ¡ Egress ¡ Pipeline ¡ DMA ¡ Pipeline ¡ Queues ¡

slide-30
SLIDE 30

Example: ¡Key-­‑Value ¡Store

4 ¡ 7 ¡ Hash ¡Table ¡

Core ¡1 ¡ Core ¡2 ¡

NIC ¡

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 ¡

  • Lock ¡conten@on ¡
  • Poor ¡cache ¡u@liza@on ¡
slide-31
SLIDE 31

Op5mizing ¡Reads: ¡Key-­‑based ¡ Steering

Core ¡1 ¡ Core ¡2 ¡

NIC ¡

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, ¡7, ¡8 ¡

1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡

Match: ¡

IF ¡udp.port ¡== ¡kvs ¡

Ac^on: ¡

core ¡= ¡HASH(kvs.key) ¡% ¡2 ¡ DMA ¡hash, ¡kvs ¡TO ¡Cores[core] ¡

  • No ¡locks ¡needed ¡
  • Be[er ¡cache ¡u@liza@on ¡
slide-32
SLIDE 32

Op5mizing ¡Writes: ¡Custom ¡DMA

  • DMA ¡to ¡applica@on-­‑level ¡data ¡structures ¡
  • Requires ¡packet ¡valida@on ¡and ¡transforma@on ¡

Item ¡Log ¡ Event ¡Queue ¡

G ¡

Item ¡1 ¡ Item ¡2 ¡

G ¡ S ¡

GET, ¡Client ¡ID, ¡Hash, ¡Key ¡ SET, ¡Client ¡ID, ¡Item ¡Pointer ¡

slide-33
SLIDE 33

Real-­‑5me ¡Analy5cs ¡System

  • Offload ¡(de)mul@plexing ¡and ¡ACK ¡genera@on ¡to ¡

FlexNIC ¡

NIC ¡ Sojware ¡ Rx ¡ Queue ¡ Tx ¡ Queue ¡ Count ¡ Count ¡ Rank ¡ Rank ¡ Demux ¡ ACKs ¡ Mux ¡

slide-34
SLIDE 34

Evalua5on ¡of ¡the ¡Model

  • Measure ¡impact ¡on ¡applica@on ¡performance ¡
  • Without ¡wai@ng ¡for ¡hardware ¡implementa@on ¡
  • Re-­‑use ¡exis@ng ¡NIC ¡func@onality ¡
  • Hash ¡on ¡certain ¡fields ¡
  • Sovware ¡emula@on ¡of ¡M+A ¡pipeline ¡

Key-­‑value ¡store: ¡

  • Workload: ¡100k ¡32B ¡keys, ¡64B ¡values, ¡90% ¡GET ¡
  • 6 ¡Core ¡Sandy ¡Bridge ¡Xeon ¡2.2GHz, ¡2x ¡10G ¡links ¡
slide-35
SLIDE 35

Key-­‑based ¡steering

  • Be[er ¡scalability ¡
  • PCIe ¡is ¡bo[leneck ¡for ¡4+ ¡cores ¡
  • 30-­‑45% ¡higher ¡throughput ¡
  • Processing ¡@me ¡reduced ¡from ¡510ns ¡to ¡310ns ¡

0 ¡ 2 ¡ 4 ¡ 6 ¡ 8 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ Throughput ¡[m ¡op/s] ¡ Number ¡of ¡CPU ¡Cores ¡ FlexKVS/Flow ¡ FlexKVS/Key ¡ FlexKVS/Linux ¡ Memcached ¡

Steering ¡and ¡custom ¡DMA ¡ reduces ¡@me ¡from ¡510ns ¡to ¡200ns ¡

slide-36
SLIDE 36

Arrakis ¡and ¡FlexNIC

  • Data ¡center ¡applica@ons ¡need ¡high ¡performance ¡I/O ¡
  • Rethink ¡opera@ng ¡system ¡and ¡I/O ¡hardware ¡
  • Deliver ¡packets, ¡storage ¡directly ¡to ¡applica@ons ¡
  • Hardware ¡support ¡for ¡flexible ¡I/O ¡pipeline ¡processing ¡
  • Source ¡code, ¡papers: ¡

http://arrakis.cs.washington.edu/