Re: kqueue backend for pgbench

From: Roman Khapov <rkhapov(at)yandex-team(dot)ru>
To: Jeff Anton <antonpgsql(at)hesiod(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: kqueue backend for pgbench
Date: 2026-10-29 11:31:38
Message-ID: D6889C2B-0A6C-4732-A7D0-13C3FC214C3E@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi! Thanks for the review!

> Another solution to this is to have code which does not use fd_set but instead uses its own method of building and using bit arrays. I have done this in my professional development.
> I'll include the NOTES from Freebsd on the select(2) man page....
>

I rechecked the docs and the kernel impl example [0].
There is some thought about I thinking:
- max absolute fd number will be limited by FD_SETSIZE, which is
defined at compile time, would it be a fragile solution for runtime anyway?
The the implementation of bit string must rely on architecture-depended things
(ex: _DARWIN_UNLIMITED_SELECT), which will lead to a patch
similar in size to the proposed?
- the cost of operations will have O(max_fd) instead of O(nfd),
which is not critical for current implementation of pgbench, but in future may
lead to refactor of struct socket_set or the code below
- kevent already used in backend code base for cases of several fds,
proposed patch would be just continuation of [1] which have same style
to waiteventset.c

[0] - https://elixir.bootlin.com/freebsd/v15.1/source/sys/kern/sys_generic.c#L1189
[1] - https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=60e612b602999e670f2d57a01e52799eaa903ca9

--
Best regards,
Roman Khapov

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Roman Khapov 2026-10-29 11:27:45 Check the fd number against FD_SETSIZE in PQsocketPoll