From c325a7633fcb33dbd73f46ddbbe91e95ddf3b227 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 18 Mar 2025 14:40:05 -0400 Subject: aio: Add io_method=io_uring Performing AIO using io_uring can be considerably faster than io_method=worker, particularly when lots of small IOs are issued, as a) the context-switch overhead for worker based AIO becomes more significant b) the number of IO workers can become limiting io_uring, however, is linux specific and requires an additional compile-time dependency (liburing). This implementation is fairly simple and there are substantial optimization opportunities. The description of the existing AIO_IO_COMPLETION wait event is updated to make the difference between it and the new AIO_IO_URING_EXECUTION clearer. Reviewed-by: Noah Misch Reviewed-by: Jakub Wartak Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt Discussion: https://postgr.es/m/20210223100344.llw5an2aklengrmn@alap3.anarazel.de Discussion: https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf@gcnactj4z56m --- src/backend/utils/activity/wait_event_names.txt | 4 +++- src/backend/utils/misc/postgresql.conf.sample | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/utils') diff --git a/src/backend/utils/activity/wait_event_names.txt b/src/backend/utils/activity/wait_event_names.txt index 9fa12a555e8..4f44648aca8 100644 --- a/src/backend/utils/activity/wait_event_names.txt +++ b/src/backend/utils/activity/wait_event_names.txt @@ -192,7 +192,9 @@ ABI_compatibility: Section: ClassName - WaitEventIO -AIO_IO_COMPLETION "Waiting for IO completion." +AIO_IO_COMPLETION "Waiting for another process to complete IO." +AIO_IO_URING_SUBMIT "Waiting for IO submission via io_uring." +AIO_IO_URING_EXECUTION "Waiting for IO execution via io_uring." BASEBACKUP_READ "Waiting for base backup to read from a file." BASEBACKUP_SYNC "Waiting for data written by a base backup to reach durable storage." BASEBACKUP_WRITE "Waiting for base backup to write to a file." diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 0b9e3066bde..2246ccb85a7 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -204,7 +204,8 @@ # (change requires restart) #io_combine_limit = 128kB # usually 1-128 blocks (depends on OS) -#io_method = worker # worker, sync (change requires restart) +#io_method = worker # worker, io_uring, sync + # (change requires restart) #io_max_concurrency = -1 # Max number of IOs that one process # can execute simultaneously # -1 sets based on shared_buffers -- cgit v1.2.3