Re: Getting mmap's to read in faster
Re: Getting mmap's to read in faster
- Subject: Re: Getting mmap's to read in faster
- From: Mike Smith <email@hidden>
- Date: Sat, 5 Nov 2005 03:46:29 -0800
On Nov 3, 2005, at 2:10 PM, Dave MacLachlan wrote:
I hope this question is appropriate for this list:
I have a file that I am mmap'ing and jumping around in in sort of a random walk. But I do manage to hit most of the file. Is there anyway to encourage the OS to page it in for me, knowing that I'm going to be using it? The performance I'm getting reading in a couple of blocks at a time is rather slow, and I see by examining the Darwin sources that calling madvise with MADV_WILLNEED is currently useless.
I tried doing a mmap and then immediately calling read on the same file descriptor that I mmap'd to read in all the blocks, but this locked up various processes on my system.
... Mike: he already compared the read vs. mmap in the initial posting, and still wants mmap (maybe to avoid changing a lot of already written code).
Not as I read it; that suggests that after mmapping, he's trying to preheat by calling read. There's not a lot of difference in total latency when you interleave read/work requests, vs. reading everything up front; e.g., it's:
read.0 work.0 read.1 work.1 read.2 work.2 ...
vs:
read.0 read.1 read.2 work.0 work.1 work.2 ...
Except that the latter workload is
read0 work.0 work.1 work.2 ...
with 1 unit read latency vs. the former with N unit read latency.
= Mike
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden