Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVUid-000M7X-3N for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 10:22:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qVUiZ-003FV8-Vr for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 10:22:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVUiZ-003FUm-Lq for pgsql-hackers@lists.postgresql.org; Mon, 14 Aug 2023 10:22:35 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVUiW-0003ur-1s for pgsql-hackers@lists.postgresql.org; Mon, 14 Aug 2023 10:22:34 +0000 Received: from genua (113x39x105x210.ap113.ftth.ucom.ne.jp [113.39.105.210]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 17649C00D4; Mon, 14 Aug 2023 12:27:10 +0200 (CEST) Date: Mon, 14 Aug 2023 12:22:24 +0200 (CEST) From: Fabien COELHO To: Thomas Munro cc: Tatsuo Ishii , PostgreSQL Developers Subject: Re: pgbench with libevent? In-Reply-To: Message-ID: References: <9633b9f1-c128-7031-6a9e-1af6d247caa0@minesparis.psl.eu> <20230814.150659.1167547855459810626.t-ishii@sranhm.sra.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >> Interesting. In my understanding this also needs to make Latch >> frontend-friendly? > > It could be refactored to support a different subset of event types -- > maybe just sockets, no latches and obviously no 'postmaster death'. > But figuring out how to make latches work between threads might also > be interesting for future projects... > > Maybe Fabien has completion-based I/O in mind (not just "readiness"). Pgbench is really a primitive client on top of libpq. ISTM that completion-based I/O would require to enhance libpq asynchronous-ity, not just expose its underlying fd to allow asynchronous implementations. Currently pgbench only actuall "waits" for results from the server and testing PQisBusy to check whether they are there. > That's something that some of those libraries can do, IIUC. For > example, when your thread wakes up, it tells you "your socket read is > finished, the data is already in your target buffer". Indeed, libevent has a higher level "buffer" oriented API. > As opposed to "you can now call recv() without blocking", so you avoid > another trip into the kernel. But that's also something we'll > eventually want to figure out in the server. -- Fabien.