Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: require bbr by default #3774

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ build: mod
.PHONY: build

## install: Build and install the celestia-appd binary into the $GOPATH/bin directory.
install: go.sum
install: go.sum check-bbr
@echo "--> Installing celestia-appd"
@go install $(BUILD_FLAGS) ./cmd/celestia-appd
.PHONY: install
Expand Down Expand Up @@ -212,3 +212,28 @@ prebuilt-binary:
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean
.PHONY: prebuilt-binary

## check-bbr: Check if your system uses BBR congestion control algorithm. Only works on Linux.
check-bbr:
@echo "Checking if BBR is enabled..."
@if [ "$(sysctl net.ipv4.tcp_congestion_control | awk '{print $3}')" != "bbr" ]; then \
echo "WARNING: BBR is not enabled. Please enable BBR for optimal performance. Call make enable-bbr or see Usage section in the README."; \
else \
echo "BBR is enabled."; \
fi
.PHONY: check-bbr

## enable-bbr: Enable BBR congestion control algorithm. Only works on Linux.
enable-bbr:
@echo "Configuring system to use BBR..."
@if [ "$(sysctl net.ipv4.tcp_congestion_control | awk '{print $3}')" != "bbr" ]; then \
echo "BBR is not enabled. Configuring BBR..."; \
sudo modprobe tcp_bbr; \
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf; \
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf; \
sudo sysctl -p; \
echo "BBR has been enabled."; \
else \
echo "BBR is already enabled."; \
fi
.PHONY: enable-bbr
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ See <https://docs.celestia.org/nodes/celestia-app> for more information.

## Usage

First, make sure that the [BBR](https://www.ietf.org/archive/id/draft-cardwell-iccrg-bbr-congestion-control-01.html) ("Bottleneck Bandwidth and Round-trip propagation time") congestion control algorithm is enabled in the
system's kernel. The result should contain `bbr`:

```sh
sysctl net.ipv4.tcp_congestion_control
```

If not, enable it on Linux by calling the `make use-bbr` or by running:

```sh
sudo modprobe tcp_bbr
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
sudo sysctl -p
```

```sh
# Print help
celestia-appd --help
Expand Down
2 changes: 1 addition & 1 deletion cmd/celestia-appd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func initRootCommand(rootCommand *cobra.Command, encodingConfig encoding.Config)
)

// Add the following commands to the rootCommand: start, tendermint, export, version, and rollback.
server.AddCommands(rootCommand, app.DefaultNodeHome, NewAppServer, appExporter, addModuleInitFlags)
addCommands(rootCommand, app.DefaultNodeHome, NewAppServer, appExporter, addModuleInitFlags)
}

// setDefaultConsensusParams sets the default consensus parameters for the
Expand Down
Loading
Loading