Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dp0I0-0002YB-0Q for pgsql-performance@arkaria.postgresql.org; Mon, 04 Sep 2017 22:56:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dp0Hz-0002vf-DC for pgsql-performance@arkaria.postgresql.org; Mon, 04 Sep 2017 22:56:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dp0GB-0008Ax-LL for pgsql-performance@postgresql.org; Mon, 04 Sep 2017 22:54:27 +0000 Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dp0Fz-00088B-Tz for pgsql-performance@postgresql.org; Mon, 04 Sep 2017 22:54:27 +0000 Received: by mail-qk0-x22f.google.com with SMTP id o129so6235459qkd.0 for ; Mon, 04 Sep 2017 15:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+l0SZAxgjLa+As4kk1k9M3waI9psZFazT2hk93Oxv9A=; b=Cv/qowA9/Tr07FxGL3X67ut0L9bH/Z+MudH0GfNy3UNrn5hWbv0Ww+kZDRVaTQFZoC G2eiPIhpco0YnPbEuPV1U2M+Mv5zneQIugp14OXIl9Ov0qRFplOjC9ibCU7oX1WcB1ie q4+Pbaj+fsaE1Q0m22snwAaKFQCWV1fF6YBqnKwcLGd/rdtmQ0wX7Pw/LgOaqeJtJ77Q jVxhVTTBVq2hq06U56stZgjfbkJ9HE7GOKRMWxnSP8kijEy+KXrvoNdITrzcjZhNHErA DahmGFIA3puUGrJENKNVunot8RUD/bMPRL8I6x2gl8HUL0MCGr75Nqv1JjpwmvZZP6Z/ 5smA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+l0SZAxgjLa+As4kk1k9M3waI9psZFazT2hk93Oxv9A=; b=FTjlfejh/+bP9nwEuu3OjLFCz0VxKStQPOAdjRebZEsg9iUAaNenDHL5F3AMVoQ6AN smeQBk9oYgXQLM/RMvDJl2eYcS3unRCfqmxEuhnY/VocEcyM6IfBqNLgI7O3C+0sdgQR y4l63XRlo8TW1ugyuTvUu0cd9o04nhlRFtTHiysC014coNTE5SWfLRihBrULqJy+DVLT 0ouJOyjvGH8I5a9eXdEpdiH3ECSfxCL+5BEWYWi2ADbBCaDMV3CwlZMFOwZZIKM3ev73 wWbC7TmHsEa6X2p6iPip0oOcGPaEiQAOAzy6WRKfULi4hoyGYH1bFaOOJuMgKnzXLLWO wAKA== X-Gm-Message-State: AHPjjUhaIYR/a6YzjT6O7avdwcHRT8qyV4UtIj1xmX2Qpw47s8Blw+HE Ltfucw34Hk+T7kV5ZjBI2IIWZAk/aw== X-Google-Smtp-Source: ADKCNb5DpdCKm2Oyhf+RbSmf3XYeqM+9RxENI0M5vb3p6q7HDupWNquQ8F1DpMFfyklXZH+S8Bo4VutEWqrZQXRuSyM= X-Received: by 10.55.71.19 with SMTP id u19mr2600243qka.160.1504565653649; Mon, 04 Sep 2017 15:54:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?7Jqw7ISx66+8?= Date: Mon, 04 Sep 2017 22:54:03 +0000 Message-ID: Subject: Re: Handling small inserts from many connections. To: Scott Marlowe Cc: "pgsql-performance@postgresql.org" Content-Type: multipart/alternative; boundary="001a114a854253be66055864fd6b" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --001a114a854253be66055864fd6b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I=E2=80=99am already using pgbouncer as a connection pooler and default_poo= l_size =3D 96. i checked =E2=80=9Cshow pools=E2=80=9D, the max_wait was as high as 70 or m= ore while INSERT statement duration is about 3000ms in postgres log. These numbers increase over time. I=E2=80=99ll try RAID with more SSDs. Thank you for your response. 2017=EB=85=84 9=EC=9B=94 5=EC=9D=BC (=ED=99=94) =EC=98=A4=EC=A0=84 3:15, Sc= ott Marlowe =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > On Mon, Sep 4, 2017 at 2:14 AM, =EC=9A=B0=EC=84=B1=EB=AF=BC wrote: > > Hi team, > > > > I'm trying to configure postgres and pgbouncer to handle many inserts > from > > many connections. > > > > Here's some details about what i want to achieve : > > > > We have more than 3000 client connections, and my server program fork= s > > backend process for each client connections. > > This is a terrible configuration for any kind of performance. Under > load all 3,000 connections can quickly swamp your server resulting in > it slowing to a crawl. > > Get a connection pooler involved. I suggest pgbouncer unless you have > very odd pooling needs. It's easy, small, and fast. Funnel those 3,000 > connections down to <100 if you can. It will make a huge difference in > performance and reliability. > > > System information : > > PGBouncer 1.7.2. > > PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 > > 20120313 (Red Hat 4.4.7-18), 64-bit on CentOS release 6.9 (Final). > > Kernel version 2.6.32-696.10.1.el6.x86_64 > > Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz processor. > > 32GB ECC/REG-Buffered RAM. > > 128GB Samsung 840 evo SSD. > > If it's still slow after connection pooling is setup, then look at > throwing more SSDs at the problem. If you're using a HW RAID > controller, turn off caching with SSDs unless you can prove it's > faster with it. It almost never is. > --001a114a854253be66055864fd6b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I=E2=80=99am already using pgbouncer as a connection pool= er and default_pool_size =C2=A0=3D 96.

i checked =E2=80=9Cshow pools=E2=80=9D, the max_wait was as = high as 70 or more while INSERT statement duration is about 3000ms in postg= res log.
These numbers increase over time.

I=E2=80=99ll try RAID with more S= SDs.

Thank you for your = response.

2017=EB=85=84 9=EC= =9B=94 5=EC=9D=BC (=ED=99=94) =EC=98=A4=EC=A0=84 3:15, Scott Marlowe <scott.marlowe@gmail.com>=EB= =8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1:
On Mon, Sep 4, 2017 at 2:14 AM, =EC=9A=B0=EC=84=B1=EB=AF=BC <dntjdals0513@gmail.com> wrote:
> Hi team,
>
> I'm trying to configure postgres and pgbouncer to handle many inse= rts from
> many connections.
>
> Here's some details about what i want to achieve :
>
>=C2=A0 =C2=A0We have more than 3000 client connections, and my server p= rogram forks
> backend process for each client connections.

This is a terrible configuration for any kind of performance. Under
load all 3,000 connections can quickly swamp your server resulting in
it slowing to a crawl.

Get a connection pooler involved. I suggest pgbouncer unless you have
very odd pooling needs. It's easy, small, and fast. Funnel those 3,000<= br> connections down to <100 if you can. It will make a huge difference in performance and reliability.

> System information :
>=C2=A0 =C2=A0PGBouncer 1.7.2.
>=C2=A0 =C2=A0PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (= GCC) 4.4.7
> 20120313 (Red Hat 4.4.7-18), 64-bit on CentOS release 6.9 (Final).
>=C2=A0 =C2=A0Kernel version 2.6.32-696.10.1.el6.x86_64
>=C2=A0 =C2=A0Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz processor.
>=C2=A0 =C2=A032GB ECC/REG-Buffered RAM.
>=C2=A0 =C2=A0128GB Samsung 840 evo SSD.

If it's still slow after connection pooling is setup, then look at
throwing more SSDs at the problem. If you're using a HW RAID
controller, turn off caching with SSDs unless you can prove it's
faster with it. It almost never is.
--001a114a854253be66055864fd6b--