JSP load taking more than 12 seconds

好久不见. 提交于 2019-12-12 06:14:59

问题


I have JSP which takes more than 12 seconds to load. It works fine on IE11. It includes 6 other jsps within. I am trying to analyze what is causing longer load time for parent jsp.

Does included JSPs are compiled every time parent JSP is being loaded?

Each JSP and parent JSP has some functions defined in script tag.
Are these functions compiled on server? And if compiled does browser render this JS functions everytime on load?

Improvement steps: Include all JS functions in JS script and import it on page. So that browser can pick it up from browser cache rather than rendering it again and again. Will it help?

Heres the snapshot of profiler report.


回答1:


JSPs are typically compiled once by the application server, and the resulting class files re-used between restarts. In Tomcat, they are stored in the work directory.

See Where are compiled JSP Java (*__jsp.java) files?

You can delete the work directory, then monitor the work directory after the server starts up and see how long it takes to compile. It shouldn't be any longer for one browser than another, since compilation happens server side.

I am a little confused because the second part of your answer references JS files. Are you asking about Javascript or Java Server Pages?




回答2:


You may profile using any of the java profiler tools like Yourkit and see where most of the time is spent



来源:https://stackoverflow.com/questions/31084905/jsp-load-taking-more-than-12-seconds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!