每次 Java 更新时,Web 启动 jar 验证都会变慢 [英] web start jar validation getting slower with each Java update

查看:32
本文介绍了每次 Java 更新时,Web 启动 jar 验证都会变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 90MB 的 (Eclipse RCP) 应用程序,其中包含 139 个自签名 jar,它在没有 Web Start 的情况下在 8 秒内启动,在旧版本的 Java 7 中启动需要 10 秒.我们将 Java 配置为不使用浏览器代理,即 deployment.proxy.type=0.

We have an (Eclipse RCP) application of 90MB with 139 self-signed jars which starts in 8s without Web Start and in 10s in an older version of Java 7. We configured Java to not use the browser proxy, i.e. deployment.proxy.type=0.

Oracle 的 Java 启动性能随着每次更新而下降.完全启动需要越来越多的时间:

With each update of Oracle's Java startup performance drops. It takes more and more time to fully start up:

  • 7u60/7u65/8u25:13 秒(在 Web 启动处理 5 秒后开始)
  • 7u75:23 秒
  • 8u31:20 秒
  • 8u40:29 秒
  • 8u51/8u60ea:32 秒

我该怎么做才能解决这个问题?

What can I do to solve this issue?

从跟踪/日志中我可以看到,这种减速很可能完全是由于验证缓存的 jar 花费了更多时间.请注意,这个问题很相似,但没有不提供以下详细信息:

From the trace/logs I can see that it is very probable that this slowdown is completely due to validating the cached jars taking much more time. Note that this question is similar but doesn't provide the following details:

诊断:

  • 缓存后,更新检查仅运行 0.5 秒(服务器返回304 Not修改"),但即使是完整下载,在千兆网络上也只需几秒钟.
  • 更新检查后,对于每个 jar XXX 都有一个日志条目:

验证缓存的 jar XXX.jar

validating cached jar XXX.jar

完成后,com.sun.javaws.Main 启动,此后似乎再次发生相同的验证并花费大约相同的时间,然后应用程序启动.

When this is done, com.sun.javaws.Main is started after which the same validation seems to happen again and takes about the same amount of time, then the application starts.

  • 验证缓存 jar 所花费的时间似乎对应于申请开始前所需的额外时间.
  • Web 启动闪屏总是显示大约 2 秒钟,对应于更新检查,然后隐藏.大约 20 秒后,Java 控制台终于出现,我的应用程序实际启动.
  • 在延迟期间,jp2launcher.exe 在具有超线程的四核(8 个逻辑核)上使用了大约 16% 的处理器时间.所以看起来它完全使用了其中一个逻辑处理器.

我已经尝试过但没有任何区别:

  • 清除网络启动缓存(无数次)
  • 配置 deployment.properties 以禁用证书吊销检查(以及 blacklist.check 和 validation.ocsp、validation.crl)
  • 离线运行
  • 使用版本下载协议
  • 添加到站点例外列表
  • 检查网络服务器日志是否有问题.未找到,所有 138 个 jar 的更新检查运行时间约为 500 毫秒.
  • 使用另一个网络服务器
  • 已检查证书到期日期 2016 年 2 月 17 日
  • 使用 JaNela 验证了我的 jnlp,没有发现严重问题
  • 创建部署规则集以允许应用程序在未签名的情况下运行以加快验证速度.这应该是可能的,看起来是解决这个问题的一种很有前途的方法,但我无法让它工作.另见我的回答这篇文章.
  • 将 Java 配置为不启动控制台"

详细信息:7u60 上的一些奇怪行为在 7u60 中,应用程序在大约 5 秒后启动,之后 Java 控制台似乎在后台进行 jar 验证,而应用程序已经启动.但是 .log 文件报告应用程序在所有验证完成后启动.它将此报告为 25 秒,然后显示我的应用程序的第一个 System.out,它实际上仅在 5 秒左右后发生.它还显示了与服务器进行 jar 更新检查的时间是服务器报告的时间的 10 倍.所以我猜这是日志框架落后的问题!没有在 8u51 上看到这个.

Detail: some weird behavior on 7u60 In 7u60 the application is started after about 5 seconds, after which the Java console APPEARS to be doing the jar validation in the background while the application is already started. HOWEVER the .log file reports that the application gets started AFTER all the validations are done. It reports this as 25 seconds and then shows the first System.out of my application which actually happened after only 5 seconds or so. It also shows the jar update check with the server taking 10 times as long as reported by the server. So I guess this is an issue with the logging framework lagging behind! Haven't seen this on 8u51.

推荐答案

本身(还)不是答案,但我发现启用跟踪时 Java 8u25 仅生成单个跟踪文件.8u51 生成两个文件,一个来自用于更新应用程序的 JVM,另一个用于运行它.这是新的(两个 JVM 启动),我认为与使用本机 Windows 沙箱功能的新设置有关.问题是它不应该在第二个 JVM 上再次验证签名.无论是否禁用使用原生沙箱的设置(默认),两个 JVM 实例的分离总是发生.

Not an answer per se (yet), but I found that Java 8u25 when tracing is enabled, only generate a single trace file. 8u51 generates two files, one from the JVM used to update the application and other to run it. This is new (two JVM startups) and I think is related to the new setting for using native Windows sandbox capabilities. The problem is that it shouldn't have to validate the signatures again on the second JVM. The separation on two JVM instances always happen no matter if the setting for using native sandbox is disabled (the default).

我报告了一个回归错误,如果我从 Oracle 得到答案,我将编辑答案.

I reported a regression bug, will edit the answer if I get an answer from Oracle.

注意:Java 8u31 仍然在一个 JVM 上运行所有内容,但启动时间与问题所述相同.

Note: Java 8u31 still runs everything on one JVM but have the same doubled startup time the question stated.

这篇关于每次 Java 更新时,Web 启动 jar 验证都会变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