title: Check number of TCP connections to the server
body: <p>We have two application servers viz. s1 and s2. 
  For every request come to s1, it calls the services exposed by s2.
  s1 is running port <code>8585</code> and s2 runnng on port <code>8989</code></p>
  
  <ul>
  <li>We have implemented the Http connection pooling on the s1, so connections will be re-used while communicating with s2. For that we are using apache httpclient library and PoolingHttpClientConnectionManager for connection polling.</li>
  <li>HttpClient intance is created only once at startup and shared while calling service exposed by s2.</li>
  <li>While creating HttpClient, we have configured HttpClient max connection to 50</li>
  </ul>
  
  <p><strong>how to check the connection polling is working correctly?</strong></p>
  
  <p>We have added 10 sec delay in s2, so every request is waiting for 10 sec to get the response.</p>
  
  <p>We are trying with Jmeter to generate 200 concurrent request to server s1 and following netstat command to check number of connections established by the server s1 to s2</p>
  
  <pre><code>while [ 1 ] ; do netstat -apnt | grep -E '8585.*ESTABLISHED' ;echo "---";sleep 3; done
  </code></pre>
  
  <p>it gives random behavior. 
  Some times connection count shows 100, some times it shows 65 or any other number. </p>