Re: Sthange things happen: SkyTools pgbouncer is NOT a balancer

From: "Ivan Zolotukhin" <ivan(dot)zolotukhin(at)gmail(dot)com>
To: dmitry(at)koterov(dot)ru
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sthange things happen: SkyTools pgbouncer is NOT a balancer
Date: 2007-09-11 17:26:11
Message-ID: 751e56400709111026n5cdf8fd4v2d107a7c3a588a6d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

AFAIK PgBouncer is not a balancer but a connection pooler. Skype said
nothing about load balancing in its docs, so they are fair in this
sense. Why did you decide it should balance the load?

Regards,
Ivan

On 9/11/07, Dmitry Koterov <dmitry(at)koterov(dot)ru> wrote:
> Hello.
>
> We discovered some time ago that pgbouncer is NOT a balancer, because it
> cannot spread connections/queries to the same database to multiple servers.
> It's unbeliveable, but it's a fact! So, database name in the config MUST be
> unique.
>
> E.g. if we write
>
> bardb = host=192.168.0.1 dbname=bardb
> bardb = host=192.168.0.2 dbname=bardb
> bardb = host=192.168.0.3 dbname=bardb
>
> in the config, pgbouncer always uses the first connection, and others are
> ignored. Here is the part of the source code:
>
> == loader.c:
> void parse_database(char *name, char *connstr) {
> ...
> db = add_database(name);
> ...
> }
>
> == objects.c:
> PgDatabase *add_database(const char *name)
> {
> PgDatabase *db = find_database(name);
> /* create new object if needed */
> if (db == NULL) {
> db = zmalloc(sizeof(*db));
> ...
> }
> return db;
> }
>
> In these functions "name" is a key from the config ("bardb" in our example).
> We see that it's useless to create duplicate keys in config elements in
> [databases] sections, because only the first one is accepted.
>
> So, it's completely magical for me why "Session pooling", "Transaction
> pooling" and "Statement pooling" options are exist (see
> https://developer.skype.com/SkypeGarage/DbProjects/PgBouncer).
> If pgbouncer is not a balancer, what purpose is to use "Statement pooling" -
> if we sent 100 queries (e.g.) in the same connection, they will always be
> directed to the SAME MACHINE in its different connections, no balancing
> optimization at all.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marko Kreen 2007-09-11 17:29:39 Re: Sthange things happen: SkyTools pgbouncer is NOT a balancer
Previous Message George Pavlov 2007-09-11 17:03:48 Re: Question about a query with two count fields