Re: [EXTERNAL] Re: Support load balancing in libpq

From: Jacob Champion <jchampion(at)timescale(dot)com>
To: Maxim Orlov <orlovmg(at)gmail(dot)com>
Cc: Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>, Michael Banck <mbanck(at)gmx(dot)net>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: Support load balancing in libpq
Date: 2023-01-12 23:19:19
Message-ID: CAAWbhmhvkjTN2BxpHFEPsvbi=MKSQ2wZEqwZNwODyRh7ZKcd3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 14, 2022 at 7:54 AM Maxim Orlov <orlovmg(at)gmail(dot)com> wrote:
> For the patch itself, I think it is better to use a more precise time function in libpq_prng_init or call it only once.
> Thought it is a special corner case, imagine all the connection attempts at first second will be seeded with the save
> value, i.e. will attempt to connect to the same host. I think, this is not we want to achieve.

Just a quick single-issue review, but I agree with Maxim that having
one PRNG, seeded once, would be simpler -- with the tangible benefit
that it would eliminate weird behavior on simultaneous connections
when the client isn't using OpenSSL. (I'm guessing a simple lock on a
global PRNG would be less overhead than the per-connection
strong_random machinery, too, but I have no data to back that up.) The
test seed could then be handled globally as well (envvar?) so that you
don't have to introduce a debug-only option into the connection
string.

Overall, I like the concept.

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-01-12 23:27:47 Re: document the need to analyze partitioned tables
Previous Message Thomas Munro 2023-01-12 23:11:53 Experimenting with Postmaster variable scope