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

Yourkit agent on container connection issue

Moderators: Vladimir Kondratyev, Anton Katilin

Yourkit agent on container connection issue

Postby dvoloshin » Sun Jun 17, 2018 10:52 am

Hi All

I'm trying to setup the yourkit agent on docker container to profile an web app which is running on Jetty app server, I went according to the following instructions to set-up an agent https://www.yourkit.com/docs/java/help/docker.jsp. Then I built a new container and run it, according to the container log, the startup seems ok, and the agent is started correctly. including 10001 port exposure.
But when I try to connect to the process from Yourkit UI the connection is not getting established


Here is my dockerfile yourkit related code.

Code: Select all
RUN wget https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2018.04-docker.zip -P /tmp/ && \
      unzip /tmp/YourKit-JavaProfiler-2018.04-docker.zip -d /usr/local && \
      rm /tmp/YourKit-JavaProfiler-2018.04-docker.zip

COPY docker-entrypoint.sh generate-jetty-start.sh /

USER jetty
EXPOSE 8080
EXPOSE 10001
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-Xmx100m","-agentpath:/usr/local/YourKit-JavaProfiler-2018.04/bin/linux-x86-64/libyjpagent.so=port=10001,listen=all","-jar","/usr/local/jetty/start.jar"]




here is log output

Cannot create log file: /home/jetty/.yjp/log/start-10.log
To specify alternate log directory use startup option 'logdir'
18.04-73 0.000: Command line:
java
-Xmx100m
-agentpath:/usr/local/YourKit-JavaProfiler-2018.04/bin/linux-x86-64/libyjpagent.so=port=10001,listen=all
-jar
/usr/local/jetty/start.jar
--dry-run
18.04-73 0.000: Executable: /opt/ibm/java/jre/bin/java
18.04-73 0.000: uname:
sysname: Linux
release: 4.9.93-linuxkit-aufs
version: #1 SMP Wed Jun 6 16:55:56 UTC 2018
machine: x86_64
18.04-73 0.000: Linux; 64-bit process
18.04-73 0.000: hid: 3602299757ZX88999779ZZ593870571132 64-bit machine
18.04-73 0.000: Today is 20180617
18.04-73 0.000: full_build_stamp: 2018.04.73 201806140917
18.04-73 0.000: Agent library path: /usr/local/YourKit-JavaProfiler-2018.04/bin/linux-x86-64/libyjpagent.so
18.04-73 0.001: getTimeNsInfo: "monotonic_raw"
18.04-73 0.001: Agent_OnLoad: orig_options=port=10001,listen=all
full_options=port=10001,listen=all
18.04-73 0.001: phase: 1
18.04-73 0.001: jvmtiVersion: 30010203
18.04-73 0.001: vendor: IBM Corporation
18.04-73 0.001: version: 2.9
18.04-73 0.001: info: 20180523_387150
18.04-73 0.001: isJava6: 0
18.04-73 0.002: session_id: 44478905545 (1529232585,10)
18.04-73 0.003: line_method: 1
18.04-73 0.003: can_generate_exception_events: disabled by default on IBM - specify startup option "exceptions=on" or "exceptions=off" to override
18.04-73 0.003: can_access_local_variables: disabled by default on IBM - specify startup option "_with_local_vars" to override
18.04-73 0.011: Jar file created: /tmp/yjp201806140917.jar
18.04-73 0.011: JVMTI 30010203; 2.9; IBM Corporation; 20180523_387150; [IBM]
18.04-73 0.039: Successfully registered probes: 28
Registered: .AgentLoadingSupport
Registered: .AsyncChannels
Registered: .AwtEvents
Registered: .Cassandra
Registered: .CassandraLW
Registered: .CpuTracingSupport
Registered: .Databases
Registered: .DatabasesLW
Registered: .Files
Registered: .FilesLW
Registered: .HBase
Registered: .HBaseLW
Registered: .JNDI
Registered: .JPA_DataNucleus
Registered: .JPA_EclipseLink
Registered: .JPA_Hibernate
Registered: .JPA_OpenJPA
Registered: .JUnitTests
Registered: .MongoDB
Registered: .MongoDBLW
Registered: .Processes
Registered: .Servlets
Registered: .ServletsLW
Registered: .Sockets
Registered: .SocketsLW
Registered: .Sync
Registered: .TestNG
Registered: .Threads
18.04-73 0.389: agentStart: 1
18.04-73 0.389: agentStart: 2
18.04-73 0.391: agentStart: OK
18.04-73 0.391: vmInit: 1
18.04-73 0.395: vmInit: 2
18.04-73 0.395: agentInit: 1
18.04-73 0.396: agentInit: Core loaded
18.04-73 0.407: setTriggers:

