cloudflare / cloudflare/boringtun

Issue with unstable throughput

Open
#259 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
7.2k
Forks
532
PR merge metrics
No merged PRs in 30d

Description

Hi!
We downloaded boringtun and ran performance tests, and we found that throughput was inconsistent.
Here's a case.
for server:
```bash
# wireguard-go conf
root@n198-100-016:~# cat /etc/wireguard/wgx.conf
[Interface]
Address = 192.169.1.1/24
ListenPort = 5001
PrivateKey = oHtzn34+s2LB9o8bIFNrvUBTZ7VoXOOc5nXTZOs5jnk=

[Peer]
AllowedIPs = 192.169.1.3/32,192.168.1.3/32
PublicKey = FoGUDBjfh0wu73Ohii3hTVn0NrRxTN4hKeIOVhaaWVQ=
Endpoint = 10.198.100.17:5001
# wireguard-go cmd
wg-quick up wgx

# boringtun conf
root@n198-100-016:~# cat /etc/wireguard/wgu.conf
[Interface]
Address = 192.168.1.1/24
ListenPort = 5000
PrivateKey = oHtzn34+s2LB9o8bIFNrvUBTZ7VoXOOc5nXTZOs5jnk=

[Peer]
AllowedIPs = 192.168.1.3/32
PublicKey = FoGUDBjfh0wu73Ohii3hTVn0NrRxTN4hKeIOVhaaWVQ=
Endpoint = 10.198.100.17:5000

# boringtun cmd
su zhaoya
sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun wg-quick up wgu

iperf -s
```
for client:
```bash
# wireguard-go conf
root@n198-100-017:~# cat /etc/wireguard/wgx.conf
[Interface]
Address = 192.169.1.3/24
ListenPort = 5001
PrivateKey = sFWijh452FMN5krVhsF1wOoyK8A2aiEg8cUXJuWOX08=

[Peer]
AllowedIPs = 192.169.1.1/32,192.168.1.1/32
PublicKey = 4+b3CbE4qmzJbheQTm4pCC9Ksx8pnHbncGAmgC/oDjY=
Endpoint = 10.198.100.16:5001
PersistentKeepalive = 25

# wireguard-go cmd
wg-quick up wgx

# boringtun conf
root@n198-100-017:~# cat /etc/wireguard/wgu.conf
[Interface]
Address = 192.168.1.3/24
ListenPort = 5000
PrivateKey = sFWijh452FMN5krVhsF1wOoyK8A2aiEg8cUXJuWOX08=

[Peer]
AllowedIPs = 192.168.1.1/32
PublicKey = 4+b3CbE4qmzJbheQTm4pCC9Ksx8pnHbncGAmgC/oDjY=
Endpoint = 10.198.100.16:5000

# boringtun cmd
su zhaoya
sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun wg-quick up wgu

iperf -c 10.198.100.16 -i 1
```
for result:
![image](https://user-images.githubusercontent.com/106961620/172271234-8f067024-132a-469e-b2e6-a776cd4cd514.png)

We changed the architecture and created multiple reuseport sockets for each thread. Each thread operated only on its own socket and the performance was very stable.
Here's our patch:
[multi_poll.diff.txt](https://github.com/cloudflare/boringtun/files/8849104/multi_poll.diff.txt)

I don't know if this issue is known, and if the community has a fix or optimization plan.

Looking forward to reply.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.