Boost Java App Performance with MyPerf4J: A Complete Monitoring Guide
This article introduces MyPerf4J, a high‑performance, low‑latency Java monitoring tool, outlines its key features, provides step‑by‑step installation and configuration instructions—including JavaAgent setup, InfluxDB and Grafana integration—and demonstrates its monitoring results, helping developers efficiently track JVM metrics.
Feature Highlights
High performance: single‑thread, up to 16 million ops/sec, 63 ns per record.
Non‑intrusive: uses JavaAgent, no code changes required.
Real‑time: second‑level statistics with full‑volume collection.
Metrics: JVM metrics (Thread, Memory, GC, Class, etc.) and method metrics (RPS, latency percentiles, etc.).
Installation & Deployment
Download and unzip
MyPerf4J-ASM.zip, then edit
MyPerf4J.propertiesto set
app_name,
metrics.log.xxxand
filter.packages.include.
Add the following JVM arguments:
<code>-javaagent:D:\MyPerf4J-ASM-3.3.0-SNAPSHOT\MyPerf4J-ASM-3.3.0-SNAPSHOT.jar
-DMyPerf4JPropFile=D:\MyPerf4J-ASM-3.3.0-SNAPSHOT\MyPerf4J.properties
</code>Install InfluxDB v2.x, create a bucket named
MyPerf4J, and configure the exporter:
<code>metrics.exporter = http.influxdb
influxdb.version=2.1
influxdb.orgName=org # adjust to your org
influxdb.host=127.0.0.1
influxdb.port=8086 # adjust if needed
influxdb.username=test
influxdb.password=12345678
influxdb.database=MyPerf4J # bucket name
</code>Install Grafana (e.g., version 8.4.0) and import the Method Dashboard and JVM Dashboard.
In Grafana set the data source name to
InfluxDBand use Flux as the query language. Example Flux query to list tag values:
<code># Application
import "influxdata/influxdb/schema"
schema.tagValues(
bucket: "MyPerf4J",
tag: "AppName",
predicate: (r) => true,
start: -7d
)
// Host
schema.tagValues(
bucket: "MyPerf4J",
tag: "host",
predicate: (r) => true,
start: -7d
)
</code>Monitoring Effect
Project Address
<code>https://github.com/LinShunKang/MyPerf4J
</code>Conclusion
MyPerf4J is a high‑concurrency, low‑latency Java performance monitoring and statistics tool. It supports log files and InfluxDB storage, works well with Grafana for real‑time visualization, and is worth trying for anyone interested in server monitoring.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.