简体   繁体   English

我的 Java 应用程序中的 Jar 文件访问存在高争用

[英]High contention on Jar file access in my Java application

We work on a JMS based application that receives messages in XML format from a JMS queue.我们开发一个基于 JMS 的应用程序,该应用程序从 JMS 队列接收 XML 格式的消息。 The application is deployed on Weblogic server (12c).该应用程序部署在 Weblogic 服务器 (12c) 上。

Having a rate of about 400-500 msgs/sec we are experiencing bad performance and accumulating backlog on the JMS queue.以大约 400-500 msgs/sec 的速率,我们正在经历糟糕的性能并在 JMS 队列上积累积压。

I tried to profile the application using Java Mission Control and after recording one minute of activity of the system I found that there is a lot of contention on access phase to Zip (Jar) files by the Weblogic classloader.我尝试使用Java Mission Control对应用程序进行分析,在记录了系统的一分钟活动后,我发现 Weblogic 类加载器对 Zip (Jar) 文件的访问阶段存在很多争用。

The operation that was performed by my JMS MDB when the contention is detected is the XML file content unmarshalling using JAXB.检测到争用时我的 JMS MDB 执行的操作是使用 JAXB 解组 XML 文件内容。

Any hint on what can cause the issue?关于什么可能导致问题的任何提示?

A possibility is that you are doing repeated calls on a JAXP factory method like XMLParserFactory.getInstance() , which involves searching the classpath and inspecting the JAR files.一种可能是您正在重复调用像XMLParserFactory.getInstance()这样的 JAXP 工厂方法,这涉及搜索类路径和检查 JAR 文件。 These methods are intended to be called once only when the application is initialised.这些方法仅在应用程序初始化时才被调用一次。 (As well as reusing the factory, it's also beneficial to reuse the XML parser itself - at any rate, that was the case at one time.) (除了重用工厂之外,重用 XML 解析器本身也是有益的 - 无论如何,曾经是这种情况。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM