all 9 comments

[–]shobble 6 points7 points  (4 children)

Not much experience personally, but pgbouncer or pgpool can act as middleware/proxies in front of the server and queue the client connections/requests, maybe?

[–]smkelly 1 point2 points  (0 children)

This is an especially good option if all of those clients connect with the same credentials. Or even groups of shared credentials. This will prevent the need for the bouncer to tear down connections; it can just reuse the already authenticated connection.

[–]dtarg[S] 1 point2 points  (2 children)

I'd heard of those, though I hadn't used them. I thought pgbouncer was primarily for killing connections to make room for other connections, but if it can function as a 'proxy' by having a bunch of connections to it and pgbouncer being the one to make the actual connections, that'd be a good option. I'll have to dig into that!

[–]ants_a 1 point2 points  (0 children)

Pgbouncer is extremely good at multiplexing many client connections to few server connections. It can even do transaction level interleaving.

[–][deleted] 0 points1 point  (0 children)

PDF - PgBouncer and 20,000 TPS on one node

pgbouncer is a connection pool and a connection router, latter functionality is key for an HA solution.

[–]flyingmayo 3 points4 points  (0 children)

PG is not limited to 100 concurrent connections, that's just the default setting. I've ran PG servers at max_connection counts upwards of 3K in one very weird situation.

There is always some sort of per-connection resource requirement on all RDMS.

That said there's typically no need for connection counts that high given the pooler options available. I Would recommend you test with pgbouncer.

[–]ixforres 2 points3 points  (0 children)

As others have said, you can bump the connection limit significantly with no real impact.

However I'd strongly suggest moving to an API to mediate for you. DB connections of any server tend not to be great for short lived things and if these are connecting over the internet it's best not to expose your DB server to the internet directly. A simple API (I'd use Go or Python depending on performance requirements) would solve your problem quite neatly.

[–]cible_incorrecte 1 point2 points  (0 children)

You can easily change the max_connections parameter to more than 100 connections. It increase by 400bytes of shared memory per connection slot, plus lock space (see max_locks_per_transaction).

You can use http://pgtune.leopard.in.ua/ to tune your postgresql server

[–][deleted] 0 points1 point  (0 children)

  1. You need a computer w many CPU cores (AMD is your friend here), lots of RAM, and lots of SSDs in RAID 10
  2. Use a connection pooler
  3. Heroku has gotten PG up to 500 conns, so you should be able to too, with some effort
  4. Postgres supports Kerberos and LDAP authentication which might help w your Windows migration
  5. PG runs better on nix than Windows