title: Django CONN_MAX_AGE failures with postgresql max_connections
body: <p>Since I'm using <code>CONN_MAX_AGE: 300</code> on my Django servers, request fail with errors because PostgreSQL exceeds the <code>max_connections</code> limit (which is 100 by default).</p>
  
  <p>What is the best strategy to solve this? I've tried using pgpool2, but this didn't solve the problem at all. Now the connections were queued by pgpool 2 (letting the sites wait forever, and cause a gateway timeout in the end).</p>
  
  <p>I expected that using pgpool would reduce the number of idle connections going to PostgreSQL, not cause the same issue again.</p>
  
  <p>These are the settings I've used:</p>
  
  <p>pgpool2:</p>
  
  <p><code>num_init_children = 32    # are so many workers needed?
  max_pool = 10             # default is 4</code></p>
  
  <p>postgres:</p>
  
  <p><code>max_connections = 400   # upgraded from default 100</code></p>
  
  <p>uWSGI/Django:</p>
  
  <ul>
  <li>all workers have 20 threads.</li>
  <li>there are 10 workers in total with all sites combined.</li>
  </ul>
  
  <p>The VPS is an 8core Linode @ 2.27GHz with 2GB ram.</p>