doc.overops.com

JVM in a Docker Container

If you're attaching the OverOps Micro-Agent to an environment that's running Java 10 or 11 or any IBM Java version, please follow these guidelines:

When attaching an OverOps Agent to a JVM that is running Java 10 or 11 or any IBM java versions, follow these guidelines:

  1. Turn off Class Sharing: This can be done using the following flags:
    for IBM Java
    ‑Xshareclasses:none
    for HotSpot
    -Xshare:off -XX:-UseTypeSpeculation

  2. Increase ReservedCodeCache to at least 512mb by adding the following flag
    -XX:ReservedCodeCacheSize=512m

  3. The Agent should appear last in the VM arguments list before specifying the main class or jar.

  4. When adding/removing 3rd party packages, the Agent should be restarted.

Additionally, if you wish to upgrade your own compiler to target Java 10/11, then you'll have to upgrade your Collector (SaaS) or Collector + backend (On-Premises) to support it.

AIX - Statistic Overhead and Performance

When running on an AIX system please add the following parameter to reduce the Statistics Overhead and increase performance
-Dtakipi.neo.heapless.inst.pre.vm=path/to/java-executable
Details can be found in the Micro-Agent Properties

For example path: ../jre/bin/java binary

Attaching the OverOps Micro-Agent to Docker Containers

The OverOps Micro-Agent library can be made available to a container through a mount or by copying it directly into an image.

Set environment variables to configure the Micro-Agent to connect to the Collector and to attach the Micro-Agent to all running JVMs inside the container.

TAKIPI_COLLECTOR_HOST=collector
TAKIPI_COLLECTOR_PORT=6060
JAVA_TOOL_OPTIONS=-agentpath:/takipi/lib/libTakipiAgent.so

Agent Ranking

Make sure that the OverOps Micro-Agent is the last -agentlib or -agentpath argument in your argument list if you are using any other agents with your application in addition to OverOps.

Note

If you're running more than one JVM inside a container and you do not want OverOps to monitor all of them, you'll need to modify the command used to start your JVM.

Instead of setting the JAVA_TOOL_OPTIONS environment variable, start your JVM with
-agentpath:/takipi/lib/libTakipiAgent.so before the -jar and -cp arguments.

TIP

For best results, name your applications and deployments at the JVM level.
see Naming the Application, Server, Deployment for details.

Note

Verify that the -Dtakipi.* JVM arguments are located before the -jar and -cp arguments.

The OverOps Micro-Agent is a native agent and is OS-specific. If using an:

  • Alpine Linux based image, use the Alpine Agent
  • Red Hat and Debian based images, use the Standard Agent.

Mount

Mounting the Micro-Agent into a container at runtime is the preferred approach.

To mount the Micro-Agent into your image, first download and unzip the latest Micro-Agent to create a takipi folder.

Important

The Alpine Linux image is currently in Beta and not supported.Refer to Software and Hardware Requirements for supported OS versions.

Now run your image with the required environment variables set and the mount attached.

docker run \
-e TAKIPI_RESOURCES_DIR=/tmp \
-e TAKIPI_COLLECTOR_HOST=localhost \
-e TAKIPI_COLLECTOR_PORT=6060 \
-e JAVA_TOOL_OPTIONS=-agentpath:/takipi/lib/libTakipiAgent.so \
--mount type=bind,source="$(pwd)"/takipi,target=/takipi \
example/your-image-here:latest

Note

If you're sharing the same Micro-Agent through a mount across multiple containers, set the environment variable
TAKIPI_RESOURCES_DIR=/tmp to avoid conflicts and to ensure each Agent writes to its own folder.

Tip

If you're running the Collector on the same host machine as the JVM with the Micro-Agent, use TAKIPI_COLLECTOR_HOST=docker.host.internal

Copy

To copy the Micro-Agent into your image, add the following lines to your Dockerfile:

# set default environmental variables
ENV TAKIPI_COLLECTOR_HOST=collector
ENV TAKIPI_COLLECTOR_PORT=6060
ENV JAVA_TOOL_OPTIONS=-agentpath:/takipi/lib/libTakipiAgent.so

# download and install the agent - extracts into the `takipi` folder.
# NOTE: use the correct Agent for your OS
RUN curl -sL https://s3.amazonaws.com/app-takipi-com/deploy/linux/takipi-agent-latest.tar.gz | tar -xvzf -

Verify

Confirm connectivity by going to https://app.overops.com.

Next Steps

Naming your Application, Server, Deployment

  • Option 1: Using JVM arguments passed at application start-up
  • Option 2: Using JAR or WAR manifest attributes

Updated 5 months ago

JVM in a Docker Container


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.