• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Performance Tuning Java Web Application

 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java web application and i m facing performance issues; i need to optimize my code to do it ; can somebody suggest me what all things i should keep in my mind or areas i should look for ; also i want to know that a lot of time is consumed in downloading js css images files and header footer files ; cannot this be optimized or kept in browser or some other cache
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sushil bharwani:
I have a java web application and i m facing performance issues; i need to optimize my code to do it ; can somebody suggest me what all things i should keep in my mind or areas i should look for ; also i want to know that a lot of time is consumed in downloading js css images files and header footer files ; cannot this be optimized or kept in browser or some other cache


One way is by setting the objects which you are not using to be "null".Which can boost a bit of performance for your application.
If you are more concerned about Performance and want to implement cache solution then you can look for Java Caching System(JCS) which is a jakarta project.
JCS LINK
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way is by setting the objects which you are not using to be "null".

This is a micro-optimization, which may or may not do anything, and may actually be harmful with modern-day JVMs.

Make sure you actually need to optimize, and that you measure what you're tuning before and after you do it, so that you can be sure that your changes have the desired effect. Further hints can be found in the http://faq.javaranch.com/java/PerformanceFaq.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAMON is easy to install and would be a good starting place to decide where your problems lie.

Many times people are surprised by the actual location of the performance problem.

For an amusing walk thru computer science history do a google search for:
"premature optimization is the root of all evil"

Bill
 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried a lot to improve on performance on a piece of code but am not able to find out where the exact bottle neck lies what ever i try whatsoever i do i am stuck and feel hopeless does there exists any tool which can tell me where i can find which line of code or which method is most expensive
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you follow Bill's advice and installed and used Jamon?
 
vishalraju shah
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems you need some profiling tool to drill down into your application. I have worked little bit with JProfiler which is good tool (unfortunately it's licence copy), profiling tools gives you good summary where your objects are heavily created ,how many times method are called , execution time and lot others.

Java application monitor seems good , worth monitoring your application with that.

Also , if you want to you use caching than JCS or EHcache(for object caching) are good option.
 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the issue is i use Broadvision applicatioon Server installed on a Remote Server which os Solaris Machine and its becomes quite difficult for me configuring any profiling tool on that server I am finding myself in a helpless mode
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can't monitor the real running application, can you create a local version on your own system and simulate a load on it?

Bill
 
sushil bharwani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well No i cannot do it;After moving much within the code i found that its a jsp which is taking most of the time inside the JSP there is a menu.jsp file included which if not included makes my file work faster. the menu.jsp file has a lot of div tags and javascript which takes somewhere around 10 seconds to render on browswer.So my question is cannot in someway i can use my broswer cache to cache this entire menu and thus save time.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So my question is cannot in someway i can use my broswer cache to cache this entire menu and thus save time.


It sounds like you have been doing some excellent detective work to locate the source of your problem.

If the menu created by menu.jsp does not change (too much) between requests, you may be looking at an excellent opportunity to use AJAX style dynamic programming. This would leave most of the page built on the browser intact while refreshing only the data that changes between requests.

AJAX is a very hot topic so you can find plenty of resources. You might start at the HTML and Javascript forum here at the ranch.

Bill
[ January 08, 2008: Message edited by: William Brogden ]
 
Raees Uzhunnan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check about "data islands". This might help you in your effort isn storing temporary static data at the browser side
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before spending too much time on caching on the browser side I would ensure the performance issues are caused by the html/javascript and not the jsp itself. Based on your write up the source of the performance problem is not conclusive to me.


An easy test to see if it is javascript/html that is the performance problem is to do a save-as from your browser and load the saved static html. If that is slow (the 10 seconds you mention) then you have a client side problem. Based on the 10 second figure I am guessing your problem is more likely to be serverside.

Using the jamon servlet filter you should be able to get server side page timings. This can be done on your development server if you don't have access to your prod server. The servlet filter will give you performance numbers for all of your web pages including jsp's. If menu.jsp is slow (i.e. the 10 seconds you mention) then this is a server side problem and you will need to tune your java code. The jamon servlet filter requires no code changes to work, so it is quite easy to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic