Bug #46957 Innodb on windows doesn't do concurrent IO per file
Submitted: 27 Aug 2009 17:15 Modified: 9 Sep 2009 17:53
Reporter: Mark Callaghan
Status: Not a Bug
Category:Server: InnoDB Severity:S5 (Performance)
Version:5.0,5.1,plugin OS:Microsoft Windows
Assigned to: Target Version:
Tags: windows, innodb, performance

[27 Aug 2009 17:15] Mark Callaghan
Description:
Innodb uses os_file_read and os_file_write to read and write from files. Both of these
hold a mutex while calling SetFilePointer/WriteFile or SetFilePointer/ReadFile. This is
done because WriteFile and ReadFile apparently do not support positioned reads (pread)
and positioned writes (pwrite) so the mutex is held while the offset to the file is set.

Because of this there can be at most one file IO request pending per file. You really
need to use innodb_file_per_table in this case.

How to repeat:
Read os_file_read and os_file_write. Look for '#ifdef __WIN__'.

Suggested fix:
I don't know.
[27 Aug 2009 22:26] Peter Laursen
@Mark .. your synopsis reads "Innodb on windows .." but the OS field reads 'any'. Please
clarify!
[27 Aug 2009 22:36] Mark Callaghan
set OS to Windows
[1 Sep 2009 4:10] Mark Callaghan
Mikael Ronstrom might have more background on this. After reading more of the code, I
think Win XP and more recent windows are OK:
>>>
On reading the code again, when os_aio_use_native_aio is set, then async IO is used for
all (most?) IO requests from InnoDB. And it is set on windows as long as
os_get_os_version() != OS_WIN95, OS_WIN31, OS_WINNT. 

So, InnoDB IO performance on Win XP and more recent systems might be better than it is on
Linux.
>>>
[9 Sep 2009 17:44] Calvin Sun
Async IO is default on Windows.
[9 Sep 2009 17:53] Mark Callaghan
Yes, I updated my blog but not the bug after figuring out how that is done. To be
pedantic, this is supported for modern windows (XP or greater) not Windows. The code
which serializes IO is used for older Windows releases.
[9 Sep 2009 17:59] Peter Laursen
@Mark .. it was not pedantic.  It was very pedantic!

All Windows versions before XP are *totally dead*. Not supported by Microsoft for several
years. 'Windows' and 'Windows XP and later' are synonyms.