Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hckI0-0000VB-PV for pgsql-general@arkaria.postgresql.org; Mon, 17 Jun 2019 05:34:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hckHy-0006hz-SD for pgsql-general@arkaria.postgresql.org; Mon, 17 Jun 2019 05:34:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hckHy-0006hs-DD for pgsql-general@lists.postgresql.org; Mon, 17 Jun 2019 05:34:42 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hckHu-00075k-Ko for pgsql-general@postgresql.org; Mon, 17 Jun 2019 05:34:40 +0000 Received: by mail-wr1-x42a.google.com with SMTP id v14so8423341wrr.4 for ; Sun, 16 Jun 2019 22:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=lVnIurnff5x+KMMBPvbSdMuLOTQV45WZXaQYyAPu+8o=; b=eDT8YRQV/IiXa3ZQm0dsvNsxPCHjbRBBofiNlCKjWN3HevY/Xj1BBCawwlkWaixL2a 8GtgKlpvSz57PguQq4fSXY8ylIIYt7BZvL1g8Vi4vOiGzis96HgUVe8hzdSrmwkHJQhA pfkRGYqFyQ8o08otbgsJH1P+8gAKFLEuyZQG08/q+SDv3h7KIc0FoE6fSFBfSRQow3F9 92eo9tl5jNC1cKNYZO4+/J8+44ZXEpX34vBKRwAHiD2WaxB7uz64SyGGX+OtZg2h/YFu DSrpM9/Gpwag5MXH9VuDT9aRDYVhX1t5YIkIwLvLxeKn+nyaNezLtk2RGx/0L7Oahd9f FXLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=lVnIurnff5x+KMMBPvbSdMuLOTQV45WZXaQYyAPu+8o=; b=OxYstn1r5qXkAe0O5jlJF2eBnc5naQBaDmJbchM3xTFR8/uaygS4Opajee8focrEto 1URnUB1dNu4Vt7aYSAiJhxWUtqYisRpGRNsixKjMZ30xx6wdxR47dVDQkn0+eYjsy53a DBYOvQqpfi/8HvdGN4H9YwrWSKMHk9Z6aO6JH2SP6QCbJhdpC9O5I2nReZ57xm0s13gW +0FEVMaideVrcKItGfFvOVqBM/RA5ofBWEUcTf1W+xErASnphxteA/bhFs8CiK3X7F8t KeutgHujSV8hCTWFNuGdys8MJ5F4YbWDzZoqyCKLD03k5YCvv/8KKDy3NLCD1SEQ1zN4 vTiw== X-Gm-Message-State: APjAAAXTL9jCH0reDhQIjXts+eQBddMDXxQVwTAaQKgspy85jQW6YUqr D90UrSEwjqllsS3lex13Jmtd/kk5OEZ82g== X-Google-Smtp-Source: APXvYqzMhqNIfGm8Ft4DJ6vOiJnUppAp9LIdo2UpN6EYwC2Rt5A0Mb9yUHPf7A/4lfznkqNOH22wVg== X-Received: by 2002:adf:fd11:: with SMTP id e17mr4734610wrr.337.1560749676079; Sun, 16 Jun 2019 22:34:36 -0700 (PDT) Received: from roberts-mbp.lan ([37.6.201.131]) by smtp.gmail.com with ESMTPSA id l12sm30399045wrb.81.2019.06.16.22.34.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Jun 2019 22:34:35 -0700 (PDT) From: Rob Nikander Content-Type: multipart/alternative; boundary="Apple-Mail=_164E0BC0-5AAF-4C61-B0EF-EB611AAA0803" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Async client libraries - not worth it? Message-Id: <73BC6656-5B14-4F6A-B0FE-5A1102AEF393@gmail.com> Date: Mon, 17 Jun 2019 08:34:33 +0300 To: Postgres General X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_164E0BC0-5AAF-4C61-B0EF-EB611AAA0803 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, I=E2=80=99m writing a new web app, and I=E2=80=99ve been experimenting = with some async DB access libraries [1]. I also see some discussion = online about a future Java standard to replace or supplement JDBC with = an async API. While I understand the benefits of async in some situations, it seems to = me that these libraries are not going to give much performance benefit, = given the architecture of a PostgreSQL server. (Nothing against PG; = probably most RDBMSs are like this.) I wonder if anyone else has looked at this and agrees, or not. ? A client library with an async-style API may allow 100,000s of = concurrent =E2=80=9Coperations=E2=80=9D, but since the PG server itself = doesn=E2=80=99t handle connections on that scale (and has no plans to, I = assume?), the client library is really maintaining a queue of operations = waiting for a connection pool. Maybe there is some performance benefit = there, but the most important point - to free up the front end to handle = many HTTP connections - can also happen by combining an operation queue = with a synchronous API.=20 Rob [1]: Mentioned here: https://github.com/pgjdbc/pgadba/issues/17= --Apple-Mail=_164E0BC0-5AAF-4C61-B0EF-EB611AAA0803 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hi,

I=E2=80=99m writing a new web app, and I=E2=80=99ve = been experimenting with some async DB access libraries [1]. I also see = some discussion online about a future Java standard to replace or = supplement JDBC with an async API.

While = I understand the benefits of async in some situations, it seems to me = that these libraries are not going to give much performance benefit, = given the architecture of a PostgreSQL server. (Nothing against PG; = probably most RDBMSs are like this.)

I = wonder if anyone else has looked at this and agrees, or not. = ?

A client library with an async-style API may allow = 100,000s of concurrent =E2=80=9Coperations=E2=80=9D, but since the PG = server itself doesn=E2=80=99t handle connections on that scale (and has = no plans to, I assume?), the client library is really maintaining a = queue of operations waiting for a connection pool. Maybe there is some = performance benefit there, but the most important point - to free up the = front end to handle many HTTP connections - can also happen by combining = an operation queue with a synchronous API. 

Rob


= --Apple-Mail=_164E0BC0-5AAF-4C61-B0EF-EB611AAA0803--