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

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Date: 2015-11-17 07:13:53
Message-ID: 564AD3B1.1040506@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/12/15 1:11 PM, Thomas Munro wrote:
> It's true that a pooling system/middleware could spy on your sessions
> and insert causality token handling imposing a global ordering of
> visibility for you, so that naive users don't have to deal with them.
> Whenever it sees a COMMIT result (assuming they are taught to return
> LSNs), it could update a highest-LSN-seen variable, and transparently
> insert a wait for that LSN into every transaction that it sees
> beginning. But then you would have to push all your queries through a
> single point that can see everything across all Postgres servers, and
> maintain this global high LSN.

I think that depends on what you're doing. Frequently you don't care
about anyone elses writes, just your own. In that case, there's no need
for a shared connection pooler, you just have to come back to the same one.

There's also a 4th option: until a commit has made it out to some number
of slaves, re-direct all reads from a session back to the master. That
might sound horrible for master performance, but in reality I think it'd
normally be fine. Generally, you only care about this when you're going
to read data that you've just written, which means the data's still in
shared buffers.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-11-17 07:16:40 Re: [PATCH] SQL function to report log message
Previous Message Kyotaro HORIGUCHI 2015-11-17 07:09:25 Re: Making tab-complete.c easier to maintain