VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session...
Transcript of VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session...
VPP Host StackTransport, Session, VCL
Florin Coras, Dave Barach
VPP Host Stack
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
App
rx txmq
VPP
mq
VPP Host Stack: Session Layer
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
App
rx txmq§ App-interface sub-layer maintains per app state § Allocates and manages segments, message
queues and fifos§ Exposes APIs for conveying session events
between applications and transports § Binary/native C API for external/builtin
applicationsapp worker
mq
session
io/ctrl events
app worker
rw data
VPP Host Stack: Session Layer
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
App
rx txmq
§ Allocates and manages sessions§ Session lookup tables (5-tuple) and
local/global session rule tables (filters)§ Support for pluggable transport protocols§ Isolates network resources via namespacing
TCP UDP TLS QUIC
session pools
session tables
IP FIB
app ns
VPP Host Stack: Session Layer
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
App
rx txmq
§ Exposes APIs transports can use for enqueueing data to apps
§ Handles segmentation of app data into buffers before sending it to transport protocols
§ Can enforce tx-pacing if transport asks for ittransport
app worker
rx txsession
io/ctrl events
read bytes
recv/send buffers
write bytes
evt poll
VPP Host Stack: SVM
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
App
rx txmq
§ Fifo segments:§ Shared memory segments allocated by
the app-interface sub-layer and mapped by applications
§ Preferred without file backing (memfd). Support for segments with file backing (shm) will eventually be deprecated
VPP Host Stack: SVM
FD.io Mini-Summit at KubeCon Europe 2019
§ message queue§ Allocated in first shared memory segment § Has two rings for control and io events
from vpp to app§ Supports condvar or eventfd signaling
Session
TCP
IP, DPDK
App Interface
App
rx txmq
VPP Host Stack: SVM
FD.io Mini-Summit at KubeCon Europe 2019
§ fifos§ Fixed header position and linked list of
memory chunks for actual data§ Can grow/shrink by adding/removing
chunks§ Lock free enqueue/dequeue but some
atomic operations needed§ Option to dequeue/peek data§ Support for out-of-order data enqueues
Session
TCP
IP, DPDK
App Interface
App
rx txmqmq
hdr
hdr
fifo segment
VPP Host Stack: TCP
FD.io Mini-Summit at KubeCon Europe 2019
§ Clean-slate implementation§ “Complete” state machine implementation,
connection management and flow control § Timestamps, SACKs§ High scale timers implementation§ NewReno and Cubic congestion control§ Fast recovery, timer based retransmissions§ Tx pacing§ Checksum offloading§ Protocol correctness tested with Defensics
Codenomicon
Session
TCP
IP, DPDK
App Interface
App
rx txmq
VPP Host Stack: Comms Library (VCL)
FD.io Mini-Summit at KubeCon Europe 2019
§ Apps can directly use the raw session layer APIs but then need to:§ Manage binary api and message queue
interaction with vpp§ Maintain session state, potentially deal
with thread safety§ Implement async communication
mechanisms
Session
TCP
IP, DPDK
App Interface
App
rx txmq
mqmq
sessions
session pool
locking logic
blockingor poll apis
VPP Host Stack: Comms Library (VCL)
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
§ VPP Comms library (VCL)§ Manages interaction with session layer § Abstracts sessions to integer session
handles§ Exposes epoll/select/poll functions§ Supports multi-worker applications§ Can handle mq notifications with both
mutex-condvar pair and eventfd signaling
App Interface
rx txmq
mqmq
App
sessions
vcl handles
blockingor poll apis
session pool
VCL
App
VPP Host Stack: Comms Library (VLS)
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
§ VCL Locked Sessions (VLS)§ Exposes northbound a vls handle table
shared by all workers§ Detects app threads and enforces vls table
and session locking on rw access§ Detects app forks and registers new
processes as vcl workersApp Interface
VLS+VCL
rx txmq
App
App
vcl handles
vcl worker
vls handles
blockingor poll apis
vls session pool
locking logic
VLS + VCL
App
VPP Host Stack: Comms Library (LDP)
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
LDP + VLS + VCL
rx txmq
§ LDP library § Uses LD_PRELOAD to intercept and
redirect syscalls to VLS§ Manages fd to vls session handle
translation§ When it works, it requires no changes
to applications§ Do not expect it to always work§ Functionally works with iperf, nginx,
sshd etc.§ Not optimized for performance
App
App
vls handles
VLS
fds
LDP
Data Transfer
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
server
mq
Session
TCP
IP, DPDK
client
mq
Congestion controlReliable transport
rx tx rx txenqueue to fifotx io event
enqueue to fiforx io notification
App Interface
poll tx eventsdequeue to bufferadd tcp header
App Interface
Data Transfer
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
server
mq
Session
TCP
IP, DPDK
client
mq
Congestion controlReliable transport
rx tx rx tx
enqueue to fiforx io notification
App Interface App Interface
Some rough numbers on a E2699 w/XL710: ~36Gbps/core (1.5k MTU) half-duplex!
enqueue to fifotx io event
poll tx eventsdequeue to bufferadd tcp header
Redirected Connections (Cut-through)
FD.io Mini-Summit at KubeCon Europe 2019
Cut-Through
IP, DPDK
App Interface
client server
connect bind
Session
Redirected Connections (Cut-through)
FD.io Mini-Summit at KubeCon Europe 2019
Cut-Through
IP, DPDK
App Interface
client server
acceptedconnected
§ Cut-through transport:§ Tracks the sessions§ Allocates ssvm segment for fifos§ Asks apps to map segment
tx/rxrx/tx
Session
Redirected Connections (Cut-through)
FD.io Mini-Summit at KubeCon Europe 2019
Cut Through
IP, DPDK
App Interface
client server
Throughput is around ~120Gbps half-duplex if receiver does not touch the data!
acceptedconnected
tx/rxrx/tx
Session
§ Cut-through transport:§ Tracks the sessions§ Allocates ssvm segment for fifos§ Asks apps to map segment
VPP builtin apps
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
Builtin apprxtx
connect/listen
§ Use app-interface C apis§ Applications provide at attachment time
callback functions for io/ctrl events§ Shm segment/fifo segment allocated in
process memory
VPP builtin apps
FD.io Mini-Summit at KubeCon Europe 2019
Session
TCP
IP, DPDK
App Interface
Builtin apprxtx
io/ctrl events
§ Ctrl/rx io events are delivered to app within vpp worker context
§ Tx io events from app to session layer rely on session layer message queue
§ E.g. http_static, echo apps
• Get the Code, Build the Code, Run the Code• Session layer: src/vnet/session• TCP: src/vnet/tcp• SVM: src/svm• VCL: src/vcl
• Read/Watch the Tutorials
• Read/Watch VPP Tutorials• Join the Mailing Lists
FD.io Mini-Summit at KubeCon Europe 2019
Next steps – Get involved
Thank you!
FD.io Mini-Summit at KubeCon Europe 2019
? Florin Corasemail:([email protected])irc: florinc