Java- Netty库执行时间非常大 - Java Nio

发布于 2025-02-06 20:17:27 字数 693 浏览 2 评论 0 原文

我正在开发一个Java应用程序,该应用程序从 redis 数据库中读取数据,我使用生菜库将其连接到 redis ,又使用'netty'库与 redis 进行通信 我怀疑我的申请的执行时间比预期的要大,因此使用 jprofiler 进行了分析实验,令我惊讶的是, FastThreadLocalRunnable 采取了很大一部分的执行。没有理由的时间,因为树显示没有函数调用时间花费时间:

​在测量执行时间的剖面师中?

都值得赞赏


对任何帮助的编辑

:多亏了Ingo的答案,我现在可以展开树,但事实证明,Java Nio正在消耗我的处理器:

“

有什么想法吗?

I am developing a Java application that reads data from a Redis Database, I use Lettuce library to connect to Redis which in turn uses 'Netty' library to communicate with Redis
I suspect that the execution time of my application is greater than expected, so a conducted a profiling experiment using JProfiler, I was surprised that a FastThreadLocalRunnable takes a significant portion of the execution time with no justification as the tree shows no function calls taking time:

Screenshot from JProfiler after some long time of execution

So, is it a bug in Lettuce library?, or is it a problem in the profiler measuring the execution time?

Any help is appreciated


Edit:

Thanks to Ingo's answer I can now expand the tree but it turns out that the java NIO is consuming my processor:

Java NIO is taking the processing power

Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2025-02-13 20:17:27

Jprofiler中的呼叫树仅显示您在分析设置中定义的呼叫树过滤器中包含的类:

默认情况下,这排除了许多常见的框架和库,以便您可以开始没有配置任何东西。如果您删除这些过滤器并在此处添加您自己的个人化软件包,那就更好了。

除了介绍的类外,Jprofiler还显示了线程入口点,即使它不是介绍的类,例如 io.netty.util.concurrent.concurrent.fastThreadLocalRunnable 。同样,在呼叫树中的任何级别上始终显示第一个呼叫,始终显示。

就您而言,在 io.netty.util.concurrent.fastthreadlocalrunnable 下面有非专业类的呼叫链,从不调用个人资料类。它们可能属于某个框架或代码的某些部分,而这些框架中未包含在介绍的类中。这次必须去某个地方,因此它归因于 io.netty.util.concurrent.fastthreadlocalrunnable node。

一种简单的检查方法是在分析设置中禁用过滤,然后您看到所有类。

有关呼叫树过滤器的更多信息,请访问

https://www.ej-technologies.com/resources/jprofiler/help/help/doc/main/methodcallrecording.html

The call tree in JProfiler only shows classes that are included in the call tree filters that you define in the profiling settings:

enter image description here

By default, this excludes a lot of common frameworks and libraries so that you can get started without configuring anything. It is better if you delete these filters and add your own profiled packages here.

In addition to the profiled classes, JProfiler shows the thread entry point even it is not a profiled class, such as io.netty.util.concurrent.FastThreadLocalRunnable. Also, the first call into non-profiled classes is always shown at any level in the call tree.

In your case there are call chains to non-profiled classes below io.netty.util.concurrent.FastThreadLocalRunnable that never call a profiled class. They could belong to some framework or to some part of your code that is not included in the profiled classes. This time has to go somewhere, so it is attributed to the io.netty.util.concurrent.FastThreadLocalRunnable node.

An easy way to check is to disable filtering in the profiling settings, then you see all classes.

enter image description here

More information about call tree filters can be found at

https://www.ej-technologies.com/resources/jprofiler/help/doc/main/methodCallRecording.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文