Skip to content

rushil-ambati/abdBPF

Repository files navigation

abdBPF

A high-performance implementation of the ABD (Attiya-Bar-Noy-Dolev) and the multi-writer variant (MW-ABD) atomic register protocols using eBPF for in-kernel packet processing, with a userspace reference implementation for comparison.

Project Structure

abdBPF/
├── abd/                    # Userspace coordinator and loaders
├── abd-common/             # Shared types, constants, and message definitions
├── abd-ebpf/              # eBPF programs (XDP/TC) implementing ABD logic
├── abd-userspace/         # Userspace protocol implementation
├── bench/                 # Benchmarking and performance measurement tools
├── client/                # CLI client for testing and interaction
├── scripts/               # Orchestration, evaluation, and utility scripts
├── evaluation_results_*/  # Generated benchmark results and analysis
└── logs/                  # Runtime logs and monitoring data

Prerequisites

Ensure you have the following dependencies installed:

System Requirements

  • Linux Kernel: 5.4+ with BPF support enabled
  • Build Tools: build-essential, pkg-config, clang, llvm
  • System Libraries: libbpf-dev
  • Network Tools: iproute2 (for network namespace management)

Rust Toolchain

# Install Rust via rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install required toolchains
rustup toolchain install stable
rustup toolchain install nightly --component rust-src

# Install bpf-linker for eBPF compilation
cargo install bpf-linker

Python Dependencies

# Core dependencies for evaluation and monitoring
pip3 install matplotlib numpy scipy pandas

# Optional: for CPU monitoring
pip3 install psutil

# Or install all at once
pip3 install -r scripts/requirements.txt

Ubuntu/Debian Installation

sudo apt update
sudo apt install build-essential pkg-config clang llvm libbpf-dev iproute2

Development Workflow

Building

# Build all components (debug mode)
cargo build

# Build optimized release version
cargo build --release

# Build with multi-writer support
cargo build --features multi-writer

# Check compilation without building
cargo check

# Clean build artifacts
cargo clean

Running the System

The main orchestration script handles cluster setup, network namespaces, and service coordination:

# Basic cluster with 3 nodes (eBPF implementation)
sudo python3 scripts/run.py

# Userspace implementation with 5 nodes
sudo python3 scripts/run.py -n 5 -u

# Run with debug builds and wait for manual termination
sudo python3 scripts/run.py -d -w

# Run quick functionality test
sudo python3 scripts/run.py test

# Run latency benchmark
sudo python3 scripts/run.py bench latency

# Run throughput benchmark
sudo python3 scripts/run.py bench throughput

Run Script Options

  • -n, --num-nodes NUM_NODES: Number of replica nodes (default: 3)
  • -u, --userspace: Use userspace implementation instead of eBPF
  • -d: Use debug builds
  • -w, --wait: Wait for background services after client finishes
  • test: Run basic functionality test with read/write operations
  • bench {latency|throughput}: Run specific benchmark type

Comprehensive Evaluation

The evaluation script provides automated benchmarking and analysis:

# Full evaluation (both eBPF and userspace implementations)
sudo python3 scripts/evaluate.py

# Analyze existing results without re-running benchmarks
python3 scripts/evaluate.py --skip-benchmarks

# Custom output directory
sudo python3 scripts/evaluate.py --output my_evaluation

# Scalability analysis across different node counts
sudo python3 scripts/evaluate.py --scalability

# Custom node counts for scalability testing
sudo python3 scripts/evaluate.py --scalability --node-counts 3 5 7 9 11

# Enable sweep load testing for throughput analysis
sudo python3 scripts/evaluate.py --sweep

# Use debug builds for evaluation
sudo python3 scripts/evaluate.py --debug

# Disable LaTeX rendering (for systems without LaTeX)
sudo python3 scripts/evaluate.py --skip-latex

Evaluation Script Options

  • --output OUTPUT: Output directory for results (default: evaluation_results)
  • --skip-benchmarks: Skip running benchmarks and analyze existing results
  • --debug: Use debug builds for benchmarking
  • --skip-latex: Disable LaTeX rendering in plots
  • --num-nodes NUM_NODES: Number of nodes for benchmarking (default: 3)
  • --sweep: Enable sweep load testing for throughput benchmarks
  • --scalability: Run scalability evaluation across different node counts
  • --node-counts: Custom node counts for scalability (default: 3 5 7 9 11)

Testing and Development

# Format code
cargo fmt

# Run lints
cargo clippy

# Manual client testing (requires running cluster)
sudo python3 scripts/run.py -w
# In another terminal:
cargo run --bin client -- write 192.168.1.1 "test_value"
cargo run --bin client -- read 192.168.1.1

Configuration and Features

Feature Flags

The system supports different protocol modes via Cargo features:

# Single-writer mode (default)
cargo build

# Multi-writer mode (concurrent writers)
cargo build --features multi-writer

Cleanup

scripts/cleanup -a

About

Pure eBPF implementation of distributed ABD algorithms

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published