loadBalanceHosts and weighted server selection

From: Michael Charnoky <noky(at)noky(dot)net>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: loadBalanceHosts and weighted server selection
Date: 2022-05-27 14:36:34
Message-ID: CAEWrP=k88RCdQoCkLZ7-NOf4_UvMRq5dAinPqjQ=R4DoOsG88A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi, we'd like to take advantage of the "loadBalanceHosts" feature of the
jdbc driver. The only hitch is that we'd like to have the driver prefer one
host over the other based on some sort of "weight". Ideally the driver
would choose hostA 2/3 of the time and the hostB 1/3 of the time (all
queries are read-only). Can we achieve this by specifying hostA twice in
the jdbc url? For example, would this work?

jdbc:postgresql://hostA,hostA,hostB/dbname?loadBalanceHosts=true

Thanks,
noky

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2022-05-27 17:45:24 Re: Clarification on thread-safety
Previous Message Martin Pärtel 2022-05-27 14:12:10 Re: Clarification on thread-safety