Updated on 2025-01-06 GMT+08:00

Setting JVM Parameters for the MgC Agent's Tomcat Server

Windows

The following procedure uses Windows 11 as an example.

  1. Navigate to the location of the startup script.

    Go to the MgC Agent installation directory (C:\Edge by default) and find .\tools\SecAs-1.2.29\bin\startup.bat.

  2. Set the JVM parameters.

    1. In the MgC Agent installation directory (C:\Edge by default), edit .\tools\SecAs-1.2.29\bin\catalina.bat.

    2. Add the following information below @echo off in the file:
      set "JAVA_OPTS=-Xms512M -Xmx1024M"

      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.

    3. Save and exit catalina.bat. The JVM parameters are configured for the Edge Tomcat server.

      This configuration will be applied if the MgC Agent is started using the startup script. It will not be applied if the MgC Agent is automatically started upon system or service startup.

  3. 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 MgC Agent's Tomcat server.
    1. If the MgC Agent is automatically started upon system startup or service startup, perform the following steps:
      1. Press Ctrl, Alt, and Delete and select Task Manager on the displayed page to open it. In the Task Manager dialog box, choose the Details tab.
      2. Select tomcat9.exe and click End Task.
    2. If the MgC Agent is started using the startup script, close the command prompt window that appears during the script execution.
      Figure 1 Command prompt
    • Stop the collectors.
    1. Stop the collectors using the task manager.
      1. Press Ctrl, Alt, and Delete and select Task Manager on the displayed page to open it. In the Task Manager dialog box, choose the Details tab.
      2. Select rda-storage-collector.exe, rda-collector-server.exe, rda-collector-platform.exe, rda-collector-kubernetes.exe, and rda-collector-database.exe individually and click End Task.
    2. Run a script to stop a single collector. rda-storage-collector is used as an example.
      1. Go to the MgC Agent installation directory, find the collector's directory (C:\Edge\tools\plugins\collectors\rda-storage-collector\bin\stop.bat by default), and run stop.bat.

      2. Find and stop the other collectors in the .\tools\plugins\collectors directory.

    • Restart the MgC Agent.

    Go to the MgC Agent installation directory (C:\Edge by default) and run .\tools\SecAs-1.2.29\bin\startup.bat. the MgC Agent's Tomcat server and the pre-installed collectors are restarted.

  4. Query the JVM parameters of the MgC Agent's Tomcat server.

    This step requires that the Java development environment be installed on Windows.

    1. Press Ctrl, Alt, and Delete and select Task Manager on the displayed page to open it. In the Task Manager dialog box, choose the Details tab.
    2. The following steps depend on how the MgC Agent is started.
      1. If the MgC Agent is automatically started upon system startup or service startup, find tomcat9.exe in Task Manager and check the corresponding PID.
      2. If the MgC Agent is started using the startup script, search for the java.exe program and check the corresponding PID. If there are multiple java.exe programs, do as follows:
        1. After querying the JVM settings of a Java program, you can determine whether the program is the MgC Agent program based on the value of java_class_path in the command output. If the MgC Agent and tomcat fields are contained, it is the MgC Agent program.
        2. 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 2 Command prompt

Linux

The following uses CentOS 8 as an example.

  1. 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.

  2. Set the JVM parameters.

    1. In the MgC Agent installation directory (/opt/cloud/Edge by default), edit /tools/SecAs-1.2.29/bin/catalina.sh.
    2. Add the following information at the beginning of the file:
      JAVA_OPTS="-Xms512M -Xmx1024M"

      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.

    3. Save and exit catalina.bat. The JVM parameters are configured for the Edge Tomcat server.

  3. Restart the Edge Tomcat server.

    If the MgC Agent is running, stop Tomcat and the pre-installed collectors.

    1. Go to the .\script directory in the MgC Agent installation directory (/opt/cloud/Edge by default).
    2. Run the following command to stop the MgC Agent:
      sh stop.sh
    3. Run the following command to start the MgC Agent:
      sh start.sh

  4. Query the JVM parameters of the MgC Agent's Tomcat server.

    Run the ps -ef|grep java command to check the JVM parameters when the MgC Agent is running.