MCPcopy Index your code
hub / github.com/LinShunKang/MyPerf4J

github.com/LinShunKang/MyPerf4J @3.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 3.6.0 ↗ · + Follow
1,417 symbols 4,215 edges 259 files 285 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

简体中文 | English

MyPerf4J

A high performance, non-intrusive Java performance monitoring and statistical tool designed for high-concurrency, low-latency applications.

GitHub (pre-)release Build Status Coverage Status GitHub issues GitHub closed issues GitHub

Features

  • High performance: Very low performance consumption, only 63 nano seconds per record, can be used in production environment for a long time.
  • No intrusion: Using JavaAgent mode, no intrusion to the application, no need to modify the application code.
  • Low memory: With memory multiplexing, only a small number of temporary objects are generated throughout the life cycle, and the GC of the application is not affected.
  • Real-time: Supports second level monitoring, minimum 1 second

Usage scenarios

  • Quickly locate performance bottlenecks for Java applications in a development environment
  • Long-term monitoring of performance metrics for Java applications in a production environment

Multilingual document

What does it monitor?

MyPerf4J collects dozens of metrics per application. All these metrics are collected and visualized in real-time.

This is a list of what it currently monitors: * Method Metrics

RPS, Count, Avg, Min, Max, StdDev, TP50, TP90, TP95, TP99, TP999, TP9999, TP100 Markdown

ThreadMemoryByteBuffGCClassCompilationFileDescriptor Markdown

Want to know how to achieve the above effect? Please start the application according to the description of Quick Start, and then follow the instructions in here to install and configure.

Quick start

MyPerf4J adopts JavaAgent configuration mode, transparent access application, and the application code is completely no-intrusive.

Download

  • Download and unzip MyPerf4J-ASM.zip
  • Read the README file
  • Modify app_name, metrics.log.xxx and filter.packages.include in MyPerf4J.properties

Configure

Add the following two parameters to the JVM startup parameters * -javaagent:/path/to/MyPerf4J-ASM.jar * -DMyPerf4JPropFile=/path/to/MyPerf4J.properties

Like: java -javaagent:/path/to/MyPerf4J-ASM.jar -DMyPerf4JPropFile=/path/to/MyPerf4J.properties -jar yourApp.jar

Note: If you are using JDK 9 and above, please add --add-opens java.base/java.lang=ALL-UNNAMED as an additional flag.

Run

Start your application, the output is to /path/to/log/method_metrics.log:

MyPerf4J Method Metrics [2020-01-01 12:49:57, 2020-01-01 12:49:58]
Method[6]                            Type        Level  TimePercent      RPS  Avg(ms)  Min(ms)  Max(ms)    StdDev    Count     TP50     TP90     TP95     TP99    TP999   TP9999
DemoServiceImpl.getId2(long)      General      Service      322.50%     6524     0.49        0        1     0.50      6524        0        1        1        1        1        1
DemoServiceImpl.getId3(long)      General      Service      296.10%     4350     0.68        0        1     0.47      4350        1        1        1        1        1        1
DemoServiceImpl.getId4(long)      General      Service      164.60%     2176     0.76        0        1     0.43      2176        1        1        1        1        1        1
DemoServiceImpl.getId1(long)      General      Service        0.00%     8704     0.00        0        0     0.00      8704        0        0        0        0        0        0
DemoDAO.getId1(long)         DynamicProxy          DAO        0.00%     2176     0.00        0        0     0.00      2176        0        0        0        0        0        0
DemoDAO.getId2()             DynamicProxy          DAO        0.00%     2176     0.00        0        0     0.00      2176        0        0        0        0        0        0

Uninstall

Remove the following two parameters from the JVM startup parameters and restart to uninstall the tool. * -javaagent:/path/to/MyPerf4J-ASM.jar * -DMyPerf4JPropFile=/path/to/MyPerf4J.properties

Build

You can build MyPerf4J-ASM.jar by yourself. * git clone git@github.com:LinShunKang/MyPerf4J.git * mvn clean package

MyPerf4J-ASM-${MyPerf4J-version}.jar at MyPerf4J-ASM/target/

Issues

If you encounter any issues or if you have a question, don't hesitate to create an issue or send email : )

Known Users

Welcome to register the company name in this issue: https://github.com/LinShunKang/MyPerf4J/issues/30 (In order of registration)

       

Thanks

Thanks JetBrains support provided by OpenSourceSupport : )

Inspired by

More Information

For more information about the project, please read https://github.com/LinShunKang/MyPerf4J/wiki/English-Doc.

Extension points exported contracts — how you extend this code

MetricsExporter (Interface)
Created by LinShunkang on 2018/8/19 整体处理流程如下: beforeProcess() -> process() -> process() -> -> process() -> afterPr [26 …
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/exporter/MetricsExporter.java
Scheduler (Interface)
Created by LinShunkang on 2018/8/22 [5 implementers]
MyPerf4J-Base/src/main/java/cn/myperf4j/base/Scheduler.java
ILogger (Interface)
(no doc) [6 implementers]
MyPerf4J-Base/src/main/java/cn/myperf4j/base/log/ILogger.java
Dispatcher (Interface)
Created by LinShunkang on 2020/07/12 [3 implementers]
MyPerf4J-Base/src/main/java/cn/myperf4j/base/http/server/Dispatcher.java
JvmBufferPoolMetricsExporter (Interface)
Created by LinShunkang on 2018/8/21 [3 implementers]
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/exporter/JvmBufferPoolMetricsExporter.java

Core symbols most depended-on inside this repo

get
called by 171
MyPerf4J-Base/src/main/java/cn/myperf4j/base/util/concurrent/IntHashCounter.java
error
called by 112
MyPerf4J-Base/src/main/java/cn/myperf4j/base/util/Logger.java
size
called by 70
MyPerf4J-Base/src/main/java/cn/myperf4j/base/util/concurrent/IntHashCounter.java
add
called by 66
MyPerf4J-Base/src/main/java/cn/myperf4j/base/http/HttpHeaders.java
format
called by 55
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/formatter/MetricsFormatter.java
write
called by 45
MyPerf4J-Base/src/main/java/cn/myperf4j/base/buffer/LongBuf.java
length
called by 41
MyPerf4J-Base/src/main/java/cn/myperf4j/base/util/concurrent/AtomicIntArray.java
of
called by 40
MyPerf4J-Base/src/main/java/cn/myperf4j/base/config/ConfigKey.java

Shape

Method 1,132
Class 244
Interface 39
Enum 2

Languages

Java100%

Modules by API surface

MyPerf4J-Base/src/main/java/cn/myperf4j/base/util/concurrent/AtomicIntHashCounter.java38 symbols
MyPerf4J-Core/src/main/java/cn/myperf4j/core/AbstractBootstrap.java30 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/MethodMetrics.java30 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/http/HttpRequest.java27 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/http/server/SimpleHttpServer.java22 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/influxdb/InfluxDbV2Client.java21 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/config/MetricsConfig.java20 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/JvmMemoryMetrics.java19 symbols
MyPerf4J-Core/src/main/java/cn/myperf4j/core/recorder/AbstractRecorderMaintainer.java18 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/metric/JvmGcMetrics.java18 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/influxdb/InfluxDbV1Client.java17 symbols
MyPerf4J-Base/src/main/java/cn/myperf4j/base/file/AutoRollingFileWriter.java17 symbols

For agents

$ claude mcp add MyPerf4J \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact