Remote Profiling Neo4j Using yourkit
Join the DZone community and get the full member experience.Join For Free
yourkit is my favourite JVM profiling tool and whilst it’s really easy to profile a local JVM process, sometimes I need to profile a process on a remote machine.
In that case we need to first have the remote JVM started up with a yourkit agent parameter passed as one of the args to the Java program.
Since I’m mostly working with Neo4j this means we need to add the following to conf/neo4j-wrapper.conf:
If we run lsof with the Neo4j process ID we’ll see that there’s now a socket listening on port 8888:
java 4388 markhneedham 20u IPv6 0x901df453b4e9a125 0t0 TCP *:8888 (LISTEN) ...
We can connect to that via the ‘Monitor Remote Applications’ section of yourkit:
In this case I’m demonstrating how to connect to it on my laptop and am using localhost but usually we’d specify the remote machine’s host name instead.
We also need to ensure that port 8888 is open on any firewalls we have in front of the machine.
The file we refer to in the ‘agentpath’ flag is a bit different depending on the operating system we’re using. All the details are on the yourkit website.
Published at DZone with permission of Mark Needham, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.