Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtio net bugfixes and performance improvement #149

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

mtjhrc
Copy link
Collaborator

@mtjhrc mtjhrc commented Oct 18, 2023

Since bug https://bugs.passt.top/show_bug.cgi?id=74 is now fixed in passt, it now became possible to test with small socket buffers, doing so revealed some bugs and a performance issue on the libkrun side.

If you want to test this, please use passt 0^20231004.gf851084, because of the aforementioned bug.

Note that there is now a performance issue where increasing the socket buffer sizes to the previously recommended 16Mib decreases performance. The performance of libkrun with small socket buffers is better than QEMU+passt, with bigger buffer sizes they are both kind of slow. Curiously limiting iperf3 speed (using -b) increases the performance. This seems to be another passt issue.

Since bug https://bugs.passt.top/show_bug.cgi?id=74 is now fixed
in passt, it is now became possible to test with small socket
buffers, doing so revealed this mistake.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Previously when write_loop was called by try_finish_write and it wrote
something to the socket (but not fully finish the current frame),
it would set last_partial_write_length to an incorect value.

This commit also changes the type of last_partial_write_length to usize
from, Option<NonZeroUsize> because it seems to be simpler to work with.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
@mtjhrc mtjhrc changed the title Draft: virtio net fixes Draft: virtio net bugfixes and performance improvments Oct 18, 2023
@mtjhrc mtjhrc marked this pull request as draft October 19, 2023 08:32
@mtjhrc mtjhrc changed the title Draft: virtio net bugfixes and performance improvments virtio net bugfixes and performance improvments Oct 19, 2023
@mtjhrc
Copy link
Collaborator Author

mtjhrc commented Oct 19, 2023

The clippy issues seem to be fixed in #148 so not fixing them in this PR.

@mtjhrc mtjhrc marked this pull request as ready for review October 19, 2023 08:46
With the default small socket buffer sizes of 204KiB, this seems
to masively improve iperf3 TCP upload from guest to host.
The throughput is now around 33 Gbits/sec instead of 130 Mbits/sec.

To set the socket buffer sizes you can use:
$ sudo sysctl -w net.core.rmem_max=$((204*1024)) -w net.core.wmem_max=$((204*1024))

Tested with passt version: 0^20231004.gf851084-1.fc38.x86_64

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
@mtjhrc mtjhrc changed the title virtio net bugfixes and performance improvments virtio net bugfixes and performance improvement Oct 25, 2023
@slp
Copy link
Contributor

slp commented Nov 29, 2023

@mtjhrc LGTM, could you please force-push this PR to retrigger the checks?

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
Copy link
Contributor

@slp slp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, let's merge it now.

@slp slp merged commit 79d993c into containers:main Nov 29, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants