Skip to content

feat(tests): add disk performance benchmark tests #324

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Millefeuille42
Copy link

No description provided.

@Millefeuille42 Millefeuille42 self-assigned this Jun 13, 2025
@Millefeuille42 Millefeuille42 force-pushed the test-disk-performance branch 2 times, most recently from c89c4e6 to 385f290 Compare June 13, 2025 15:06
@Millefeuille42
Copy link
Author

@Nambrok @AnthoineB I added usage of the SR, VM, VBD, etc. fixtures. For now it's only using a local SR but I could make it use a specific SR (shared or local).

I still need to add some stuff like making all parameters editable through the config file / flags. Feel free to add feedback on the current state of the PR if needed

@Millefeuille42 Millefeuille42 force-pushed the test-disk-performance branch 2 times, most recently from 539c38d to 68ecbbc Compare June 16, 2025 10:15
@Millefeuille42 Millefeuille42 marked this pull request as ready for review June 17, 2025 09:14
@last-genius
Copy link

last-genius commented Jun 17, 2025

Please squash some of the fix and style commits. Otherwise it's difficult to review commits when they are changed just later in the series

- fix(disk_perf): add configurable numjob
- fix(disk_perf): styling and readability
- misc(disk_perf): simplify fixtures
- misc(disk_perf): styling
- fix(disk_perf): usage of double quote in nested string

Signed-off-by: Mathieu Labourier <[email protected]>
- style(disk_perf): sort imports and minor style fixes

Signed-off-by: Mathieu Labourier <[email protected]>
- fix(disk_perf): csv paths and add logging

Signed-off-by: Mathieu Labourier <[email protected]>
@Millefeuille42 Millefeuille42 force-pushed the test-disk-performance branch from 68ecbbc to efa4b26 Compare June 17, 2025 12:25
@Millefeuille42
Copy link
Author

Millefeuille42 commented Jun 17, 2025

@last-genius

Please squash some of the fix and style commits. Otherwise it's difficult to review commits when they are changed just later in the series

Done

jobs.py Outdated
"params": {
"--vm": "single/small_vm",
},
"paths": ["tests/storage"],
Copy link
Contributor

Choose a reason for hiding this comment

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

path should point to benchmark subdirectory directly in the job

Suggested change
"paths": ["tests/storage"],
"paths": ["tests/storage/benchmarks"],

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 377d577



# use vhd, qcow2, raw... when image_format support will be available
@pytest.fixture(scope="module", params=["vdi"])
Copy link
Contributor

Choose a reason for hiding this comment

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

The temporary one could have been vhd ^^

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 377d577

("command -v apk", "apk add fio", "apk del fio"),
)

for check_cmd, install_cmd, remove in install_cmds:
Copy link
Contributor

@Nambrok Nambrok Jun 19, 2025

Choose a reason for hiding this comment

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

There is already code allowing to install things on a VM.
You have for example lib/vm.py:VM.detect_package_manager() that exist.
You can see example of its usage in tests/guest_tools/unix/test_guest_tools_unix.py.
To uninstall, you can make a snapshot before installing your package and revert at the end to have the VM reset to its initial state (There might be a fixture already doing this).

Copy link
Author

Choose a reason for hiding this comment

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

fixed in df0b40f

@pytest.fixture(scope="module")
def vdi_on_local_sr(host, local_sr_on_hostA1, image_format):
sr = local_sr_on_hostA1
vdi = sr.create_vdi("testVDI", MAX_LENGTH)
Copy link
Contributor

Choose a reason for hiding this comment

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

The image_format has to be given to create_vdi

Suggested change
vdi = sr.create_vdi("testVDI", MAX_LENGTH)
vdi = sr.create_vdi("testVDI", MAX_LENGTH, image_format=image_format)

Copy link
Author

Choose a reason for hiding this comment

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

Image format is not supported yet, resulting in an error. I will provide it as a comment though.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 377d577

def vdi_on_local_sr(host, local_sr_on_hostA1, image_format):
sr = local_sr_on_hostA1
vdi = sr.create_vdi("testVDI", MAX_LENGTH)
vdi.image_format = image_format
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
vdi.image_format = image_format

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 377d577

- change job path
- set "vhd" as the placeholder image_format
- remove leftover code

Signed-off-by: Mathieu Labourier <[email protected]>
@Millefeuille42 Millefeuille42 requested a review from Nambrok June 19, 2025 08:56
"--file-sizes",
action="store",
type=lambda value: str_to_tuple(value, sep=","),
default=("1G", "4G", f"{int((system_memory // (1024.**3)) * 2)}G"),
Copy link
Member

Choose a reason for hiding this comment

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

Small comment

Suggested change
default=("1G", "4G", f"{int((system_memory // (1024.**3)) * 2)}G"),
default=("1G", "4G", f"{int((system_memory // (1024.**3)) * 2)}G"), # (2*Memory) GiB

Copy link
Author

Choose a reason for hiding this comment

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

fixed in 65157ae

vm = running_unix_vm_with_fio
vbd = plugged_vbd
device = f"/dev/{vbd.param_get(param_name='device')}"
test_type = "{}-{}-{}-{}".format(block_size, file_size, rw_mode, image_format)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add a prefix here, like "bench-fio-", to have a common part of the name. If there is other tests we can have something like "bench-newtool-".

Copy link
Member

Choose a reason for hiding this comment

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

I know that adding more in the test_type could look heavy but shouldn't we add iodepth and numjob in the test_type string?

Copy link
Author

@Millefeuille42 Millefeuille42 Jun 20, 2025

Choose a reason for hiding this comment

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

We should add the bench- prefix indeed as well as the numjob and iodepth. I forgot to add the latter part when I added those options. I will fix that.

Copy link
Author

Choose a reason for hiding this comment

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

done in 63e2cf5

logging.info("Performance difference summary:")
for k, v in diffs.items():
sign = "+" if v < 0 else "-"
logging.info(f"- {k}: {sign}{abs(v):.2f}%")
Copy link
Member

Choose a reason for hiding this comment

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

It may be interesting to have a condition that log a special message if the performance are above a threshold to signal a perf improvement.

Copy link
Author

Choose a reason for hiding this comment

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

That could be interesting. Both threshold (for failure and future positive message) could be changed through flags too

Copy link
Author

Choose a reason for hiding this comment

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

done in 63e2cf5

Millefeuille42 and others added 2 commits June 20, 2025 16:01
- add improvement threshold
- adjust wording in messages
- add additional information in test_type
- fix percentage calculation
- styling

Signed-off-by: Mathieu Labourier <[email protected]>
MAX_LENGTH = 64 * (1024**3) # 64GiB


# use vhd, qcow2, raw... when image_format support will be available
Copy link
Member

@Wescoeur Wescoeur Aug 4, 2025

Choose a reason for hiding this comment

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

Should have a TODO: label in this case, otherwise "will" is incorrect. Otherwise we can block this PR as long as the desired code is not merged I suppose.

Copy link
Author

Choose a reason for hiding this comment

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

added the TODO label in 718b41f

Copy link
Author

Choose a reason for hiding this comment

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

As for blocking the PR, idk since the support of image formats is not required to make it work for now. If we don't block this PR we should be cautious to not loose track of this TODO (maybe make a card about this?)

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.

5 participants