VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session...

22
VPP Host Stack Transport, Session, VCL Florin Coras, Dave Barach

Transcript of VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session...

Page 1: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

VPP Host StackTransport, Session, VCL

Florin Coras, Dave Barach

Page 2: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

VPP Host Stack

FD.io Mini-Summit at KubeCon Europe 2019

Session

TCP

IP, DPDK

App Interface

App

rx txmq

VPP

Page 3: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 4: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 5: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 6: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 7: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 8: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 9: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 10: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 11: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 12: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 13: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 14: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 15: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 16: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

Redirected Connections (Cut-through)

FD.io Mini-Summit at KubeCon Europe 2019

Cut-Through

IP, DPDK

App Interface

client server

connect bind

Session

Page 17: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 18: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 19: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 20: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

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

Page 21: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

• 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

Page 22: VPP Host Stack · VPP Host Stack: Session Layer FD.io Mini-Summit at KubeCon Europe 2019 Session TCP IP, DPDK App Interface App mqrxtx §Exposes APIs transports can use for enqueueing

Thank you!

FD.io Mini-Summit at KubeCon Europe 2019

? Florin Corasemail:([email protected])irc: florinc