You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Michael McCandless <lu...@mikemccandless.com> on 2015/04/27 16:54:52 UTC

Can test HEARTBEATs also print the CPU usage of the JVM process?

This can be helpful to differentiate a test that is in a busy loop
(taking 100% CPU) vs a deadlock/hang (taking 0% CPU)...

Is it easy/possible to get this from straight Java APIs?
OperatingSystemMXBean maybe...?

Mike McCandless

http://blog.mikemccandless.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: Can test HEARTBEATs also print the CPU usage of the JVM process?

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Wed, May 20, 2015 at 5:07 PM, Dawid Weiss
<da...@cs.put.poznan.pl> wrote:

> Hi Mike!
>
> https://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html#getSystemCpuLoad--
>
> Doable if we're under 1.7, if the JVM supports it and if we spawn a
> daemon thread on the forked JVM (which could also conveniently handle
> the heartbeat)... Added to the queue...

Wonderful, thanks Dawid!

Mike McCandless

http://blog.mikemccandless.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: Can test HEARTBEATs also print the CPU usage of the JVM process?

Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
Hi Mike!

https://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html#getSystemCpuLoad--

Doable if we're under 1.7, if the JVM supports it and if we spawn a
daemon thread on the forked JVM (which could also conveniently handle
the heartbeat)... Added to the queue...

Dawid

On Mon, Apr 27, 2015 at 10:04 PM, Dawid Weiss
<da...@cs.put.poznan.pl> wrote:
> Hi Mike,
>
> I'm pretty sure it could, if permitted by the security manager. :) The
> problem with this metric is that the CPU is not exclusively owned by
> Java so if you have a shared system then the CPU usage may not tell
> you anything?
>
> Dawid
>
>
> On Mon, Apr 27, 2015 at 4:54 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
>> This can be helpful to differentiate a test that is in a busy loop
>> (taking 100% CPU) vs a deadlock/hang (taking 0% CPU)...
>>
>> Is it easy/possible to get this from straight Java APIs?
>> OperatingSystemMXBean maybe...?
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: Can test HEARTBEATs also print the CPU usage of the JVM process?

Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
I think the incorrect link got pasted somehow. I meant
getProcessCpuLoad (thanks for noticing, Uwe).

Dawid



On Wed, May 20, 2015 at 11:24 PM, Uwe Schindler <us...@apache.org> wrote:
> Hi,
>
> For policeman Jenkins it is highly shared... There are running 2 virtual machines (OSX and Windows) next to the main Jenkins build processor. This machine always has all 6 (12 HT) cores used and in most times approx. 40% of its 32 GiB of b*er ahm RUM...
>
> But we can get the JVM process' CPU usage from the same MX bean. I think this one helps more :-)
>
> Uwe
>
> -----
> Uwe Schindler
> uschindler@apache.org
> ASF Member, Apache Lucene PMC / Committer
> Bremen, Germany
> http://lucene.apache.org/
>
>
>> -----Original Message-----
>> From: dawid.weiss@gmail.com [mailto:dawid.weiss@gmail.com] On Behalf
>> Of Dawid Weiss
>> Sent: Monday, April 27, 2015 10:05 PM
>> To: dev@lucene.apache.org
>> Subject: Re: Can test HEARTBEATs also print the CPU usage of the JVM
>> process?
>>
>> Hi Mike,
>>
>> I'm pretty sure it could, if permitted by the security manager. :) The problem
>> with this metric is that the CPU is not exclusively owned by Java so if you
>> have a shared system then the CPU usage may not tell you anything?
>>
>> Dawid
>>
>>
>> On Mon, Apr 27, 2015 at 4:54 PM, Michael McCandless
>> <lu...@mikemccandless.com> wrote:
>> > This can be helpful to differentiate a test that is in a busy loop
>> > (taking 100% CPU) vs a deadlock/hang (taking 0% CPU)...
>> >
>> > Is it easy/possible to get this from straight Java APIs?
>> > OperatingSystemMXBean maybe...?
>> >
>> > Mike McCandless
>> >
>> > http://blog.mikemccandless.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
>> > additional commands, e-mail: dev-help@lucene.apache.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
>> commands, e-mail: dev-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


RE: Can test HEARTBEATs also print the CPU usage of the JVM process?

Posted by Uwe Schindler <us...@apache.org>.
Hi,

For policeman Jenkins it is highly shared... There are running 2 virtual machines (OSX and Windows) next to the main Jenkins build processor. This machine always has all 6 (12 HT) cores used and in most times approx. 40% of its 32 GiB of b*er ahm RUM...

But we can get the JVM process' CPU usage from the same MX bean. I think this one helps more :-)

Uwe

-----
Uwe Schindler
uschindler@apache.org 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany
http://lucene.apache.org/


> -----Original Message-----
> From: dawid.weiss@gmail.com [mailto:dawid.weiss@gmail.com] On Behalf
> Of Dawid Weiss
> Sent: Monday, April 27, 2015 10:05 PM
> To: dev@lucene.apache.org
> Subject: Re: Can test HEARTBEATs also print the CPU usage of the JVM
> process?
> 
> Hi Mike,
> 
> I'm pretty sure it could, if permitted by the security manager. :) The problem
> with this metric is that the CPU is not exclusively owned by Java so if you
> have a shared system then the CPU usage may not tell you anything?
> 
> Dawid
> 
> 
> On Mon, Apr 27, 2015 at 4:54 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
> > This can be helpful to differentiate a test that is in a busy loop
> > (taking 100% CPU) vs a deadlock/hang (taking 0% CPU)...
> >
> > Is it easy/possible to get this from straight Java APIs?
> > OperatingSystemMXBean maybe...?
> >
> > Mike McCandless
> >
> > http://blog.mikemccandless.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
> > additional commands, e-mail: dev-help@lucene.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: Can test HEARTBEATs also print the CPU usage of the JVM process?

Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
Hi Mike,

I'm pretty sure it could, if permitted by the security manager. :) The
problem with this metric is that the CPU is not exclusively owned by
Java so if you have a shared system then the CPU usage may not tell
you anything?

Dawid


On Mon, Apr 27, 2015 at 4:54 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
> This can be helpful to differentiate a test that is in a busy loop
> (taking 100% CPU) vs a deadlock/hang (taking 0% CPU)...
>
> Is it easy/possible to get this from straight Java APIs?
> OperatingSystemMXBean maybe...?
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org