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.

Remote connection to docker

Moderators: Vladimir Kondratyev, Anton Katilin

Remote connection to docker

Postby ukhl » Wed Oct 27, 2021 7:17 am

Hi,

where i can found full manual how to remote connect to docker app?


I tried cretate Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:5.0

RUN apt-get update && apt-get install -y wget && apt-get install -y unzip

RUN wget https://www.yourkit.com/dotnet/download ... 3-b101.zip -P /tmp/ && \
unzip /tmp/YourKit-NetProfiler-2021.3-b101.zip -d /usr/local && \
rm /tmp/YourKit-NetProfiler-2021.3-b101.zip


ENV CORECLR_PROFILER={MY_GUID}
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER_PATH_64=/usr/local/YourKit-NetProfiler-2021.3-b101/bin/linux-x86-64/libynpagent.so
ENV YNP_STARTUP_OPTIONS=listen=all,recursive

# ASP.NET Core doesn't handle SIGTERM properly but instead handles SIGINT for graceful shutdown
STOPSIGNAL SIGINT

WORKDIR /app
COPY binaries/engine /app
ENTRYPOINT ["dotnet", "MyApp.dll"]

also i run this image with -p 10001:10001 option

status give me
Name | PID | User | Profiler Agent | Port
-------------------+----------+------+----------------+------
MyApp.dll | 1 64-bit | root | Not loaded |

and remote connection does not working
ukhl
 
Posts: 2
Joined: Wed Oct 27, 2021 7:13 am

Re: Remote connection to docker

Postby Anton Katilin » Wed Oct 27, 2021 10:43 am

Hello,

Please ensure the GUID is specified.

Instead of

ENV CORECLR_PROFILER={MY_GUID}

please do something like

RUN 'export CORECLR_PROFILER=$(cat /usr/local/YourKit-NetProfiler-2021.3-b101/guid.txt)'
Anton Katilin
 
Posts: 6086
Joined: Wed Aug 11, 2004 8:37 am

Re: Remote connection to docker

Postby Ilia » Wed Oct 27, 2021 10:59 am

Hello,

Your Dockerfile looks almost right - top level profiler directory doesn't contain build number.

By the way, if you want to and open specific port you can use "port=" startup option. And to connect to the profiler agent in Docker container from the machine where it runs, you have to add remote connection to the localhost and set the port, as you won't see it in "Local applications", which relies on shared memory.

Unfortunately there's bug in version 2021.3 which causes deadlock on Linux with Server GC, so it should be disabled while profiling. For example you can set environment variable COMPlus_gcServer to 0.
Other methods are described here: https://docs.microsoft.com/en-us/dotnet ... -collector

The bug will be fixed in the next profiler version, which will also support .NET 6.

This should work:
Code: Select all
# Profiler GUID is unique for each profiler build - this one is for b101
ENV CORECLR_PROFILER="{17154956-38B7-4D11-AEDD-AE33A5E1DA27}"
ENV CORECLR_ENABLE_PROFILING="1"
ENV CORECLR_PROFILER_PATH_64="/usr/local/YourKit-NetProfiler-2021.3/bin/linux-x86-64/libynpagent.so"
ENV YNP_STARTUP_OPTIONS="listen=all,port=10001"
# Workaround for profiler bug
ENV COMPlus_gcServer="0"
Ilia
 
Posts: 3
Joined: Mon Oct 15, 2018 8:12 pm

Re: Remote connection to docker

Postby ukhl » Wed Oct 27, 2021 3:42 pm

Ilia wrote:Hello,

Your Dockerfile looks almost right - top level profiler directory doesn't contain build number.

By the way, if you want to and open specific port you can use "port=" startup option. And to connect to the profiler agent in Docker container from the machine where it runs, you have to add remote connection to the localhost and set the port, as you won't see it in "Local applications", which relies on shared memory.

Unfortunately there's bug in version 2021.3 which causes deadlock on Linux with Server GC, so it should be disabled while profiling. For example you can set environment variable COMPlus_gcServer to 0.
Other methods are described here: https://docs.microsoft.com/en-us/dotnet ... -collector

The bug will be fixed in the next profiler version, which will also support .NET 6.

This should work:
Code: Select all
# Profiler GUID is unique for each profiler build - this one is for b101
ENV CORECLR_PROFILER="{17154956-38B7-4D11-AEDD-AE33A5E1DA27}"
ENV CORECLR_ENABLE_PROFILING="1"
ENV CORECLR_PROFILER_PATH_64="/usr/local/YourKit-NetProfiler-2021.3/bin/linux-x86-64/libynpagent.so"
ENV YNP_STARTUP_OPTIONS="listen=all,port=10001"
# Workaround for profiler bug
ENV COMPlus_gcServer="0"



Thanks, it helps
ukhl
 
Posts: 2
Joined: Wed Oct 27, 2021 7:13 am


Return to .NET Profiler

Who is online

Users browsing this forum: No registered users 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.