Re: Proposal: "Causal reads" mode for load balancing reads without stale data

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Дата
Msg-id CA+TgmoZcmoJ-Bvbp=d8HPEvFvjsrvZkmQeurWG++0DzTvGfXGw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal: "Causal reads" mode for load balancing reads without stale data  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
On Wed, Nov 11, 2015 at 3:23 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> This causes every writer to wait.
>
> What we want is to isolate the wait only to people performing a write-read
> sequence, so I think it should be readers that wait. Let's have that debate
> up front before we start reviewing the patch.

One advantage of having writers wait is that the master and its read
slaves can't ever get too far apart.  Suppose the master is generating
WAL much faster than the read slaves (or one of them) can replay it.
You might say it sucks to slow down the master to the speed the slaves
can keep up with, and that's true.  On the other hand, if the master
is allowed to run ahead, then a process that sends a read query to a
standby which has gotten far behind might have to wait minutes or
hours for it to catch up.  I think a lot of people are enabling
synchronous replication today just for the purpose of avoiding this
problem - keeping the two machines "together in time" makes the
overall system behavior a lot more predictable.

Also, if we made readers wait, wouldn't that require a network
roundtrip to the master every time a query on a reader wanted a new
snapshot?  That seems like it would be unbearably expensive.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Ants Aasma
Дата:
Сообщение: Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Следующее
От: YUriy Zhuravlev
Дата:
Сообщение: Re: Some questions about the array.