Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujA7K-003ik9-HP for pgsql-admin@arkaria.postgresql.org; Tue, 05 Aug 2025 05:21:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ujA7J-007GfW-9W for pgsql-admin@arkaria.postgresql.org; Tue, 05 Aug 2025 05:21:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujA7I-007GfL-T2 for pgsql-admin@lists.postgresql.org; Tue, 05 Aug 2025 05:21:40 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ujA7F-000oqg-0v for pgsql-admin@lists.postgresql.org; Tue, 05 Aug 2025 05:21:40 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-24049d16515so31455425ad.1 for ; Mon, 04 Aug 2025 22:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754371295; x=1754976095; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VwBqnWHzjT3XNgwSn/GfcIbr7iZK9U/wfXp9Nmpmy6M=; b=S4PVr2ik8fI2bJOquAQFTvkTELnoNVjw10WAI5XmfJkkTrBxt5ZxK+PVjwPPBWX5CJ 1hwfZnAPxnVlirW7QqX4lbkGzpCWR7sBpqUKxndNtJCiNOf80tnf4ex81BJgyP0u8621 yGv6f4ktcO9rMRdlJI026WpG3x2I13W6fyfYPC5CYNGAA4ZCb51VBYBu9rX7j1ptj/CA TcPDiSssraQWrbi4TjZ3Ifzf2LTLrpelUazjZtNwskUyrmVX+1cyzBATM7J5szv0cH9K WCh/1bz1lKdw6x52lEEyJbK/SljzTpgR8tFBT5N222/jY8sCkB0dbSRQS+skJfOgCkon IcLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754371295; x=1754976095; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VwBqnWHzjT3XNgwSn/GfcIbr7iZK9U/wfXp9Nmpmy6M=; b=T09vv+EzLG4/Ebl3hPz62gSkkWa79SFefjI5+mV8LnrpWHcaELemFeT1kkXaR+LemA RtDYyrZTDN2nhIhWWA/BMUoctpvMAPAlhMLmqdJP4haRr1V0KFt/xbG6heY6qmY2sJyN qxQHnnFyGE7dnV84Kzg00EquTSiJk5EojRLqvlQ+EoR3oF0U2Hs2fT5O48vdFkxNkVJj +VoM4MTXIC2cz/JM3jAb2YcgO+MU/GE6ts6RG194eO48NMBlqkYsDPpSTZZe5hpWZJyD Gr4wlumZJ7iziv6KeVm2015mIp4l8JkZt2lL/tgJCtfuwwIGIbhST3piJHobVP20bXqy w9VQ== X-Gm-Message-State: AOJu0YwcfLIfUPm4NgRRXyl+/5XsDi4A0Sz8OOSwxBuD7jxyMkGJ4JLF wEi4WryPBXLdbuXM09HzMLnvzlmLNkKOvYmljYKvW69eM7GwrTAQeLC07aEdPqrfAQDtD6N2DQT PpucrW1E9+r9EDKTgvL1UFxQgT/VFCSRUYic= X-Gm-Gg: ASbGncvAMZoqrYzQ7ca4HDsC2+DMa+qZMTpW3T/N72WNPBf/SMd4HEhUeVsBln8H/gB YTjFbVncRzWCIiq8vrSURM/1Y6Eb8fwM2fB6YXI7RHcW/NCfjQvf/652UiC9SCkYQX1UwGy1EpH iVjXGJAWcc9QmZilsEl0pqZamXDgE4QtaSZzVtDuqLPS8IRE1qzHn5QdKNE6oiLIc/CVYlsM9uV ZdoZkMGqAmaXsQyqA== X-Google-Smtp-Source: AGHT+IFAQukqND+Z5faRJbPdAkIJNF2d2jobb6HDo7juAHcLOK7QkMUOaqHrBINPGR3HAXiQt3JP36wjUPYUgUysvTc= X-Received: by 2002:a17:902:cec4:b0:240:8fef:a3bd with SMTP id d9443c01a7336-24246fec7f8mr162209695ad.25.1754371294692; Mon, 04 Aug 2025 22:21:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Deepak Goel Date: Tue, 5 Aug 2025 10:51:22 +0530 X-Gm-Features: Ac12FXzNfhoJqEXtg6xtSnyW0_aSCyGHh0HGJN8T82fHCI9W5d1VPSWX0uOV-Kw Message-ID: Subject: Re: DB load balancer To: Siraj G Cc: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000d30bb8063b97657a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d30bb8063b97657a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Please share what you mean by slow (CPU usage of secondary over time, response times of the transactions over time). Deepak "The greatness of a nation can be judged by the way its animals are treated - Mahatma Gandhi" +91 73500 12833 deicool@gmail.com LinkedIn: www.linkedin.com/in/deicool "Plant a Tree, Go Green" Make In India : http://www.makeinindia.com/home On Tue, Aug 5, 2025 at 10:18=E2=80=AFAM Siraj G wrote= : > Hello Experts! > > We have a multi tenant model DB with a Primary and a Secondary. There are > 3x or 4x connections flowing to Secondary as the application is read > intensive. Accordingly we have allocated more number of resources to the = VM > hosting the secondary/replica DB. > > Spec:- > Primary: 48 CPUs, 48GB memory > Secondary: 80 CPUs, 128GB memory > PG version: 12.22 (we have already started the upgrade process) > OS: Ubuntu > > The problem very frequently we are experiencing is that the CPU load on > the SECONDARY is going very very high causing the app slowness. Also, > frequently the postgres is crashing due to OOM. > > I was thinking of these (please give feedback): > 1. Have a DB level balancer for the load balancing in the DB level, > meaning primary will also receive the READ traffic > 2. Add a second REPLICA and configure load balancer for the connection > load balancing > > What do we do for load balancing at the DB level, in postgres? > > If there are any suggestions, please let me know. > > Regards > Siraj > --000000000000d30bb8063b97657a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Please share what you mean by slow (CPU usage of seco= ndary over time, response times of the transactions=C2=A0over time).
<= div>


Dee= pak
"The greatness of a nation can be judged by t= he way its animals are treated - Mahatma Gandhi"

=
+91 73500 12833
deicool@gmail.com

L= inkedIn:=C2=A0www.linkedin.com/in/deicool

"Plant a Tree, Go Green"



On Tue, Aug 5, = 2025 at 10:18=E2=80=AFAM Siraj G <tosiraj.g@gmail.com> wrote:
Hello Experts!

We h= ave a multi tenant model DB with a Primary and a Secondary. There are 3x or= 4x connections flowing to Secondary as the application is read intensive. = Accordingly we have allocated more number of resources to the VM hosting th= e secondary/replica DB.=C2=A0

Spec:-=C2=A0
Primary: 48 CPUs, 48GB memory
Secondary: 80 CPUs, 128GB memory=
PG version: 12.22 (we have already started the upgrade process)<= /div>
OS: Ubuntu

The problem very frequently w= e are experiencing is that the CPU load on the SECONDARY is going very very= high causing the app slowness. Also, frequently the postgres is crashing d= ue to OOM.

I was thinking of these (please give fe= edback):
1. Have a DB level balancer for the load balancing in th= e DB level, meaning primary will also receive the READ traffic
2.= Add a second REPLICA and configure load balancer for the connection load b= alancing

What do we do for load balancing at the D= B level, in postgres?

If there are any suggestions= , please=C2=A0let me know.

Regards
Siraj=
--000000000000d30bb8063b97657a--