Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created December 22, 2023 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpenick/eb7cb51201873a74035d476056df57ca to your computer and use it in GitHub Desktop.
Save mpenick/eb7cb51201873a74035d476056df57ca to your computer and use it in GitHub Desktop.
Buffer size makes a huge difference!

Results

Lang Buffer Size 100c/10s 100c/60s
Go 1kb 475.944 Mbps 437.203 Mbps
Go 8kb 1993.027 Mbps 1976.818 Mbps
Go 16kb 2027.369 Mbps 2048.668 Mbps
Rust 1kb 1672.325 Mbps 1661.514 Mbps
Rust 8kb 2242.304 Mbps 2385.639 Mbps
Rust 16kb 2121.545 Mbps 2197.390 Mbps

Raw Results

Go 1k buffer:
$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     28452.8 MiB (29834929278 bytes)
Total data received: 28379.5 MiB (29758079840 bytes)
Bandwidth per channel: 475.944⇅ Mbps (59493.0 kBps)
Aggregate bandwidth: 23766.502↓, 23827.878↑ Mbps
Packet rate estimate: 2573356.6↓, 2045100.8↑ (4↓, 45↑ TCP MSS/op)
Test duration: 10.0168 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     156401.1 MiB (163998489996 bytes)
Total data received: 156344.8 MiB (163939399524 bytes)
Bandwidth per channel: 437.203⇅ Mbps (54650.3 kBps)
Aggregate bandwidth: 21856.186↓, 21864.064↑ Mbps
Packet rate estimate: 1883824.8↓, 1876550.4↑ (3↓, 45↑ TCP MSS/op)
Test duration: 60.0066 s.

Go 8k buffer:
$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     118980.1 MiB (124759644174 bytes)
Total data received: 118674.1 MiB (124438780931 bytes)
Bandwidth per channel: 1993.027⇅ Mbps (249128.4 kBps)
Aggregate bandwidth: 99523.052↓, 99779.670↑ Mbps
Packet rate estimate: 9177995.1↓, 8563896.4↑ (12↓, 45↑ TCP MSS/op)
Test duration: 10.0028 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     714019.0 MiB (748703228328 bytes)
Total data received: 714055.0 MiB (748740922710 bytes)
Bandwidth per channel: 1976.818⇅ Mbps (247102.2 kBps)
Aggregate bandwidth: 99831.805↓, 99826.779↑ Mbps
Packet rate estimate: 9197524.9↓, 8567939.7↑ (12↓, 45↑ TCP MSS/op)
Test duration: 60.0002 s.

Go 16k buffer:
$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     122184.2 MiB (128119384206 bytes)
Total data received: 122054.1 MiB (127982956911 bytes)
Bandwidth per channel: 2027.369⇅ Mbps (253421.1 kBps)
Aggregate bandwidth: 102327.589↓, 102436.668↑ Mbps
Packet rate estimate: 9370484.0↓, 8791941.4↑ (12↓, 45↑ TCP MSS/op)
Test duration: 10.0057 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     732588.7 MiB (768174895818 bytes)
Total data received: 732970.0 MiB (768574744829 bytes)
Bandwidth per channel: 2048.668⇅ Mbps (256083.5 kBps)
Aggregate bandwidth: 102460.033↓, 102406.729↑ Mbps
Packet rate estimate: 9382573.9↓, 8789371.8↑ (12↓, 45↑ TCP MSS/op)
Test duration: 60.0097 s.

Rust 1k buffer:
$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     99750.5 MiB (104595960942 bytes)
Total data received: 99732.7 MiB (104577365192 bytes)
Bandwidth per channel: 1672.325⇅ Mbps (209040.6 kBps)
Aggregate bandwidth: 83608.822↓, 83623.689↑ Mbps
Packet rate estimate: 7753020.2↓, 7177259.8↑ (11↓, 45↑ TCP MSS/op)
Test duration: 10.0063 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     594277.5 MiB (623145134700 bytes)
Total data received: 594191.9 MiB (623055404835 bytes)
Bandwidth per channel: 1661.514⇅ Mbps (207689.2 kBps)
Aggregate bandwidth: 83069.699↓, 83081.663↑ Mbps
Packet rate estimate: 7458320.7↓, 7130738.7↑ (11↓, 45↑ TCP MSS/op)
Test duration: 60.0031 s

Rust 8k buffer:

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     135182.8 MiB (141749453142 bytes)
Total data received: 135058.4 MiB (141618995622 bytes)
Bandwidth per channel: 2242.304⇅ Mbps (280288.0 kBps)
Aggregate bandwidth: 113184.217↓, 113288.481↑ Mbps
Packet rate estimate: 9691224.9↓, 9723331.6↑ (11↓, 45↑ TCP MSS/op)
Test duration: 10.0098 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     852919.8 MiB (894351274938 bytes)
Total data received: 853436.8 MiB (894893396951 bytes)
Bandwidth per channel: 2385.639⇅ Mbps (298204.9 kBps)
Aggregate bandwidth: 119318.104↓, 119245.822↑ Mbps
Packet rate estimate: 10313346.7↓, 10234638.6↑ (11↓, 45↑ TCP MSS/op)
Test duration: 60.0005 s.

Rust 16k buffer:

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 10s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     126585.1 MiB (132734111400 bytes)
Total data received: 126354.3 MiB (132492135025 bytes)
Bandwidth per channel: 2121.545⇅ Mbps (265193.1 kBps)
Aggregate bandwidth: 105980.473↓, 106174.030↑ Mbps
Packet rate estimate: 9740381.2↓, 9112712.0↑ (12↓, 45↑ TCP MSS/op)
Test duration: 10.0012 s.

$ tcpkali 0.0.0.0:2112 -m 'hello world' -c 100 -T 60s
Destination: [0.0.0.0]:2112
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [0.0.0.0]:2112
Ramped up to 100 connections.
Total data sent:     785845.9 MiB (824019170238 bytes)
Total data received: 786048.4 MiB (824231502512 bytes)
Bandwidth per channel: 2197.390⇅ Mbps (274673.8 kBps)
Aggregate bandwidth: 109883.670↓, 109855.363↑ Mbps
Packet rate estimate: 10136131.0↓, 9428673.7↑ (12↓, 45↑ TCP MSS/op)
Test duration: 60.0076 s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment