From: Tatsuo Ishii <t-ishii@sra.co.jp>
To: josh@agliodbs.com
Cc: pgsql-performance@postgresql.org
Cc: darcy@wavefire.com
Cc: jd@www.commandprompt.com
Cc: sfrost@snowman.net
Cc: herve@elma.fr
Subject: Re: PostgreSQL clustering VS MySQL clustering
Date: Sat, 22 Jan 2005 12:01:28 +0900 (JST)
Message-ID: <20050122.120128.74753619.t-ishii@sra.co.jp> (raw)
In-Reply-To: <200501210947.53938.josh@agliodbs.com>
References: <200501201949.24292.josh@agliodbs.com>
<20050121.170731.08315885.t-ishii@sra.co.jp>
<200501210947.53938.josh@agliodbs.com>
> 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@.
>
> 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?
I'm not clear what "pgPool only needs to monitor "update switching" by
*connection* not by *table*" means. In your example:
> (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
I think (2) and (3) are on different connections, thus pgpool cannot
judge if SELECT in (3) should go only to the master or not.
To solve the problem you need to make pgpool understand "web sessions"
not "database connections" and it seems impossible for pgpool to
understand "sessions".
--
Tatsuo Ishii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: t-ishii@sra.co.jp, josh@agliodbs.com, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr
Subject: Re: PostgreSQL clustering VS MySQL clustering
In-Reply-To: <20050122.120128.74753619.t-ishii@sra.co.jp>
References: <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> <200501210947.53938.josh@agliodbs.com> <20050122.120128.74753619.t-ishii@sra.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox