pgsql: aio: Basic read_stream adjustments for real AIO

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: aio: Basic read_stream adjustments for real AIO
Date: 2025-03-30 22:59:25
Message-ID: E1tz1cj-001plU-0Y@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

aio: Basic read_stream adjustments for real AIO

Adapt the read stream logic for real AIO:
- If AIO is enabled, we shouldn't issue advice, but if it isn't, we should
continue issuing advice
- AIO benefits from reading ahead with direct IO
- If effective_io_concurrency=0, pass READ_BUFFERS_SYNCHRONOUSLY to
StartReadBuffers() to ensure synchronous IO execution

There are further improvements we should consider:

- While in read_stream_look_ahead(), we can use AIO batch submission mode for
increased efficiency. That however requires care to avoid deadlocks and thus
done separately.
- It can be beneficial to defer starting new IOs until we can issue multiple
IOs at once. That however requires non-trivial heuristics to decide when to
do so.

Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Co-authored-by: Andres Freund <andres(at)anarazel(dot)de>
Co-authored-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f4d0730bbca1b338b8f06389d04816c6c9f06e58

Modified Files
--------------
src/backend/storage/aio/read_stream.c | 39 +++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-03-30 23:41:40 pgsql: Enable IO concurrency on all systems
Previous Message Andres Freund 2025-03-30 22:25:05 pgsql: docs: Reframe track_io_timing related docs as wait time