Jetty启动延迟 [英] Jetty startup delay

查看:289
本文介绍了Jetty启动延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图找出Jetty启动时会导致 1分钟延迟的原因。是配置问题,我的应用程序还是其他什么?

I'm trying to figure out what would be causing a 1 minute delay in the startup of Jetty. Is it a configuration problem, my application, or something else?

我在服务器上安装了Jetty 7(jetty-7.0.1.v20091125 2009年11月25日)将45MB ROOT.war文件部署到webapps目录中。这是Jetty中唯一配置的webapp。然后我用命令启动Jetty:

I have Jetty 7 (jetty-7.0.1.v20091125 25 November 2009) installed on a server and I deploy a 45MB ROOT.war file into the webapps directory. This is the only webapp configured in Jetty. I then start Jetty with the command:

java -DSTOP.PORT=8079 -DSTOP.KEY=mystopkey -Denv=stage -jar start.jar etc/jetty-logging.xml etc/jetty.xml &

我这样做后得到两行输出:

I get two lines of output right after doing this:

2010-03-07 14:20:06.642:INFO::Logging to StdErrLog::DEBUG=false via org.eclipse.jetty.util.log.StdErrLog
2010-03-07 14:20:06.710:INFO::Redirecting stderr/stdout to /home/zing/jetty-distribution-7.0.1.v20091125/logs/2010_03_07.stderrout.log

当我按下回车键时,我收到命令提示符。查看日志文件(logs / 2010_03_07.stderrout.log),我在开头看到以下内容:

When I press the enter key, I get my command prompt back. Looking at the log file (logs/2010_03_07.stderrout.log), I see the following at the beginning:

2010-03-07 14:08:50.396:INFO::jetty-7.0.1.v20091125
2010-03-07 14:08:50.495:INFO::Extract jar:file:/home/zing/jetty-distribution-7.0.1.v20091125/webapps/ROOT.war!/ to /tmp/Jetty_0_0_0_0_8080_ROOT.war___.8te0nm/webapp
2010-03-07 14:08:52.599:INFO::NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
2010-03-07 14:09:51.379:INFO::Set web app root system property: 'webapp.root' = [/tmp/Jetty_0_0_0_0_8080_ROOT.war___.8te0nm/webapp]
2010-03-07 14:09:51.585:INFO::Initializing Spring root WebApplicationContext
INFO  - ContextLoader              - Root WebApplicationContext: initialization started
INFO  - XmlWebApplicationContext   - Refreshing Root WebApplicationContext: startup date [Sun Mar 07 14:09:51 PST 2010]; root of context hierarchy
...

注意第3和第3个之间的1分钟长暂停第4行。 Jetty在这一点上做了什么?还有什么其他的事情可以发生?它甚至看起来还没有开始我的Spring初始化。

Notice the 1 minute long pause between the 3rd and 4th lines. What is Jetty doing at this point? What other things could be going on? It doesn't even look like it has started my Spring initialization yet.

请注意,我检查了我的/ tmp目录以查看是否只是解压我的战争时间文件,但文件已完全解压缩,即使在这1分钟的延迟开始。

Note that I checked my /tmp directory to see if it was simply the time to unpack my war file, but the file had been completely unpacked even at the start of this 1 minute delay.

更新:

感谢您的建议,我添加了DEBUG日志记录。我发现大约2秒用于提取war文件。但是 Init SecureRandom 大约有41秒延迟:

Thanks to suggestions, I added DEBUG logging. I found that about 2 seconds was used to extract the war file. But then there is about a 41 second delay on Init SecureRandom:

2010-03-07 21:54:45.414:DBUG::Starting SessionHandler@79884a40@
2010-03-07 21:54:45.414:DBUG::Starting org.eclipse.jetty.server.session.HashSessionManager@5fe8ce8
2010-03-07 21:54:45.416:DBUG::Container org.eclipse.jetty.server.Server@35175422 + org.eclipse.jetty.server.session.HashSessionIdManager@1d96f4b5 as sessionIdManager
2010-03-07 21:54:45.416:DBUG::Starting org.eclipse.jetty.server.session.HashSessionIdManager@1d96f4b5
2010-03-07 21:54:45.416:DBUG::Init SecureRandom.
2010-03-07 21:55:26.244:DBUG::STARTED org.eclipse.jetty.server.session.HashSessionIdManager@1d96f4b5
2010-03-07 21:55:26.247:DBUG::STARTED org.eclipse.jetty.server.session.HashSessionManager@5fe8ce8
2010-03-07 21:55:26.248:DBUG::Starting ConstraintSecurityHandler@6b9cd75a@
2010-03-07 21:55:26.261:DBUG::Starting ServletHandler@62c2ee15@

什么是SecureRandom,为什么会造成这种情况延迟?

What is SecureRandom, and why would it be causing this delay?

解决方案:

我的系统没有足够的负载。我刚刚把它设置为一个新的登台服务器,除了我以外没有人使用它。因此,系统没有足够的熵来使随机数生成器快速生成足够的随机性。

It looks like I'm running into a problem with my system not having enough load. I've just set this up as a new staging server, and there is nobody using it except me. So the system doesn't have enough entropy for the random number generator to generate enough randomness quickly.

推荐答案

Jetty 7 (也许更低):

使用 -Dorg设置(非常)详细的调试日志记录。 eclipse.jetty.util.log.DEBUG = true (参见码头/启动/移植到Jetty 7 )并试着看看在这一分钟内发生了什么。

Set the (very) verbose debug logging with -Dorg.eclipse.jetty.util.log.DEBUG=true (see Jetty/Starting/Porting to Jetty 7) and try to see what is happening during this minute.

作为旁注,你可能需要jsp支持所以你应该在启动时传递 -DOPTIONS = Server,deploy,jsp (参见运行Jetty-7.0.x

As a side note, you'll probably need jsp support so you should pass -DOPTIONS=Server,deploy,jsp when starting (see Running Jetty-7.0.x).

如果你不需要Jetty的花哨的东西7.x,那么你应该坚持使用Jetty 6而不是Jetty 7 eclipse(由于Eclipse迁移,更稳定,更少的问题,bett呃文档,更容易使用)。

And if you don't need fancy things from Jetty 7.x, then you should stick with Jetty 6 instead of Jetty 7 eclipse (more stable, less problems because of the Eclipse migration, better documentation, easier to use).

Jetty 8:

在码头8.1:系统属性[org.eclipse.jetty.util.log.DEBUG]已被弃用! (使用org.eclipse.jetty.LEVEL = DEBUG代替)

In Jetty 8.1: System Property [org.eclipse.jetty.util.log.DEBUG] has been deprecated! (Use org.eclipse.jetty.LEVEL=DEBUG instead)

这篇关于Jetty启动延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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