在空闲时间访问应用程序时,Glassfish会变慢

时间:2015-12-16 15:12:33

标签: performance jsf primefaces glassfish

草绘背景: 我在JDK 7上运行了一个Glassfish 4.1服务器。在那个glassfish上部署了几个应用程序,每个应用程序都有自己的上下文根。在应用程序之间共享一个公共库,并且SSO已打开,因此用户只需登录一个应用程序。

问题: 当我第一次打开应用程序时,它非常慢。打开一个简单的页面大约需要10秒钟(一些基本的数据库调用,一些JSF和一些Javascript)。之后,页面快速(相对)加载,大约700ms。 因此,当用户点击重定向到另一个应用程序的链接时,再次加载时间很长。

所以可能的解决方案是当服务器启动时,我登录然后点击每一页。 现在问题是,一段时间后,它开始再次加载缓慢。我认为它与垃圾收集有关,但我增加了最大堆大小,最大permgen,没有效果。

这可能是什么原因以及可能解决这个问题的原因。我不想告诉我的用户只需点击并等待10秒钟。

我已经添加了Measure the render time of a JSF view after a server request告诉我要做的问题,结果很奇怪:

FIRST CALL

create /content/index.xhtml: 6,167607ms
build /content/index.xhtml: 808,034825ms
render /content/index.xhtml: 1030,724281ms
create /content/index.xhtml: 0,935276ms
create /content/index.xhtml: 0,564929ms
build /content/index.xhtml: 207,870007ms
build /content/index.xhtml: 192,585271ms
build /content/index.xhtml: 18,823134ms
build /content/index.xhtml: 26,695793ms
render /content/index.xhtml: 2,928994ms
render /content/index.xhtml: 32,036747ms

Total: 2321 ms (rounded)

According to Google extension:
TCP Request: 3553ms
TCP Response: 864ms
Processing: 616ms
onload event: 7ms

Total: 5044ms


SECOND CALL

create /content/index.xhtml: 0,720167ms
build /content/index.xhtml: 127,220694ms
render /content/index.xhtml: 294,285362ms
create /content/index.xhtml: 0,748819ms
create /content/index.xhtml: 0,580752ms
build /content/index.xhtml: 152,104949ms
build /content/index.xhtml: 30,822214ms
build /content/index.xhtml: 224,347038ms
render /content/index.xhtml: 63,673639ms
build /content/index.xhtml: 9,347205ms

Total: 899 ms (rounded)

According to Google extension:
TCP Request: 178ms
TCP Response: 285ms
Processing: 477ms
onload event: 8ms

Total: 952ms

PostConstruct渲染时间:2569ms

0 个答案:

没有答案
相关问题