sun.rmi.server.LoaderHandler.urlsToPath() 占用大量 CPU

发布于 2024-08-18 17:52:01 字数 302 浏览 1 评论 0原文

我正在尝试优化一个进行大量 RMI 调用的应用程序。根据 JProfiler 的说法,超过 30% 的 CPU 时间花费在 sun.rmi.server.LoaderHandler.urlsToPath() 方法上,该方法显然是在封送过程中被调用的。该方法调用 URL.toExternalForm()

这正常吗?我还没有弄清楚哪些对象正在被准确序列化,但这似乎是一个奇怪的瓶颈。

LoadHandler.urlsToPath() 的用途是什么?我可以采取哪些措施来减少其使用?

I'm trying to optimize an app that makes a lot of RMI calls. According to JProfiler, more than 30% of the CPU time is spent in the sun.rmi.server.LoaderHandler.urlsToPath() method, which is apparently getting called during marshaling. This method calls URL.toExternalForm()

Is that normal? I haven't yet figured out which objects are getting serialized exactly, but it seems like an odd bottleneck.

What is the purpose of LoadHandler.urlsToPath(), and what can I do to reduce its usage?

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

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

发布评论

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

评论(1

灵芸 2024-08-25 17:52:01

我通过 Google 搜索“sun.rmi.server.LoaderHandler.java”发现了这一点。

                 /**
0795:             * Convert an array of URL objects into a corresponding string
0796:             * containing a space-separated list of URLs.
0797:             *
0798:             * Note that if the array has zero elements, the return value is
0799:             * null, not the empty string.
0800:             */
0801:            private static String urlsToPath(URL[] urls) {

简单来说,它是 String bashing。您需要查看应用程序调用此函数的上下文,以找出为何如此频繁地调用它,但这很可能是进行大量 RMI 调用的直接结果。如果是这样,解决方案将是减少 RMI 调用,或者使用 RMI 以外的其他方法。

I found this with a Google search for "sun.rmi.server.LoaderHandler.java"

                 /**
0795:             * Convert an array of URL objects into a corresponding string
0796:             * containing a space-separated list of URLs.
0797:             *
0798:             * Note that if the array has zero elements, the return value is
0799:             * null, not the empty string.
0800:             */
0801:            private static String urlsToPath(URL[] urls) {

In simple terms it is String bashing. You'd need to look at the context in which your application is calling this to figure out why it is being called so often, but the chances are that this is a direct consequence of doing lots of RMI calls. If so, the solution will be to do fewer RMI calls, or to use something other than RMI.

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