4 ms·
The connection handling section was surprising to me, reading that Postgres uses a process per connection! This is pretty shocking to me, in a bad way.
by slantedview 10y ago
The connection handling section was surprising to me, reading that Postgres uses a process per connection! This is pretty shocking to me, in a bad way.
- iampims 10y agopgbouncer works pretty well for that. I kinda wish it was part of the default Postgres install.
- scrollaway 10y agoHow does pgbouncer work with Amazon RDS (where you can't install separate software)?
- rpedela 10y agopgbouncer does not need to run on the same machine as the DB. It can run on an EC2 instance in front of your RDS instance.
- dijit 10y agoyou install it on the clients of the servers themselves and "connect locally" to the bouncer or have a bouncer step (server pair) in front of the database connections themselves.
- 0xmohit 10y agoOne could use connection pooling. Quoting from the tuning guide [0]: max_connections sets exactly that: the maximum number of client connections allowed. This is very important to some of the below parameters (particularly work_mem) because there are some memory resources that are or can be allocated on a per-client basis, so the maximum number of clients suggests the maximum possible memory use. Generally, PostgreSQL on good hardware can support a few hundred connections. If you want to have thousands instead, you should consider using connection pooling software to reduce the connection overhead. Replication, Clustering, and Connection Pooling [1] [0] https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Serv... [1] https://wiki.postgresql.org/wiki/Replication,_Clustering,_and_Connection_Pooling https://wiki.postgresql.org/wiki/Replication,_Clustering,_an...
- saja 10y agoDifferent design goals, Mysql lot of connections with shared memory model and fast running small queries, ex: PHP one connection per page view. Postgres dedicated memory model long running complex queries.
- Roboprog 10y agoSo PG has a process pool instead of a thread pool. (I doubt either database is spawning procs/thds anew willy nilly for each request). This means the PG has explicit IPC overhead, vs the quick and seductive path (to the dark side?) of simply sharing memory between threads. Safety vs speed.
- Tostino 10y agoIt actually forks a new process per connection.