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

Re: Slony sync times

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Slony sync times
Date: 2007-03-16 17:10:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Zoomby Woof <zoombywoofremove(at)thisgmail(dot)com> writes:
> I'm using slony1 version 1.2.1 and I'm trying to figure out what the
> actual default of the 'sync_interval' parameter is. The manual says
> 100 ms in one place, and 10 seconds on another...some other places on
> the net says 60 seconds, I have even seen 2 seconds being mentioned as
> the default value for this parameter. My gut feeling is that it is 100
> ms, I haven't set this value explicitly, and stuff seems to replicate
> pretty quick so...I haven't made any scientific tests on this though.
> Anyone knows the truth ?
> Also, are there any other dangers in lowering this number to say, 50
> ms, or even 10 ms, except the fact that the machine will be more
> loaded ? We have an application where we loadbalance stuff and
> occasionally we run into sync problem (the subscriber havent been
> updated fast enough)

There are two "sync parameters":

- sync_interval
- sync_interval_timeout

The first one represents how often the slon will consider generating a
SYNC event.  In confoptions.c/confoptions.h (it moved from .h to .c in
version 1.2), the default value is 2000ms.

The second one represents how often a SYNC will get generated anyways,
even if there are no updates taking place that would cause it to
decide to generate a SYNC.  The default is 2 minutes, which seems
pretty reasonable.

The event loop will wake up every (sync_interval) ms, and check to see
if there has been any data collected to replicate.  If so, it will
generate a SYNC, and thus allow other nodes to start pulling data.  If
not, then it'll go back to sleep.  If it reaches the
sync_interval_timeout time without having yet generated a SYNC, it
will do a SYNC even though there have been no changes, so that the
systems can be aware that they're at least *trying* to replicate, even
though your application isn't giving Slony-I any work to do.

Dropping sync_interval to 100ms will mean it generates 20x as many
SYNCs (increasing the workload, a cost...), and that it can consider
replicating data 1/20th as soon (a benefit).

That may very well be a good trade-off for you.  I'd be surprised if
dropping the time to 10ms gave a material further improvement; I'd
think that would add more work than benefit.  But you can feel free to
prefer otherwise, and you won't be wrong, by your metrics.
Rules of the Evil Overlord #206. "When my Legions of Terror park their
vehicle  to do  reconnaissance on  foot,  they will  be instructed  to
employ The Club." <>

pgsql-admin by date

Next:From: Anton PikhteryevDate: 2007-03-16 17:36:13
Subject: Re: Problem migrating from 8.0.3 to 8.2.3
Previous:From: FrancoDate: 2007-03-16 16:37:38
Subject: unsubscribe

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