← Back to team overview

launchpad-dev team mailing list archive

Re: Offloading queries to the slave databases

 

On Tue, 2010-02-23 at 15:43 +0700, stuart.bishop@xxxxxxxxxxxxx wrote:
> Hi. There were some inquiries recently on how to get scripts using slave databases, in order to reduce load on the master databases. I've taken this opportunity to improve the syntax and write improved documentation. The new documentation is in lib/canonical/launchpad/doc/db-policy.txt and is reproduced below.
> 
> Storm Stores & Database Policies
> ================================
> 
> Launchpad has multiple master and slave databases. Changes to data are
> made on the master and replicated asynchronously to the slave
> databases. Slave databases will usually lag a few seconds behind their
> master. Under high load they may lag a few minutes behind, during
> maintenance they may lag a few hours behind and if things explode
> while admins are on holiday they may lag days behind.

How does the replication_lag check function work in this case? I know
that for web app servers, they revert to the master if the lag gets too
long, but would the same automatically happen for scripts, or only if we
set that up explicitly? I'm just a little concerned that developers may
see "it may be lagged a few hours" under some conditions, and think
"this isn't worth me chancing it - I don't need data that's absolutely
up to the second up to date, but if there's a chance it's a few hours
old, it's not worth risking it - I'll just always connect to the
master".

Thanks, Tom





Follow ups

References