Skip to content

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Sep 25, 2024

Add a benchmark that attempts to capture the latency of a single page
fault in a guest memory configuration that we also use in production.
This should catch regressions such as the 1.6 memfd/vhost post
snapshot-restore latency regression, and does indeed do so:

MAP_ANONYMOUS:

     Running benches/memory_access.rs
page_fault    time:   [2.8611 µs 2.9327 µs 3.0170 µs]
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

memfd_create:

     Running benches/memory_access.rs
page_fault    time:   [5.7449 µs 5.8779 µs 6.0450 µs]
              change: [+85.649% +92.231% +98.074%] (p = 0.00 < 0.05)
              Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe

Add the same benchmark for huge pages, just in case. Funnily enough,
there is no vhost-tax to be paid for huge pages.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

All other fields of `VmResources` and the contained `VmConfig` struct
are accessed directly, with `track_dirty_pages` being the odd one out.
Let's make it uniform.

Signed-off-by: Patrick Roy <[email protected]>
Move guest memory allocation into a function of `VmResources`. The
configuration we end up allocating depends solely on the information in
`VmResources`, and this allows us to easily use production guest memory
configurations in benchmarks.

Signed-off-by: Patrick Roy <[email protected]>
Add a benchmark that attempts to capture the latency of a single page
fault in a guest memory configuration that we also use in production.
This should catch regressions such as the 1.6 memfd/vhost post
snapshot-restore latency regression, and does indeed do so:

MAP_ANONYMOUS:
     Running benches/memory_access.rs
page_fault    time:   [2.8611 µs 2.9327 µs 3.0170 µs]
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

memfd_create:
     Running benches/memory_access.rs
page_fault    time:   [5.7449 µs 5.8779 µs 6.0450 µs]
              change: [+85.649% +92.231% +98.074%] (p = 0.00 < 0.05)
              Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe

Add the same benchmark for huge pages, just in case. Funnily enough,
there is no vhost-tax to be paid for huge pages.

Signed-off-by: Patrick Roy <[email protected]>
@roypat roypat requested a review from kalyazin September 25, 2024 12:33
@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Sep 25, 2024
@roypat roypat merged commit 7803c42 into firecracker-microvm:main Sep 25, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants