You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Oliver Fernandez <ol...@marfeel.com> on 2017/05/10 07:44:13 UTC
Thread.sleep CPU time
While profiling my Tomcat app using YourKit, I noticed two Threads,
consuming 57% of total CPU, in the method Thread.sleep()
[image: Inline images 1]
What's this Thread.sleep() about?
Re: Thread.sleep CPU time
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 10. Mai 2017 09:44:13 MESZ schrieb Oliver Fernandez <ol...@marfeel.com>:
>While profiling my Tomcat app using YourKit, I noticed two Threads,
>consuming 57% of total CPU, in the method Thread.sleep()
>
>[image: Inline images 1]
The image was removed by the mailing list. Could you post the details as text?
Regards,
Felix
>
>What's this Thread.sleep() about?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Thread.sleep CPU time
Posted by Thomas Meyer <th...@m3y3r.de>.
> Am 10.05.2017 um 12:02 schrieb Oliver Fernandez <ol...@marfeel.com>:
>
> But, is it correct Thread to be sleep?
Basically yes. But Brendan Gregg had yesterday an interesting article about CPU utilization in modern OSes - http://brendangregg.com/blog/2017-05-09/cpu-utilization-is-wrong.html
>
>> On 10 May 2017 at 10:43, Oliver Fernandez <ol...@marfeel.com> wrote:
>> So basically we can consider this time as CPU being idle, right?
>>
>>
>>> On 10 May 2017 at 10:15, Mark Thomas <ma...@apache.org> wrote:
>>> On 10/05/17 09:02, Oliver Fernandez wrote:
>>> > Sorry about the image. Here's in text format
>>> >
>>> > <All Threads>
>>> >
>>> > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
>>> > 42% CPU. This is my webapp code. It's OK
>>> >
>>> > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
>>> > - AbstractProtocol.java:1138 [Wall Time]
>>> > java.lang.Thread.sleep(long) ----> 38% CPU
>>> >
>>> > - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
>>> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
>>> > ------> 19%
>>>
>>> You are looking at wall time, not CPU time so those values look fine.
>>> For an explanation of the differences see the YourKit docs:
>>> https://www.yourkit.com/docs/java/help/times.jsp
>>>
>>> Mark
>>>
>>>
>>> >
>>> >
>>> > I'm not sure what this means. is it just that the CPU is IDLE waiting
>>> > for other tasks to complete?
>>> >
>>> >
>>> > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com
>>> > <ma...@gmail.com>> wrote:
>>> >
>>> > Maybe sleep call is in a loop - busy waiting, and sleeping too
>>> > short. Sleep
>>> > longer, observe latency after the change. In Java 9 there will be extra
>>> > option
>>> > http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
>>> > <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->
>>> >
>>> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
>>> > oliver.fernandez@marfeel.com <ma...@marfeel.com>>
>>> > wrote:
>>> >
>>> > > While profiling my Tomcat app using YourKit, I noticed two Threads,
>>> > > consuming 57% of total CPU, in the method Thread.sleep()
>>> > >
>>> > > [image: Inline images 1]
>>> > >
>>> > > What's this Thread.sleep() about?
>>> > >
>>> > >
>>> > >
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > *Óliver Fernández*
>>> >
>>> > Principal Architect
>>> >
>>> >
>>> > Inline image 2
>>> >
>>> >
>>> >
>>> >
>>> > Marfeel Solutions S.L.
>>> >
>>> > Rambla Catalunya 35, Principal 2ª
>>> >
>>> > 08007 Barcelona, Spain
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>>> >
>>> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>>> >
>>> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > www.marfeel.com <http://www.marfeel.com/>
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>>
>> --
>> Óliver Fernández
>> Principal Architect
>>
>>
>>
>>
>> Marfeel Solutions S.L.
>> Rambla Catalunya 35, Principal 2ª
>> 08007 Barcelona, Spain
>>
>>
>>
>> ES: (+34) 93 178 59 50 ext. 106
>> US: (+1) 917-341-2540 ext. 106
>> UK: (+44) 207-048-37-28 ext. 106
>>
>>
>> www.marfeel.com
>
>
>
> --
> Óliver Fernández
> Principal Architect
>
>
>
>
> Marfeel Solutions S.L.
> Rambla Catalunya 35, Principal 2ª
> 08007 Barcelona, Spain
>
>
>
> ES: (+34) 93 178 59 50 ext. 106
> US: (+1) 917-341-2540 ext. 106
> UK: (+44) 207-048-37-28 ext. 106
>
>
> www.marfeel.com
Re: Thread.sleep CPU time
Posted by Mark Thomas <ma...@apache.org>.
On 10/05/17 11:08, Oliver Fernandez wrote:
> Is there anyway to know if this is caused by specific method? For
> example, if a method is waiting for a I/O operation, or network request
Well, you could always look at the source code.
Mark
>
> On 10 May 2017 at 12:05, Mark Thomas <markt@apache.org
> <ma...@apache.org>> wrote:
>
> On 10/05/17 11:02, Oliver Fernandez wrote:
> > But, is it correct Thread to be sleep?
>
> Yes.
>
> > On 10 May 2017 at 10:43, Oliver Fernandez <oliver.fernandez@marfeel.com <ma...@marfeel.com>
> > <mailto:oliver.fernandez@marfeel.com <ma...@marfeel.com>>>
> wrote:
> >
> > So basically we can consider this time as CPU being idle, right?
>
> Yes.
>
> Mark
>
> >
> >
> > On 10 May 2017 at 10:15, Mark Thomas <markt@apache.org <ma...@apache.org>
> > <mailto:markt@apache.org <ma...@apache.org>>> wrote:
> >
> > On 10/05/17 09:02, Oliver Fernandez wrote:
> > > Sorry about the image. Here's in text format
> > >
> > > <All Threads>
> > >
> > > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> > > 42% CPU. This is my webapp code. It's OK
> > >
> > > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > > - AbstractProtocol.java:1138 [Wall Time]
> > > java.lang.Thread.sleep(long) ----> 38% CPU
> > >
> > > - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> > > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> > > ------> 19%
> >
> > You are looking at wall time, not CPU time so those values look
> > fine.
> > For an explanation of the differences see the YourKit docs:
> > https://www.yourkit.com/docs/java/help/times.jsp
> <https://www.yourkit.com/docs/java/help/times.jsp>
> > <https://www.yourkit.com/docs/java/help/times.jsp
> <https://www.yourkit.com/docs/java/help/times.jsp>>
> >
> > Mark
> >
> >
> > >
> > >
> > > I'm not sure what this means. is it just that the CPU is IDLE waiting
> > > for other tasks to complete?
> > >
> > >
> > > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com <ma...@gmail.com>
> <mailto:sslavic@gmail.com <ma...@gmail.com>>
> > > <mailto:sslavic@gmail.com <ma...@gmail.com>
> <mailto:sslavic@gmail.com <ma...@gmail.com>>>> wrote:
> > >
> > > Maybe sleep call is in a loop - busy waiting, and sleeping too
> > > short. Sleep
> > > longer, observe latency after the change. In Java 9 there will be extra
> > > option
> > > http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->
> > <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->>
> > > <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->
> > <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->>>
> > >
> > > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > > oliver.fernandez@marfeel.com <ma...@marfeel.com>
> > <mailto:oliver.fernandez@marfeel.com <ma...@marfeel.com>>
> > <mailto:oliver.fernandez@marfeel.com
> <ma...@marfeel.com>
> > <mailto:oliver.fernandez@marfeel.com <ma...@marfeel.com>>>>
> > > wrote:
> > >
> > > > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > > > consuming 57% of total CPU, in the method Thread.sleep()
> > > >
> > > > [image: Inline images 1]
> > > >
> > > > What's this Thread.sleep() about?
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > *Óliver Fernández*
> > >
> > > Principal Architect
> > >
> > >
> > > Inline image 2
> > >
> > >
> > >
> > >
> > > Marfeel Solutions S.L.
> > >
> > > Rambla Catalunya 35, Principal 2ª
> > >
> > > 08007 Barcelona, Spain
> > >
> > >
> > >
> > >
> > >
> > >
> > > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050>
> <tel:%28%2B34%29%2093%20178%2059%2050>
> > <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> > >
> > > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540>
> > <tel:%28%2B1%29%20917-341-2540> ext. 106
> > >
> > > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> > >
> > >
> > >
> > >
> > >
> > > www.marfeel.com <http://www.marfeel.com>
> <http://www.marfeel.com> <http://www.marfeel.com/>
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> > <mailto:users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>>
> > For additional commands, e-mail: users-help@tomcat.apache.org <ma...@tomcat.apache.org>
> > <mailto:users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>>
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050>
> <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com> <http://www.marfeel.com/>
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050>
> <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com> <http://www.marfeel.com/>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>
>
>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
>
> Inline image 2
>
>
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
>
>
> ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>
> US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>
> UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>
>
>
>
>
> www.marfeel.com <http://www.marfeel.com/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Thread.sleep CPU time
Posted by Oliver Fernandez <ol...@marfeel.com>.
Is there anyway to know if this is caused by specific method? For example,
if a method is waiting for a I/O operation, or network request
On 10 May 2017 at 12:05, Mark Thomas <ma...@apache.org> wrote:
> On 10/05/17 11:02, Oliver Fernandez wrote:
> > But, is it correct Thread to be sleep?
>
> Yes.
>
> > On 10 May 2017 at 10:43, Oliver Fernandez <oliver.fernandez@marfeel.com
> > <ma...@marfeel.com>> wrote:
> >
> > So basically we can consider this time as CPU being idle, right?
>
> Yes.
>
> Mark
>
> >
> >
> > On 10 May 2017 at 10:15, Mark Thomas <markt@apache.org
> > <ma...@apache.org>> wrote:
> >
> > On 10/05/17 09:02, Oliver Fernandez wrote:
> > > Sorry about the image. Here's in text format
> > >
> > > <All Threads>
> > >
> > > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run()
> --->
> > > 42% CPU. This is my webapp code. It's OK
> > >
> > > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > > - AbstractProtocol.java:1138 [Wall Time]
> > > java.lang.Thread.sleep(long) ----> 38% CPU
> > >
> > > - org.apache.catalina.core.ContainerBase$
> ContainerBackgroundProcessor.run()
> > > - ContainerBase.java:1355 [Wall Time]
> java.lang.Thread.sleep(long)
> > > ------> 19%
> >
> > You are looking at wall time, not CPU time so those values look
> > fine.
> > For an explanation of the differences see the YourKit docs:
> > https://www.yourkit.com/docs/java/help/times.jsp
> > <https://www.yourkit.com/docs/java/help/times.jsp>
> >
> > Mark
> >
> >
> > >
> > >
> > > I'm not sure what this means. is it just that the CPU is IDLE
> waiting
> > > for other tasks to complete?
> > >
> > >
> > > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com
> <ma...@gmail.com>
> > > <mailto:sslavic@gmail.com <ma...@gmail.com>>> wrote:
> > >
> > > Maybe sleep call is in a loop - busy waiting, and sleeping
> too
> > > short. Sleep
> > > longer, observe latency after the change. In Java 9 there
> will be extra
> > > option
> > > http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
> > <http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait-->
> > > <http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
> > <http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait-->>
> > >
> > > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > > oliver.fernandez@marfeel.com
> > <ma...@marfeel.com>
> > <mailto:oliver.fernandez@marfeel.com
> > <ma...@marfeel.com>>>
> > > wrote:
> > >
> > > > While profiling my Tomcat app using YourKit, I noticed
> two Threads,
> > > > consuming 57% of total CPU, in the method Thread.sleep()
> > > >
> > > > [image: Inline images 1]
> > > >
> > > > What's this Thread.sleep() about?
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > *Óliver Fernández*
> > >
> > > Principal Architect
> > >
> > >
> > > Inline image 2
> > >
> > >
> > >
> > >
> > > Marfeel Solutions S.L.
> > >
> > > Rambla Catalunya 35, Principal 2ª
> > >
> > > 08007 Barcelona, Spain
> > >
> > >
> > >
> > >
> > >
> > >
> > > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050>
> > <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> > >
> > > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540>
> > <tel:%28%2B1%29%20917-341-2540> ext. 106
> > >
> > > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> > >
> > >
> > >
> > >
> > >
> > > www.marfeel.com <http://www.marfeel.com> <
> http://www.marfeel.com/>
> > >
> >
> >
> > ------------------------------------------------------------
> ---------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > <ma...@tomcat.apache.org>
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > <ma...@tomcat.apache.org>
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext.
> 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com/>
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com/>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
*Óliver Fernández*
Principal Architect
[image: Inline image 2]
Marfeel Solutions S.L.
Rambla Catalunya 35, Principal 2ª
08007 Barcelona, Spain
ES: (+34) 93 178 59 50 ext. 106
US: (+1) 917-341-2540 ext. 106
UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
www.marfeel.com
Re: Thread.sleep CPU time
Posted by Mark Thomas <ma...@apache.org>.
On 10/05/17 11:02, Oliver Fernandez wrote:
> But, is it correct Thread to be sleep?
Yes.
> On 10 May 2017 at 10:43, Oliver Fernandez <oliver.fernandez@marfeel.com
> <ma...@marfeel.com>> wrote:
>
> So basically we can consider this time as CPU being idle, right?
Yes.
Mark
>
>
> On 10 May 2017 at 10:15, Mark Thomas <markt@apache.org
> <ma...@apache.org>> wrote:
>
> On 10/05/17 09:02, Oliver Fernandez wrote:
> > Sorry about the image. Here's in text format
> >
> > <All Threads>
> >
> > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> > 42% CPU. This is my webapp code. It's OK
> >
> > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > - AbstractProtocol.java:1138 [Wall Time]
> > java.lang.Thread.sleep(long) ----> 38% CPU
> >
> > - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> > ------> 19%
>
> You are looking at wall time, not CPU time so those values look
> fine.
> For an explanation of the differences see the YourKit docs:
> https://www.yourkit.com/docs/java/help/times.jsp
> <https://www.yourkit.com/docs/java/help/times.jsp>
>
> Mark
>
>
> >
> >
> > I'm not sure what this means. is it just that the CPU is IDLE waiting
> > for other tasks to complete?
> >
> >
> > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com <ma...@gmail.com>
> > <mailto:sslavic@gmail.com <ma...@gmail.com>>> wrote:
> >
> > Maybe sleep call is in a loop - busy waiting, and sleeping too
> > short. Sleep
> > longer, observe latency after the change. In Java 9 there will be extra
> > option
> > http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->
> > <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->>
> >
> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > oliver.fernandez@marfeel.com
> <ma...@marfeel.com>
> <mailto:oliver.fernandez@marfeel.com
> <ma...@marfeel.com>>>
> > wrote:
> >
> > > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > > consuming 57% of total CPU, in the method Thread.sleep()
> > >
> > > [image: Inline images 1]
> > >
> > > What's this Thread.sleep() about?
> > >
> > >
> > >
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050>
> <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540>
> <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com> <http://www.marfeel.com/>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>
>
>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
>
> Inline image 2
>
>
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
>
>
> ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>
> US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>
> UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>
>
>
>
>
> www.marfeel.com <http://www.marfeel.com/>
>
>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
>
> Inline image 2
>
>
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
>
>
> ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>
> US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>
> UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>
>
>
>
>
> www.marfeel.com <http://www.marfeel.com/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Thread.sleep CPU time
Posted by Oliver Fernandez <ol...@marfeel.com>.
But, is it correct Thread to be sleep?
On 10 May 2017 at 10:43, Oliver Fernandez <ol...@marfeel.com>
wrote:
> So basically we can consider this time as CPU being idle, right?
>
>
> On 10 May 2017 at 10:15, Mark Thomas <ma...@apache.org> wrote:
>
>> On 10/05/17 09:02, Oliver Fernandez wrote:
>> > Sorry about the image. Here's in text format
>> >
>> > <All Threads>
>> >
>> > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run()
>> --->
>> > 42% CPU. This is my webapp code. It's OK
>> >
>> > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
>> > - AbstractProtocol.java:1138 [Wall Time]
>> > java.lang.Thread.sleep(long) ----> 38% CPU
>> >
>> > - org.apache.catalina.core.ContainerBase$ContainerBackgroundPr
>> ocessor.run()
>> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
>> > ------> 19%
>>
>> You are looking at wall time, not CPU time so those values look fine.
>> For an explanation of the differences see the YourKit docs:
>> https://www.yourkit.com/docs/java/help/times.jsp
>>
>> Mark
>>
>>
>> >
>> >
>> > I'm not sure what this means. is it just that the CPU is IDLE waiting
>> > for other tasks to complete?
>> >
>> >
>> > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com
>> > <ma...@gmail.com>> wrote:
>> >
>> > Maybe sleep call is in a loop - busy waiting, and sleeping too
>> > short. Sleep
>> > longer, observe latency after the change. In Java 9 there will be
>> extra
>> > option
>> > http://download.java.net/java/jdk9/docs/api/java/lang/T
>> hread.html#onSpinWait--
>> > <http://download.java.net/java/jdk9/docs/api/java/lang/Thre
>> ad.html#onSpinWait-->
>> >
>> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
>> > oliver.fernandez@marfeel.com <ma...@marfeel.com>>
>> > wrote:
>> >
>> > > While profiling my Tomcat app using YourKit, I noticed two
>> Threads,
>> > > consuming 57% of total CPU, in the method Thread.sleep()
>> > >
>> > > [image: Inline images 1]
>> > >
>> > > What's this Thread.sleep() about?
>> > >
>> > >
>> > >
>> >
>> >
>> >
>> >
>> > --
>> >
>> > *Óliver Fernández*
>> >
>> > Principal Architect
>> >
>> >
>> > Inline image 2
>> >
>> >
>> >
>> >
>> > Marfeel Solutions S.L.
>> >
>> > Rambla Catalunya 35, Principal 2ª
>> >
>> > 08007 Barcelona, Spain
>> >
>> >
>> >
>> >
>> >
>> >
>> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>> >
>> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>> >
>> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>> >
>> >
>> >
>> >
>> >
>> > www.marfeel.com <http://www.marfeel.com/>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
> [image: Inline image 2]
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
> ES: (+34) 93 178 59 50 ext. 106
>
> US: (+1) 917-341-2540 ext. 106
>
> UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
>
>
> www.marfeel.com
>
--
*Óliver Fernández*
Principal Architect
[image: Inline image 2]
Marfeel Solutions S.L.
Rambla Catalunya 35, Principal 2ª
08007 Barcelona, Spain
ES: (+34) 93 178 59 50 ext. 106
US: (+1) 917-341-2540 ext. 106
UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
www.marfeel.com
Re: Thread.sleep CPU time
Posted by Oliver Fernandez <ol...@marfeel.com>.
So basically we can consider this time as CPU being idle, right?
On 10 May 2017 at 10:15, Mark Thomas <ma...@apache.org> wrote:
> On 10/05/17 09:02, Oliver Fernandez wrote:
> > Sorry about the image. Here's in text format
> >
> > <All Threads>
> >
> > - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> > 42% CPU. This is my webapp code. It's OK
> >
> > - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > - AbstractProtocol.java:1138 [Wall Time]
> > java.lang.Thread.sleep(long) ----> 38% CPU
> >
> > - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
> run()
> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> > ------> 19%
>
> You are looking at wall time, not CPU time so those values look fine.
> For an explanation of the differences see the YourKit docs:
> https://www.yourkit.com/docs/java/help/times.jsp
>
> Mark
>
>
> >
> >
> > I'm not sure what this means. is it just that the CPU is IDLE waiting
> > for other tasks to complete?
> >
> >
> > On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> > Maybe sleep call is in a loop - busy waiting, and sleeping too
> > short. Sleep
> > longer, observe latency after the change. In Java 9 there will be
> extra
> > option
> > http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
> > <http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait-->
> >
> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > oliver.fernandez@marfeel.com <ma...@marfeel.com>>
> > wrote:
> >
> > > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > > consuming 57% of total CPU, in the method Thread.sleep()
> > >
> > > [image: Inline images 1]
> > >
> > > What's this Thread.sleep() about?
> > >
> > >
> > >
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
> >
> > US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
> >
> > UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com <http://www.marfeel.com/>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
*Óliver Fernández*
Principal Architect
[image: Inline image 2]
Marfeel Solutions S.L.
Rambla Catalunya 35, Principal 2ª
08007 Barcelona, Spain
ES: (+34) 93 178 59 50 ext. 106
US: (+1) 917-341-2540 ext. 106
UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
www.marfeel.com
Re: Thread.sleep CPU time
Posted by Mark Thomas <ma...@apache.org>.
On 10/05/17 09:02, Oliver Fernandez wrote:
> Sorry about the image. Here's in text format
>
> <All Threads>
>
> - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> 42% CPU. This is my webapp code. It's OK
>
> - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> - AbstractProtocol.java:1138 [Wall Time]
> java.lang.Thread.sleep(long) ----> 38% CPU
>
> - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> ------> 19%
You are looking at wall time, not CPU time so those values look fine.
For an explanation of the differences see the YourKit docs:
https://www.yourkit.com/docs/java/help/times.jsp
Mark
>
>
> I'm not sure what this means. is it just that the CPU is IDLE waiting
> for other tasks to complete?
>
>
> On 10 May 2017 at 09:53, Stevo Slavić <sslavic@gmail.com
> <ma...@gmail.com>> wrote:
>
> Maybe sleep call is in a loop - busy waiting, and sleeping too
> short. Sleep
> longer, observe latency after the change. In Java 9 there will be extra
> option
> http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> <http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait-->
>
> On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> oliver.fernandez@marfeel.com <ma...@marfeel.com>>
> wrote:
>
> > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > consuming 57% of total CPU, in the method Thread.sleep()
> >
> > [image: Inline images 1]
> >
> > What's this Thread.sleep() about?
> >
> >
> >
>
>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
>
> Inline image 2
>
>
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
>
>
> ES: (+34) 93 178 59 50 <tel:%28%2B34%29%2093%20178%2059%2050> ext. 106
>
> US: (+1) 917-341-2540 <tel:%28%2B1%29%20917-341-2540> ext. 106
>
> UK: (+44) 207-048-37-28 <tel:%28%2B44%29%20704-837-28> ext. 106
>
>
>
>
>
> www.marfeel.com <http://www.marfeel.com/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Thread.sleep CPU time
Posted by Oliver Fernandez <ol...@marfeel.com>.
Sorry about the image. Here's in text format
<All Threads>
- org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
42% CPU. This is my webapp code. It's OK
- org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
- AbstractProtocol.java:1138 [Wall Time] java.lang.Thread.sleep(long)
----> 38% CPU
- org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
- ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
------> 19%
I'm not sure what this means. is it just that the CPU is IDLE waiting for
other tasks to complete?
On 10 May 2017 at 09:53, Stevo Slavić <ss...@gmail.com> wrote:
> Maybe sleep call is in a loop - busy waiting, and sleeping too short. Sleep
> longer, observe latency after the change. In Java 9 there will be extra
> option
> http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
>
> On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> oliver.fernandez@marfeel.com> wrote:
>
> > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > consuming 57% of total CPU, in the method Thread.sleep()
> >
> > [image: Inline images 1]
> >
> > What's this Thread.sleep() about?
> >
> >
> >
>
--
*Óliver Fernández*
Principal Architect
[image: Inline image 2]
Marfeel Solutions S.L.
Rambla Catalunya 35, Principal 2ª
08007 Barcelona, Spain
ES: (+34) 93 178 59 50 ext. 106
US: (+1) 917-341-2540 ext. 106
UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
www.marfeel.com
Re: Thread.sleep CPU time
Posted by Stevo Slavić <ss...@gmail.com>.
Maybe sleep call is in a loop - busy waiting, and sleeping too short. Sleep
longer, observe latency after the change. In Java 9 there will be extra
option
http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
oliver.fernandez@marfeel.com> wrote:
> While profiling my Tomcat app using YourKit, I noticed two Threads,
> consuming 57% of total CPU, in the method Thread.sleep()
>
> [image: Inline images 1]
>
> What's this Thread.sleep() about?
>
>
>