4 ms·
> reusing connections to databases pgBouncer and ProxySQL are going to give you a better bang for the buck than a stateful web app will.
by jawngee 7y ago
> reusing connections to databases
pgBouncer and ProxySQL are going to give you a better bang for the buck than a stateful web app will.
- dijit 7y agoMaybe. Kinda. Not really. You can have an awful implementation of a connection pooler, sure, but opening an authenticated socket is more expensive by far than just referencing one. Less so for a unix socket/named pipe- but still much slower than a memory lookup. Of course you probably don’t care until you hit a certain scale or number of backend system accesses.
- johannes1234321 7y agoFetching a connection from a (sane) pool isn't just a memory lookup. Database conenctions have to be cleared of state (transactions, temp tables, prepared statement handles, ...) which takes time as well. Otherwise one runs into "funny" bugs at some point in time.
- dehrmann 7y agoUnless they're local (and managing that fleet would get pretty annoying), there's still unnecessarily TCP overhead, and even the possibility of exhausting ports. I'm not arguing for a truly stateful webapp, but the connecting pooling you get for free (or some library wrangling) with a long-lived process does a lot for performance and scalability.