F-Stack - A Full User-Space Network Service With DMM: Based On DPDK, Freebsd Tcp/Ip Stack
F-Stack - A Full User-Space Network Service With DMM: Based On DPDK, Freebsd Tcp/Ip Stack
Hailong Wang
Explosive growth of data services
Challenges
service traffic:CDN,live streaming(RTMP),etc.
DDoS, CC
Solution
NIC: 25GbE40GbE100GbE
CPU: 24Cores48Cores56Cores
L2/L3: Kernel bapass(DPDK)
L4/L7: ?
The problem - Kernel
Thread0
Thread1
Thread2
Thread3
Thread4
Thread5
User space
Kernel space
CPU cores(NUMA)
NIC queues
User space
The solution - Kernel Bypass
Process3
Process2
Process1
Data plane
Process0
Control plane
Kernel space
What does F-Stack do?
APP
SDK
Posix-like API
DPDK
The characteristics of F-Stack
APP …… …… Full user-space
No context switch
SDK …… …… Zero copy
No hirqs and sirqs
Posix-like API …… ……
Shared-nothing architecture
FreeBSD TCP/IP stack …… ……
Linear scalability
No schedule
DPDK …… ……
No lock
No cache locality miss
Why FreeBSD
tcp_sendmsg
tcp_recestablished tcp_recvmsg
ip_finish_output
tcp_push
tcp_v4_recv tcp_v4_do_recv
tcp_write_xmit dev_queue_xmit
ip_local_deliver ip_recv
tcp_transmit_skb
netif_rx netif_recv_skb
ip_queue_xmit
TCP/IP stack on FreeBSD
read readv recvmsg recvfrom write writev
sosend
tcp_input
tcp_outpt
ip_input
ip_output
ether_demux
ether_input ether_output
User space FreeBSD TCP/IP stack
phymem
phymem mtx
timecounter
timecounter kernel,irq
kernel,irq threading
threading
uma_page_slab
uma_page_slab rw
ticks
ticks sched
sched
uma
uma rm
hz
hz wakeup
wakeup
kmem_malloc
kmem_malloc sx
timer
timer sleep
sleep
malloc
malloc cond
remove
hijack replace remove
&
replace
mmap/malloc rte_timer
(rte_mempool/rte_ ticks polling empty macro
malloc) timecounter
top
etc..
F-Stack Lib
Application Cases
Load Balance
4 layer: ipfw/nat
7 layer: nginx
Web Server
epoll-based http server: httpdns
nginx: live streaming(rtmp).
WAF
nginx+lua/openresty
SCTP
Limitations
Plug-in interface
module init
https://github.com/f-stack
Thanks!