--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii
Henrik Nordstrom wrote:
>Stephen R. van den Berg wrote:
>> But, using one FD, and mmapping multiple parts of this file/device in
>> different places allows for async io without the use of more than
>> one filedescriptor per filesystem.
>Possibly, if you utilize threads to trigger the needed pagefaults.
Naturally. Otherwise we would be blocking on a pagefault and be back
to synchronous IO again.
>But I am afraid that using mmap is not suitable for Squid as it
>increases the VM paging and may generate a lot of pagefaults for the
>main Squid process as well. The VM based file I/O may push parts of
>Squid out on swap unless you have a lot of memory available.
I fail to see why this should be the natural conclusion.
mmap()ing files basically *always* saves memory and therefore reduces
net disk activity (which is what it is all about, we don't care if we
page, or swap, or read/write files; all we care about is that we want
to minimise disk activity, and minimise the total memory required).
Without mmap()ing we see:
Sending diskdata to a network client involves a copy from disk to the kernel
buffer, and a copy from the kernel buffer to the user buffer, then we start
the network transmit on the user buffer. In userspace we have this
allocated buffer which can never be reclaimed by the kernel (it
could be swapped out, but that's about it).
With mmapping, we see:
Sending diskdata to a network client involves setting up the mmap, then
simply start the network transfer on the data mmapped.
This has two advantages:
1. The data is copied from disk to memory only once.
2. There is no separate user buffer taking up memory.
3. The kernel could (temporarily) reclaim the mmapped region since
it controls when it pages in this information (the information does
not need to be swapped out to swap space in order to do this).
>Some OS:es uses VM paging for plain file I/O and have these problems
>regardless of what we do (I beleive Solaris is one of them).
Depending on your definition of VM paging, I think you could say that
all OSes do this, I suppose.
-- Sincerely, srb@cuci.nl Stephen R. van den Berg (AKA BuGless). The eleventh commandment: Thou shalt not re-curse! --MimeMultipartBoundary--Received on Tue Jul 29 2003 - 13:15:50 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:47 MST