Giter VIP home page Giter VIP logo

myperf4j's Introduction

简体中文 | English

MyPerf4J

一个针对高并发、低延迟应用设计的高性能 Java 性能监控和统计工具。

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

特性

  • 高性能: 单线程支持每秒 1000 万次 响应时间的记录,每次记录只花费 73 纳秒
  • 无侵入: 采用 JavaAgent 方式,对应用程序完全无侵入,无需修改应用代码
  • 低内存: 采用内存复用的方式,整个生命周期只产生极少的临时对象,不影响应用程序的 GC
  • 高精度: 采用纳秒来计算响应时间
  • 高实时: 支持秒级监控,最低 1 秒

使用场景

  • 开发环境中快速定位 Java 应用程序的性能瓶颈
  • 生产环境中长期监控 Java 应用程序的性能指标

文档

监控指标

MyPerf4J 为每个应用收集数十个监控指标,所有的监控指标都是实时采集和展现的。

下面是 MyPerf4J 目前支持的监控指标列表:

快速启动

MyPerf4J 采用 JavaAgent 配置方式,透明化接入应用,对应用代码完全没有侵入

打包

  • git clone [email protected]:LinShunKang/MyPerf4J.git
  • mvn clean package
  • 把 MyPerf4J-ASM-${MyPerf4J-version}.jar 重命名为 MyPerf4J-ASM.jar

如果你使用的是 JDK 7 或者更高版本可以尝试直接下载 MyPerf4J-ASM.jar

配置

在 JVM 启动参数里加上以下两个参数

-javaagent:/your/path/to/MyPerf4J-ASM.jar

-DMyPerf4JPropFile=/your/path/to/myPerf4J.properties

其中,MyPerf4JPropFile的配置如下:

#应用名称
AppName=MyPerf4JTest

#MetricsProcessor类型,0:以标准格式化结构输出到stdout.log 1:以标准格式化结构输出到磁盘  2:以InfluxDB LineProtocol格式输出到磁盘
MetricsProcessorType=1

#配置各个Metrics日志的文件路径,可不配置
MethodMetricsFile=/data/logs/MyPerf4J/method_metrics.log
ClassMetricsFile=/data/logs/MyPerf4J/class_metrics.log
GCMetricsFile=/data/logs/MyPerf4J/gc_metrics.log
MemMetricsFile=/data/logs/MyPerf4J/memory_metrics.log
BufPoolMetricsFile=/data/logs/MyPerf4J/buf_pool_metrics
ThreadMetricsFile=/data/logs/MyPerf4J/thread_metrics.log

#配置Record模式,可配置为accurate/rough
RecorderMode=accurate
   
#配置时间片,单位为ms,最小1s,最大600s
MilliTimeSlice=10000
   
#需要监控的package,可配置多个,用英文';'分隔
IncludePackages=cn.perf4j.demo;cn.perf4j.demo1.[p1,p2,p3];cn.*.demo.*

#是否展示方法参数类型
ShowMethodParams=true

想了解更多的配置?请看这里

运行

  • 输出结果,输出到 /data/logs/MyPerf4J/method_metrics.log:

    MyPerf4J Method Metrics [2019-02-11 20:29:22, 2019-02-11 20:29:23]
    Method[5]                           RPS  Avg(ms)  Min(ms)  Max(ms)   StdDev     Count     TP50     TP90     TP95     TP99    TP999   TP9999  TP99999    TP100
    DemoServiceImpl.getId1(long)     203674     0.00        0        0     0.00    203674        0        0        0        0        0        0        0        0
    DemoServiceImpl.getId2(long)     318386     0.00        0        2     0.00    318386        0        1        2        2        2        2        2        2
    DemoServiceImplV2.getId1(long)  1931153     0.00        0        0     0.00   1931153        0        0        0        0        0        0        0        0
    DemoServiceImplV2.getId3(long)  3862304     0.00        0        0     0.00   3862304        0        0        0        0        0        0        0        0
    Dao.doQuery()                   2134826     0.00        0        0     0.00   2134826        0        0        0        0        0        0        0        0
    

卸载

在 JVM 启动参数中去掉以下两个参数,重启即可卸载此工具。

-javaagent:/your/path/to/MyPerf4J-ASM.jar

-DMyPerf4JPropFile=/your/path/to/myPerf4J.properties

问题

如果您有任何问题、疑问或者建议,请您毫不犹豫的 提交Issue 或者 发送邮件 : )

参考项目

MyPerf4J 是受以下项目启发而来:

更多信息

想更深入的了解 MyPerf4J ?请看https://github.com/LinShunKang/MyPerf4J/wiki/Chinese-Doc

myperf4j's People

Contributors

linshunkang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.