-1

Tomcat is unresponsive and throwing 504 intermittently. But there is not much CPU usage. We suspected it could happen we receive many number of requests and made tomcat unresponsive. We gave 400 as maxThreads in server.xml and the only lead we have is below error in the log.

Maximum number of threads (400) created for connector with address null and port 8090

We use AWS and checked the ELB, It is just 299 requests at that time. So it confusing for us that when we see maximum number of threads in the error and how can ELB shows less that that.

3
  • 2
    It's really hard to say based on the information provided. Do your logs say anything interesting during the time periods in question? Dec 6, 2014 at 20:28
  • Made some edits based on our analysis from the log Dec 8, 2014 at 12:23
  • Have you tried increasing the maxThreads setting? You're clearly hitting the limit. As to why, you could take some thread dumps to see what the threads are doing at the time. If they're all active then you just need more threads. If some are sitting idle, then you may have connection timeout issues with your LB (i.e. make sure connectionTimeout is set correctly). Dec 16, 2014 at 18:16

1 Answer 1

2

Such behaviour is often caused by high heap memory usage and/or excessive garbage collection.

When Tomcat gets tight on memory it will start to respond slowly and timeout intermittently. Situation usually deteriorates slowly until it becomes unresponsive.

In such situations you may or may not see high CPU usage. Try to analyse memory usage (JMX may help with this), GC logs and see if that's what causing it.

If that's the case, you likely have memory leak somewhere. So then analyse some more, find it and fix it or keep restarting Tomcat every time it reaches this state.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .