Setting JVM Parameters for the MgC Agent's Tomcat Server
Windows
The following procedure uses Windows 11 as an example.
- Navigate to the location of the startup script.
Go to the MgC Agent installation directory (C:\Edge by default) and find .\scripts\start.bat.
- Set the JVM parameters.
- In the MgC Agent installation directory (C:\Edge by default), edit .\scripts\start.bat.
- Find the following statement in the file:
start %mgcEdgeHome%\tools\jre\bin\Edge_Tomcat.exe %jvmOptions% -jar %mgcEdgeHome%\tools\SecAs-1.2.29\mgc-edge-server.1.0.0.jar --spring.config.location=%mgcEdgeHome%\config\application.yml
Replace the statement with the following:start %mgcEdgeHome%\tools\jre\bin\Edge_Tomcat.exe -Xms512M -Xmx1024M %jvmOptions% -jar %mgcEdgeHome%\tools\SecAs-1.2.29\mgc-edge-server.1.0.0.jar --spring.config.location=%mgcEdgeHome%\config\application.yml
In the preceding information, -Xms512M -Xmx1024M are the JVM parameters to be configured. -Xms512M indicates that the initial heap memory allocated to the JVM is 512 MB. -Xmx1024M indicates that the maximum heap memory that can be allocated to the JVM is 1,024 MB. You can add other JVM parameters as required.
The statement appears twice in the file and needs to be modified twice, as shown in the following figure.
Figure 1 Modification 1
Figure 2 Modification 2
- Save and exit start.bat. The JVM parameters are configured for the Edge Tomcat server.
- Restart the Edge Tomcat server.
If the MgC Agent is running, stop Tomcat and the pre-installed collectors. After that, restart the MgC Agent.
- Stop the Edge Tomcat server.
Go to the MgC Agent installation directory (C:\Edge by default) and run .\scripts\stop.bat. The Edge Tomcat server and the pre-installed collectors will be stopped.
- Restart the MgC Agent.
Go to the MgC Agent installation directory (C:\Edge by default) and run .\scripts\start.bat. the MgC Agent's Tomcat server and the pre-installed collectors are restarted.
- Stop the Edge Tomcat server.
- Query the JVM parameters of the MgC Agent's Tomcat server.
This step requires that the Java development environment be installed on Windows.
- Press Ctrl, Alt, and Delete and select Task Manager on the displayed page to open it. Click the Details tab, find the Edge_Tomcat.exe program, and note the PID of the program.
- After obtaining the PID, open Command Prompt as the administrator, enter the following command, and press Enter:
jinfo PID
In the preceding command, PID indicates the PID of the MgC Agent program. You can view the effective JVM parameters in the command output.
Figure 3 Command prompt
Linux
The following uses CentOS 8 as an example.
- Navigate to the location of the startup script.
Go to the MgC Agent installation directory (/opt/cloud/Edge by default) and find ./scripts/start.sh.
- Set the JVM parameters.
- In the MgC Agent installation directory (/opt/cloud/Edge by default), edit ./scripts/start.sh.
- Find the following statement in the file:
nohup java $JVM_OPTIONS -jar $EDGE_APP_FILE --spring.config.location=${MgC_EDGE_HOME}/config/application.yml >/dev/null 2>&1 &Replace the statement with the following:nohup java -Xms512M -Xmx1024M $JVM_OPTIONS -jar $EDGE_APP_FILE --spring.config.location=${MgC_EDGE_HOME}/config/application.yml >/dev/null 2>&1 &In the preceding information, -Xms512M -Xmx1024M are the JVM parameters to be configured. -Xms512M indicates that the initial heap memory allocated to the JVM is 512 MB. -Xmx1024M indicates that the maximum heap memory that can be allocated to the JVM is 1,024 MB. You can add other JVM parameters as required.

- Save and exit start.bat. The JVM parameters are configured for the Edge Tomcat server.
- Restart the Edge Tomcat server.
If the MgC Agent is running, stop the Edge Tomcat server and the pre-installed collectors.
- Go to the .\script directory in the MgC Agent installation directory (/opt/cloud/Edge by default).
- Run the following command to stop the MgC Agent:
sh stop.sh
- Run the following command to start the MgC Agent:
sh start.sh
- Query the JVM parameters of the Edge Tomcat server.
Run the ps -ef|grep java command to check the JVM parameters when the MgC Agent is running.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.