Skip to content

bpftune - Automatic Kernel Tuning with eBPF Cheatsheet

bpftune - Automatic Kernel Tuning with eBPF Cheatsheet

bpftune (by Oracle) is a lightweight daemon that automatically tunes Linux kernel parameters using eBPF. Rather than requiring an admin to guess sysctl values, it observes actual system behavior through eBPF probes — TCP buffer pressure, connection table saturation, memory reclaim — and adjusts the relevant parameters continuously as load changes. Its guiding principle is to be invisible: near-zero overhead, no configuration required, and it deliberately backs off any parameter an administrator has set manually.

Automatic tuning changes kernel behavior on a live system. Trial it on non-critical hosts and watch the logs before broad rollout.

Requirements

  • Linux kernel with BPF and BTF support (5.15+ recommended)
  • Root privileges (loads eBPF programs, writes sysctls)

Installation

PlatformCommand
Oracle Linux / Fedorasudo dnf install bpftune
From sourcegit clone https://github.com/oracle/bpftune && make && sudo make install
Servicesudo systemctl enable --now bpftune
Verifybpftune -h

Running

CommandDescription
sudo bpftuneRun in the foreground
sudo bpftune -dRun as a daemon
sudo systemctl start bpftuneStart via systemd
sudo bpftune -sShow summary of tuners and current state
journalctl -u bpftune -fWatch tuning decisions live

Key Options

FlagEffect
-dDaemon mode
-sSummary/status output
-SSuppress (dry-run) — log what it would change
-LLearning mode / legacy behavior
-rRollback changes on exit
-l LEVELLog verbosity
# See what it would tune without changing anything
sudo bpftune -S -l debug

What It Tunes

TunerAdjusts
TCP buffertcp_rmem / tcp_wmem under throughput pressure
TCP congestionCongestion control algorithm selection
Connection limitssomaxconn, backlog sizes when queues overflow
Neighbour tableARP/ND table sizes when entries are dropped
Route tableRoute cache sizing
Netns / sysctlPer-namespace equivalents where applicable

How the Feedback Loop Works

StepDetail
ObserveeBPF probes count drops, overflows, pressure events
DecideIf a threshold is repeatedly hit, the parameter is a bottleneck
AdjustRaise the limit incrementally (never unbounded)
Re-observeConfirm the symptom cleared
Back offIf an admin set the value manually, leave it alone

This “observe, nudge, verify” cycle is why it can run continuously without oscillating.

Verifying Its Effect

# What has bpftune changed?
sudo bpftune -s

# Confirm a sysctl it reported adjusting
sysctl net.ipv4.tcp_rmem net.core.somaxconn

# Correlate with the symptom it was fixing
ss -s                      # socket/queue stats
netstat -s | grep -i drop  # drops that triggered tuning

When to Use It

ScenarioFit
Variable/unknown workloadsStrong — adapts as load changes
Cloud instances of differing sizesStrong — no per-instance tuning
Highly tuned, fixed workloadWeak — your manual values are likely better
Strict change controlUse -S dry-run first, or skip

bpftune vs Manual/Profile Tuning

AspectbpftuneTuneDManual sysctl
ModelContinuous, feedback-drivenStatic profilesOne-time values
Adapts to loadYesNoNo
Config neededNonePick a profileFull expertise
Respects manual settingsYes (backs off)OverwritesN/A

Complements TuneD (broad static profiles) and direct tools like cpupower; bpftune targets network/kernel limits specifically.

Resources