Skip to content

Commit

Permalink
feat: require bbr by default (#3774)
Browse files Browse the repository at this point in the history
This PR adds a requirement to use bbr by default. This requirement can
be bypassed by using a flag. Warnings are returned when installing, and
there is a makefile command that will configure the system to use bbr.

Most of this PR is copying over the start command from the sdk.
Alternatively, we could simply modify the sdk. That would not require
copy past forking, but the trend has been that every change that we make
to the sdk eventually gets moved here, so I figured we should just skip
to doing that. This also gives us finer grained control in the future.
I'm definitely not tied to this approach, and if we'd rather change our
fork, then I'm happy go do that instead.

closes #3745

---------

Co-authored-by: Rootul P <rootulp@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and cmwaters committed Aug 22, 2024
1 parent fb79af5 commit 4870645
Show file tree
Hide file tree
Showing 4 changed files with 676 additions and 2 deletions.
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 @@ -207,3 +207,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
Loading

0 comments on commit 4870645

Please sign in to comment.