Thread: Load sharing question

Load sharing question

From
"Johnson, Shaunn"
Date:

Howdy:

Running RedHat Linux 2.4.7-10 and PostgreSQL 7.2.1
on an Intel box.

Has anyone configured their machines to do load sharing
(and to a greater extent, clustering) for PostgreSQL?

I have a box where I might want to add a second CPU,
but that's not going to happen for a while.  I do, however,
have a second machine that is not doing much of anything
and that IS attached via Ethernet crossover to the
primary server.  I'd like to use that processor to
take some the load off of the primary box.

Is there some documentation / examples of load sharing
and PostgreSQL out there?  I'm not finding much from
groups.google.com.  (a few LVS and ultramonkey.org)

Thanks!

-X

Re: Load sharing question

From
Andrew Sullivan
Date:
On Mon, Sep 09, 2002 at 12:09:55PM -0400, Johnson, Shaunn wrote:
> Howdy:
>
> Running RedHat Linux 2.4.7-10 and PostgreSQL 7.2.1
> on an Intel box.
>
> Has anyone configured their machines to do load sharing
> (and to a greater extent, clustering) for PostgreSQL?

What, exactly, are you thinking of doing here?  Is this "make a copy
of the database and use it for read-only queries?"  In that case,
it's easy: use one of the myriad replication packages and catch
inbound SELECTs with your client; then just redirect them.  Do 'whois
afilais.info' for a working example of exactly this.

If what you mean is sharing the read and write load across two
database machines, you can't really do that right now.  When
Postgres-R is finished, it should be possible.  But it isn't right
now.

A
--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: Load sharing question

From
"Johnson, Shaunn"
Date:

-- Thanks for the response.

-- Right now, all I want to do is some load balancing ( I'm
-- sorry ... I should have said this instead of sharing)
-- techniques (reviewing MOSIX docs http://www.mosix.cs.huji.ac.il/).
-- for PostgreSQL.  I just want to spread the workload
-- from one machine to multiple machines and *not* run
-- duplicate versions of the database.

-- I must say, however, that Postgres-R sounds very interesting.

-X

On Mon, Sep 09, 2002 at 12:09:55PM -0400, Johnson, Shaunn wrote:
> Howdy:
>
> Running RedHat Linux 2.4.7-10 and PostgreSQL 7.2.1
> on an Intel box.
>
> Has anyone configured their machines to do load sharing
> (and to a greater extent, clustering) for PostgreSQL?

What, exactly, are you thinking of doing here?  Is this "make a copy
of the database and use it for read-only queries?"  In that case,
it's easy: use one of the myriad replication packages and catch
inbound SELECTs with your client; then just redirect them.  Do 'whois
afilais.info' for a working example of exactly this.

If what you mean is sharing the read and write load across two
database machines, you can't really do that right now.  When
Postgres-R is finished, it should be possible.  But it isn't right
now.

A
--

Re: Load sharing question

From
Andrew Sullivan
Date:
On Mon, Sep 09, 2002 at 04:22:08PM -0400, Johnson, Shaunn wrote:
> -- Thanks for the response.
>
> -- Right now, all I want to do is some load balancing ( I'm
> -- sorry ... I should have said this instead of sharing)
> -- techniques (reviewing MOSIX docs http://www.mosix.cs.huji.ac.il/).
> -- for PostgreSQL.  I just want to spread the workload
> -- from one machine to multiple machines and *not* run
> -- duplicate versions of the database.

Hmm.  PostgreSQL requires that _one_ postmaster be in charge of the
data area.  I seem to recall someone explaining to me why this made
MOSIX not work for Postgres, but I can't recall now what the reasons
were.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: Load sharing question

From
Bruce Momjian
Date:
Andrew Sullivan wrote:
> On Mon, Sep 09, 2002 at 04:22:08PM -0400, Johnson, Shaunn wrote:
> > -- Thanks for the response.
> >
> > -- Right now, all I want to do is some load balancing ( I'm
> > -- sorry ... I should have said this instead of sharing)
> > -- techniques (reviewing MOSIX docs http://www.mosix.cs.huji.ac.il/).
> > -- for PostgreSQL.  I just want to spread the workload
> > -- from one machine to multiple machines and *not* run
> > -- duplicate versions of the database.
>
> Hmm.  PostgreSQL requires that _one_ postmaster be in charge of the
> data area.  I seem to recall someone explaining to me why this made
> MOSIX not work for Postgres, but I can't recall now what the reasons
> were.

We can't make shared memory work across machines.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Load sharing question

From
Curt Sampson
Date:
On Mon, 9 Sep 2002, Bruce Momjian wrote:

> We can't make shared memory work across machines.

Actually, shared memory does work fine across some machines.
Digital Unix clusters, for example....

cjs
--
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC


Re: Load sharing question

From
Bruce Momjian
Date:
Curt Sampson wrote:
> On Mon, 9 Sep 2002, Bruce Momjian wrote:
>
> > We can't make shared memory work across machines.
>
> Actually, shared memory does work fine across some machines.
> Digital Unix clusters, for example....

OK, I didn't go into detail, but the issue is test-and-set assembler
instructions we use for light-weight locking.  You can't tell me that
actually works on a cluster, can you?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Load sharing question

From
Curt Sampson
Date:
On Mon, 9 Sep 2002, Bruce Momjian wrote:

> OK, I didn't go into detail, but the issue is test-and-set assembler
> instructions we use for light-weight locking.  You can't tell me that
> actually works on a cluster, can you?

You bet. But DU clustering (derived from VMS clustering) is one of the
few "pretty much transaparent" clustering systems in the world. It's
very, very cool stuff, IMHO.

However, even with a very, very fast bus between the systems, that's not
to say you're going to like the memory latency when you've got to drag a
shared memory block off another machine on to yours. :-)

Generally, one would want to modify one's program to use locking
mechanisms more suitable for a cluster, and distribute the load more
suitably, as well.

cjs
--
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC