Very inconsistent (read) speed on UFS2

Bob Friesenhahn bfriesen at
Tue Aug 30 23:03:13 UTC 2011

On Wed, 31 Aug 2011, Lev Serebryakov wrote:
>>   I'll try this experiment with mmap() and touching every 4096-th byte of
>> mapped memory instead of read(2).
>  Strange enough, it gives only 40-50MiB/s and results are very
> consistent.
>  It really surprise me. I didn't think, that there will be so much
> difference, I was sure, that it will be almost equivalent speed.

FreeBSD does not seem to default to sequential read-ahead when memory 
mapping is used with sequential page access.  Try using madvise() 
with the MADV_SEQUENTIAL option and see if it helps.

There are also MADV_WILLNEED, MADV_DONTNEED, and MADV_FREE.  Careful 
use of these options can help performance quite a lot when data is 
large compared to memory.

Bob Friesenhahn
bfriesen at,
GraphicsMagick Maintainer,

More information about the freebsd-fs mailing list