No applications recognized even though Elasticsearch is running

Questions about YourKit Java Profiler
Post Reply
nola111
Posts: 2
Joined: Thu Nov 17, 2022 5:48 pm

No applications recognized even though Elasticsearch is running

Post by nola111 »

Hi,

First-time user of YourKit, here is my scenario.

I have an AWS virtual machine running Ubuntu. On it I have Elasticsearch 7.10 running as a service 24/7.

I am using YourKit Java Profiler 2022.9 on my Mac with macOS Monterey. I did "Profile Remote Java Server or application" and chose the SSH access option. After filling in all the info, I can connect to the VM without any problems, but it says No applications found.

Now, I've been exploring the support section of this site to see what I may be missing, but I'm confused about which suggestions apply to my case. Elasticsearch 7.10 is an application that runs in a JVM, so I'm pretty sure suggestions related to the Java Server don't apply to me, correct?

In any case, it seems I may be needing to do some manual installation of a profiling agent on the remote VM? Is that what we think is the issue here? I am confused by this as the SSH Access option says "If Java process is running without the profiler agent, then profiler agent will be uploaded to the host and attached to the running process." So I guess in my case, it must not be finding any running Java processes to attach a profiler to.

Can you please advise on what exactly I need to do on the remote machine to get this up and running for ES?
Anton Katilin
Posts: 6143
Joined: Wed Aug 11, 2004 8:37 am
Contact:

Re: No applications recognized even though Elasticsearch is running

Post by Anton Katilin »

Hi,

If the profiler doesn't show running Java processes this means it cannot detect them for some reason.

Under which user does the process you want to profile to run? To let the Java attach mechanism detect it, the user should match the user under which you connect with SSH. Attach does not work cross users.

If you have a chance to manually SSH login to that machine and run commands in console, please try running the console version of the attach wizard under appropriate (the process's) user:
https://www.yourkit.com/docs/java/help/ ... wizard.jsp
Do you see the process in the list?

Alternatively to attaching the profiler agent to a running JVM instance, please consider starting it with the agent:
https://www.yourkit.com/docs/java/help/ ... remote.jsp
Please choose the "Other Java application" option and apply the generated VM option -agentpath to the script that starts your process.

Best regards,
Anton
nola111
Posts: 2
Joined: Thu Nov 17, 2022 5:48 pm

Re: No applications recognized even though Elasticsearch is running

Post by nola111 »

Hi Anton.

Many thanks for the reply.

I do believe that Elasticsearch is running under the user that it generates for itself (called elasticsearch) when you install it, and unfortunately I don't think you can actually SSH into the machine as that user. So this is likely why it didn't find the running instance.

However, what I ended up doing on the remote machine is moving the .ykp folder to a folder which I know Elasticsearch can access (since it's where the jvm.options file resides) and then I added the following line to the jvm.options file:

Code: Select all

-agentpath:/etc/elasticsearch/.yjp/2022.9-b171/bin/linux-x86-64/libyjpagent.so
Then I restart Elasticsearch and et voila, it is recognized in YourKit on my local laptop. Not sure if this is similar to what you suggested in your post starting with "Alternatively to attaching..." but this seems to be what ultimately worked.

Thanks.
Anton Katilin
Posts: 6143
Joined: Wed Aug 11, 2004 8:37 am
Contact:

Re: No applications recognized even though Elasticsearch is running

Post by Anton Katilin »

Hi,

It's great news that you managed to connect to the JVM from your laptop.
Not sure if this is similar to what you suggested in your post starting with "Alternatively to attaching..." but this seems to be what ultimately worked.
Yes, specifying -agentpath is exactly what I meant.

Please note that if you used a direct connection to the remote host (i.e. not via SSH) you would need to also specify the agent option "listen=all" to allow remote connection to the profiler agent:
https://www.yourkit.com/docs/java/help/ ... jsp#listen

Code: Select all

-agentpath:/etc/elasticsearch/.yjp/2022.9-b171/bin/linux-x86-64/libyjpagent.so=listen=all
Best regards,
Anton
Vladimir Kondratyev
Posts: 1561
Joined: Tue Aug 10, 2004 7:52 pm
Location: Düsseldorf, Germany
Contact:

Re: No applications recognized even though Elasticsearch is running

Post by Vladimir Kondratyev »

YourKit Connection Broker will help to setup profiling in AWS instance:

https://www.yourkit.com/broker/features/
https://www.yourkit.com/docs/connection ... d_java.jsp

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
Post Reply