postgresql/src/include/storage
Thomas Munro d1c01b79d4 aio: Adjust I/O worker pool automatically.
The size of the I/O worker pool used to implement io_method=worker was
previously controlled by the io_workers setting, defaulting to 3.  It
was hard to know how to tune it effectively.  That is replaced with:

  io_min_workers=2
  io_max_workers=8 (up to 32)
  io_worker_idle_timeout=60s
  io_worker_launch_interval=100ms

The pool is automatically sized within the configured range according to
recent variation in demand.  It grows when existing workers detect that
latency might be introduced by queuing, and shrinks when the
highest-numbered worker is idle for too long.  Work was already
concentrated into low-numbered workers in anticipation of this logic.

The logic for waking extra workers now also tries to measure and reduce
the number of spurious wakeups, though they are not entirely eliminated.

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2Bm4xV0LMoH2c%3DoRAdEXuCnh%2BtGBTWa7uFeFMGgTLAw%2BQ%40mail.gmail.com
2026-04-08 19:08:32 +12:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
aio.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
aio_internal.h Convert AIO to use the new shmem allocation functions 2026-04-06 02:13:04 +03:00
aio_subsys.h Convert AIO to use the new shmem allocation functions 2026-04-06 02:13:04 +03:00
aio_types.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
barrier.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
block.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
buf.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
buf_internals.h Convert buffer manager to use the new shmem allocation functions 2026-04-06 02:13:08 +03:00
buffile.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
bufmgr.h Convert buffer manager to use the new shmem allocation functions 2026-04-06 02:13:08 +03:00
bufpage.h Online enabling and disabling of data checksums 2026-04-03 22:58:51 +02:00
bulk_write.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
checksum.h Online enabling and disabling of data checksums 2026-04-03 22:58:51 +02:00
checksum_block_internal.h Use .h for the file containing the page checksum code fragment 2026-04-07 15:52:55 +07:00
checksum_impl.h Use .h for the file containing the page checksum code fragment 2026-04-07 15:52:55 +07:00
condition_variable.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
copydir.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
dsm.h Use the new shmem allocation functions in a few core subsystems 2026-04-06 02:12:59 +03:00
dsm_impl.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
dsm_registry.h Use the new shmem allocation functions in a few core subsystems 2026-04-06 02:12:59 +03:00
fd.h Add file_extend_method=posix_fallocate,write_zeros. 2026-02-06 17:38:49 +13:00
fileset.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
freespace.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fsm_internals.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
indexfsm.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
io_worker.h aio: Adjust I/O worker pool automatically. 2026-04-08 19:08:32 +12:00
ipc.h Introduce a registry of built-in shmem subsystems 2026-04-06 02:12:55 +03:00
itemid.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
itemptr.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
large_object.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
latch.h Don't include wait_event.h in pgstat.h 2026-03-06 16:24:58 +01:00
lmgr.h Don't include storage/lock.h in so many headers 2026-03-24 17:11:12 +01:00
lock.h Convert all remaining subsystems to use the new shmem allocation API 2026-04-06 02:13:10 +03:00
lockdefs.h Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
locktag.h Move declarations related to locktags from lock.h to new locktag.h 2026-03-21 14:34:47 +09:00
lwlock.h Convert lwlock.c to use the new shmem allocation functions 2026-04-06 02:12:57 +03:00
lwlocklist.h aio: Adjust I/O worker pool automatically. 2026-04-08 19:08:32 +12:00
md.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
off.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_sema.h Use the new shmem allocation functions in a few core subsystems 2026-04-06 02:12:59 +03:00
pg_shmem.h Move shmem allocator's fields from PGShmemHeader to its own struct 2026-01-30 18:22:56 +02:00
pmsignal.h aio: Adjust I/O worker pool automatically. 2026-04-08 19:08:32 +12:00
predicate.h Convert SLRUs to use the new shmem allocation functions 2026-04-06 02:13:02 +03:00
predicate_internals.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
proc.h Use the new shmem allocation functions in a few core subsystems 2026-04-06 02:12:59 +03:00
procarray.h Allow logical replication snapshots to be database-specific 2026-04-07 12:31:18 +02:00
proclist.h Rename AssertVariableIsOfType to StaticAssertVariableIsOfType 2026-02-03 08:45:24 +01:00
proclist_types.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
procnumber.h bufmgr: Change BufferDesc.state to be a 64-bit atomic 2026-01-15 14:20:41 -05:00
procsignal.h Fix slotsync worker blocking promotion when stuck in wait 2026-04-08 11:22:21 +09:00
read_stream.h Add EXPLAIN (IO) infrastructure with BitmapHeapScan support 2026-04-07 22:33:34 +02:00
reinit.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
relfilelocator.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
s_lock.h Remove SpinLockFree() and S_LOCK_FREE(). 2026-02-19 16:19:41 -06:00
sharedfileset.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
shm_mq.h Don't include proc.h in shm_mq.h 2026-02-27 10:53:47 +01:00
shm_toc.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
shmem.h Add alignment option to ShmemRequestStruct() 2026-04-06 02:13:06 +03:00
shmem_internal.h Convert SLRUs to use the new shmem allocation functions 2026-04-06 02:13:02 +03:00
sinval.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
sinvaladt.h Use the new shmem allocation functions in a few core subsystems 2026-04-06 02:12:59 +03:00
smgr.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
spin.h Convert SpinLock* macros to static inline functions. 2026-02-23 15:32:01 -06:00
standby.h Allow logical replication snapshots to be database-specific 2026-04-07 12:31:18 +02:00
standbydefs.h Allow logical replication snapshots to be database-specific 2026-04-07 12:31:18 +02:00
subsystemlist.h Fix compilation without injection points with some compilers 2026-04-06 15:46:00 +03:00
subsystems.h Introduce a registry of built-in shmem subsystems 2026-04-06 02:12:55 +03:00
sync.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
waiteventset.h Update copyright for 2026 2026-01-01 13:24:10 -05:00