와탭랩스 블로그 오픈 이벤트 😃
자세히 보기
Tech
2024-03-29
Realtime Java method performance

without modifying

I. Contents

Describe and sample a method that is useful when you want to monitor the results of external payment integration, critical method processing, etc. in real time without modifying the original source while servicing a Java Application.

II. Requirements

1. What to use
  • WhaTap Java or Kubernetes Monitoring
  • WhaTap Java Application Agent
  • WhaTap Flex Board
  • Your Application or Sample Application
2. What to develop
  • WhaTap Weaving

III. Viewing Sampled Results

1. Programs used
  • Server.jar : sample source for socket load testing from an acquaintance who specializes in performance testing
  • Jmeter : Open source load testing tool trained by the above acquaintance
  • weaving.test.server-0.1.jar : WhaTap Weaving
  • WhaTap Java Monitoring + Flex Board
2. Performance metric descriptions and real-time charting

1) Measurement Methods

  • addClient : When a new user joins, create a Thread on the server and attach a connection via addClient
  • removeClient : When a user disconnects, the thread disconnects through removeClient.
  • message : Server and Client exchange Conn/Disconn/SendMsg/Ack/Nack, etc. and this method is called to output the corresponding message in the GUI window.

2) Measurement performance items

  • Execution count: The number of executions of the method (within a 5-second period)
  • Total Execution Time: Total execution time of the method (in 5-second increments, ms)
  • Maximum execution time (once): Maximum execution time of the method (within 5 seconds)
  • Exception Catch Count: The number of times a throwable is caught to catch an error (within a 5-second period).

3) Execution screen

Server.jar + WhaTap Java Agent(Weaving) + Jmeter + WhaTap Flex Board

3. Write WhaTap Weaving

1) Original source (identified by Server.jar -> TestServer, Decompiler)

2) Write a performance data resource structure

3) Write a class to weave in the monitored class/methods

4) Write a dummy class to compile the Weaving class

5) Write a WhaTap Weaving Agent class for conveying performance data

6) Build

a. AntBuild (you can build anything you want, but you need to check the box in MANIFEST.MF)

blog main image
blog main image

b. MANIFEST.MF (must contain the following)

blog main image
4. Apply and start the WhaTap Agent
blog main image
  • Start WhaTap Java Agent by hanging it on javaagent
  • Create instrument directory in WhaTap Java Agent Home directory and upload the built Weaving jar file
  • Start Java Application

# Refer to 'Project -> Management -> Install Agent' to install WhaTap Monitoring Agent

와탭 모니터링을 무료로 체험해보세요!