You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by "W.P. McNeill" <bi...@gmail.com> on 2011/10/17 20:34:13 UTC

How do I connect Java Visual VM to a remote task?

I'm investigating a bug where my mapper and reducer tasks run out of memory.
It only reproduces when I run on large data sets, so the best way to dig in
is to launch my job with sufficiently large inputs on the cluster and
monitor the memory characteristics of the failing JVMs remotely. Java Visual
VM looks like the tool I want to use. Specifically I want to use it to do
heap dumps on my tasks. I can't figure out how to set up the listening end
on the cluster nodes, however.

Here is what I have tried:

1. *Turn on JMX remote for the tasks*...I added the following options to
mapred.child.java.opts:
com.sun.management.jmxremote,
com.sun.management.jmxremote.port=8004,com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl
= false.

This does not work because there is contention for the JMX remote port when
multiple tasks run on the same node. All but the first task fail at JVM
initialization time, causing the job to fail before I can see the repro.

2. *Use jstatd*...I tried running jstatd in the background on my cluster
nodes. It launches and runs, but when I try to connect using Visual VM,
nothing happens.

I am going to try adding -XX:-HeapDumpOnOutOfMemoryError, which will at
least give me post-mortem information. Does anyone know where the heap dump
file will  be written?

Has anyone debugged a similar setup? What tools did you use?

Re: How do I connect Java Visual VM to a remote task?

Posted by Harsh J <ha...@cloudera.com>.
Hello,

(Inline)

On Tue, Oct 18, 2011 at 12:04 AM, W.P. McNeill <bi...@gmail.com> wrote:
<snip>
> 1. *Turn on JMX remote for the tasks*...I added the following options to
> mapred.child.java.opts:
> com.sun.management.jmxremote,
> com.sun.management.jmxremote.port=8004,com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl
> = false.
>
> This does not work because there is contention for the JMX remote port when
> multiple tasks run on the same node. All but the first task fail at JVM
> initialization time, causing the job to fail before I can see the repro.

For profiling/etc. this way, you are probably interested in just one
task. So switch down your slots to 1, and that'd be an easy way out -
1 mapper at a time, reusing the port as it goes.

> 2. *Use jstatd*...I tried running jstatd in the background on my cluster
> nodes. It launches and runs, but when I try to connect using Visual VM,
> nothing happens.

While I find it odd that jstatd doesn't seem to expose the host's jvm
metrics out for you, I don't think jstatd would let you do memory
profiling AFAIK. You need jmx for that, right? You can observe heap
charts with jstatd running though, I think.

> I am going to try adding -XX:-HeapDumpOnOutOfMemoryError, which will at
> least give me post-mortem information. Does anyone know where the heap dump
> file will  be written?

Enable keep.failed.task.files as true for your job, then hunt the
attempt directory down in your mapred.local.dir of the TaskTracker
that ran it. An easier way is to also log the Child's pwd via your
java code so you see which disk its on when you check logs first.
Under the attempt dir, you should be able to locate your heap dump.

> Has anyone debugged a similar setup? What tools did you use?

I think you'll find some (possibly odd looking) ways described on
https://issues.apache.org/jira/browse/MAPREDUCE-2637, similar to your
approach.

-- 
Harsh J

Re: Is there a way to get the version of a remote hadoop instance

Posted by Ta...@emc.com.
Shevek,

Thanks for your response, getting the protocol version doesn't fit our
requirements.

I think it's pretty easy for hadoop to provide this kind of information,
and this seems very common for those popular NOSQL databases......

Anyway, thanks for your reply! Hopefully hadoop can provide this
information in the coming versions.

Thanks and regards!
Tao

On 10/19/11 1:21 AM, "Shevek" <sh...@karmasphere.com> wrote:

>Hadoop instances don't publish their Hadoop version by RMI, only their
>protocol version. Hadoop 0.20.x will use JobTracker protocol 65, DataNode
>protocol 14, and so forth. You can query this using the Protocol RMI
>interface, although I'm not sure that this method is accessible through
>any
>public manner from JobClient.
>
>There is an nmap script for Hadoop which queries (I believe) the web
>interface available at http://seclists.org/nmap-dev/2011/q4/58 - porting
>this script to Java using commons-httpclient and either Pattern or Scanner
>will not be hard.
>
>S.
>
>On 17 October 2011 17:41, <Ta...@emc.com> wrote:
>
>> Hi,
>>
>> Is there a way to get the version of a remote hadoop instance through
>>java
>> API?
>>
>> Suppose there are two machines: A and B. I deploy the hadoop instance on
>> machine A, while my application is deployed on machine B. Before
>>starting
>> my application, I want to check whether the hadoop instance version is
>> compatible with my application, so I want to get the version of the
>>hadoop
>> instance on machine A from B.
>>
>> I go through all the API, only find there is a VersionInfo class which
>>can
>> get you the local Hadoop version, not the remote instance. Do you have
>>any
>> ideas about this?
>>
>> Thanks and regards!
>> Tao
>>
>>


