fix(perf): run iperf on TCP and set TCP windows to bdp (#241)

This commit makes iperf use TCP instead of UDP. Using UDP allows the sender to
send as much data as they can, not as much data as the receiver can handle.
Using TCP measures the actual bandwidth of the connection.

This commit sets the TCP send and receive window to the bandwidth-delay-product.
In order to exhaust the whole bandwidth between the two nodes, TCP needs to be
able to buffer all bytes on the wire in the case of packet loss.
This commit is contained in:
Max Inden 2023-08-04 10:23:47 +02:00 committed by GitHub
parent e8c0733ce5
commit cfd1049e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1614 additions and 1604 deletions

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,8 @@ function runPing(clientPublicIP: string, serverPublicIP: string): PingResults {
} }
function runIPerf(clientPublicIP: string, serverPublicIP: string): IperfResults { function runIPerf(clientPublicIP: string, serverPublicIP: string): IperfResults {
console.error(`= run 60 iPerf UDP from client to server`); const iterations = 60;
console.error(`= run ${iterations} iPerf TCP from client to server`);
const killCMD = `ssh -o StrictHostKeyChecking=no ec2-user@${serverPublicIP} 'kill $(cat pidfile); rm pidfile; rm server.log || true'`; const killCMD = `ssh -o StrictHostKeyChecking=no ec2-user@${serverPublicIP} 'kill $(cat pidfile); rm pidfile; rm server.log || true'`;
const killSTDOUT = execCommand(killCMD); const killSTDOUT = execCommand(killCMD);
@ -82,7 +83,7 @@ function runIPerf(clientPublicIP: string, serverPublicIP: string): IperfResults
const serverSTDOUT = execCommand(serverCMD); const serverSTDOUT = execCommand(serverCMD);
console.error(serverSTDOUT); console.error(serverSTDOUT);
const cmd = `ssh -o StrictHostKeyChecking=no ec2-user@${clientPublicIP} 'iperf3 -c ${serverPublicIP} -u -b 25g -t 60'`; const cmd = `ssh -o StrictHostKeyChecking=no ec2-user@${clientPublicIP} 'iperf3 -c ${serverPublicIP} -b 25g -t ${iterations}'`;
const stdout = execSync(cmd).toString(); const stdout = execSync(cmd).toString();
// Extract the bitrate from each relevant line // Extract the bitrate from each relevant line

View File

@ -7,6 +7,14 @@ sudo yum -y install iperf3
# Bump UDP receive buffer size. See https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size. # Bump UDP receive buffer size. See https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size.
sudo sysctl -w net.core.rmem_max=2500000 sudo sysctl -w net.core.rmem_max=2500000
# Set maximum TCP send and receive window to bandwidth-delay-product.
#
# With a bandwidth of 25 Gbit/s per machine and a ping of 60 ms between the two
# machines, the bandwidth-delay-product is ~178.81 MiB. Set send and receive
# window to 200 MiB.
sudo sysctl -w net.ipv4.tcp_rmem='4096 131072 200000000'
sudo sysctl -w net.ipv4.tcp_wmem='4096 20480 200000000'
sudo yum update -y sudo yum update -y
sudo yum install docker -y sudo yum install docker -y
sudo systemctl enable docker sudo systemctl enable docker

View File

@ -19,6 +19,7 @@ resource "aws_instance" "perf" {
launch_template { launch_template {
name = "perf-node" name = "perf-node"
version = "2"
} }
key_name = aws_key_pair.perf.key_name key_name = aws_key_pair.perf.key_name