Skip to content

Commit

Permalink
mirage-unix: increase TCP buffer size
Browse files Browse the repository at this point in the history
On `AMD Ryzen 9 7950X` using Fedora39 and OCaml 4.14.1 testing with
iperf on localhost, with 4K buffer:
```
[  1] 0.00-10.00 sec  31.1 GBytes  26.7 Gbits/sec
```

With 64KiB buffer:
```
[  1] 0.00-10.00 sec  49.9 GBytes  42.9 Gbits/sec
```

The max size for various TSO/GSO/GRO packet offloads in Linux is 64KiB,
so going beyond that is unlikely to be useful [1].

[1]: although there are plans for larger than 64KiB offloads https://netdevconf.info/0x15/slides/35/BIG%20TCP.pdf

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Dec 1, 2023
1 parent 18393c0 commit 9d7fb79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stack-unix/tcp_socket.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let disconnect _ =
return_unit

let read fd =
let buflen = 4096 in
let buflen = 65536 in
let buf = Cstruct.create buflen in
Lwt.catch (fun () ->
Lwt_cstruct.read fd buf
Expand Down

0 comments on commit 9d7fb79

Please sign in to comment.