Protocol stacks and multicore scalability
The evolving hardware-software interface
- r
Why we love and hate offload MSN 2010 Robert N. M. Watson University of Cambridge
Portions of this work supported by Juniper Networks, Inc.
Protocol stacks and multicore scalability The evolving - - PowerPoint PPT Presentation
Protocol stacks and multicore scalability The evolving hardware-software interface or Why we love and hate offload MSN 2010 Robert N. M. Watson University of Cambridge Portions of this work supported by Juniper Networks, Inc. Idealised
The evolving hardware-software interface
Why we love and hate offload MSN 2010 Robert N. M. Watson University of Cambridge
Portions of this work supported by Juniper Networks, Inc.
2
Network stack goodness
NIC NIC
The somebody else's problem cloud Network stack goodness magic
3
* … and end host-like middle nodes: proxies, application firewalls, anti-spam, anti-virus, …
4
5
6
7
* It sounds good so it must be true!
8
100Mb/s 10Gb/s 1Gb/s
9
10
Userspace Kernel Hardware user thread ithread Data stream from application TCP header encapsulation IP header encapsulation Kernel copies in data to mbufs + clusters Application Socket TCP IP Link layer + driver Checksum + transmit Ethernet frame encapsulation, insert in descriptor ring Device 2k, 4k, 9k, 16k
MSS MSS
TCP segmentation Move TCP segmentation from TCP layer to hardware
Reduce effective PPS to improve OS performance
11
Hardware Kernel ithread user thread Userspace Linker layer + driver IP TCP + Socket Socket Strip IP header Interpret and strips link layer header Kernel copies
clusters Receive, validate ethernet, IP, TCP checksums Reassemble segments Application Data stream to application Look up and deliver to socket Strip TCP header Move TCP segment reassembly from network protocol to device driver Device
* Interestingly, LRO is often done in software
12
Varying TSO and LRO − bandwidth
Net bandwidth in Gb/s Processes
1 2 3 4 5 6 7 8 2 4 6
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
13
14
* Again, try not to change the protocol…
15
!" #" $" %" &" '" (" )" *" +" #!" #",-./011" $",-./01101" %",-./01101" &",-./01101" 2.31." 31."
!"# $!"# %!"# &!"# '!"# (!"# )!"# *!"# +!"# ,!"# $!!"#
/ . 1 $ 2 3 . 4 5 # / . 1 $ 2 3 . 4 5 #
/ . 1 % 2 3 . 4 5 5 # / . 1 % 2 3 . 4 5 5 #
/ . 1 & 2 3 . 4 5 5 # / . 1 & 2 3 . 4 5 5 #
/ . 1 ' 2 3 . 4 5 5 # / . 1 ' 2 3 . 4 5 5 # "6785# "6-/3# "090#
16
Varying locking strategy − bandwidth
Net bandwidth in Gb/s Processes
1 2 3 4 5 6 7 8 1 2 3 4
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
17
Hardware Userspace Kernel ithread netisr software ithread user thread Device Application Linker layer + driver IP TCP + Socket Socket Data stream to application Validate checksum, strip IP header Validate checksum, strip TCP header Reassemble segments, deliver to socket Interpret and strips link layer header Kernel copies
clusters Receive, validate checksum Look up socket
Potential dispatch points
18
⚠ MTCP watch out! ⚠ The Toeplitz catastrophe
19
Varying dispatch strategy − bandwidth
Net bandwidth in Gb/s Processes
1 2 3 4 5 6 7 8 1 2 3 4
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
20
21
22
23
24
25
Network stack goodness NIC Application
Ithread 0 Ithread Ithread 2 Ithread 3 Ithread 4 Ithread 5 Ithread 6 Ithread 7 Queue 0 Queue Queue 2 Queue 3 Queue 4 Queue 5 Queue 6 Queue 7 Thread 0 Thread 1 Thread 2 Thread 3 Thread 4 Thread 5 Thread 6 Thread 7 Socket 0 Socket 1 Socket 2 Socket 3 Socket 4 Socket 5 Socket 6 Socket 7 Core 0 Core 1 Core 2 Core 3 Core 4 Core 5 Core 6 Core 7 Core 0 Core 1 Core 2 Core 3 Core 4 Core 5 Core 6 Core 7
Awkwardly random distribution
26
Network stack goodness NIC Application
Ithread 0 Ithread Ithread 2 Ithread 3 Ithread 4 Ithread 5 Ithread 6 Ithread 7 Queue 0 Queue Queue 2 Queue 3 Queue 4 Queue 5 Queue 6 Queue 7 Thread 0 Thread 1 Thread 2 Thread 3 Thread 4 Thread 5 Thread 6 Thread 7 Socket 0 Socket 1 Socket 2 Socket 3 Socket 4 Socket 5 Socket 6 Socket 7 Core 0 Core 1 Core 2 Core 3 Core 4 Core 5 Core 6 Core 7 Core 0 Core 1 Core 2 Core 3 Core 4 Core 5 Core 6 Core 7
Is this better?
27
28
Network stack goodness NIC NIC Network stack goodness Application Application Switches / Routers Switches / Routers
The somebody else's problem cloud
Quite a lot less magic
29
30