Re: Request for Feedback on PostgreSQL HA + Load Balancing Architecture

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: vijay patil <vijay(dot)postgres(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Request for Feedback on PostgreSQL HA + Load Balancing Architecture
Date: 2025-07-21 19:26:37
Message-ID: CAKAnmmLxh5bzdi_f7FJX+fq7YqEGMZ9+FVKBi0uKG44ssTEgLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> Is this architecture considered a best practice within the PostgreSQL
> community?

I would say Patroni is probably "best practice", but there are other people
out there happy with, and expert with, repmgr as well.

Are there any potential bottlenecks or failure points I should be aware of?

How is pgbouncer supposed to know which db to go to?I would think since
HAProxy has some way to tell, that pgbouncer should go on other side of
haproxy (between the app and haproxy)

Would you recommend any improvements or alternative tools for achieving
> better reliability and performance?

Seems you need a witness server or some sort. Your HA system should have a
few main goals:

* Immediately fail over to a replica should the primary go down
* Reroute the application traffic
* Rebuild the old primary as a replica
* Never, ever allow there to be more than one primary server

Secondary goals:
* make the non-Postgres things redundant (as with keepalived and haproxy)
* provide read/write traffic routing (as you kind of have here)
* some sort of backup system (don't see any here)

Your design will also depend on how bulletproof you want your HA system to
be, and how much data your application is allowed to lose.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2025-07-22 15:17:35 Wrapping a select in another select makes it slower
Previous Message Laurenz Albe 2025-07-21 13:35:11 Re: Postgresql 16.9 fast shutdown hangs with walsenders eating 100% CPU