开发者

How to configure apache tomcat to render pages fast [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 1开发者_如何学Python1 years ago.

Improve this question

I am hosting a jsp/servlet web app on apache-tomcat 7.0 on a Intel core 2 duo Ubuntu 11.4 machine. I feel the performance is slow compared to same deployment on Windows 7.

I am very new to web application development. How do I tweak my tomcat settings to make it run fast. The machine is now solely dedicated to host this web application.

Regards,

Nandish


a few things to take into consideration:

  • first hit to JSP's will compile the JSP which is a lengthy process -- so try precompiling the pages before deployment, or check the pages after they get compiled
  • check that the JDK version is the same -- even minor JDK versions sometimes bring speed improvements
  • check that you are using the same Tomcat version
  • if you are using a database in the backend -- is the database performing slow? in which case tune your DB
  • is it the fact that your windows machine is local and as such downloading a page is instantaneous whereas the linux machine is in a datacentre or somewhere else -- basically no longer on your localhost -- and the network traffic slows down the transfer? Consider in this case adding a gzip encoding to your output and compress the data before sending, thus lowering the transfer time.
  • are you accessing a lot of static files in your app (e.g. images, css)? In this case, could it be that the access to the file system is slow? If your resources are on a file system that is heavily used, try to move them onto a different disk -- or even better have a standard apache (not tomcat) server serving the static content.


Check if its slow with static content (.html) files too, If it is you should look into installing with with the APR (Apache Runtime Portable).

If its not slow when rendering static content then you should take a look at profiling your application to see exactly where the bottle neck is.

Is it slow when using the browser on the serving machine pointing to localhost? If not it may well be that the network is slow rather than the tomcat machine.

Really to find out why something is slow you should profile it. You can profile a remote java application using something like yourkit.

  • Also check all the things that Liv said above.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