(eBPF + AF_XDP + XDPHelper)
(Options)
(One intermediate revision by the same user not shown)
Line 118: Line 118:
  
 
''receiver = "Modules/ExpressFilter.o:eth0";''
 
''receiver = "Modules/ExpressFilter.o:eth0";''
 
=== Options ===
 
 
* Modules/ExpressFilter.o - basic eBPF module, does filtering for the AF_XDP receiver
 
* Modules/ExpressFilterPlus.o - extended eBPF module, in addition passes pre-parsed data (requires to have modern libbpf and kernel)
 
  
 
== eBPF + AF_XDP + XDPHelper ==
 
== eBPF + AF_XDP + XDPHelper ==

Revision as of 23:19, 28 June 2020

UDPTX is BrandMeister-own UDP communication library, used to transmit and receive UDP traffic fast.

UDP Transmitter

At this moment BrandMeister provides several backends (options) to send outgoing UDP:

  • socket
  • raw
  • AF_XDP
  • DPDK


UDPTX.png

socket

This is standard default backend that uses Berkley sockets for sending a traffic. It tries to send the data in non-blocking mode and has special transmission thread to re-send failed packets.

You have to use it if you have

  • non-ethernet interfaces
  • more than one interface for outgoing traffic (such as public + AMPR, or one for IPv4 and another one for IPv6)
  • huge routing tables

Performance

Passed performance tests to transmit to 5K connections

Configuration

transmitter = "socket";

raw

This is fast forwarding backend that uses RAW (PACKET_MMAP) socket of Ethernet interface for sending a traffic. It allows to save up to 50% CPU time and has great compatibility.

Limitations

  • Requires to use a single ethernet interface for BrandMeister's traffic (IPv4 and IPv6, local site connectivity will not work)
  • All traffic will be routed via default gateway (except loopback, see next bullet)
  • Loopback addresses (127.0.0.1 and ::1) are handled by using Berkley sockets

Performance

Passed performance tests to transmit to 20K connections

Configuration

transmitter = "raw:<interface name>";

transmitter = "raw:eth0";

AF_XDP

This is faster forwarding backend that uses AF_XDP socket of Ethernet interface for sending a traffic and in most cases communicates directly with Linux network interface driver.

Limitations

  • The same set of limitations as raw
  • Requires Linux kernel >= 4.18
  • Interface have to be configured to use the same count of TX and RX queues (please read man ethtool)

Performance

Passed performance tests to transmit to 30K connections

Configuration

transmitter = "xdp:<interface name>";

transmitter = "xdp:eth0";

DPDK

This is fastest forwarding backend that uses kernel-bypass NIC driver for sending a traffic. It allows to save much more CPU time due to direct poll communications to the NIC and CRC offload features of some NIC models. In some tests we got up to 75% acceleration. List of supported NIC models can be found here.

Limitations

  • The same set of limitations as raw
  • You have to have separate NIC or virtual detachable NIC port allowed to use for the DPDK transmission
  • Only DPDK port #0 will be used
  • We added support of dpdk-proc-info and dpdk-pdump

Performance

Passed performance tests to transmit to 40K connections

Configuration

transmitter = "Modules/DPDK-edge.so:<reference interface> <EAL parameters>";

transmitter = "Modules/DPDK-edge.so:eth0 -w 0000:af:00.0 --file-prefix bm --lcores '(0-3)@0'";


  • Reference interface is a kernel attached interface used for normal communications (please read about raw mode). DPDK will reuse its IPs and default gateway
  • For EAL parameters please read this documentation
  • It will use so many NIC queues as defined amount of slave logical cores minus one in startup parameters.
  • The best performance on NUMA machines could be reached by using the same CPU as NIC connected by pinning logical cores via EAL's parameter lcores and BrandMeister's parameter affinity
  • Also in most cases it requires to run BrandMeister with root privileges, you can do this by overriding systemd configuration (beandmeister@.service.d):
# /etc/systemd/system/brandmeister@.service.d/override.conf
[Service]
User=root

UDP Receiver

