Giter Site home page Giter Site logo

blocking API about pooler HOT 8 CLOSED

epgsql avatar epgsql commented on August 16, 2024
blocking API

from pooler.

Comments (8)

mdaguete avatar mdaguete commented on August 16, 2024

+1

from pooler.

seth avatar seth commented on August 16, 2024

I'd be interested to hear some of the ways you are using pooler and the reasons for wanting the blocking approach.

In writing pooler, I chose to avoid the blocking approach because it both simplifies the implementation and makes it easier to detect an overloaded pool (which in a blocking implementation can hide as added latency).

That said, I'm not opposed to enhancing the pool to make it more useful to more folks. But want to better understand the goals. So. Can you provide some background on why you'd like a blocking approach? Are there other features that are keeping you with pooler instead of poolboy?

from pooler.

rlipscombe avatar rlipscombe commented on August 16, 2024

We're currently using poolboy, but I'm evaluating pooler as an alternative. We have a specific case where our clients don't particularly care if a database query takes a long time (they'll wait, and they don't timeout). If, however, we return an error or otherwise drop the connection, the client will disconnect and come back immediately. This is expensive (reconnect incurs a whole bunch of DB queries, which, as you can imagine, just snowballs).

Thus, it's better for our particular case, if DB congestion causes blocking (even at the expense of extra latency), rather than errors.

We'd be prepared to monitor the increased latency by looking at reported metrics. As it stands, we have metrics wrappers for poolboy that report the time taken to check out a pool member, so that's not a big problem for us.

from pooler.

seth avatar seth commented on August 16, 2024

@rlipscombe thanks for the background. I can see the benefit and am considering adding the queue feature.

Though also curious, since you are currently using poolboy and that lib has the queuing, what's driving the evaluation of pooler?

from pooler.

rlipscombe avatar rlipscombe commented on August 16, 2024

A couple of reasons:

Poolboy doesn't have a mechanism for temporarily keeping idle workers around; pooler does. Including this functionality in poolboy has been rejected (see devinus/poolboy#30), but that issue includes various ways to implement this. In the end, I went for a variation of the technique that Zotonic uses: https://github.com/zotonic/zotonic/blob/master/src/db/z_db_pgsql.erl#L91-117

Pooler has better support for reporting metrics through (e.g.) folsom; I think that there are a couple of open issues for this in poolboy, and it wasn't that hard to implement ourselves (though you have to be careful about decrementing waiting/active counters if the caller crashes), but having it built in to the pooling library would have been useful.

Also, until poolboy 1.2.2, workers were stored in a queue, meaning that older workers (from the original pool) were returned before newer (overflow) workers; we think that this could lead to disconnect/connect churn (e.g. when talking to postgresql) when operating in pool overflow.

The other feature missing from poolboy (I haven't checked pooler yet) is the ability to resize the pool at runtime. We would find that useful to avoid restarting things in production.

Oh, and the pool groups feature in pooler looks interesting, though I've not really played with it much.

At this point, we'll probably be sticking with poolboy, but I hope this explains why I was evaluating pooler as an alternative.

from pooler.

seth avatar seth commented on August 16, 2024

Hi all,

Thanks to @oferrigni, pooler now has optional queuing when all members are in use. See tag 1.3.0.

from pooler.

arjan avatar arjan commented on August 16, 2024

Nice!

from pooler.

redink avatar redink commented on August 16, 2024

Long-awaited, thanks!

from pooler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.