Re: Proposal: Implement failover on libpq connect level.

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Implement failover on libpq connect level.
Date: 2015-09-01 17:52:58
Message-ID: CABUevExZU-V0r4rr894T11BL_XTxmn9Pq5y5_4NecrriNddjMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Tue, Sep 1, 2015 at 7:50 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> Robert Haas wrote:
> > On Wed, Aug 19, 2015 at 9:41 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > > That sort-of ties into what seems to me the main objection to this
> > > proposal, namely that there is already a way to do this sort of thing:
> > > DNS-based load balancing. All the clients think they connect to
> > > db.mycompany.com, but which server they actually get is determined by
> > > what IP address the DNS server tells them to use.
> >
> > But that kinda sucks. I mean, suppose I have three servers, A, B, and
> > C. I point db.mycompany.com to A, which is the master; then A dies.
> > Under your proposal, whatever script I use to control failover now has
> > to change the DNS records to repoint db.mycompany.com to B, my new,
> > and newly-promoted, new master. It's quite possible that some
> > machines on the network, or some processes, will have the old IP
> > address cached, and it may be several minutes before those caches time
> > out. In the meantime, I'm down: even if I bounce the application
> > servers, they may just try to reconnect to A.
>
> The solution to this part seems to be to lower the TTL, which seems
> easy enough.
>

It seems easy enough. Until you actually try to do it, and discover
platforms and appservers that completely ignore the ttl by default (like,
uh, java, which you may have run into - at least it used to do that), or
enforces a lower minimum of longer than you want in order to decrease load,
and things like that.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2015-09-01 18:04:18 Re: Horizontal scalability/sharding
Previous Message Robert Haas 2015-09-01 17:51:49 Re: Proposal: Implement failover on libpq connect level.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Haas 2015-09-01 18:07:19 Re: Proposal: Implement failover on libpq connect level.
Previous Message Robert Haas 2015-09-01 17:51:49 Re: Proposal: Implement failover on libpq connect level.