SlideShare a Scribd company logo
SNABB
A TOOLKIT FOR BUILDING USER-SPACE NETWORK
FUNCTIONS
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
ABOUT IGALIA
Consultancy specialized in open-source
Base in Coruña but distributed all over the world (>60 people working from 15
different countries)
Contributors to projects such as WebKit, Chromium V8, etc
Other areas: Graphics, Multimedia, Networking
https://www.igalia.com/networking
AGENDA
What is Snabb?
How it works?
Catalog and programs
Use case: lwAFTR
WHAT IS SNABB?
Snabb is a toolkit for developing high-performance network functions in user-
space
WHAT IS A NETWORK FUNCTION?
A program that manipulates traffic data
Basic operations: read, forward, drop, modify, create...
Combining these primitives we can build any network function
EXAMPLES
Firewall: read incoming packets, compare to table of rules and execute an
action(forward or drop)
NAT: read incoming packets, modify headers and forward packet
Tunelling: read incoming packets, create a new packet, embed packet into new
one and send it
WHY SNABB?
Increasing improvement of commodity hardware: 10Gbps NICs at very
affordable prices
High-performance equipment is still very expensive
Idea: build an analog high-performance router using commodity hardware
WHY SNABB?
What software to put into this hardware?
Common intuition: Linux
Drawback: Linux is not suitable for high-performance networking
WHY NOT LINUX?
General-purpose operating system
An OS abstracts hw resources to offer high-level interfaces: filesystems,
processes, sockets...
Our network function will be divided into two lands: user-space and kernel-
space
Colorary: processing a packet has an inheritent cost => the cost of the OS
HIGH-PERFORMANCE NETWORKING
NIC: 10Gbps
Avg Packet-size: 550-byte
PPS: 2272727,27
1 packet every 440ns ((1/2272727,27)*10^9)
CPU: 2,5 Ghz
1100 cycles to process one packet (2,5 cycles/sec * 440 ns)
HIGH-PERFORMANCE NETWORKING
Packet-size: 64-byte: 51 ns per packet; 128 cycles per packet
Lock/Unlock: 16ns; Cache-miss: 32 ns
Source: Jonathan Corbet's
Small packet size => More packets per second => worse
Faster CPU => better
"Improving Linux networking performance"
USER-SPACE DRIVER
Do a kernel by-pass and manage the hardware directly from user-space:
Tell Linux not to manage the PCI device (unbind)
Do a mmap of the registers of the PCI device into addressable memory
Whenever we read/write the addressable memory, we're actually poking the
registers of the NIC
Follow the NIC's datasheet to implement operations such as initialize,
receive, transmit, etc
USER-SPACE NETWORKING
Snabb is not an isolated case of user-space networking:
Snabb (2012)
DPDK (2012)
VPP/fd.io (2016)
DPDK (Data-plane Development Kit, Intel)
VPP (Vector Packet Processing, Cisco)
RING-BUFFER
Very important to avoid packet drops
INSIDE SNABB
SNABB
Project started by Luke Gorrie
User-space networking benefit: freedom of programming language
Snabb is mostly written in Lua
Network functions are also written in Lua
Fast to run, fast to develop
Snabb means fast in Swedish :)
ABOUT LUA
Started in 1993 at University of Rio de Janeiro (PUC Rio)
Very similar to JavaScript, easy to learn
Very small and compact, it's generally embeded in other systems
Use cases: microcontrollers (NodeMCU), videogames (Grim Fandango), IA
(Torch7)
ABOUT LUAJIT
Just-in-time compiler for Lua
Extremely fast virtual machine!!
Very good integration with C thanks to FFI (Foreign Function Interface)
FFI: EXAMPLE
ffi.cdef[[
void syslog(int priority, const char*format, ...);
]]
ffi.C.syslog(2, "error:...");
local ether_header_t = ffi.typeof [[
/* All values in network byte order. */
struct {
uint8_t dhost[6];
uint8_t shost[6];
uint16_t type;
} __attribute__((packed))
]]
SNABB IN A NUTSHELL
A snabb program is an app graph
Apps are conected together via links
Snabb processes the program in units called breadths
NF: APP GRAPH
BREADTHS
A breadth has two steps:
inhale a batch of packets into the graph
process those packets
To inhale, the method pull of the apps is executed (if defined)
To process, the method push of the apps is executed (if defined)
# Pull function of included Intel 82599 driver
function Intel82599:pull ()
for i = 1, engine.pull_npackets do
if not self.dev:can_receive() then break end
local pkt = self.dev:receive()
link.transmit(self.output.tx, pkt)
end
end
# Push function of included PcapFilter
function PcapFilter:push ()
while not link.empty(self.input.rx) do
local p = link.receive(self.input.rx)
if self.accept_fn(p.data, p.length) then
link.transmit(self.output.tx, p)
else
packet.free(p)
end
end
end
PACKET PROCESSING
Normally only one app of the app graph introduces packets into the graph
The method push gives an opportunity to every app to do something with a
packet
APP GRAPH DEFINITION
local c = config.new()
-- App definition.
config.add(c, "nic", Intel82599, {
pci = "0000:04:00.0"
})
config.add(c, "filter", PcapFilter, "src port 80")
config.add(c, "writer", Pcap.PcapWriter, "output.pcap")
-- Link definition.
config.link(c, "nic.tx -> filter.input")
config.link(c, "filter.output -> writer.input")
engine.configure(c)
engine.main({duration=1})
PACKETS
struct packet {
uint16_t length;
unsigned char data[10*1024];
};
LINKS
struct link {
struct packet *packets[1024];
// the next element to be read
int read;
// the next element to be written
int write;
};
SNABB: APP CATALOG AND PROGRAMS
INVENTARY
apps: software components that developers combine together to build network
functions
programs: complete network functions
APPS I/O
Intel i210/i350/82599/XL710
Mellanox Connectx-4/5
Virtio host y guest
UNIX socket
Linux: tap and "raw" (e.g: eth0)
Pcap files
APPS L2
Flooding and learning bridge
VLAN insert/remove
ARP/NDP
APPS L3
IPv4/v6 fragmentation and reassembly
IPv4/v6 splitter
ICMPv4/v6 echo responder
Control-plane delegation (nh_fwd)
APPS L4
IPsec ESP
Lightweight 4-over-6 AFTR
Keyed IPv6 Tunnel
APPS MONITORING
IPFix capturer and exporter
L7 monitor/filtering (libndpi)
Pcap expressions filter (with own backend for code generation)
APPS TESTING
Lots of load generators: loadgen, packetblaster, loadbench...
USE CASE: LWAFTR
CONTEXT
2012-2014: Several RIRs run out of IPv4 public addresses
2008: IPv6 adoption starts to peak up
Still big dependency on IPv4: services, websites, programs, etc
SOLUTIONS
Carrier-Grade NAT: temporal solution for IPv4 address exhaustion problem
Deployment of Dual-Stack networks (IPv4 e IPv6)
Dual-Stack implies increasing complexity and costs (maintenance of two
separated networks)
Dual-Stack Lite (IPv6-only network which also offers IPv4 connectivity relying
on CGN)
Lightweight 4over6: iteration over Dual-Stack
LIGHTWEIGHT 4OVER6
LW4O6 - GOALS
RFC7596 fully complaint (lwAFTR part)
Performance: 2MPPS; 550-byte (packet-size); Binding-table: 1M subscribers.
No packet drops
LW4O6 - DEVELOPMENT
Version 1:
Prototype
Basic functionality (encapsulating/decapsulating)
Small binding-table (own format)
Development of tools to measure performance
LW4O6 - DEVELOPMENT
Version 2
Production quality
Fully standard compliant
Big binding-table: 1M subscribers (still customized format but much closer
to standard)
Add support for other necessary protocols: ARP, NDP, fragmentation,
reassembly, ping
Tons of optimizations (use of AVX instructions to speed up lookups)
LW4O6 - DEVELOPMENT
Version 3:
Added YANG support to Snabb
Support binding-table format according to standard
Support of execution as leader/worker (leader: control-plane/worker: data-
plane)
LW4O6 - DEVELOPMENT
Version 4:
Multiprocess (one leader, multiple workers)
Improvement of the Intel 10Gbps driver (added support for RSS, Received
Side Scaling)
Added alarms support according to latest draft
LIGHTWEIGHT 4OVER6 - TALKS
Juniper's vMX Lightweight 4over6 VNF
Charla:
Kostas Zordabelos's A real-world scale network VF using Snabb for lw4o6
Charla:
Juniper Tech Club, Marzo 2017
SDN Meetup, Abril 2017
OTHER PROGRAMS
PROGRAM: PACKET BLASTER
Generally useful tool: fill TX buffer of NIC with packets and transmit them over
and over again
Measures received traffic too
Easily saturates 10Gbps links
snabb packetblaster replay packets.pcap 82:00.1
PROGRAM: SNABBWALL
L7 firewall that optionally uses nDPI
Collaboration betwen Igalia and NLnet Foundation
Landed upstream in 2017
Website: http://snabbwall.org
PROGRAM: IPFIX
NETFLOW collector and exporter (v9 and IPFIX)
Line-rate speed on a single core. Further improvement: parallel processing via
RSS
Landed upstream very recently
PROGRAM: L2VPN
L2VPN over IPv6 (developed by Alexander Gall from SWITCH)
Pending to land upstream; used in production
Ideal Snabb use case: programmer/operator builds bespoke tool
PROGRAM: YOUR VNF
Snabb upstream open to include new network functions
Repository will grow as people will build new things
Igalia can build one for you
LAST NOTES ABOUT PERFORMANCE
CONSIDERATIONS
Isolcpus: Prevents the kernel to take a CPU to schedule processes
Dishable HyperThreading
Use HugePages (2MB) (Linux default is 4Kb)
Do not neglect NUMA when launching programs
Make use of SIMD instructions (AVX, AVX2) to speed up computations
(checksum)
Keep an eye on regressions: profile often
SUMMARY
Toolkit for developing high-performance network functions in user-space
Snabb provides apps which can be combined together forming a graph (network
function)
Snabb provides programs, complete network functions ready to use
Snabb provides libraries, to easy the development of new network functions
Completely written in Lua: easy to extend
Fast: kernel-by pass + high-level language + fast VM (LuaJIT)
THANKS!
Email: dpino@igalia.com
Twitter: @diepg
$ git clone https://github.com/snabbco/snabb.git
$ cd snabb
$ make

