Skip to contentSkip to conversation

linux aio and cache mode

Qemu-devel ching 2 participants 7 messages Sep 24, 2012 – Sep 28, 2012

lore
Share & tools
lore

ching

author
#0 lore raw

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

I am trying to use unsafe cache mode to boost i/o performance.

After googling a while, there are some old web page telling that linux native aio do not use host cache. (http://stackoverflow.com/questions/5664105/buffered-asynchronous-file-i-o-on-linux)

is it still valid for recent kernel? do i need to change to aio="threads" to take advantage of unsafe cache mode?

Thanks in advance.

Regards,
ching

#1 lore raw

Am 24.09.2012 13:32, schrieb ching:

Quoted 5 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

I am trying to use unsafe cache mode to boost i/o performance.

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

author
#2 lore raw
Quoted 12 lines · Kevin Wolf

Am 24.09.2012 13:32, schrieb ching:

Quoted 5 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

I am trying to use unsafe cache mode to boost i/o performance.

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

will qemu log a entry for the silent fallback?

Reason:

I am testing sparse image on btrfs with mount option: rw,noatime,space_cache,autodefrag,inode_cache

i encounter a speed difference (around 2X-3X) between aio=threads,cache=unsafe and aio=native,cache=unsafe

aio=threads is much faster, i guest there is conflict between "autodefrag" and linux aio

ching

#3 lore raw

Am 25.09.2012 00:40, schrieb ching:

Quoted 7 lines · Kevin Wolf
Quoted 6 lines

Am 24.09.2012 13:32, schrieb ching:

Quoted 5 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

I am trying to use unsafe cache mode to boost i/o performance.

Quoted 8 lines
Quoted 6 lines

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

will qemu log a entry for the silent fallback?

No, that's why it's silent. :-)

Quoted 7 lines

Reason:

I am testing sparse image on btrfs with mount option: rw,noatime,space_cache,autodefrag,inode_cache

i encounter a speed difference (around 2X-3X) between aio=threads,cache=unsafe and aio=native,cache=unsafe

aio=threads is much faster, i guest there is conflict between "autodefrag" and linux aio

This is odd. The point is that with cache=unsafe it shouldn't even be using Linux AIO in the first place. I can't see why there would be any difference between aio=threads and aio=native with cache=unsafe.

Kevin

author
#4 lore raw
Quoted 21 lines · Kevin Wolf

Am 25.09.2012 00:40, schrieb ching:

Quoted 6 lines · Kevin Wolf
Quoted 5 lines

Am 24.09.2012 13:32, schrieb ching:

Quoted 4 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

I am trying to use unsafe cache mode to boost i/o performance.

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

will qemu log a entry for the silent fallback?

No, that's why it's silent. :-)

Quoted 4 lines

Reason:

I am testing sparse image on btrfs with mount option: rw,noatime,space_cache,autodefrag,inode_cache

Quoted 9 lines
Quoted 3 lines

i encounter a speed difference (around 2X-3X) between aio=threads,cache=unsafe and aio=native,cache=unsafe

aio=threads is much faster, i guest there is conflict between "autodefrag" and linux aio

This is odd. The point is that with cache=unsafe it shouldn't even be using Linux AIO in the first place. I can't see why there would be any difference between aio=threads and aio=native with cache=unsafe.

Kevin

is it possible to check the open mode of file and whether it is using aio at runtime?

#5 lore raw

Am 26.09.2012 01:22, schrieb ching:

Quoted 25 lines · Kevin Wolf
Quoted 24 lines

Am 25.09.2012 00:40, schrieb ching:

Quoted 6 lines · Kevin Wolf
Quoted 5 lines

Am 24.09.2012 13:32, schrieb ching:

Quoted 4 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

I am trying to use unsafe cache mode to boost i/o performance.

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

will qemu log a entry for the silent fallback?

No, that's why it's silent. :-)

Quoted 7 lines

Reason:

I am testing sparse image on btrfs with mount option: rw,noatime,space_cache,autodefrag,inode_cache

i encounter a speed difference (around 2X-3X) between aio=threads,cache=unsafe and aio=native,cache=unsafe

aio=threads is much faster, i guest there is conflict between "autodefrag" and linux aio

Quoted 8 lines
Quoted 6 lines

This is odd. The point is that with cache=unsafe it shouldn't even be using Linux AIO in the first place. I can't see why there would be any difference between aio=threads and aio=native with cache=unsafe.

Kevin

is it possible to check the open mode of file and whether it is using aio at runtime?

You can attach strace and look for open/pwritev/iosubmit and friends. I did that yesterday with qemu-io and didn't see any iosubmit for 'qemu-io -k -t unsafe'.

Kevin

author
#6 lore raw
Quoted 30 lines · Kevin Wolf

Am 26.09.2012 01:22, schrieb ching:

Quoted 29 lines · Kevin Wolf
Quoted 28 lines

Am 25.09.2012 00:40, schrieb ching:

Quoted 6 lines · Kevin Wolf
Quoted 5 lines

Am 24.09.2012 13:32, schrieb ching:

Quoted 4 lines

Hi all,

My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native"

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

I am trying to use unsafe cache mode to boost i/o performance.

aio=native requires the image to be opened with O_DIRECT, i.e. cache=none or cache=directsync. If you specify a different cache option, it will silently fall back to aio=threads.

Kevin

will qemu log a entry for the silent fallback?

No, that's why it's silent. :-)

Quoted 7 lines

Reason:

I am testing sparse image on btrfs with mount option: rw,noatime,space_cache,autodefrag,inode_cache

i encounter a speed difference (around 2X-3X) between aio=threads,cache=unsafe and aio=native,cache=unsafe

aio=threads is much faster, i guest there is conflict between "autodefrag" and linux aio

This is odd. The point is that with cache=unsafe it shouldn't even be using Linux AIO in the first place. I can't see why there would be any difference between aio=threads and aio=native with cache=unsafe.

Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

Kevin

is it possible to check the open mode of file and whether it is using aio at runtime?

You can attach strace and look for open/pwritev/iosubmit and friends. I did that yesterday with qemu-io and didn't see any iosubmit for 'qemu-io -k -t unsafe'.

Kevin

The output of strace when using aio=native:

open("XXXXXX", O_RDWR|O_CLOEXEC) = 14

However, i can no longer reproduce the problem the VM image is defragged, it is weird.

Anyway, thank you very much for your help.

ching