Re: Slony sync times

Поиск
Список
Период
Сортировка
От Chris Browne
Тема Re: Slony sync times
Дата
Msg-id 60hcslm7wc.fsf@dba2.int.libertyrms.com
обсуждение исходный текст
Список pgsql-admin
Zoomby Woof <zoombywoofremove@thisgmail.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.
--
"cbbrowne","@","linuxdatabases.info"
http://www3.sympatico.ca/cbbrowne/multiplexor.html
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." <http://www.eviloverlord.com/>

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Anton Pikhteryev"
Дата:
Сообщение: Re: Problem migrating from 8.0.3 to 8.2.3
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem migrating from 8.0.3 to 8.2.3