Code Monkey home page Code Monkey logo

Comments (11)

LinShunKang avatar LinShunKang commented on May 13, 2024

嗯,已经更改为5s了,原意是为了让AsyncPerfStatsProcessor中的任务能完全执行完毕,根据目前的使用情况来看是有点长了。
感谢指出:)

from myperf4j.

zhangyq1011 avatar zhangyq1011 commented on May 13, 2024

如果能够配上架构图或者详细点的使用说明图就更好了。我按照使用手册跑起来了,没有看到你输出的内容。

from myperf4j.

LinShunKang avatar LinShunKang commented on May 13, 2024

指定IncludePackages了么,默认的输出到stdout里了,并且默认只输出count > 0的方法;
文档方面我会继续完善的。

from myperf4j.

zhangyq1011 avatar zhangyq1011 commented on May 13, 2024

打印日志如下:
2018-06-29 08:35:00.721 [MyPerf4J] INFO BackgroundProcessor finished!!! cost: 0ms
2018-06-29 08:35:30.144 [MyPerf4J] INFO RoundRobinProcessor finished!!! cost: 0ms
2018-06-29 08:35:30.146 [MyPerf4J] INFO BackgroundProcessor finished!!! cost: 0ms
2018-06-29 08:35:30.219 [MyPerf4J] INFO RoundRobinProcessor finished!!! cost: 0ms
2018-06-29 08:35:30.721 [MyPerf4J] INFO BackgroundProcessor finished!!! cost: 0ms

IncludePackages也配置的有。没有你给的:
Performance Statistics

from myperf4j.

LinShunKang avatar LinShunKang commented on May 13, 2024

看日志, “RoundRobinProcessor finished”和“BackgroundProcessor finished”个打印了两次,理论上应该是各一次,应该是哪里配置错了;
1、你的项目依赖了MyPerf4J-ASM.jar ?
2、启动过程中是否报错了?
3、你的配置文件是如何配置的?

from myperf4j.

zhangyq1011 avatar zhangyq1011 commented on May 13, 2024

项目没有依赖。
1、我配置的使用 java-agent 引用的。
2、启动正常没有异常
3、配置文件配置和你提供的demo一样我只是修改了IncludePackages 我们公司的包名而已

from myperf4j.

LinShunKang avatar LinShunKang commented on May 13, 2024

我刚刚修复了一个bug,是由于代码中尝试对抽象方法和native方法进行注入后导致BackgroundProcessor提前结束循环,进而所输出的'MyPerf4J Performance Statistics'的方法偏少甚至不输出;
你pull一下develop分支的代码然后打包试一下:)

from myperf4j.

zhangyq1011 avatar zhangyq1011 commented on May 13, 2024

已经尝试在使用中、如有问题反馈!

from myperf4j.

LinShunKang avatar LinShunKang commented on May 13, 2024

好的,感谢反馈!

from myperf4j.

zhangyq1011 avatar zhangyq1011 commented on May 13, 2024

AsyncPerfStatsProcessor类
ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 2, 5, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(500), ThreadUtils.newThreadFactory("MyPerf4J-AsyncPerfStatsProcessor_"), new ThreadPoolExecutor.DiscardPolicy());
定义如上 最大线程池数目为2、keepAliveTime为5分钟。添加shutdown hook
使用如下代码:
ThreadPoolExecutor executor = processor.getExecutor(); executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS);
又启动了一个 线程 线程等待5s 关闭。感觉与ThreadPoolExecutor 设置的keepAliveTime为5分钟有些冲突。

第二个小疑问为何 shutdown hook 没有对 RoundRobinProcessor、BackgroundProcessor 两个线程进行关闭处理呢?谢谢!

from myperf4j.

LinShunKang avatar LinShunKang commented on May 13, 2024

对于第一个问题,是这样的,AsyncPerfStatsProcessor负责处理提交自backgroundExecutor的性能统计数据,而引入ShutdownHook是为了把在当前TimeSlice里的数据进行处理,尽可能的保证数据不丢失,所以才等待了5s的时间,AsyncPerfStatsProcessor. executor设置的5分钟是指当前线程数超过coreSize部分的线程空闲时间达到5分钟后线程池会自动缩容至coreSize。

对于第二个问题,这个我倒是没注意到,不过RoundRobinProcessor和BackgroundProcessor只是在一个TimeSlice结束时才会触发,并且它们的执行时间都非常短(都是内存操作),理论上应该不用手动进行关闭。

PS:
1、AbstractRecorderMaintainer中涉及时间片轮转和数据转发的逻辑已经重写了,在MyPerf4J的整个生命周期均无锁等待,并且backgroundExecutor的执行效率提高了不少,建议你pull一下develop分支的代码 : )
2、中文的Wiki已经写好了:中文Wiki

from myperf4j.

Related Issues (20)

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.