FlareTuner is an interactive Bash script for conservative network tuning on Debian and Ubuntu VPS servers. It focuses on standard Linux BBR with fq, a small managed sysctl profile, and an optional runtime tc egress limit for servers that need a practical bandwidth ceiling.
The project is intentionally small: one Bash script, one shell test runner, and Markdown documentation. It does not install kernels, benchmark the network, or try to tune BBRv2.
The script MVP supports:
- Debian and Ubuntu only.
- Previewing a generated tuning profile.
- Applying a generated tuning profile as root.
- Restoring the latest FlareTuner-managed backup.
- Inspecting current network tuning status.
- Reading local memory and interface speed data to preselect conservative recommended profile inputs.
- Applying and clearing an optional runtime
tcegress bandwidth limit.
Non-goals for this MVP:
- Installing, replacing, or upgrading the kernel.
- BBRv2 tuning.
- Benchmarking or proving performance gains.
- Supporting non-Debian and non-Ubuntu distributions.
scripts/flaretuner.sh- interactive CLI and all runtime behavior.tests/flaretuner_test.sh- shell tests using environment overrides and temp directories.docs/tuning-rules.md- detailed tuning inputs, generated settings, safety rules, and rollback model.AGENTS.md- working instructions for Codex, Hermes-style agents, and other AI coding agents.skills/flaretuner/- project skill for agents that can load repo-local skills.docs/superpowers/specs/- project specs for larger changes.docs/superpowers/plans/- implementation plans that future agents can reuse.
Run the interactive menu:
bash scripts/flaretuner.shApply and restore require root privileges because they write or remove the managed sysctl file and reload sysctl settings:
sudo bash scripts/flaretuner.shPreview and status can run without root. The menu can preview tuning, apply tuning, restore the latest FlareTuner backup, or show current network tuning status.
Menu items:
Generate and apply tuning- generates a profile, asks for confirmation, writes the managed sysctl file, runssysctl --system, and verifies activebbrplusfq.Preview tuning only- renders the profile and current status without writing files or loading kernel modules.Restore last FlareTuner backup- restores or removes only the FlareTuner-managed sysctl file from the latest metadata.Show current network tuning status- prints OS, kernel, BBR, qdisc, managed config, backup, and tc limit state.Apply tc egress bandwidth limit- applies a runtime interface-wide egress limit withtc.Clear FlareTuner tc egress limit- removes the latest FlareTuner-recorded root qdisc from the recorded interface.
When generating a profile, FlareTuner reads local system information to recommend defaults for workload, memory tier, bandwidth tier, path profile, and tuning profile. Press Enter to accept each recommended value, or enter a menu number to override it manually. The recommendation is intentionally simple: it reads /proc/meminfo for memory size and /sys/class/net/*/speed for interface speed where available. It does not run speed tests or contact cloud provider metadata services.
You can enter an optional target bandwidth in Mbps before choosing the profile inputs. This value changes the generated sysctl recommendation tier, but it is not an actual traffic shaper. For example, entering 90 can make the sysctl profile stay conservative for a route that becomes unstable above 100 Mbps, but FlareTuner does not enforce a 90 Mbps cap in this MVP.
For real server-to-client egress shaping, use the Apply tc egress bandwidth limit menu item as root. It asks for an interface such as eth0 and a numeric Mbps rate, then installs a FlareTuner-managed root qdisc on that interface. This is runtime state: it is not persisted across reboot by FlareTuner. Clearing the FlareTuner tc limit uses the metadata stored under /var/lib/flaretuner/ and removes the root qdisc from the recorded interface.
Generated sysctl profiles use these inputs:
- Workload:
web,proxy,download, orlow-memory. - Memory tier:
under-512m,512m-1g,1g-4g, or4g-plus. - Bandwidth tier:
under-100m,100m-500m,500m-1g, or1g-plus. - Tuning profile:
conservative,balanced, oraggressive. - Path profile:
normal,high-latency, orqos-sensitive. - Target bandwidth Mbps: a positive integer, or
auto.
Low-memory behavior takes priority over throughput-oriented settings. The qos-sensitive path profile keeps buffers and backlogs more conservative, but it does not shape traffic by itself.
FlareTuner writes only its managed sysctl file:
/etc/sysctl.d/99-flaretuner.conf
It does not edit /etc/sysctl.conf.
Backup metadata and backups are stored under:
/var/lib/flaretuner/
The restore menu restores the latest FlareTuner-managed backup. If no previous managed file existed, restore removes the managed file. Apply failures trigger restoration of the previous managed file when possible.
Apply and restore run sysctl --system, which reloads system sysctl configuration broadly. FlareTuner still only writes, restores, or removes its managed file.
The optional tc egress limiter replaces the root qdisc on the chosen interface. Do not use it on an interface where you already maintain custom tc policy unless you are prepared for FlareTuner to replace that root qdisc.
AI coding agents should start with AGENTS.md. It is the authoritative agent instruction file for this repository and includes product boundaries, safety rules, test requirements, Context7 usage rules, GitHub CLI body safety, and subagent defaults.
For Codex, Hermes-style agents, or other agents that support reusable skills:
- Use the repo-level
AGENTS.mdbefore making changes. - Load
skills/flaretuner/SKILL.mdwhen working on FlareTuner behavior, docs, tests, or release workflow. - Treat
scripts/flaretuner.shas the source of truth for runtime behavior. - Treat
docs/tuning-rules.mdas the source of truth for tuning semantics and rollback behavior. - Keep this README aligned with user-visible behavior.
- For behavior changes or bug fixes, prefer regression-test-first edits in
tests/flaretuner_test.sh. - For larger changes, write or update a spec under
docs/superpowers/specs/and an implementation plan underdocs/superpowers/plans/. - If the task asks about a library, SDK, API, CLI tool, or cloud service, use Context7 MCP for current docs before answering or editing.
- Do not use Context7 for ordinary Bash refactoring, business-logic debugging, or code review.
Agent-safe local verification commands:
bash -n scripts/flaretuner.sh
bash -n tests/flaretuner_test.sh
bash tests/flaretuner_test.shThe test suite is designed to avoid real /etc and /var/lib writes. It uses environment overrides such as FLARETUNER_ETC_DIR, FLARETUNER_STATE_DIR, FLARETUNER_SYSCTL_CMD, FLARETUNER_TC_CMD, and related command/file overrides.
See docs/tuning-rules.md for the profile inputs, baseline settings, workload behavior, low-memory safety rules, and rollback model.
Run shell syntax checks:
bash -n scripts/flaretuner.sh
bash -n tests/flaretuner_test.shRun the test suite:
bash tests/flaretuner_test.sh