Re: High Avg. Disk Queue Length - Memory Mapped File



When you unmap a region the pages that were unmapped
are moved to the modified page list. When this list grows
beyond a certain size the mapped writer thread in the
memory manager will wake up and start flushing pages to
disk. If you repeatedly map and unmap portions of a large
file you can generate a constant stream of writes, and this
is probably what you're seeing.

I'm not sure I understand your overall design - do you
want the data you write to the mapped file to be persisted
on disk? Wouldn't this data get overwritten when the file
wraps around? If you don't need the data to be persisted
then perhaps you could use regular buffers (allocated on
the heap or using VirtualAlloc) instead of a mapped view?

--
This posting is provided "AS IS" with no warranties, and confers no
rights.


<gsudeesh@xxxxxxxxx> wrote:

The data transferred by hardware is around 500KB. The file size is
500MB. The file mapping and unmapping size is 48 MB. It takes around 30
seconds to fill the file. My program does not stop on reaching the end
of file. It does not stop until explicitly requested. It starts from
the beginning after reaching the end, that is the file is wrapped. I
am creating the file using the following function:

::CreateFile( wsFilePath.c_str(),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ |
FILE_SHARE_WRITE,
0, // No security attributes
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
0 ); // No template file

If I use FILE_FLAG_NO_BUFFERING, then I have to do any special
mechanism with mapped pointer ?

Sudeesh G.

Pavel Lebedinsky [MSFT] wrote:
Did you mean 500 MB or 500 KB? You said below that
each chunk was 48 MB. How long does it take to go over
the entire 528 MB file? What happens when you reach
the end of the file - does your program stop, or does it
start over at the beginning? If it stops, how long does it
take for the system performance to recover?

What flags do you pass to CreateFile? Does it help if you
add FILE_FLAG_NO_BUFFERING?

--
This posting is provided "AS IS" with no warranties, and confers no
rights.

"Sudeesh" wrote:
:
I am using Windows XP. The memory mapped file is backed by user page
file located in the directory C:\Temp. The file size is 528Mb. I have
2GB RAM.

Regarding the map and unmap operations, it depends on the size the data
being transferred by the hardware. The size may be in the range of
500KB.

What OS are you using? Is the memory mapped file backed by
pagefile or a user file? How much RAM do you have and how
many unmap operations happen before you notice the problem?

I need a solution for avoiding high Avg. Disk Queue lenght. I am
programming an hardware that transfers raw data to a non-paged pool.
The size of the non-paged pool is 32Mb. My application moves the
data
in the non-paged pool to a buffer in real time. The size of the
buffer
is 528Mb.
My application cannot map the entire 528Mb. So, I am mapping and
unmapping the buffer at sizes of 48Mb. The problem is that when I
run
my application, the machine becomes slow. It does not occur
immediately. It starts to happen after some time. Using the
performance

monitor, I checked the reason for this scenario. I found that when
the
Avg. Disk Queue Length becomes high, the system becomes slow.



.



Relevant Pages