In reception part UDPTX's driver works in parallel with socket receiver. All it does, is accelerate reception of UDP packets on particular interface.

eBPF + AF_XDP

This is modern method to accelerate UDP reception in BrandMeister Core. It allows to save up to 30% CPU time.

Limitations

  • Requires Linux kernel >= 4.18
  • Interface have to be configured to use the same count of TX and RX queues (please read man ethtool)
  • eBPF handles traffic before iptables
  • Works with a single instance of BrandMeister Core on the single machine

Configuration

receiver = "Modules/ExpressFilter.o:<interface name>";

receiver = "Modules/ExpressFilter.o:eth0";

eBPF + AF_XDP + XDPHelper

This is method is fully the same as eBPF + AF_XDP but uses separate small daemon XDPHelper to load and share eBPF program between several BrandMeister Core instances. XDPHelper is supplied with BrandMeister Core and starts automatically only when required (thanks to systemd and D-BUS activation). By default XDPHelper uses eBPF program ExpressFilter.o (see xdphelper.service).

Configuration

receiver = "xdp:<interface name>";

receiver = "xdp:eth0";

UDPTX is BrandMeister-own UDP communication library, used to transmit and receive UDP traffic fast.

UDP Transmitter[edit]

At this moment BrandMeister provides several backends (options) to send outgoing UDP:


UDPTX.png

socket[edit]

This is standard default backend that uses Berkley sockets for sending a traffic. It tries to send the data in non-blocking mode and has special transmission thread to re-send failed packets.

You have to use it if you have[edit]

Performance[edit]

Passed performance tests to transmit to 5K connections

Configuration[edit]

transmitter = "socket";

raw[edit]

This is fast forwarding backend that uses RAW (PACKET_MMAP) socket of Ethernet interface for sending a traffic. It allows to save up to 50% CPU time and has great compatibility.

Limitations[edit]

Performance[edit]

Passed performance tests to transmit to 20K connections

Configuration[edit]

transmitter = "raw:<interface name>";

transmitter = "raw:eth0";

AF_XDP[edit]

This is faster forwarding backend that uses AF_XDP socket of Ethernet interface for sending a traffic and in most cases communicates directly with Linux network interface driver.

Limitations[edit]

Performance[edit]

Passed performance tests to transmit to 30K connections

Configuration[edit]

transmitter = "xdp:<interface name>";

transmitter = "xdp:eth0";

DPDK[edit]

This is fastest forwarding backend that uses kernel-bypass NIC driver for sending a traffic. It allows to save much more CPU time due to direct poll communications to the NIC and CRC offload features of some NIC models. In some tests we got up to 75% acceleration. List of supported NIC models can be found here.

Limitations[edit]

Performance[edit]

Passed performance tests to transmit to 40K connections

Configuration[edit]

transmitter = "Modules/DPDK-edge.so:<reference interface> <EAL parameters>";

transmitter = "Modules/DPDK-edge.so:eth0 -w 0000:af:00.0 --file-prefix bm --lcores '(0-3)@0'";


# /etc/systemd/system/brandmeister@.service.d/override.conf
[Service]
User=root

UDP Receiver[edit]

In reception part UDPTX's driver works in parallel with socket receiver. All it does, is accelerate reception of UDP packets on particular interface.

eBPF + AF_XDP[edit]

This is modern method to accelerate UDP reception in BrandMeister Core. It allows to save up to 30% CPU time.

Limitations[edit]

Configuration[edit]

receiver = "Modules/ExpressFilter.o:<interface name>";

receiver = "Modules/ExpressFilter.o:eth0";

Options[edit]

eBPF + AF_XDP + XDPHelper[edit]

This is method is fully the same as eBPF + AF_XDP but uses separate small daemon XDPHelper to load and share eBPF program between several BrandMeister Core instances. XDPHelper is supplied with BrandMeister Core and starts automatically only when required (thanks to systemd and D-BUS activation). By default XDPHelper uses eBPF program ExpressFilter.o (see xdphelper.service).

Configuration[edit]

receiver = "xdp:<interface name>";

receiver = "xdp:eth0";