Re: pg_preadv() and pg_pwritev()
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-12-20T11:12:12Z
Lists: pgsql-hackers
On Sun, Dec 20, 2020 at 8:07 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > One minor thought is that in > > + struct iovec iov[Min(IOV_MAX, 1024)]; /* cap stack space */ > > it seems like pretty much every use of IOV_MAX would want some > similar cap. Should we centralize that idea with, say, > > #define PG_IOV_MAX Min(IOV_MAX, 1024) > > ? Or will the plausible cap vary across uses? Hmm. For the real intended user of this, namely worker processes that simulate AIO when native AIO isn't available, higher level code will limit the iov count to much smaller numbers anyway. It wants to try to stay under typical device limits for vectored I/O, because split requests would confound attempts to model and limit queue depth and control latency. In Andres's AIO prototype he currently has a macro PGAIO_MAX_COMBINE set to 16 (meaning approximately 16 data block or wal reads/writes = 128KB worth of scatter/gather per I/O request); I guess it should really be Min(IOV_MAX, <something>), but I don't currently have an opinion on the <something>, except that it should surely be closer to 16 than 1024 (for example /sys/block/nvme0n1/queue/max_segments is 33 here). I mention all this to explain that I don't think the code in patch 0002 is going to turn out to be very typical: it's trying to minimise system calls by staying under an API limit (though I cap it for allocation sanity), whereas more typical code probably wants to stay under a device limit, so I don't immediately have another use for eg PG_IOV_MAX.
Commits
-
Improve our heuristic for selecting PG_SYSROOT on macOS.
- 3934543c2bb0 9.5.25 landed
- fc6d08b27a33 9.6.21 landed
- 5fa060c8f593 10.16 landed
- 046c8facecee 11.11 landed
- f5d044eaeff0 12.6 landed
- f44ae4db5fec 13.2 landed
- 4823621db312 14.0 landed
-
Move our p{read,write}v replacements into their own files.
- 0d56acfbaa79 14.0 landed
-
Don't use elog() in src/port/pwrite.c.
- df10ac625c16 14.0 landed
-
Use vectored I/O to fill new WAL segments.
- ce6a71fa5300 14.0 landed
-
Provide pg_preadv() and pg_pwritev().
- 13a021f3e8c9 14.0 landed