BPF-Benchmark
BPF-Benchmark is a simple testsuit designed to assess the performance of different userspace eBPF (Berkeley Packet Filter) runtimes.
Usage
To effectively utilize BPF-Benchmark, follow these steps:
- Install Dependencies: Ensure that
clangandllvmare installed on your system. If you are usingDebianorUbuntu, you can easily install these packages by executing the command:sudo apt install clang llvm. - Acquire Runtimes: BPF-Benchmark includes three pre-packaged runtimes:
llvm-jit,ebpf, andubpf. If the provided executables are incompatible with your system, you have the option to manually build these runtimes. - Install Required Dependencies: The toolkit relies on various dependencies, all of which are listed in the
requirements.txtfile. Install these dependencies to ensure smooth functionality. - Compile BPF Programs: Execute the command
make -C bpf_progsto compile the BPF programs. - Run Benchmark: Launch the benchmarking process by running the
run_benchmark.pyscript. - View Results: The results of the benchmark can be observed directly in the console, or you can find graphical representations in the
outputfolder. Additionally, raw data in JSON format is stored inoutput/data.json.
Adding a New Test
To include a new test within BPF-Benchmark, adhere to these guidelines:
- Create BPF Program: Craft an eBPF program and name it as
XXX.bpf.c, placing it in thebpf_progsdirectory. The program should contain a function namedunsigned long long bpf_main(void* mem)as its entry point. Any other functions must be inlined using the__always_inlineattribute. - Optional Memory File: You have the choice to create a file named
XXX.memif your eBPF program requires specific memory input during execution.
Included Test Cases
BPF-Benchmark currently incorporates the following BPF code test cases:
log2_int.bpf.cmemcpy.bpf.cnative_wrapper.cprime.bpf.csimple.bpf.cstrcmp_fail.bpf.cstrcmp_full.bpf.cswitch.bpf.c
Select and execute the tests ending with the .bpf extension.
Supported Runtimes
BPF-Benchmark facilitates performance comparison across the following runtimes:
bpftime-llvmbpftime-rbpfbpftime-ubpf
These runtimes are involved in the benchmarking process to evaluate their relative efficiencies.
Enhance your BPF runtime evaluation experience using BPF-Benchmark! If you encounter any issues or need further assistance, feel free to reach out to us. Your feedback is invaluable in refining this toolkit.
repo: https://github.com/eunomia-bpf/bpf-benchmark