18.04-73 0.413: setTriggers: to unregister: 0
18.04-73 0.413: setTriggers: method listeners to register: 0
18.04-73 0.413: setTriggers: OK
18.04-73 0.413: ourUnsafe: true
18.04-73 0.413: shmem 42341490: OK
18.04-73 0.414: shmem 4234148E: OK
18.04-73 0.449: socket timeout: 30000
18.04-73 0.452: YourKit Java Profiler agent is listening on port 10001, "listen=all"
18.04-73 0.452: *** HINT ***: To get profiling results, connect to the application from the profiler UI
18.04-73 0.452: agentInit: Core.init() called
18.04-73 0.453: agentInit: OK
18.04-73 0.453: vmInit: 3
18.04-73 0.453: onStartProfiling: entering...
18.04-73 0.453: onStartProfiling: done
18.04-73 0.453: vmInit: OK
18.04-73 0.646: [m: 2201 49] total classes: processed=1000 instrumented=902 260ms
18.04-73 1.074: GcPauseCounter: installed to scavenge
18.04-73 1.075: GcPauseCounter: installed to global
18.04-73 1.678: vmDeath: 1
18.04-73 1.678: vmDeath: 2
18.04-73 1.679: vmDeath: 3
18.04-73 1.679: vmDeath: 4
18.04-73 1.679: vmDeath: OK
2018-06-17 10:49:47.607:INFO::main: Logging initialized @323ms to org.eclipse.jetty.util.log.StdErrLog
2018-06-17 10:49:48.063:INFO:oejs.Server:main: jetty-9.4.9.v20180320; built: 2018-03-20T12:21:10Z; git: 1f8159b1e4a42d3f79997021ea1609f2fbac6de5; jvm 8.0.5.16 - pxa6480sr5fp16-20180524_01(SR5 FP16) Small Footprint
2018-06-17 10:49:48.083:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///var/lib/jetty/webapps/] at interval 1
2018-06-17 10:49:48.118:INFO:oejs.AbstractConnector:main: Started ServerConnector@b691f1d3{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2018-06-17 10:49:48.119:INFO:oejs.Server:main: Started @841ms



Thanks
dvoloshin
 
Posts: 1
Joined: Sun Jun 17, 2018 8:50 am

Re: Yourkit agent on container connection issue

Postby Anton Katilin » Mon Jun 18, 2018 7:26 am

The process you profile (/usr/local/jetty/start.jar) finishes in 2 seconds. It seems that instead you should profile the process which it launches from itself.

Please try using the JAVA_TOOL_OPTIONS environment variable:
export JAVA_TOOL_OPTIONS=-agentpath:/usr/local/YourKit-JavaProfiler-2018.04/bin/linux-x86-64/libyjpagent.so=listen=all

Please note the agent port is not explicitly set. It will be chosen automatically from the range 10001-10010:
https://www.yourkit.com/docs/java/help/ ... s.jsp#port

For simplicity, you may expose all ports from the range. When later you understand which port the process of interest uses, expose only it, if you wish.
Anton Katilin
 
Posts: 5741
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Google [Bot] and 15 guests

cron