title: How to configure properly Tomcat no of threads and jmeter ramp up period
body: <p>I am doing load testing using jmeter.The configuration paramter for jmeter as follows </p>
  
  <p>no of threads =299
  ramp up period=1
  loop count=1</p>
  
  <p>This is my configuration for threads in tomcat .I am using tomcat 7</p>
  
  <pre><code>&lt;Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
          maxThreads="2500" minSpareThreads="2400"/&gt;
  </code></pre>
  
  <p><strong>I have  used  4 GB of ram</strong> </p>
  
  <p><strong>MYsql max connection :150</strong></p>
  
  <p>pooling configuration </p>
  
  <pre><code>&lt;prop key="hibernate.c3p0.acquire_increment"&gt;90&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.idle_test_period"&gt;28690&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.max_size"&gt;147&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.max_statements"&gt;100&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.min_size"&gt;147&lt;/prop&gt;
                  &lt;prop key="hibernate.c3p0.timeout"&gt;1800&lt;/prop&gt;          
                  &lt;prop key="hibernate.c3p0.preferredTestQuery"&gt;select 1&lt;/prop&gt; 
  </code></pre>
  
  <p>This is my tomcat configuration </p>
  
  <pre><code>-Xms1024m -Xmx1024m -XX:MaxPermSize=3g
  </code></pre>
  
  <p>When no of threads  is equal to 298 there is no problem.But,when it is increase to 299 i am getting following error
  <strong>org.apache.http.conn.HttpHostConnectException: Connection to <code>http://localhost:8080</code> refused</strong></p>
  
  <p>But,when i increased ramp up period to <strong>10</strong> then there is no error.</p>
  
  <p>So,it seems like the problem is related to tomcat threads and ramp up period of jmeter  .</p>
  
  <p>If higher the ramp up period there is no exception .But,when rampup period is lower i get the exception.</p>
  
  <p>In my case i have configured minSpareThreads =2400 then as far my understanding these minimum  no of threads are always available.</p>
  
  <p><strong>If concurrent requests hit the tomcat in interval of 1 in my case why there is problem in accepting connection to tomcat?</strong> </p>
  
  <p><strong>As in my case no of threads=299 which is higher than max threads so still why tomcat is not accepting connection?</strong>
          Any help and suggestion please?</p>