pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alan Hodgson <ahodgson@lists.simkin.ca>
To: pgsql-general@lists.postgresql.org
Subject: Re: Issues Scaling Postgres Concurrency
Date: Tue, 14 Mar 2023 11:01:35 -0700
Message-ID: <20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca> (raw)
In-Reply-To: <CA+gH7FFqADdxMTwh1DWMM53XeAzu3TjL80DEV28baAvtctSwdw@mail.gmail.com>
References: <CA+gH7FFqADdxMTwh1DWMM53XeAzu3TjL80DEV28baAvtctSwdw@mail.gmail.com>

On Mon, 2023-03-13 at 12:24 -0400, Harrison Borges wrote:
> Hello everyone.
> 
> I’m running into severe performance problems with Postgres as I
> increase the number of concurrent requests against my backend. I’ve
> identified that the bottleneck is Postgres, and to simplify the
> test case, I created an endpoint that only does a count query on a
> table with ~500k rows. At 5 concurrent users, the response time was
> 33ms, at 10 users it was 60ms, and at 20 users it was 120ms.

I'm no expert on high concurrency, but for something this simple I'd
expect that you're just CPU bottlenecked. Count in PostgreSQL
actually has to read all the rows in the table. And yeah you can't do
too many of them at the same time.

view thread (6+ messages)  latest in thread

Message-ID: <20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca>
Permalink:  ../20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca/
Also on:    postgresql.org/message-id/20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ahodgson@lists.simkin.ca
  Subject: Re: Issues Scaling Postgres Concurrency
  In-Reply-To: <20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca>
  References: <CA+gH7FFqADdxMTwh1DWMM53XeAzu3TjL80DEV28baAvtctSwdw@mail.gmail.com> <20e62f76c0b6e98c390fe020a6da64f072e343be.camel@lists.simkin.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox