Skip site navigation (1) Skip section navigation (2)

Re: PostgreSQL clustering VS MySQL clustering

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, darcy(at)wavefire(dot)com,jd(at)www(dot)commandprompt(dot)com, sfrost(at)snowman(dot)net, herve(at)elma(dot)fr
Subject: Re: PostgreSQL clustering VS MySQL clustering
Date: 2005-01-21 17:47:53
Message-ID: 200501210947.53938.josh@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-performance
Tatsuo,

> Suppose table A gets updated on the master at time 00:00. Until 00:03
> pgpool needs to send all queries regarding A to the master only. My
> question is, how can pgpool know a query is related to A?

Well, I'm a little late to head off tangental discussion about this, but ....

The systems where I've implemented something similar are for web applications.  
In the case of the web app, you don't care if a most users see data which is 
2 seconds out of date; with caching and whatnot, it's often much more than 
that!

The one case where it's not permissable for a user to see "old" data is the 
case where the user is updating the data.   Namely:

(1) 00:00 User A updates "My Profile"
(2) 00:01 "My Profile" UPDATE finishes executing.
(3) 00:02  User A sees "My Profile" re-displayed
(6) 00:04  "My Profile":UserA cascades to the last Slave server

So in an application like the above, it would be a real problem if User A were 
to get switched over to a slave server immediately after the update; she 
would see the old data, assume that her update was not saved, and update 
again.  Or send angry e-mails to webmaster(at)(dot)   

However, it makes no difference what User B sees:

(1) 00:00 User A updates "My Profile"v1			Master
(2) 00:01 "My Profile" UPDATE finishes executing.	Master
(3) 00:02  User A sees "My Profile"v2 displayed		Master
(4) 00:02  User B requests "MyProfile":UserA		Slave2
(5) 00:03  User B sees "My Profile"v1				Slave2
(6) 00:04  "My Profile"v2 cascades to the last Slave server  Slave2

If the web application is structured properly, the fact that UserB is seeing 
UserA's information which is 2 seconds old is not a problem (though it might 
be for web auctions, where it could result in race conditions.   Consider 
memcached as a helper).   This means that pgPool only needs to monitor 
"update switching" by *connection* not by *table*.

Make sense?

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

pgsql-performance by date

Next:From: kenDate: 2005-01-21 17:58:39
Subject: Re: inheritance performance
Previous:From: Matt ClarkDate: 2005-01-21 17:35:13
Subject: Re: PostgreSQL clustering VS MySQL clustering

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group