You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chen Levy <ch...@hotmail.com> on 2016/08/30 13:11:14 UTC

High CPU Consumption with Tomcat 8.5.4 NIO and SSL

Hello All

Since Tomcat 8.0.x development is about to be stopped, we’ve decided to switch to 8.5.4, but since are facing the following issue:
A few hours after startup, the Java process starts consuming 100% CPU, and while Tomcat is still responsive, it is very slow. This is consistent, been going on for a couple of weeks and is only resolved each time by restarting Tomcat.

I’ve tried a few things:
Reverted back to Tomcat 8.0.33 -> problem solved
Switched from NIO to NIO2 -> problem solved, but other issues appeared with connections ending prematurely, so not a valid option
Switched to the new connector configuration scheme -> problem persists

Setup: 
Current Amazon Linux, Tomcat 8.5.4, Java 1.8.0_92-b14, no APR

      <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
                   maxThreads="500" minSpareThreads="25"
                   enableLookups="false" disableUploadTimeout="true"
                   connectionTimeout="10000"
                   compression="on"
                   compressionMinSize="2048"
                   compressableMimeType="text/html,text/xml,text/json,text/javascript,text/css,text/plain,application/javascript,application/x-javascript,application/xml"
                   SSLEnabled="true" scheme="https" secure="true">
            <SSLHostConfig protocols="TLSv1,TLSv1.1,TLSv1.2">
                <Certificate certificateKeystoreFile="conf/tomcat.keystore"
                             certificateKeyAlias="tomcat"
                             certificateKeystorePassword="tomcat"
                             certificateKeystoreType="PKCS12"/>
            </SSLHostConfig>
        </Connector>


Analyzing the threads, there’s one which takes all of the CPU time:

"https-jsse-nio-8443-ClientPoller-0" daemon prio=5 RUNNABLE
	sun.misc.Unsafe.unpark(Native Method)
	java.util.concurrent.locks.LockSupport.unpark(LockSupport.java:141)
	java.util.concurrent.locks.AbstractQueuedSynchronizer.unparkSuccessor(AbstractQueuedSynchronizer.java:662)
	java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1264)
	java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:457)
	java.util.concurrent.LinkedBlockingQueue.signalNotEmpty(LinkedBlockingQueue.java:176)
	java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:430)
	org.apache.tomcat.util.threads.TaskQueue.offer(TaskQueue.java:74)
	org.apache.tomcat.util.threads.TaskQueue.offer(TaskQueue.java:31)
	java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1361)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:163)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:141)
	org.apache.tomcat.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:828)
	org.apache.tomcat.util.net.NioEndpoint$Poller.processKey(NioEndpoint.java:850)
	org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:826)
	java.lang.Thread.run(Thread.java:745)


This is similar to an issue on a Windows machine reported here:
http://marc.info/?l=tomcat-user&m=147082413626214&w=2

I’ll appreciate any insight or advice
Thanks in advance
Chen


Re: High CPU Consumption with Tomcat 8.5.4 NIO and SSL

Posted by Rémy Maucherat <re...@apache.org>.
2016-08-30 15:31 GMT+02:00 Mark Thomas <ma...@apache.org>:

> On 30/08/2016 14:27, Rémy Maucherat wrote:
> > 2016-08-30 15:22 GMT+02:00 Mark Thomas <ma...@apache.org>:
> >
> >> Either or both of these:
> >> http://bz.apache.org/bugzilla/show_bug.cgi?id=60030
> >>
> > I wasn't 100% sure NIO2 wasn't affected by the SNI IO loop, but it does
> > fine then reading his email.
>
> It isn't. The issue the OP observed with NIO2 were different. They might
> be related to https://bz.apache.org/bugzilla/show_bug.cgi?id=59832
>
> We'll see about other issues when they are identified, I was specifically
interested in knowing if 60030
<http://bz.apache.org/bugzilla/show_bug.cgi?id=60030> applied. So it
doesn't.

Rémy

Re: High CPU Consumption with Tomcat 8.5.4 NIO and SSL

Posted by Mark Thomas <ma...@apache.org>.
On 30/08/2016 14:27, R�my Maucherat wrote:
> 2016-08-30 15:22 GMT+02:00 Mark Thomas <ma...@apache.org>:
> 
>> Either or both of these:
>> http://bz.apache.org/bugzilla/show_bug.cgi?id=60030
>>
> I wasn't 100% sure NIO2 wasn't affected by the SNI IO loop, but it does
> fine then reading his email.

It isn't. The issue the OP observed with NIO2 were different. They might
be related to https://bz.apache.org/bugzilla/show_bug.cgi?id=59832

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: High CPU Consumption with Tomcat 8.5.4 NIO and SSL

Posted by Rémy Maucherat <re...@apache.org>.
2016-08-30 15:22 GMT+02:00 Mark Thomas <ma...@apache.org>:

> Either or both of these:
> http://bz.apache.org/bugzilla/show_bug.cgi?id=60030
>
> I wasn't 100% sure NIO2 wasn't affected by the SNI IO loop, but it does
fine then reading his email.

Rémy

Re: High CPU Consumption with Tomcat 8.5.4 NIO and SSL

Posted by Mark Thomas <ma...@apache.org>.
On 30/08/2016 14:11, Chen Levy wrote:
> Hello All
> 
> Since Tomcat 8.0.x development is about to be stopped, we\u2019ve decided to switch to 8.5.4, but since are facing the following issue:
> A few hours after startup, the Java process starts consuming 100% CPU, and while Tomcat is still responsive, it is very slow. This is consistent, been going on for a couple of weeks and is only resolved each time by restarting Tomcat.

<snip/>

> I\u2019ll appreciate any insight or advice

Either or both of these:
http://bz.apache.org/bugzilla/show_bug.cgi?id=60030
http://bz.apache.org/bugzilla/show_bug.cgi?id=60035

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org