More Related Content

PDF
Practical virtual network functions with Snabb (8th SDN Workshop)
PPTX
TLDK - FD.io Sept 2016
PDF
FD.io - The Universal Dataplane
PDF
Practical virtual network functions with Snabb (SDN Barcelona VI)
PDF
Data Plane and VNF Acceleration Mini Summit
PDF
ODP Presentation LinuxCon NA 2014
PDF
LF_DPDK17_OpenNetVM: A high-performance NFV platforms to meet future communic...
PDF
Lenovo system management solutions
Practical virtual network functions with Snabb (8th SDN Workshop)
TLDK - FD.io Sept 2016
FD.io - The Universal Dataplane
Practical virtual network functions with Snabb (SDN Barcelona VI)
Data Plane and VNF Acceleration Mini Summit
ODP Presentation LinuxCon NA 2014
LF_DPDK17_OpenNetVM: A high-performance NFV platforms to meet future communic...
Lenovo system management solutions

What's hot (20)

PPT
Naveen nimmu sdn future of networking
PDF
Ryu sdn framework
PPTX
Next Generation Network Developer Skills
PDF
Tungsten Fabric Overview
PDF
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
PPTX
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
PDF
Openstack Neutron, interconnections with BGP/MPLS VPNs
PDF
Hands on with CoAP and Californium
PPTX
Openstack Neutron Insights
PDF
Inside Microsoft's FPGA-Based Configurable Cloud
PDF
HPC Best Practices: Application Performance Optimization
PDF
LF_DPDK17_Lagopus Router
PDF
EBPF and Linux Networking
PPTX
DevOops - Lessons Learned from an OpenStack Network Architect
PPTX
Tungsten Fabric and DPDK vRouter Architecture
PDF
Crossing the river by feeling the stones from legacy to cloud native applica...
PDF
Introducing HPC with a Raspberry Pi Cluster
PDF
Evolving Virtual Networking with IO Visor
PDF
Summit 16: Service Function Chaining: Demo and Usage
PDF
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Naveen nimmu sdn future of networking
Ryu sdn framework
Next Generation Network Developer Skills
Tungsten Fabric Overview
Using IO Visor to Secure Microservices Running on CloudFoundry [OpenStack Sum...
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
Openstack Neutron, interconnections with BGP/MPLS VPNs
Hands on with CoAP and Californium
Openstack Neutron Insights
Inside Microsoft's FPGA-Based Configurable Cloud
HPC Best Practices: Application Performance Optimization
LF_DPDK17_Lagopus Router
EBPF and Linux Networking
DevOops - Lessons Learned from an OpenStack Network Architect
Tungsten Fabric and DPDK vRouter Architecture
Crossing the river by feeling the stones from legacy to cloud native applica...
Introducing HPC with a Raspberry Pi Cluster
Evolving Virtual Networking with IO Visor
Summit 16: Service Function Chaining: Demo and Usage
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Ad

Similar to Snabb, a toolkit for building user-space network functions (ES.NOG 20) (20)

PDF
Production high-performance networking with Snabb and LuaJIT (Linux.conf.au 2...
PDF
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
PDF
NkSIP: The Erlang SIP application server
PDF
2014 carlos gzlez florido nksip the erlang sip application server
PDF
Node-RED and Minecraft - CamJam September 2015
PDF
Snabbflow: A Scalable IPFIX exporter
PPSX
FD.IO Vector Packet Processing
PPSX
FD.io Vector Packet Processing (VPP)
PDF
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
PDF
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
PPTX
High Performance Networking Leveraging the DPDK and Growing Community
PDF
LibOS as a regression test framework for Linux networking #netdev1.1
PDF
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
PPTX
Introduction to DPDK
PDF
Extending DevOps to Big Data Applications with Kubernetes
PDF
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
PPTX
DPDK summit 2015: It's kind of fun to do the impossible with DPDK
PDF
DPDK Summit 2015 - NTT - Yoshihiro Nakajima
PPTX
Software Stacks to enable SDN and NFV
PDF
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
Production high-performance networking with Snabb and LuaJIT (Linux.conf.au 2...
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
NkSIP: The Erlang SIP application server
2014 carlos gzlez florido nksip the erlang sip application server
Node-RED and Minecraft - CamJam September 2015
Snabbflow: A Scalable IPFIX exporter
FD.IO Vector Packet Processing
FD.io Vector Packet Processing (VPP)
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
High Performance Networking Leveraging the DPDK and Growing Community
LibOS as a regression test framework for Linux networking #netdev1.1
Snabb Switch: Riding the HPC wave to simpler, better network appliances (FOSD...
Introduction to DPDK
Extending DevOps to Big Data Applications with Kubernetes
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
DPDK summit 2015: It's kind of fun to do the impossible with DPDK
DPDK Summit 2015 - NTT - Yoshihiro Nakajima
Software Stacks to enable SDN and NFV
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
Ad

More from Igalia (20)

PDF
Life of a Kernel Bug Fix
PDF
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
PDF
Advancing WebDriver BiDi support in WebKit
PDF
Jumping Over the Garden Wall - WPE WebKit on Android
PDF
Collective Funding, Governance and Prioritiation of Browser Engine Projects
PDF
Don't let your motivation go, save time with kworkflow
PDF
Solving the world’s (localization) problems
PDF
The Whippet Embeddable Garbage Collection Library
PDF
Nobody asks "How is JavaScript?"
PDF
Getting more juice out from your Raspberry Pi GPU
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
PDF
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
PDF
CSS :has() Unlimited Power
PDF
Device-Generated Commands in Vulkan
PDF
Current state of Lavapipe: Mesa's software renderer for Vulkan
PDF
Vulkan Video is Open: Application showcase
PDF
Scheme on WebAssembly: It is happening!
PDF
EBC - A new backend compiler for etnaviv
PDF
RISC-V LLVM State of the Union
PDF
Device-Generated Commands in Vulkan
Life of a Kernel Bug Fix
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Advancing WebDriver BiDi support in WebKit
Jumping Over the Garden Wall - WPE WebKit on Android
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Don't let your motivation go, save time with kworkflow
Solving the world’s (localization) problems
The Whippet Embeddable Garbage Collection Library
Nobody asks "How is JavaScript?"
Getting more juice out from your Raspberry Pi GPU
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
CSS :has() Unlimited Power
Device-Generated Commands in Vulkan
Current state of Lavapipe: Mesa's software renderer for Vulkan
Vulkan Video is Open: Application showcase
Scheme on WebAssembly: It is happening!
EBC - A new backend compiler for etnaviv
RISC-V LLVM State of the Union
Device-Generated Commands in Vulkan

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
cuic standard and advanced reporting.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MYSQL Presentation for SQL database connectivity
cuic standard and advanced reporting.pdf
A comparative analysis of optical character recognition models for extracting...
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf

Snabb, a toolkit for building user-space network functions (ES.NOG 20)

  • 1. SNABB A TOOLKIT FOR BUILDING USER-SPACE NETWORK FUNCTIONS
  • 3. ABOUT IGALIA Consultancy specialized in open-source Base in Coruña but distributed all over the world (>60 people working from 15 different countries) Contributors to projects such as WebKit, Chromium V8, etc Other areas: Graphics, Multimedia, Networking
  • 5. AGENDA What is Snabb? How it works? Catalog and programs Use case: lwAFTR
  • 6. WHAT IS SNABB? Snabb is a toolkit for developing high-performance network functions in user- space
  • 7. WHAT IS A NETWORK FUNCTION? A program that manipulates traffic data Basic operations: read, forward, drop, modify, create... Combining these primitives we can build any network function
  • 8. EXAMPLES Firewall: read incoming packets, compare to table of rules and execute an action(forward or drop) NAT: read incoming packets, modify headers and forward packet Tunelling: read incoming packets, create a new packet, embed packet into new one and send it
  • 9. WHY SNABB? Increasing improvement of commodity hardware: 10Gbps NICs at very affordable prices High-performance equipment is still very expensive Idea: build an analog high-performance router using commodity hardware
  • 10. WHY SNABB? What software to put into this hardware? Common intuition: Linux Drawback: Linux is not suitable for high-performance networking
  • 11. WHY NOT LINUX? General-purpose operating system An OS abstracts hw resources to offer high-level interfaces: filesystems, processes, sockets... Our network function will be divided into two lands: user-space and kernel- space Colorary: processing a packet has an inheritent cost => the cost of the OS
  • 12. HIGH-PERFORMANCE NETWORKING NIC: 10Gbps Avg Packet-size: 550-byte PPS: 2272727,27 1 packet every 440ns ((1/2272727,27)*10^9) CPU: 2,5 Ghz 1100 cycles to process one packet (2,5 cycles/sec * 440 ns)
  • 13. HIGH-PERFORMANCE NETWORKING Packet-size: 64-byte: 51 ns per packet; 128 cycles per packet Lock/Unlock: 16ns; Cache-miss: 32 ns Source: Jonathan Corbet's Small packet size => More packets per second => worse Faster CPU => better "Improving Linux networking performance"
  • 14. USER-SPACE DRIVER Do a kernel by-pass and manage the hardware directly from user-space: Tell Linux not to manage the PCI device (unbind) Do a mmap of the registers of the PCI device into addressable memory Whenever we read/write the addressable memory, we're actually poking the registers of the NIC Follow the NIC's datasheet to implement operations such as initialize, receive, transmit, etc
  • 15. USER-SPACE NETWORKING Snabb is not an isolated case of user-space networking: Snabb (2012) DPDK (2012) VPP/fd.io (2016) DPDK (Data-plane Development Kit, Intel) VPP (Vector Packet Processing, Cisco)
  • 16. RING-BUFFER Very important to avoid packet drops
  • 18. SNABB Project started by Luke Gorrie User-space networking benefit: freedom of programming language Snabb is mostly written in Lua Network functions are also written in Lua Fast to run, fast to develop Snabb means fast in Swedish :)
  • 19. ABOUT LUA Started in 1993 at University of Rio de Janeiro (PUC Rio) Very similar to JavaScript, easy to learn Very small and compact, it's generally embeded in other systems Use cases: microcontrollers (NodeMCU), videogames (Grim Fandango), IA (Torch7)
  • 20. ABOUT LUAJIT Just-in-time compiler for Lua Extremely fast virtual machine!! Very good integration with C thanks to FFI (Foreign Function Interface)
  • 21. FFI: EXAMPLE ffi.cdef[[ void syslog(int priority, const char*format, ...); ]] ffi.C.syslog(2, "error:..."); local ether_header_t = ffi.typeof [[ /* All values in network byte order. */ struct { uint8_t dhost[6]; uint8_t shost[6]; uint16_t type; } __attribute__((packed)) ]]
  • 22. SNABB IN A NUTSHELL A snabb program is an app graph Apps are conected together via links Snabb processes the program in units called breadths
  • 24. BREADTHS A breadth has two steps: inhale a batch of packets into the graph process those packets To inhale, the method pull of the apps is executed (if defined) To process, the method push of the apps is executed (if defined)
  • 25. # Pull function of included Intel 82599 driver function Intel82599:pull () for i = 1, engine.pull_npackets do if not self.dev:can_receive() then break end local pkt = self.dev:receive() link.transmit(self.output.tx, pkt) end end
  • 26. # Push function of included PcapFilter function PcapFilter:push () while not link.empty(self.input.rx) do local p = link.receive(self.input.rx) if self.accept_fn(p.data, p.length) then link.transmit(self.output.tx, p) else packet.free(p) end end end
  • 27. PACKET PROCESSING Normally only one app of the app graph introduces packets into the graph The method push gives an opportunity to every app to do something with a packet
  • 28. APP GRAPH DEFINITION local c = config.new() -- App definition. config.add(c, "nic", Intel82599, { pci = "0000:04:00.0" }) config.add(c, "filter", PcapFilter, "src port 80") config.add(c, "writer", Pcap.PcapWriter, "output.pcap") -- Link definition. config.link(c, "nic.tx -> filter.input") config.link(c, "filter.output -> writer.input") engine.configure(c) engine.main({duration=1})
  • 29. PACKETS struct packet { uint16_t length; unsigned char data[10*1024]; };
  • 30. LINKS struct link { struct packet *packets[1024]; // the next element to be read int read; // the next element to be written int write; };
  • 31. SNABB: APP CATALOG AND PROGRAMS
  • 32. INVENTARY apps: software components that developers combine together to build network functions programs: complete network functions
  • 33. APPS I/O Intel i210/i350/82599/XL710 Mellanox Connectx-4/5 Virtio host y guest UNIX socket Linux: tap and "raw" (e.g: eth0) Pcap files
  • 34. APPS L2 Flooding and learning bridge VLAN insert/remove ARP/NDP
  • 35. APPS L3 IPv4/v6 fragmentation and reassembly IPv4/v6 splitter ICMPv4/v6 echo responder Control-plane delegation (nh_fwd)
  • 36. APPS L4 IPsec ESP Lightweight 4-over-6 AFTR Keyed IPv6 Tunnel
  • 37. APPS MONITORING IPFix capturer and exporter L7 monitor/filtering (libndpi) Pcap expressions filter (with own backend for code generation)
  • 38. APPS TESTING Lots of load generators: loadgen, packetblaster, loadbench...
  • 40. CONTEXT 2012-2014: Several RIRs run out of IPv4 public addresses 2008: IPv6 adoption starts to peak up Still big dependency on IPv4: services, websites, programs, etc
  • 41. SOLUTIONS Carrier-Grade NAT: temporal solution for IPv4 address exhaustion problem Deployment of Dual-Stack networks (IPv4 e IPv6) Dual-Stack implies increasing complexity and costs (maintenance of two separated networks) Dual-Stack Lite (IPv6-only network which also offers IPv4 connectivity relying on CGN) Lightweight 4over6: iteration over Dual-Stack
  • 43. LW4O6 - GOALS RFC7596 fully complaint (lwAFTR part) Performance: 2MPPS; 550-byte (packet-size); Binding-table: 1M subscribers. No packet drops
  • 44. LW4O6 - DEVELOPMENT Version 1: Prototype Basic functionality (encapsulating/decapsulating) Small binding-table (own format) Development of tools to measure performance
  • 45. LW4O6 - DEVELOPMENT Version 2 Production quality Fully standard compliant Big binding-table: 1M subscribers (still customized format but much closer to standard) Add support for other necessary protocols: ARP, NDP, fragmentation, reassembly, ping Tons of optimizations (use of AVX instructions to speed up lookups)
  • 46. LW4O6 - DEVELOPMENT Version 3: Added YANG support to Snabb Support binding-table format according to standard Support of execution as leader/worker (leader: control-plane/worker: data- plane)
  • 47. LW4O6 - DEVELOPMENT Version 4: Multiprocess (one leader, multiple workers) Improvement of the Intel 10Gbps driver (added support for RSS, Received Side Scaling) Added alarms support according to latest draft
  • 48. LIGHTWEIGHT 4OVER6 - TALKS Juniper's vMX Lightweight 4over6 VNF Charla: Kostas Zordabelos's A real-world scale network VF using Snabb for lw4o6 Charla: Juniper Tech Club, Marzo 2017 SDN Meetup, Abril 2017
  • 50. PROGRAM: PACKET BLASTER Generally useful tool: fill TX buffer of NIC with packets and transmit them over and over again Measures received traffic too Easily saturates 10Gbps links snabb packetblaster replay packets.pcap 82:00.1
  • 51. PROGRAM: SNABBWALL L7 firewall that optionally uses nDPI Collaboration betwen Igalia and NLnet Foundation Landed upstream in 2017 Website: http://snabbwall.org
  • 52. PROGRAM: IPFIX NETFLOW collector and exporter (v9 and IPFIX) Line-rate speed on a single core. Further improvement: parallel processing via RSS Landed upstream very recently
  • 53. PROGRAM: L2VPN L2VPN over IPv6 (developed by Alexander Gall from SWITCH) Pending to land upstream; used in production Ideal Snabb use case: programmer/operator builds bespoke tool
  • 54. PROGRAM: YOUR VNF Snabb upstream open to include new network functions Repository will grow as people will build new things Igalia can build one for you
  • 55. LAST NOTES ABOUT PERFORMANCE
  • 56. CONSIDERATIONS Isolcpus: Prevents the kernel to take a CPU to schedule processes Dishable HyperThreading Use HugePages (2MB) (Linux default is 4Kb) Do not neglect NUMA when launching programs Make use of SIMD instructions (AVX, AVX2) to speed up computations (checksum) Keep an eye on regressions: profile often
  • 57. SUMMARY Toolkit for developing high-performance network functions in user-space Snabb provides apps which can be combined together forming a graph (network function) Snabb provides programs, complete network functions ready to use Snabb provides libraries, to easy the development of new network functions Completely written in Lua: easy to extend Fast: kernel-by pass + high-level language + fast VM (LuaJIT)
  • 58. THANKS! Email: dpino@igalia.com Twitter: @diepg $ git clone https://github.com/snabbco/snabb.git $ cd snabb $ make