-
Notifications
You must be signed in to change notification settings - Fork 24
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
qemu_nbd: Select cache and aio automatically #42
Conversation
Tested using backup stress test: 2022-03-13 10:37:49,122 INFO (MainThread) 64 full backups, 896 incremental backups, 0 failed, 960 passed, 0 errored in 333.8 minutes The test use imageio client to download backups and created checksum of the backup. With this |
Previously we use --cache=writeback and --aio=threads so we can access images on file system that does not support direct I/O. This is sometimes faster than --cache=none and --aio=native, but typically give less consistent results, and pollute the page cache with image data, which is mostly likely will never be used. When uploading and downloading images on a hypervisor, using the page cache can be harmful and cause sanlock timeouts when the kernel try to flush huge images to the underlying storage. Future qemu-img and qemu-nbd are expected to implement "auto" cache and aio modes, selecting --cache=none and --aio=native if possible. This change implements this in our qemu_nbd wrapper so we can use this now with current qemu version. When starting qemu_nbd.Server(), if cache was not specified, we select cache="none" if the image can be opened with direct I/O. If aio was not specified, we select it based on the cache value. Signed-off-by: Nir Soffer <nsoffer@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good, just 1 question about 2 logs.
# Implement "auto" cache mode, planned for qemu 7. | ||
if self.cache is None: | ||
self.cache = "none" if self._can_use_direct_io() else "writeback" | ||
log.debug("Using cache=%r", self.cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this log.debug()
be out of the if
(so it will be printed always)?
Same for line #99.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is logged only if we cache was automatically set. If the user set the cache to explicit value, we use it as is so there is no need to log.
Previously we use --cache=writeback and --aio=threads so we can access
images on file system that does not support direct I/O. This is
sometimes faster than --cache=none and --aio=native, but typically give
less consistent results, and pollute the page cache with image data,
which is mostly likely will never be used.
When uploading and downloading images on a hypervisor, using the page
cache can be harmful and cause sanlock timeouts when the kernel try to
flush huge images to the underlying storage.
Future qemu-img and qemu-nbd are expected to implement "auto" cache and
aio modes, selecting --cache=none and --aio=native if possible. This
change implements this in our qemu_nbd wrapper so we can use this now
with current qemu version.
When starting qemu_nbd.Server(), if cache was not specified, we select
cache="none" if the image can be opened with direct I/O. If aio was not
specified, we select it based on the cache value.
Signed-off-by: Nir Soffer nsoffer@redhat.com