Re: [EXTERNAL] Re: Support load balancing in libpq
От | Andrey Borodin |
---|---|
Тема | Re: [EXTERNAL] Re: Support load balancing in libpq |
Дата | |
Msg-id | CAAhFRxjKzhBRsa=PDnRn2-_6j1PwSXKRAGrmmkp613sim7pTDg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [EXTERNAL] Re: Support load balancing in libpq (Jelte Fennema <postgres@jeltef.nl>) |
Ответы |
Re: [EXTERNAL] Re: Support load balancing in libpq
|
Список | pgsql-hackers |
On Wed, Mar 1, 2023 at 12:03 PM Jelte Fennema <postgres@jeltef.nl> wrote: > > done and updated cf entry > Hi Jelte! I've looked into the patch. Although so many improvements can be suggested, It definitely makes sense as-is too. These improvements might be, for example, sorting hosts according to ping latency or something like that. Or, perhaps, some other balancing policies. Anyway, randomizing is a good start too. I want to note that the Fisher-Yates algorithm is implemented in a difficult to understand manner. +if (j < i) /* avoid fetching undefined data if j=i */ This stuff does not make sense in case of shuffling arrays inplace. It is important only for making a new copy of an array and only in languages that cannot access uninitialized values. I'd suggest just removing this line (in both cases). Best regards, Andrey Borodin.
В списке pgsql-hackers по дате отправления: