The setup is simple - large (0.2-1 TB) file with totally random access and small (few KB) records (the hardest thing to do on spinning disks.) The underlying filesystem is UFS.
We are noticing some interesting performance differences between the following two methods:
We'll go for #2, but I'd appreciate any insights regarding why memory/disk flush management for mmap pages is so dramatically different (and worse) than the one for file buffers.
We are noticing some interesting performance differences between the following two methods:
- mmap the entire file and write randomly as memory, at maximum speed.
- performance is good, "100".
- process itself uses 3-4% of CPU
- pagedaemon and geom together use 80-100% of one core.
- the affected disk is 100% busy
- system is non-responsive, it takes ages to do do anything (like
ps
).
- open the file and do random lseeks and writes, in exactly the same pattern as #1.
- performance is a bit lower, "80"
- process itself uses 80-90% CPU
- pagedaemon and geom together use 1-2% of one core.
- the affected disk is 10-20% busy
- system is fully responsive
We'll go for #2, but I'd appreciate any insights regarding why memory/disk flush management for mmap pages is so dramatically different (and worse) than the one for file buffers.