Create a JAVA WEB application and try OMC APM

Even if you want to try Application Performance Monitoring of Oracle Management Cloud for a while, it is quite troublesome because you have to prepare the environment where the WEB application actually operates. Here, we will introduce how to use Docker to build a JAVA WEB application and the necessary environment as easily as possible so that anyone can easily try APM.

Web application to create

A dummy WEB sample application that accesses MySQL via JDBC. There is a mechanism that slows down the response. image.png

Build image with Docker

Here, Docker is installed on Always Free of Oracle Cloud, and Apache and MySQL containers are started. Then create a configuration that monitors the sample WEB application with OMC's APM. If it is a Linux VM instance of OCI, it can be executed by Copy & Paste according to the procedure. image.png

Prepare a VM instance of Always Free

--VM instance must have HTTPS access to the internet --Access is outband only (Cloud Agent-> OMC) Inbound does not occur image.png

1. Docker&Install Docker Compose
$ sudo yum install docker-engine
$ sudo gpasswd -a $USER docker
$ docker -v
Docker version 19.03.1-ol, build ead9442
$ sudo curl -L https://github.com/docker/compose/releases/download/1.25.0-rc2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
* Exit the terminal you are currently connected to and reopen the terminal again.
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service

2.Download & unzip the web app source
$ pwd
/home/opc
$ wget https://github.com/westan24/omcapp/archive/master.zip
$ unzip master.zip
$ cd omcapp-master
$ unzip omcapp.zip
$ ls
apmdemo2.war        Dockerfile   my.cnf      person_db_mysql.sql
docker-compose.yml  initial.sql  omcapp.zip  README.md

3.Create folders required for Docker MySQL
$ sudo rm -rf ./db
$ sudo mkdir ./db
$ sudo mkdir ./db/mysql_data
$ sudo mkdir ./db/mysql_init/
$ sudo cp initial.sql db/mysql_init/
$ sudo cp person_db_mysql.sql db/mysql_init/

Download the latest APM agent from OMC

--Click the agent from the OMC console image.png

--Click the agent download icon in the upper right image.png

--Select APM Agent as the agent type and click APM JAVA Agent to download image.png

--Click Manage Registration Keys on the top right icon image.png

--Enter your favorite name and click Create New Key image.png

--Download the generated key value image.png

Create and launch a Docker container

Downloaded 1.4x_APM_226.zip and registrationKey.Two files of txt/home/opc/omcapp-Copy to master
$ ls
1.46_APM_226.zip    Dockerfile   omcapp.zip           registrationKey.txt
apmdemo2.war        initial.sql  person_db_mysql.sql
docker-compose.yml  my.cnf       README.md

* Rename the APM agent name(Since the APM agent name is incremented for each version)
$ mv 1.46_APM_226.zip 1.45_APM_226.zip

$ docker-compose up -d
-Various construction messages are played-
Creating mysql ... done
Creating tomcat ... done

$ docker-compose ps
 Name              Command             State                 Ports
--------------------------------------------------------------------------------
mysql    docker-entrypoint.sh mysqld   Up      0.0.0.0:3306->3306/tcp, 33060/tcp
tomcat   catalina.sh run               Up      0.0.0.0:8080->8080/tcp

* OK if both containers are UP

--Access the following address with a browser --http: // compute Public IP: 8080 / apmdemo2 / menu --If inaccessible, check if 8080 is open in the OCI security list

--Sample web application This web app may also generate errors along the way. Don't worry about the details ... (Because it can be used for log analysis of Log Analytics) image.png

Actually see the performance of the WEB application with APM

--APM home screen image.png

--Detailed diagram inside the server request image.png

--If the database is a JDBC connection, you can see the execution status for each SQL query. image.png

--Execution history for each instance (access taking 10 seconds is displayed) image.png

--End user monitoring must be enabled to view user browser operation history information --For the setting method, refer to OMC APM Agent Installation --.NET Edition- - https://qiita.com/western24/items/855cee9d2c0a93b8cf79

--User's browser operation history when the response is delayed by 10 seconds image.png --You can see that it took 10 seconds to access the route and display the page. image.png

How was that? I think that it can be used as it is for operation verification such as Docker monitoring with Infrastructure Monitoring of OMC and analysis of Tomcat and MySQL logs with Log Analytics. I would like to introduce the Node.js version at another time.

Click here for information related to Oracle Management Cloud (https://qiita.com/western24/items/1e44bfcaa77f3251a263)

Recommended Posts

Create a JAVA WEB application and try OMC APM
Try developing a containerized Java web application with Eclipse + Codewind
[Java] Create and apply a slide master
Try using Java framework Nablarch [Web application]
Create a simple web application with Dropwizard
Volume of trying to create a Java Web application on Windows Server 2016
Create a java web application development environment with docker for mac part2
Try to create a bulletin board in Java
Let's create a super-simple web framework in Java
[Java] Create a filter
I built a Java EE environment on AWS and tried running a web application
Create a portfolio app using Java and Spring Boot
[Introduction] Try to create a Ruby on Rails application
Create a java method [Memo] [java11]
[Java] Create a temporary file
Rails web server and application server
Socket communication with a web browser using Java and JavaScript ②
Socket communication with a web browser using Java and JavaScript ①
Create a Java and JavaScript team development environment (gradle environment construction)
Create a simple DRUD application with Java + SpringBoot + Gradle + thymeleaf (1)
Create a simple web server with the Java standard library com.sun.net.httpserver
Comparison of WEB application development with Rails and Java Servlet + JSP
Let's create a TODO application in Java 4 Implementation of posting function
Preparing to create a Rails application
Create a high-performance enum with fields and methods like Java with JavaScript
Let's create a TODO application in Java 8 Implementation of editing function
Build a web application with Javalin
Access Teradata from a Java application
[Java] How to create a folder
Automatically deploy a Web application developed in Java using Jenkins [Preparation]
[Java] Let's create a mod for Minecraft 1.16.1 [Add and generate trees]
[Java] Let's create a mod for Minecraft 1.14.4 [9. Add and generate trees]
Let's create a TODO application in Java 1 Brief explanation of MVC
Try to create a server-client app
Install Rails in the development environment and create a new application
[Java] Let's create a mod for Minecraft 1.14.4 [8. Add and generate ore]
Build a web application development environment that uses Java, MySQL, and Redis with Docker CE for Windows
Web application structure by Java and processing flow in the presentation layer
Beginners create web applications with Java and MySQL (adding at any time)
[Java] Create a jar file with both compressed and uncompressed with the jar command
Automatically deploy a web application developed in Java using Jenkins [Spring Boot application]
I want to create a dark web SNS with Jakarta EE 8 with Java 11
[Java] Deploy a web application created with Eclipse + Maven + Ontology on Heroku
I want to develop a web application!
Create a web environment quickly using Docker
A look at Jenkins, OpenJDK 8 and Java 11
Let's try WebSocket with Java and javascript!
Java implementation to create and solve mazes
Let's create a Java development environment (updating)
Try running a Kubernetes Job from Java
Create a TODO app in Java 7 Create Header
Try making a calculator app in Java
Deploy a Java web app on Heroku
Role of JSP in Web application [Java]
Install Docker and create Java runtime environment
Build Web Application Server (Java) on VPS
Let's create a TODO application in Java 9 Create TODO display Sort by date and time + Set due date default to today's date
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
Let's make a calculator application with Java ~ Create a display area in the window
Create a Windows desktop application in Ruby and distribute an executable file (.exe)!
[Java] [POI] Create a table in Word and start a new line in one cell