How do I instrument multiple JVMs on a single machine
What do I need to know about configuring multiple Java Agent JVMs that reside on a single machine?
This article describes how to configure multiple JVMs for the AppDynamics Java Agent when they reside on a single machine. In the AppDynamics model, the JVMs may serve the same or different tiers.
Table of Contents
- Overview: What's always true about configuring Java Agents, regardless of tier?
- How do I configure the Agents for the different tiers?
- How do I attach a single Java Agent to different Java applications?
- Additional Resources
Overview
Whether the JVMs serve the same or different tiers:
- All the common information should be configured using controller-info.xml.
- All the information unique to a JVM should be configured using the system properties (-D option) in the startup script.
- Information in the startup scripts always overrides the information in the controller-info.xml file.
- Any customizations to app-agent-config.xml and custom-activity-correlation.
xml configuration will apply to all agents. - This scenario can generate a lot of logs and disk IO activity. You can edit the log configuration to control the maximum size of individual logs, as well as the number of logs the agent retains for log rotation at <agent_home>/<version_number>/conf/logging/log4j.xml.
How do I configure the Agents for the same tier?
For this case, you only need to differentiate the node names in the JVM startup script and use controller-info.xml for the other settings, as follows:
- Configure the application and tier name in controller-info.xml.
-
Add the javaagent argument and system property for the node name to the batch file or startup script of each JVM.
java -javaagent:<agent_home>/<version_number>/javaagent.jar -Dappdynamics.agent.nodeName=$nodeName
Separate the system properties with a whitespace character.
Configure the Agents for different tiers
For this case, you differentiate the node and tier names in the JVM startup script and controller-info.xml for the other settings, as follows:
- Configure the application name in controller-info.xml.
-
Add the javaagent argument and the system properties to the startup script to each of your JVM:
java -javaagent:<agent_home>/<version_number>/javaagent.jar -Dappdynamics.agent.tierName=$tierName -Dappdynamics.agent.nodeName=$nodeName
Separate the system properties with a whitespace character.
Some application server management consoles allow you to specify start-up arguments using a web interface.
How do I attach a single Java Agent to different Java applications?
To attach the same single Java Agent with different java applications:
- Make sure to provide different node names for each of the applications, because Javaagent writes node-specific logs and configuration files to the javaagent installation directory under the "Node name" folder.
- Apart from adding the -javaagent argument to JAVA_OPTS/CATALINA_OPTS, you also need to add the following arguments:
- -Dappdynamics.agent.applicationName=<>
- -Dappdynamics.agent.tierName=<>
- -Dappdynamics.agent.nodeName=<>
- Add other remaining common setting details in the controller-info.xml file.
Note: If all the applications are actually instances of the same application, you can skip adding applicationName. Instead, add this common argument (i.e., applicationName or tierName) to controller-info.xml.
Additional Resources
For more information on how to install the Java Agent see Install the Java Agent
- Mark as Read
- Mark as New
- Bookmark Message
- Permalink
- Report Inappropriate Content
Questions:
1) I have 3 java applications so how I can deploy in a single controller system?
2) I am planning 3 tomcat installations in different folders in same system
3) Single Java agent installation in the same system
4) 3 tomcat folders I am planning to modify the startup.bat to use the single controller. I hope this is only the method to have multiple applications on single controller.
- Mark as Read
- Mark as New
- Bookmark Message
- Permalink
- Report Inappropriate Content
@lucky.bakshi :
Yes, you can use same single java agent to attach with 3 different java applications. Make sure that you provide different node names for each of these applications, because Javaagent writes node specific logs and configuration files to the javaagent installation directory under "Node name" folder.
* Apart from adding -javaagent argument to JAVA_OPTS/CATALINA_OPTS, you also need to add the following arguments:
-Dappdynamics.agent.applicationName=<>,
-Dappdynamics.agent.tierName=<> and
-Dappdynamics.agent.nodeName=<>
* Add other remaining common setting details in controller-info.xml file.
Note: Among the aforementioned three arguments, we can skip adding applicationName if all 3 applications are actually instances of the same application. Instead, add this common argument ie. applicationName to controller-info.xml. Same for tierName.
- Mark as Read
- Mark as New
- Bookmark Message
- Permalink
- Report Inappropriate Content
Thank you both, @lucky.bakshi and @Priya.Chhillar. I've updated the article with your question and reply. Your engagement makes the community better.
– Claudia Landivar (Community Manager & Editor)