Updated on 2022-06-02 GMT+08:00

Deploying Applications

This section describes how to deploy applications for performance management.

You need to perform operations based on application deployment modes. Currently, APM supports application deployment through:

  • ServiceStage. For details, see ServiceStage Mode.
  • Application Orchestration Service (AOS). For details, see AOS Mode.
  • Cloud Container Engine (CCE). For details, see CCE Mode.
  • Elastic Cloud Server (ECS) or Bare Metal Server (BMS) without using AOS, ServiceStage, or CCE. For details, see VM Mode.

ServiceStage Mode

ServiceStage is a one-stop DevOps platform service oriented for enterprises and developers. If you select probes when using ServiceStage to create or release applications, APM is automatically connected to the applications. After the applications run for about three minutes, log in to the APM console to view the application information on the Topology and Transactions pages.

AOS Mode

For AOS, when you add the designer pinpoint to templates during compilation, APM collection probes are added to stacks. After templates are compiled and stacks are created, APM is automatically connected to stack applications. After the stacks run for about three minutes, log in to the APM console to view the application information on the Topology and Transactions pages.

CCE Mode

CCE provides container application management services. If you select probes when creating or upgrading applications, APM collection probes are installed on the applications. After the applications run for about three minutes, log in to the APM console to view the application information on the Topology and Transactions pages.

VM Mode

Before deploying applications on the ECS or BMS without using AOS, ServiceStage, or CCE, you need to learn the process and prerequisites in advance.

Process

  1. Prepare the environment: Creating a VM and ensure that the applications to be monitored are running properly.
  2. Install the ICAgent: Collect application data in real time.
  1. Enable application performance monitoring: Modify the startup scripts of the applications to ensure that the ICAgent can collect application data.
  1. Implement performance management on APM: After the applications run for about three minutes, APM will automatically discover the application topology and performance data. Then, you can view the topology and tracing data on the APM console.

Prerequisites

An ECS server is available. To use APM, ensure that the following conditions are met:

  1. The operating system (OS) of the ECS server and the application type are supported by APM.
  2. The ECS server where applications are deployed has been bound to an Elastic IP Address (EIP). For a cluster with multiple ECS servers, ensure that at least one ECS server is bound to an EIP.
  3. The Access Key ID/Secret Access Key (AK/SK) have been obtained. The AK/SK are used to install the ICAgent. For details, see Obtaining the AK/SK.
  4. The time and time zone used by the local browser must be consistent with those of the ECS server.

Procedure

  1. Install the ICAgent.

    1. Log in to the APM console, choose Agent > Management in the navigation pane, and click Install ICAgent.
    2. Generate the ICAgent installation command and copy it.
      1. Enter the obtained AK/SK in the text box to generate the ICAgent installation command.

        Ensure that the AK/SK are correct. Otherwise, the ICAgent cannot be installed.

      2. Click Copy Command.

      1. Log in to the ECS server using the EIP as a root user through a remote login tool and run the copied command to install the ICAgent.

        If the message "ICAgent install success" is displayed, the ICAgent is successfully installed in the /opt/oss/servicemgr/ directory.

    3. (Optional) When you have multiple ECS servers and have installed the ICAgent on one of the servers, use the inherited installation method to install the remaining servers. For details, see Inherited Installation.

  2. Enable application performance monitoring.

    The vmall application and vmall-product-service application microservice are used as examples.

    After installing the ICAgent, perform the following operations to enable application performance monitoring. After it is enabled, non-intrusive probes are installed on your Java applications.
    • For Java applications that are not deployed using JBoss, add the following configuration to the startup scripts of the server where Java applications locate: After the configuration, start the applications for performance monitoring.
      -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-product-service
      Table 1 Configuration description

      Parameter

      Description

      Mandatory

      Configuration

      -javaagent

      JAR package that collection probes depend on.

      Yes

      The fixed value is /opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar.

      NOTE:

      To start a Java application as a non-root user, ensure that the user has the read and write permissions on the /opt/oss/servicemgr/ICAgent/pinpoint/ directory.

      -Dapm_application

      Application name.

      Yes

      Set the name based on actual conditions. For example, if the VMall billing system can form an application, the application name is vmall.

      NOTE:

      Naming rules

      • Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. The value must start with a lowercase letter or an underscore.
      • The value must be 1 to 64 characters long.

      -Dapm_tier

      Application microservice name.

      Yes

      Set the name based on actual conditions. For example, in the Vmall billing system, the application microservice names are vmall-product-service and vmall-api-service.

      NOTE:

      Naming rules

      • Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. The value must start with a lowercase letter or an underscore.
      • The value must be 1 to 64 characters long.

      -Xbootclasspath

      JBoss installation package directory.

      Yes

      The format is -Xbootclasspath/p:/JBoss installation package directory, for example, -Xbootclasspath/p:/opt/jboss/jboss-as-7.1.0.Final.

      Example

      Before configuration:

      After configuration:

    • If you start the program as a non-root user, run the following commands to modify the permissions on the probe file and output directory before enabling application monitoring:
      chmod -R 777 /opt/oss/servicemgr/ICAgent/pinpoint/ 
      mkdir -p /paas-apm/collectors/pinpoint 
      chmod -R 777 /paas-apm
    • On the ECS server, if you use Tomcat to start the service, you need to add a probe as follows:
      1. Go to the bin directory of Tomcat.
      2. Copy the following content to the catalina.sh file.
        JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=xxx -Dapm_tier=xxx"

        Set the value of -Dapm_application to the application name and that of -Dapm_tier to the name of the microservice to be started. Each name can contain up to 64 characters and must start with a lowercase letter or an underscore (_). Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

    • If JBoss is used to deploy a Java application, add the following information in bold to the corresponding code segment in the standalone.conf configuration file before starting JBoss in standalone mode. Note that APM supports the standalone mode only. In the added configuration content, variables are italicized. For details, see Table 1. After the configuration, start the applications for performance monitoring.
      Example:
      if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then
      JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,org.jboss.logmanager,com.navercorp.pinpoint.bootstrap,com.navercorp.pinpoint.common,com.navercorp.pinpoint.exception"
      fi
      # Uncomment the following line to prevent manipulation of JVM options
      # by shell scripts.
      #
      #PRESERVE_JAVA_OPTS=true
      #
      # Specify options to pass to the Java VM.
      #
      if [ "x$JAVA_OPTS" = "x" ]; then
      JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
      JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
      JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
      JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-product-service"
      JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/opt/jboss/jboss-as-7.1.0.Final/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar -Xbootclasspath/p:/opt/jboss/jboss-as-7.1.0.Final/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar -Xbootclasspath/p:/opt/jboss/jboss-as-7.1.0.Final/modules/org/apache/log4j/main/log4j-1.2.16.jar"
      JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
      else
      echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
      fi

  3. After the applications run for about three minutes, log in to the APM console to view the application information on the Topology and Transactions pages.