Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

therealak12/alb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfp load balancer

Notes

  1. The project is inspired by lizrice lb from scratch and katran

  2. ALB uses xdp-generic mode. Using xdp-native mode requires extra work such as attaching a dummy xdp_pass program to all involved interfaces. Refer to this for more explanation.

Structure

ALB Structure

Prerequisites

Install bpf2go

go install github.com/cilium/ebpf/cmd/bpf2go@latest

Install libbfp

git clone https://github.com/libbpf/libbpf.git /tmp/libbpf
cd /tmp/libbpf/src
make -j`nproc`
BUILD_STATIC_ONLY=1 NO_PKG_CONFIG=1 make install

Install bpftool

rm /usr/sbin/bpftool

apt update && apt install -y git
cd / && git clone --recurse-submodules https://github.com/libbpf/bpftool.git

cd bpftool/src
make install

ln -s /usr/local/sbin/bpftool /usr/sbin/bpftool

Generate bpf2go boilerplate

make generate

Develop

Setup environment

make setup-dev-env

Run

make run-in-ns NS=alb

Send Request to ALB

Make sure http servers are listening on port 80 in ns1 and ns2, then run:

sudo ip netns exec client curl 172.16.31.2

Clean environment

make clean-dev-env

About

Yet another Load Balancer using BPF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages