Managing an E-Commerce Application
This section describes how to connect an e-commerce application to Application Performance Management (APM) for management. Information about the application is as follows:
- The Java application is not deployed using JBoss and can be deployed on the SUSE 12 SP2 VM in JRE 1.8 version or later.
- The application contains five microservices, each of which contains an instance:
- apigw: API gateway, which is responsible for service authentication, request throttling, and filtering.
- product: Product management, including product query and purchase.
- user: User management, including user login and identity authentication during product purchase.
- dao: Data persistence layer, which is responsible for database request operations.
- MySQL database: Database.
The following describes how to connect the e-commerce application to APM for management.
Process
- Deploy the application on a Huawei Elastic Cloud Server (ECS). Note that APM supports Huawei ECSs only.
- Install the ICAgent. The ICAgent is a collection agent for collecting topology and tracing data in real time. You need to install the ICAgent on the ECS where the application is deployed.
- Modify application startup parameters to ensure that APM can monitor the application.
- Manage the application on APM, for example, view the application status on the topology page and view user experience on the transaction page.
Procedure
- Deploy the application on a Huawei ECS.
- Register a cloud account, top up the account, and purchase a Linux ECS. For details, see Logging In to an ECS.
To ensure application performance, select an ECS with at least 2 vCPU cores and 4 GB memory. In addition, because the application supports only the SUSE 12 SP2 Operating System (OS), select the corresponding image.
- Log in to the ECS, create an application directory, and go to the directory, for example, mall.
- Download and install the JRE 1.8 version from Oracle.
- Download the application package to the mall directory and install it.
curl -l http://demos.obs.myhuaweicloud.com/demo_install.sh > demo_install.sh && bash demo_install.sh
- Register a cloud account, top up the account, and purchase a Linux ECS. For details, see Logging In to an ECS.
- Install the ICAgent. For details, see Initial Installation.
- Modify application startup parameters to ensure that the application can be monitored by APM.
Specifically, add the following parameters to the application startup script:
Parameter
Description
Example
-javaagent
JAR package that the collection probe depends on. The value is always /opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar.
/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar
-Dapm_application
Application name, which can be customized.
vmall
-Dapm_tier
Application microservice name.
In this example, microservice names include apigw, product, user, and dao.
Application startup scripts:
Before the modification:
nohup java -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-persistence-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_dao.yml > dao.log & nohup java -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-api-gateway-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_api.yml > api.log & nohup java -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-user-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_userservice.yml > user.log & nohup java -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-product-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_prod.yml > prod.log & nohup java -Xms512m -Xmx2048m -jar /root/testdemo/cloud-simple-ui-1.0.0.jar --spring.config.location=file:/root/testdemo/ui.properties > ui.log &
After the modification (the modified information is shown in bold):
nohup java -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-dao-service -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-persistence-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_dao.yml > dao.log & nohup java -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-apigw-service -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-api-gateway-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_api.yml > api.log & nohup java -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-user-service -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-user-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_userservice.yml > user.log & nohup java -javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=vmall -Dapm_tier=vmall-product-service -Xms512m -Xmx2048m -jar /root/testdemo/ecommerce-product-service-0.0.1-SNAPSHOT.jar --spring.config.location=file:/root/testdemo/application_prod.yml > prod.log & nohup java -Xms512m -Xmx2048m -jar /root/testdemo/cloud-simple-ui-1.0.0.jar --spring.config.location=file:/root/testdemo/ui.properties > ui.log &
- Restart the application. After about three minutes, application data is displayed on the APM console.
You can monitor applications and locate application exceptions on the Dashboard and Topology pages of the APM console. For details, see APM User Guide.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot