On this page:
This topic describes how to configure multiple Node.js Agent on a machine to share a single, multi-tenant Java proxy.
Each Node.js agent on a machine normally launches its own proxy instance, having created the control directory for its proxy based on a unique combination of application, tier, and node name for the agent. The control directory contains the configuration for the agent as well as the domain control socket, which the agent uses to start an AppDynamics node.
If running multiple Node.js agents on a single machine, you can configure them to use a shared Java proxy. A shared proxy (also called multi-tenant proxy) reduces the overhead of additional proxies.
A shared proxy is required configuration if you use an external process manager, such as PM2.
Create directories for the agent and the agent logs and for the proxy control directory. The permissions on this directory must be readable and executable by the application user that the application and writable by the proxy user. For example:
mkdir /tmp/appd /tmp/appd/logs /tmp/appd/proxy_ctrl_dir
You may want to devise a technique for creating these directories automatically whenever you upgrade the Node.js agent.
Disable automatic proxy launching for each agent. In the AppDynamics require.profile() block, set proxyAutolaunchDisabled to true and set the proxyCtrlDir to the directory that you created. For example:
... proxyAutolaunchDisabled: true, proxyCtrlDir: '/tmp/appd/proxy_ctrl_dir', ...
Ensure that each agent that reports to the multi-tenant proxy is configured with a unique node name.
In its default configuration, a single proxy can handle up to ten agents. If you need to run more, you will likely need to adjust the maxHeapSize and maxPermSize settings in the runproxy script.
When adding agents, use debug mode and monitor the proxy.out file, which indicates whether the proxy is running out of heap. The file is visible when running in debug mode.