Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Running profiler on k8s

Moderators: Vladimir Kondratyev, Anton Katilin

Running profiler on k8s

Postby oali » Thu Feb 18, 2021 4:08 pm

So I'm having issues running the profiler on k8s. I was able to setup the profiler locally in a docker container and it works but I wanted to run it in the k8s cluster. I start the agent with my jar by using
Code: Select all
-agentpath:/usr/local/YourKit-JavaProfiler-2020.9/bin/linux-x86-64/libyjpagent.so=port=10002,listen=all -jar ...


I have a service that exposed the port 10002. The port of the service that is externally facing is different because k8s creates a random port. When I try and access the endpoint of the node the app is running on using the port that k8s creates I am able to see the summary page.
When I try and connect from the GUI I provide the node name in the k8s cluster where the app is running as the hostname and the profiler agent port is the port that is provided by my service. I see that the connection is green so when I click on it I see it says remote application is being profiled. After a couple of seconds it terminates and says the application was terminated or connection is lost. My app hasn't restarted at all so I don't know why the connection terminated. In the logs in k8s for the Yourkit I see the following:
Code: Select all
 error: Exception in dispatchRequest(): java.io.EOFException
        at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202)
        at java.base/java.io.DataInputStream.readLong(DataInputStream.java:421)
        at com.yourkit.f.au.a(a:50)
        at com.yourkit.runtime.RequestProcessing.dispatchRequest(a:30)
        at com.yourkit.runtime.Core$5.run(a:646)
        at java.base/java.lang.Thread.run(Unknown Source)


Any idea? The connection does work but it doesn't stay connected for more than a few seconds. Am I supposed to add liveness probes to keep it connected?
oali
 
Posts: 2
Joined: Thu Feb 18, 2021 3:47 pm

Re: Running profiler on k8s

Postby oali » Thu Feb 18, 2021 5:11 pm

If someone else runs into this issue I found the solution which was silly. I was running 2 replicas of the app in k8s and didn't think it was a big deal. I decided to take one of the replicas down thinking that even though I was connecting to one node and the other replica was on a different node that it wouldn't cause an issue. Guess I was wrong and it seems running the app with two or more replicas would confuse the profiler and cause it to terminate the connection.
oali
 
Posts: 2
Joined: Thu Feb 18, 2021 3:47 pm

Re: Running profiler on k8s

Postby Anton Katilin » Thu Feb 18, 2021 7:25 pm

Perhaps it was a problem with a fixed port you specified for the agent with the option "port=10002". When you use this option please be sure that the port is not opened by another process. The option allows to specify a port range instead to choose a free port from, e.g. "port=10001-10010", see https://www.yourkit.com/docs/java/help/ ... s.jsp#port
Anton Katilin
 
Posts: 6029
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Google [Bot] and 1 guest

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.