Connection Pool shared across processes?
===

My web app runs out of connection slots to the database when enough requests occur. This is despite setting it to run what seems to be a conservative size of connection pool, and I have limited the number of processes, threads. Am I correct that the connection pool is shared across threads, but not processes? And what is a good strategy for choosing a good combination of connection pool size, number of processes and threads, whilst avoiding running out of DB connections?

Error I'm seeing:

> OperationalError: (OperationalError) FATAL:  remaining connection
> slots are reserved for non-replication superuser connections

/etc/postgresql/9.1/main/postgresql.conf:

       max_connections = 100

app.ini:

       sqlalchemy.pool_size = 1
       sqlalchemy.max_overflow = 5

Apache config:

       WSGIDaemonProcess test1 processes=5 threads=10 maximum-requests=10000
       WSGIProcessGroup test1

Looking at the processes:
$ ps aux |grep postgres |wc
This can increase to 102 under a reasonable load and stay there, despite many connections being idle, and errors come in.