by Gladdyu · 6y ago · 0 comments
Isn't this a bit misleading? mmaping a file doesn't cause the kernel to start loading the whole thing into RAM, it just sets things up for the kernel to later transparently load pages of it on demand, possibly with some prefetching.
The article shows that he's getting half the throughput of parsing a CSV that's already in RAM. But: he's using RAID0 of two SSDs and only getting a little more than half the throughput of one of those SSDs. As currently written, this program might not be giving the SSDs a high enough queue depth to hit their full read throughput. I'd like to see what throughput is like with an explicit attempt to prefetch data into RAM (either with a thread manually touching all the necessary pages, or maybe with a madvise call). That could drastically reduce the number of page faults and context switches affecting the OpenMP worker threads, and yield much better CPU utilization.
Put another way, what would you do to read in the CSV serially to increase speed that would push the queue depth above 1?
Edit: just seen this which kind of touches on the same https://news.ycombinator.com/item?id=24737186
There is literally no io being done on your data access paths. Synchronising mapped pages with file contents happens in background write back threads.