I tried to make a program that searches for the target class from the process that is overloaded with Java

Introduction

I tried this article to find out the load on my application The program under load was found.

https://qiita.com/tnakagawa/items/4d7d891af4913e2b5865

However, since it is difficult to type commands every time, I made it possible for the program to automatically issue commands. It is published on github, so I hope it helps someone. I made it quickly, so please understand that it is full of feelings for the time being ...

https://github.com/ewai/check-java-process

Operation confirmed environment

CentOS 6.7 java8

Execution method

Run

Execute the following in the target system. A log directory is created in the directory directly under the execution, and the log is output there. I think it is necessary to execute with the same authority as the application.


java -jar check-java-process.jar 50 30 packageName

https://github.com/ewai/check-java-process/tree/master/build/libs You can use the jar that is placed here You can import it into eclipse as a gradle project and fine-tune it.

parameter

# Set value default Trailing
1 CPU(%) 50 Search for processes that exceed this set value
2 processing time(Seconds) 10 Search for processes that exceed this set value
3 keyword None Only processes that have this keyword in stacktrace will be logged.

What you are doing in the program

  1. Find the java process
  2. Get a thread dump of 1
  3. Find the child process of 1
  4. Match 2 and 3 and issue a stack trace for each child process.
  5. Only processes that exceed the parameter threshold.
  6. Only processes that include parameter keywords.
  7. Output to the log.

that's all.

Recommended Posts

I tried to make a program that searches for the target class from the process that is overloaded with Java
How to deal with the type that I thought about writing a Java program for 2 years
[Java] I tried to make a rock-paper-scissors game that beginners can run on the console.
[Java] I tried to make a maze by the digging method ♪
I tried to make a web application that searches tweets with vue-word cloud and examines the tendency of what is written in the associated profile
I tried to make a Web API that connects to DB with Quarkus
[Introduction to Java] I tried to summarize the knowledge that I think is essential
I tried to make Basic authentication with Java
A program that searches for a character string, and when the search character string is found, displays the character string from the beginning of the line to just before the search character string.
I tried to break a block with java (1)
A story that I wanted to write a process equivalent to a while statement with the Stream API of Java8
[JDBC] I tried to make SQLite3 database access from Java into a method for each SQL statement.
I tried to automatically generate a class to convert from a data class to a Bundle with APT
[Small story] I tried to make the java ArrayList a little more convenient
I tried to make a login function in Java
I tried to make FizzBuzz that is uselessly flexible
[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner]
I tried to make a product price comparison tool of Amazon around the world with Java, Amazon Product Advertising API, Currency API (2017/01/29)
I tried to create a java8 development environment with Chocolatey
I tried to modernize a Java EE application with OpenShift.
[JDBC] I tried to access the SQLite3 database from Java.
I tried to make a client of RESAS-API in Java
I tried upgrading from CentOS 6.5 to CentOS 7 with the upgrade tool
I want to return a type different from the input element with Java8 StreamAPI reduce ()
I made a program in Java that solves the traveling salesman problem with a genetic algorithm
I tried to interact with Java
A story that I struggled to challenge a competition professional with Java
I tried to make an Android application with MVC now (Java)
I tried to generate a C language program source from cURL
How to identify the path that is easy to make a mistake
I tried to make a group function (bulletin board) with Rails
I tried to express the result of before and after of Date class with a number line
Since the Rspec command is troublesome, I tried to make it possible to execute Rspec with one Rake command
I tried to make a parent class of a value object in Ruby
I tried learning Java with a series that beginners can understand clearly
[WSL] Solution for the phenomenon that 404 is displayed when trying to insert Java with apt (personal memo)
[iOS] I tried to make a processing application like Instagram with Swift
[First Java] Make something that works with Intellij for the time being
A program that calculates factorials from 2 to 100
When calling sshpass from Java with shell etc., it seems that it is necessary to have a path.
I tried to make a talk application in Java using AI "A3RT"
From Java9, the constructor of the class corresponding to primitive types is deprecated.
I made a class that can use JUMAN and KNP from Java
I tried to make a sample program using the problem of database specialist in Domain Driven Design
A story about running a program that copies files in Java from a bat file to make the work done every day a little more efficient
A story that suffered from a space that does not disappear even if trimmed with Java The cause is BOM
I tried to create a method to apply multiple filters at once with Java Stream API. Is this okay?
[Java] I installed JDBC and tried to connect with servlet + MySQL. (There is a version using DAO / Bean)
A note that I gave up trying to make a custom annotation for Lombok
I tried to make a machine learning application with Dash (+ Docker) part3 ~ Practice ~
Initialize Ruby array with 0 like Java, that is, set the default value to 0
I tried to make a simple game with Javafx ① "Let's find happiness game" (unfinished)
[Java] I tried to connect using a connection pool with Servlet (tomcat) & MySQL & Java
Until you run a Java program with the AWS SDK local to Windows
I tried to get the distance from the address string to the nearest station with ruby
[Android] I tried to make a material list screen with ListView + Bottom Sheet
[Azure] I tried to create a Java application for free-Web App creation- [Beginner]
I searched for a lightweight framework that answers the sudden "make it quickly"
[Rails] I tried to raise the Rails version from 5.0 to 5.2
java I tried to break a simple block
I did Java to make (a == 1 && a == 2 && a == 3) always true