News for hackers. Stuff that matters.
Re:Experiences with running PostgreSQL on Kubernetes by jontro on Monday January 22, 2018 @03:40PM (#16207702)
Wouldn't you have to wait until all replicas are in sync before a commit can be completed? Even though there might be a low replica lag I would be really careful of depending on transactions in application code using this.
Re:Experiences with running PostgreSQL on Kubernetes by aberoham on Monday January 22, 2018 @03:52PM (#16207812)
Pg streaming replication is asynchronous by default and there are some big caveats besides performance when it comes to synchronous use cases, esp around automatic fail-over / recovery. The pg/stolon FAQ hints at some of these issues:

1. https://github.com/sorintlab/stolon/blob/master/doc/faq.md#h...

Re:Experiences with running PostgreSQL on Kubernetes by maga_2020 on Monday January 22, 2018 @07:24PM (#16209618)
in the video referenced by @aberoham , a the end there is a question to the presenter (Josh Berkus), about the 2 types of replication their deployment tool is supporting.

this was on about 33rd minute of the presentation

He suggested , that if you need to use , synchronous replication, to use PostgreSQL 10 with synchronous quorum replication, so that it will not block transactions if one of the replicas fail.

Re:Experiences with running PostgreSQL on Kubernetes by joshberkus on Tuesday January 23, 2018 @05:26PM (#16218414)
Yes, that's correct. If you are going to use sync rep because you can't lose transactions, you really want to use the latest version of PostgreSQL, which supports quorum sync (i.e. "one of these three replicas must ack"), even in complex configurations ("one replica from each availability zone must ack"). Note, though, that the existing HA automation solutions (Patroni, Stolon) don't currently have support for complex topographies, so you'd need to do some hacking.

It is a tradeoff though. With synch rep, you are at a minimum adding the cost of two network trips to the latency of each write (distributed consistent databases like Cassandra pay this cost as well, which is why they tend to have relatively high write latency). It turns out that a lot of users are willing to lose a few transactions in a combination failure case instead of having each write take three times as long.

Postgres also has some "in between" modes because write transactions can be individually marked as synch or asynch, so less critical writes can be faster. I believe that Cassandra has something similar.

Re:Experiences with running PostgreSQL on Kubernetes by UK-Al05 on Monday January 22, 2018 @06:16PM (#16209078)
The synchronous replication is a difficult from a performance point of view.