Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am load testing an app that runs on Tomcat (6.0.33). As I increase the number of users I start to get connection problems. Here is what jMeter returns. I am pretty new to Tomcat, can anyone give any advice on where to even start looking?

org.apache.http.conn.HttpHostConnectException: Connection to https://example.domain.edu refused
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:284)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1075)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1064)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.net.ConnectException: Operation timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
    at java.net.Socket.connect(Socket.java:529)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:549)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
    ... 12 more
share|improve this question
I faced similar problem with tomcat 7.x and it was solved by using maxConnections settings along with acceptCount in server.xml. I set both to a higher value, say 5000, and I don't get connection exception when hitting tomcat with 1000+ users. I used maxThreads=10 for the test. –  pongapundit Mar 6 at 17:57

2 Answers 2

You have here established that past a threshold number of users, your service becomes unresponsive to new connections. You need to use stats and logging at the application server to determine what causes that issue. Hanging on new connections could be the result of contention in any number of resources:

  • CPU, memory, or IO (vmstat will help with these)

  • You could be hitting a ulimit for maximum number of open sockets, files or processes (this will be logged to syslog)

  • Your application could be stuck waiting for access to an external resource, like a database, which itself could suffer from any of the resource contention issues described above.

In short: load testing, at least for the purposes of optimizing service performance under load, is only useful if you combine it with careful monitoring of the service you're testing in order to quantify its results. With that monitoring, load testing only tells you the threshold past which your service is no longer useable.

share|improve this answer

You should increase the Max threads in tomcat config.

Here is an explanation: http://tomcat-configure.blogspot.com.es/2009/01/tomcat-maxthreads-configuration.html

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.