JSF2页面加载缓慢

JSF2页面加载缓慢

本文介绍了JSF2页面加载缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF2 Web应用程序.当我在不同页面之间导航时,它们通常会快速加载;少于100毫秒.有时候,尽管没有明显的原因,却要花几秒钟.

I'm working with a JSF2 webapp. When I'm navigating between different pages they normally load fast; less than 100 ms. Sometimes though, for no apparent reason, it takes several seconds.

我一直在尝试寻找发生这种情况的共同点,但是无论页面如何以及我是否曾经访问过该页面几次,它都会发生.另外,在页面加载缓慢之后,下次我加载该页面时,它将在一段时间内再次快速加载.

I've been trying to find some common denominator for when this occurs, but it happens regardless of page and regardless if I have visited the page several times before. Also, after a page has been slow to load, the next time I load it, it will load fast again for some time.

这一切似乎都是随机发生的.

It all seems to happen randomly.

我试图找出应用程序中需要花费时间来执行其任务的部分.我已经或多或少地计时了我能想到的所有东西,这不是数据库调用,类中的逻辑或类似的东西.相反,查看chrome的网络"图,似乎是对页面的首次调用,这是时间小偷.

I have tried to find out what part of the application that takes time to carry out its task. I've timed more or less everything I can think of and it's not database calls, the logic in my classes or anything like that. Instead, looking at the "network" graph of chrome, it seems to be the initial call to the page that is the time thief.

看看Chrome的网络"图,它表明在这种情况下第一次通话的等待时间为几秒钟.

Looking at the "network" diagram of Chrome, it shows that the latency for the first call is several seconds on those occasions.

如果这是由于我自己的错误代码造成的,我至少可以对它进行计时,并找出我在哪里犯了错误.看到这似乎是在甚至没有达到我自己的代码之前发生的,所以我不知道如何解决此问题.

Had this been due to my own bad code, I could at least have timed it and found out where I had made mistakes. Seeing that this seems to happen before my own code is even reached, I have no idea about how to solve this problem.

推荐答案

这可能不是导致该问题的实际原因,但是我注意到我的Internet连接正在上升或下降,这似乎影响了应用程序,即使我正在运行本地服务器.

This may not be the actual reason to the problem, but I noticed that my internet connection was going up and down, which seems to affect the application even though I'm running a local server.

如果我已向应用程序发出请求,并且Internet连接断开,则将不会加载所请求的页面,一旦连接恢复,该页面就会加载.

If I have made a request to the application and the internet connection goes down, the requested page won't load and as soon as the connection is back, the page loads.

我认为这根本不会影响应用程序,因为服务器是本地服务器,因此我可以取消Internet连接并仍然访问该应用程序.

I didn't think that this would affect the application at all, as the server is local and I can inactivate the internet connection and still access the application.

这篇关于JSF2页面加载缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:25