Re: Is there a way to get the version of a remote hadoop instance

Posted by Shevek <sh...@karmasphere.com>.
Hadoop instances don't publish their Hadoop version by RMI, only their
protocol version. Hadoop 0.20.x will use JobTracker protocol 65, DataNode
protocol 14, and so forth. You can query this using the Protocol RMI
interface, although I'm not sure that this method is accessible through any
public manner from JobClient.

There is an nmap script for Hadoop which queries (I believe) the web
interface available at http://seclists.org/nmap-dev/2011/q4/58 - porting
this script to Java using commons-httpclient and either Pattern or Scanner
will not be hard.

S.

On 17 October 2011 17:41, <Ta...@emc.com> wrote:

> Hi,
>
> Is there a way to get the version of a remote hadoop instance through java
> API?
>
> Suppose there are two machines: A and B. I deploy the hadoop instance on
> machine A, while my application is deployed on machine B. Before starting
> my application, I want to check whether the hadoop instance version is
> compatible with my application, so I want to get the version of the hadoop
> instance on machine A from B.
>
> I go through all the API, only find there is a VersionInfo class which can
> get you the local Hadoop version, not the remote instance. Do you have any
> ideas about this?
>
> Thanks and regards!
> Tao
>
>

Re: Is there a way to get the version of a remote hadoop instance

Posted by Te...@emc.com.
Hi Tao,

I'm afraid there is no such API. A related JIRA ticket is
https://issues.apache.org/jira/browse/HADOOP-7719.

Regards,

---- 
Ted Xu








On 10/18/11 8:41 AM, "Zhang, Tao" <Ta...@emc.com> wrote:

>Hi, 
>
>Is there a way to get the version of a remote hadoop instance through java
>API?
>
>Suppose there are two machines: A and B. I deploy the hadoop instance on
>machine A, while my application is deployed on machine B. Before starting
>my application, I want to check whether the hadoop instance version is
>compatible with my application, so I want to get the version of the hadoop
>instance on machine A from B.
>
>I go through all the API, only find there is a VersionInfo class which can
>get you the local Hadoop version, not the remote instance. Do you have any
>ideas about this?
>
>Thanks and regards!
>Tao
>
>


Is there a way to get the version of a remote hadoop instance

Posted by Ta...@emc.com.
Hi, 

Is there a way to get the version of a remote hadoop instance through java
API?

Suppose there are two machines: A and B. I deploy the hadoop instance on
machine A, while my application is deployed on machine B. Before starting
my application, I want to check whether the hadoop instance version is
compatible with my application, so I want to get the version of the hadoop
instance on machine A from B.

I go through all the API, only find there is a VersionInfo class which can
get you the local Hadoop version, not the remote instance. Do you have any
ideas about this?

Thanks and regards!
Tao


Re: How do I connect Java Visual VM to a remote task?

Posted by Rahul Jain <rj...@gmail.com>.
The easy way to debug such problems in our experience is to use 'jmap' to
take a few snapshots of one of the tasktrackers (child tasks) and analyze
them under a profiler tool such as jprofiler, yourkit etc. This should give
you pretty good indication of objects that are using up most heap memory.

You can add JVM options to suspend child tasks upon startup and attach using
debugger etc. but that is more painful in a distributed environment.


-Rahul

On Mon, Oct 17, 2011 at 11:34 AM, W.P. McNeill <bi...@gmail.com> wrote:

> I'm investigating a bug where my mapper and reducer tasks run out of
> memory.
> It only reproduces when I run on large data sets, so the best way to dig in
> is to launch my job with sufficiently large inputs on the cluster and
> monitor the memory characteristics of the failing JVMs remotely. Java
> Visual
> VM looks like the tool I want to use. Specifically I want to use it to do
> heap dumps on my tasks. I can't figure out how to set up the listening end
> on the cluster nodes, however.
>
> Here is what I have tried:
>
> 1. *Turn on JMX remote for the tasks*...I added the following options to
> mapred.child.java.opts:
> com.sun.management.jmxremote,
>
> com.sun.management.jmxremote.port=8004,com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl
> = false.
>
> This does not work because there is contention for the JMX remote port when
> multiple tasks run on the same node. All but the first task fail at JVM
> initialization time, causing the job to fail before I can see the repro.
>
> 2. *Use jstatd*...I tried running jstatd in the background on my cluster
> nodes. It launches and runs, but when I try to connect using Visual VM,
> nothing happens.
>
> I am going to try adding -XX:-HeapDumpOnOutOfMemoryError, which will at
> least give me post-mortem information. Does anyone know where the heap dump
> file will  be written?
>
> Has anyone debugged a similar setup? What tools did you use?
>