Boost Java Performance with MyPerf4J: High‑Throughput, Low‑Latency Monitoring
MyPerf4J is a high‑throughput, low‑latency Java performance monitoring tool that uses a non‑intrusive JavaAgent to collect real‑time method, memory, GC, and class metrics, offering developers quick bottleneck detection in development and continuous observability in production.
As the company's services grew, the original vertical architecture couldn't meet product development, and parallel development by dozens of engineers reduced efficiency.
The company thus pushed a service-oriented approach, allowing each engineer to focus on their own sub‑project, improving efficiency but introducing new challenges such as monitoring service QPS, latency percentiles, identifying slow methods, load balancing, and diagnosing issues across DB, cache, or downstream services.
Use Cases
Quickly locate performance bottlenecks in Java applications during development.
Continuously monitor performance metrics of Java applications in production.
Features
High Performance: Single‑threaded recording of up to 10 million responses per second, each record costing only 73 ns.
Non‑intrusive: Implemented via JavaAgent, requiring no code changes.
Low Memory: Uses object reuse to generate minimal temporary objects, avoiding GC impact.
High Precision: Measures response time in nanoseconds.
Real‑time: Supports second‑level monitoring, minimum interval 1 s.
Monitoring Metrics
MyPerf4J collects dozens of real‑time metrics for each application.
Method
RPS, Count, Avg, Min, Max, StdDev, TP50, TP90, TP95, TP99, TP999, TP9999, TP99999, TP100
Memory
HeapInit, HeapUsed, HeapCommitted, HeapMax, NonHeapInit, NonHeapUsed, NonHeapCommitted, NonHeapMax
JVM GC
CollectCount, CollectTime
JVM Class
Total, Loaded, Unloaded
Quick Start
MyPerf4J is integrated via JavaAgent, requiring no code modifications.
Download
Download and unzip MyPerf4J-ASM.zip.
Read the README file.
Modify app_name, metrics.log.xxx and filter.packages.include in MyPerf4J.properties as needed.
Configuration
Add the following JVM arguments:
-javaagent:/path/to/MyPerf4J-ASM.jar
-DMyPerf4JPropFile=/path/to/MyPerf4J.propertiesRun
Start the application; monitoring logs are written to /path/to/log/method_metrics.log.
Uninstall
Remove the two JavaAgent arguments from the JVM startup parameters and restart.
-javaagent:/path/to/MyPerf4J-ASM.jar
-DMyPerf4JPropFile=/path/to/MyPerf4J.propertiesOpen‑source repository: https://github.com/LinShunKang/MyPerf4J
Java Backend Technology
Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
