Обсуждение: pgbouncer

Поиск
Список
Период
Сортировка

pgbouncer

От
Rita
Дата:

seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
--
--- Get your facts first, then you can distort them as you please.--

Re: pgbouncer

От
Sebastiaan Mannem
Дата:
It greatly depends on what you want to achieve. Both have pro’s and con’s.
What do you need pgbouncer for?

Verstuurd vanaf mijn iPhone

> Op 28 jun. 2023 om 13:19 heeft Rita <rmorgan466@gmail.com> het volgende geschreven:
>
> 
>
> seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
> --
> --- Get your facts first, then you can distort them as you please.--



Re: pgbouncer

От
Laurenz Albe
Дата:
On Wed, 2023-06-28 at 07:19 -0400, Rita wrote:
> seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?

On the database server.  You don't want network latency between pgbouncer and PostgreSQL,
so that the connections can be active as much as possible.
That will improve throughput.

Yours,
Laurenz Albe



Re: pgbouncer

От
Giovanni Biscontini
Дата:
On the DB server: the bouncer is made to optimize many and fast connections to the DB and fasten the throughput, so You've to have the shortest way to go to the data.
One important thing: remember that different user raise different connections so be careful to choose which application you'll direct to pgbouncer.
A couple more: be careful to choose the right pool_mode and tune the right server_connect_timeout value. 
all the best, Giovanni

Il giorno mer 28 giu 2023 alle ore 13:19 Rita <rmorgan466@gmail.com> ha scritto:

seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
--
--- Get your facts first, then you can distort them as you please.--


--

Best Regards


Dott. Giovanni Biscontini

Software Developer & Database Architect

_________________________________________________________________
Privacy e riservatezza: il presente messaggio, così come i relativi allegati, contengono dati ed informazioni da considerarsi strettamente riservate ed è indirizzato esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato a trattarlo in osservanza delle norme del Regolamento UE 2016/679 (RGPD). Chiunque ricevesse questo messaggio per errore di evitare di copiarlo, divulgarlo, distribuirlo a terzi e di dare notizia al mittente dell’errato invio, distruggendo poi l'eventuale copia cartacea e la copia in formato elettronico.


Re: pgbouncer

От
Rita
Дата:
I have a dedicated server. I have 3 additional physical application servers which hit the database. I periodically get the application server not able to reach the database server (is server on port 5432 listening? message). Looking at some metrics, seems like I am pulling a lot of tuples (300k or so) during that time. 


On Wed, Jun 28, 2023 at 8:23 AM Sebastiaan Mannem <sebas@mannem.nl> wrote:
It greatly depends on what you want to achieve. Both have pro’s and con’s.
What do you need pgbouncer for?

Verstuurd vanaf mijn iPhone

> Op 28 jun. 2023 om 13:19 heeft Rita <rmorgan466@gmail.com> het volgende geschreven:
>
> 
>
> seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
> --
> --- Get your facts first, then you can distort them as you please.--


--
--- Get your facts first, then you can distort them as you please.--

Re: pgbouncer

От
Ben Chobot
Дата:
Laurenz Albe wrote on 6/28/23 5:27 AM:
On Wed, 2023-06-28 at 07:19 -0400, Rita wrote:
seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
On the database server.  You don't want network latency between pgbouncer and PostgreSQL,
so that the connections can be active as much as possible.
That will improve throughput.

This is true, but as somebody who also deploys a fleet of stand-alone pgBouncers in front of his dbs, a good reason to have a pgBouncer-based traffic spigot before traffic hits your db server is that you can pause traffic from the client to the db during maintenance, up to and including replacing your entire db server, and all clients see is a period of the db acting slow.

For applications that struggle with connection management, this can be very valuable.