On 3/14/25 09:43, Frédéric Yhuel wrote:
One thing I've noticed is that posix_fadvise(,,POSIX_FADV_WILLNEED) isn't always non-blocking on Linux. As Ted Ts'o explains in this old thread[1], it blocks when the request queue fills up.

When posix_fadvise() blocks, it doesn't seem to be completely off-cpu (but mostly, at least on my machine), and I assume that this is the reason for the sentence "A value higher than needed to keep the disks busy will only result in extra CPU overhead" in the documentation for effective_io_concurrency? My guess is that Linux uses a spinlock somewhere, and that this explains the cpu overhead.

Also, on Linux, it seems we can control the size of the request queue with the /sys/block/XXX/queue/nr_requests setting. On my machine, it is set to 64 by default. When I set it up to 128, postgres spends less time on posix_fadvise(), and correspondingly more on pread().


Reply via email to