Re: Add time spent in posix_fadvise() in I/O read time ? - Mailing list pgsql-hackers

From Frédéric Yhuel
Subject Re: Add time spent in posix_fadvise() in I/O read time ?
Date
Msg-id 8c4ec02f-763c-465c-adf3-801c8cbf02a5@dalibo.com
Whole thread Raw
In response to Add time spent in posix_fadvise() in I/O read time ?  (Frédéric Yhuel <frederic.yhuel@dalibo.com>)
List pgsql-hackers

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().



pgsql-hackers by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: PATCH: warn about, and deprecate, clear text passwords
Next
From: Bruce Momjian
Date:
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER