I have a problem with tomcat6, when I "top -H", I can see 3 java threads running at 100% CPU. I looked up what tomcat was doing using PSI-probe and in the "Connectors" tab, under jk-8009, I can see the following 3 lines:
Remote IP stage Proc.time IN OUT URL
192.168.10.11 Service 20:02:17.105 522 B 0 B POST /configuration.jsf
192.168.10.11 Service 20:02:17.171 447 B 0 B POST /configuration.jsf
192.168.10.11 Service 20:02:17.167 447 B 0 B POST /configuration.jsf
According to the top command, the 3 processes which are at 100% have been running for 1197 minutes, which seem to correspond to the 20:02 minutes displayed in the 3 lines above. So I am pretty sure that these 3 services are the problem.
the /configuration.jsf which is stated is the main page of the application, so it could be anything.
Restarting tomcat solves the issue, but I need to find out what is the cause of the problem.
I can see no crash in the logs. I looked around on the internet and it seems to me like it could be a deadlock in the database.
The application uses JSF, Prime Faces. The database is mysql
Would anybody have any kind of input on the matter?
Edit:
in /etc/tomcat6/server.xml, I have this configuration
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Using the blocking Java connector solved this for me in Tomcat 8.0.21:
<Connector port="8009" protocol="org.apache.coyote.ajp.AjpProtocol" redirectPort="8443" />
Now CPU stays at about 0,3% when there is no usage. Using AjpNio2Protocol
gave the same result with CPU but in my peformance test AjpProtocol
was a bit faster.
https://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html#Connector_Comparison