title: What is limiting requests count? Why `Timeout while getting a connection from pool`?
body: <p>At high load conditions NHibernate sometimes throws an exception when BeginTransaction is called. The message contains <code>Timeout while getting a connection from pool</code> in the RequestConnector method of Npgsql.</p>
  
  <p>In the pg_log: <code>could not receive data from client: No connection could be made because the target machine actively refused it.</code></p>
  
  <p>Postgres stats doesn't show any expensive queries.</p>
  
  <p>The machine have enough free cpu and ram resources.</p>
  
  <p>Versions: Postgres 9.4.0 64-bit, NHibernate 3.3.1.4000, Npgsql 2.2.3.</p>
  
  <p>Postgres settings:</p>
  
  <pre><code>shared_buffers = 128MB
  max_connections = 300
  checkpoint_segments = 6
  </code></pre>
  
  <p>Connection string settings:</p>
  
  <pre><code>Pooling = true;
  MINPOOLSIZE=20;
  MAXPOOLSIZE=1000;
  </code></pre>
  
  <p>Postgres and the application are located on the same machine.</p>
  
  <p>All NHibernate transactions and sessions are disposed with <code>using</code>.</p>