[Java] New Relic real-time profiling for java AWS ECS container

We are currently running newRelic java agent in a container running on AWS ECS.

I am trying add the real time profiler. But not sure how to?

This is how we start the application in the container
java -javaagent:$BASE_PATH/newrelic/newrelic.jar -jar $BASE_PATH/application.war

I checked https://docs.newrelic.com/docs/agents/java-agent/features/real-time-profiling-java-using-jfr-metrics

How do i run the profiler jar in AWS ECS?

Hi ixb,

Good question! JFR is new for us as well so we need a bit more time to research. To start, can you reply with a permalink to the application? You can create a permalink by clicking the ‘permalink’ button found in the top right corner of the application page.

Here you go https://one.nr/0j3B8eJR

Hey @ixb. You will need to run the profiler daemon inside the container with the application that you want to profile. So, you’ll just need add the deamon jar to the file system for your docker container (or whatever container you’re using) and provide the startup commands as part of that script in whatever way makes sense for the deployment process. Similar to however your container gets access to the newrelic.jar, you’d just bring in the jfr-daemon-n.n.n.jar and configure environment variables and settings as outlined here:
https://docs.newrelic.com/docs/agents/java-agent/features/real-time-profiling-java-using-jfr-metrics

You could optionally run the daemon in a second container and expose the appropriate ports for remote jmx access on the applications container and java process. However, it is important to note that the daemon should be 1:1 with a java process that it is monitoring. One daemon per java process.

Hope that helps!

2 Likes