Skip to content

Add performance test using lima and iperf3#66

Merged
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
nirs:perf
Nov 19, 2024
Merged

Add performance test using lima and iperf3#66
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
nirs:perf

Conversation

@nirs
Copy link
Copy Markdown
Member

@nirs nirs commented Nov 7, 2024

% test/perf.sh
Usage test/perf.sh command
                                                                                                                                                                  
Available commands:
  create                  create test vms 
  delete                  delete test vms 
  host-to-vm [TIME]       test host to vm performance
  host-to-vm-2 [TIME]     test host to vm performance with 1 extra vm
  vm-to-vm [TIME]         test vm to vm performance

This may duplicate code in the github workflow, but performance testing cannot be done in github actions. You need a controlled and idle machine to get repeatable results.

Comment thread test/perf.sh
Comment thread test/perf.sh Outdated
Comment thread test/perf.sh Outdated
Comment thread test/lima.yaml
@nirs nirs marked this pull request as draft November 8, 2024 21:13
@nirs nirs force-pushed the perf branch 2 times, most recently from 5f58752 to 818ea8f Compare November 9, 2024 14:00
@nirs nirs mentioned this pull request Nov 9, 2024
    % test/perf.sh
    Usage test/perf.sh command

    Available commands:
      create                  create test vms
      delete                  delete test vms
      host-to-vm [TIME]       test host to vm performance
      host-to-vm-2 [TIME]     test host to vm performance with 1 extra vm
      vm-to-vm [TIME]         test vm to vm performance

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
nirs added a commit to nirs/socket_vmnet that referenced this pull request Nov 9, 2024
The way we used dispatch queue was not optimal, leading to creation of
too many threads, which can cause unneeded context switching, and lower
performance.

We use now 2 queues:

- vms_queue - concurrent queue use to run accepted connections
  threads. For this queue we must use concurrent queue since we want to
  process requests from VMs in parallel.

- host_queue - serial queue for processing events from vmnet. This queue
  is used for the start and stop callback and for the events callback.

With this change we use consistent number of threads: main thread, 1
vmnet thread, 1 thread per connected vm.

Testing show no change in performance.

| hardware | os     | test          | before (Gb/s) | after (Gb/s) |
|----------|--------|---------------|---------------|--------------|
| M1 Pro   | 14.7.1 | host-to-vm    |         3.252 |        3.219 |
| M1 Pro   | 14.7.1 | host-to-vm-2  |         1.902 |        1.880 |
| M1 Pro   | 14.7.1 | vm-to-vm      |         1.493 |        1.507 |
| M2 Max   | 15.1   | host-to-vm    |         2.335 |        2.359 |
| M2 Max   | 15.1   | host-to-vm-2  |         1.798 |        1.802 |
| M2 Max   | 15.1   | vm-to-vm      |         1.275 |        1.266 |

Results are average send throughput of 10 runs. Using performance tests
from lima-vm#66.

We have a performance regression on macOS 15.1. With 14.7 on same M2 Max
machine it was up ot 1.2 times faster. With 15.1 it is up to 1.4 times
slower.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
@nirs nirs marked this pull request as ready for review November 9, 2024 20:22
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

Probably this should be executed on GHA too

@AkihiroSuda AkihiroSuda merged commit 5b59d7e into lima-vm:master Nov 19, 2024
@AkihiroSuda AkihiroSuda added this to the v1.2.0 milestone Nov 19, 2024
@nirs nirs deleted the perf branch November 19, 2024 19:04
@nirs
Copy link
Copy Markdown
Member Author

nirs commented Nov 19, 2024

Probably this should be executed on GHA too

It can be helpful to run this with very short time (e.g. test/perf.sh host-to-vm 1) to make sure the test does not break, but nested vms are very slow and flaky on github action so this will only make the build worse.

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