A common problem in datacenters is how to redirect multiple Clients to different Servers, without exposing every single one of them. The most common solution is to use a Middlebox, a proxy that receives all the incoming connections from Clients, reads the Server Name on the first TLS packet and redirects the rest of the conversation to the correct Server. Traditional userspace proxies, such as Envoy, Nginx, Haproxy all work by opening two connections, one from the Client and one to the Server, and copying in userspace all data sent from one to the other. This creates problems when working at high network speeds: the Linux kernel, which is in charge of all the packet processing, can't keep up with line rate speed. In this thesis, we discuss various ways to avoid paying this Linux kernel networking stack price, like Kernel Bypass or NIC offloading, and we approach this problem using eBPF, a framework used to define complex packet processing procedures inside the Linux kernel. This allows us to avoid time-costly operations like kernel-to-userspace memory copy and TCP/IP processing. We leverage the power and speed of the Envoy userspace to setup the initial connections, but then offload all the packet redirection to custom eBPF XDP programs. We evaluate this implementation, an Envoy filter called eBPF TCP Proxy, using both TCP and HTTP stress tests. Our results show that we can deliver packets with both higher throughput and lower latency in respect to baseline Envoy, while mantaing lower CPU load. We also present a similar filter + eBPF program, this time in the SK_SKB hook, closer to userspace, as a starting point to extend this project from L4 packet processing to L7.

Un problema comune nei datacenter è come indirizzare multipli Client a Server diversi, senza dover esporre ognuno di loro su internet. La soluzione più comune è quella di usare una Middlebox, un proxy che riceve tutte le connessioni in ingresso dai Client, legge il Server Name dal primo pacchetto TLS e redirige il resto della conversazione al Server corretto. I proxy tradizionali in userspace, come Envoy, Nginx e Haproxy funzionano aprendo due connessioni, una dal Client e una verso il Server, copiando in userspace tutti i dati mandati da una all'altra. Questo crea problemi quando si lavora con reti ad alta velocità: il kernel Linux, che è in carica di processare pacchetti, non riesce a sostenere alte velocità di trasmissione. In questa tesi analizziamo diversi modi di evitare di pagare il prezzo dello stack di rete del kernel Linux, come saltare il kernel e processare in userspace o spostare le computazioni nella NIC, e abbiamo approcciato il problema usando eBPF, un framework usato per definire procedure complesse di processo di pacchetti all'interno del kernel Linux. Questo ci permette di evitare operazione costose come copia di dati da memoria kernel a memoria di utente e gestione del protocollo TCP/IP. Abbiamo sfruttato il potere e la velocità dello userspace di Envoy per creare le connessioni iniziali, ma poi spostiamo tutto l'indirizzamento dei pacchetti a un programma eBPF XDP. Valutiamo questa implementazione, un filtro Envoy chiamato eBPF TCP Proxy, usando sia TCP che HTTP stress test. I nostri risultati mostrano che possiamo mandare pacchetti con maggiore portata e minore latenza rispetto a Envoy base, mantenendo un consumo di CPU minore. Presentiamo anche un simile filtro + programma eBPF, stavolta nell'hook SK_SKB, più vicino allo userspace, come punto di partenza per estendere questo progetto e processare pacchetti al L7.

Accelerating L4 middleboxes in the Linux kernel

SCALISE, PASQUALE
2023/2024

Abstract

A common problem in datacenters is how to redirect multiple Clients to different Servers, without exposing every single one of them. The most common solution is to use a Middlebox, a proxy that receives all the incoming connections from Clients, reads the Server Name on the first TLS packet and redirects the rest of the conversation to the correct Server. Traditional userspace proxies, such as Envoy, Nginx, Haproxy all work by opening two connections, one from the Client and one to the Server, and copying in userspace all data sent from one to the other. This creates problems when working at high network speeds: the Linux kernel, which is in charge of all the packet processing, can't keep up with line rate speed. In this thesis, we discuss various ways to avoid paying this Linux kernel networking stack price, like Kernel Bypass or NIC offloading, and we approach this problem using eBPF, a framework used to define complex packet processing procedures inside the Linux kernel. This allows us to avoid time-costly operations like kernel-to-userspace memory copy and TCP/IP processing. We leverage the power and speed of the Envoy userspace to setup the initial connections, but then offload all the packet redirection to custom eBPF XDP programs. We evaluate this implementation, an Envoy filter called eBPF TCP Proxy, using both TCP and HTTP stress tests. Our results show that we can deliver packets with both higher throughput and lower latency in respect to baseline Envoy, while mantaing lower CPU load. We also present a similar filter + eBPF program, this time in the SK_SKB hook, closer to userspace, as a starting point to extend this project from L4 packet processing to L7.
MIANO, SEBASTIANO
ING - Scuola di Ingegneria Industriale e dell'Informazione
3-apr-2025
2023/2024
Un problema comune nei datacenter è come indirizzare multipli Client a Server diversi, senza dover esporre ognuno di loro su internet. La soluzione più comune è quella di usare una Middlebox, un proxy che riceve tutte le connessioni in ingresso dai Client, legge il Server Name dal primo pacchetto TLS e redirige il resto della conversazione al Server corretto. I proxy tradizionali in userspace, come Envoy, Nginx e Haproxy funzionano aprendo due connessioni, una dal Client e una verso il Server, copiando in userspace tutti i dati mandati da una all'altra. Questo crea problemi quando si lavora con reti ad alta velocità: il kernel Linux, che è in carica di processare pacchetti, non riesce a sostenere alte velocità di trasmissione. In questa tesi analizziamo diversi modi di evitare di pagare il prezzo dello stack di rete del kernel Linux, come saltare il kernel e processare in userspace o spostare le computazioni nella NIC, e abbiamo approcciato il problema usando eBPF, un framework usato per definire procedure complesse di processo di pacchetti all'interno del kernel Linux. Questo ci permette di evitare operazione costose come copia di dati da memoria kernel a memoria di utente e gestione del protocollo TCP/IP. Abbiamo sfruttato il potere e la velocità dello userspace di Envoy per creare le connessioni iniziali, ma poi spostiamo tutto l'indirizzamento dei pacchetti a un programma eBPF XDP. Valutiamo questa implementazione, un filtro Envoy chiamato eBPF TCP Proxy, usando sia TCP che HTTP stress test. I nostri risultati mostrano che possiamo mandare pacchetti con maggiore portata e minore latenza rispetto a Envoy base, mantenendo un consumo di CPU minore. Presentiamo anche un simile filtro + programma eBPF, stavolta nell'hook SK_SKB, più vicino allo userspace, come punto di partenza per estendere questo progetto e processare pacchetti al L7.
File allegati
File Dimensione Formato  
2025_04_Scalise_Executive_Summary.pdf

accessibile in internet per tutti

Descrizione: Executive Summary
Dimensione 636.76 kB
Formato Adobe PDF
636.76 kB Adobe PDF Visualizza/Apri
2025_04_Scalise_Tesi.pdf

accessibile in internet per tutti

Descrizione: Tesi
Dimensione 994.28 kB
Formato Adobe PDF
994.28 kB Adobe PDF Visualizza/Apri

I documenti in POLITesi sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/10589/236136