File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Performance Tuning in Java Web Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Performance Tuning in Java Web Application" Watch "Performance Tuning in Java Web Application" New topic
Author

Performance Tuning in Java Web Application

Dhayakar Tulasi
Greenhorn

Joined: Jun 25, 2013
Posts: 17

Hi ,

I am having 2+ years of experience in Java, Want to know about Performance tuning in Java web Application.

How can we improve the performance and what are the steps involved in that, Please answer the my question (I am willing to know about the performance tuning in Java web application).

Thanks
Dhayakar.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11313
    
  16

Step 1 is to decide what your performance requirements are. Without them, how do you know when you are done?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12783
    
    5
Assuming you are interested in such things as response time under various defined loads, you will need a way to emulate multiple "simultaneous" clients.

The open source HTTP components toolkit at Apache can be used to emulate clients and I am sure there are other tools.

Bill
Dhayakar Tulasi
Greenhorn

Joined: Jun 25, 2013
Posts: 17
Thankyou.


I want to know, How to improve the performance at java application side and also how to improve the performance at data base side.
Please give some brief information.

thanks
Dhayakar
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11313
    
  16

Generally speaking, you start with analysis. Where is your program spending the most time? There are tons of profilers out there, a quick search should find them (and tutorials on how to use them).

Once you know WHERE your program is spending its time, you then look at the places you can get the most bang for your buck. You may want to completely re-write your sort algorithm, but if your program is only spending 0.1% of the time there, you won't gain much.

If if your db select statement is taking 30% of the time, then it is possible a new index could speed things up dramatically.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12783
    
    5
Resist the urge to try various "optimizations" instead of doing the analysis as recommended by Fred.

Try a google search for "premature optimization is the root of all evil" - a famous programmer aphorism - as an amusing diversion.

Bill
jake lopez
Greenhorn

Joined: Jul 03, 2013
Posts: 13
it is important to take the type of application into consideration. So that performance solution can be more effective. For example, if you are only writing a blog in Java, it will be mostly read. Maybe utilizing caching will speed up performance
soundar rajan
Greenhorn

Joined: May 08, 2013
Posts: 16
• Before going to start the performance improvement analysis you should have the SLA for each page, it means the expected responses time from the customer or end user.
• Execute performance test and get the base line results, before adding any performance optimizations.
• Use http watch plugin for getting total execution time for each page rendering.
• Identify the hotspots at method level, for this we have to enable the loggers to get the each method execution time.
• Identify the SQLs and checks all the SQLs having the proper indexing at DB level.
• Check if there were any optimization is possible in SQLs.
• Check the code level if any unnecessary query execution is happened and try to make it as less.
• Profiling the application will be giving more data points for adding optimizations.
• Using yslow plugin for getting more information for js, css and image related optimizations.
dan spe
Greenhorn

Joined: Sep 26, 2013
Posts: 1

There is no way to completely answer this question in a few words or paragraphs. Performance tuning is one of the more complicated tasks, especially if you have limited expertise. When I have to deal with the performance tuning I am following the systematic approach.

First, find the parts of the application that require improvement, whether they’ve been discovered during the development cycle, functional testing or reported by the application users in production. No reason to take on everything as you will complete nothing.
Depending on the system - the real issue can lay in hardware, network, system architecture, custom code, or combination of things, etc.
Without proper approach - you can spend weeks, months without success. And try to add heavy user load scenarios to the mix and this will multiply the complexity.

Second - define what tools you will use to identify the issue. You can decide to analyze JVM first, or use known java profilers, or use java monitoring and analytical tools.
I personally like to have a big picture first and then be able to drilldown to the lowest possible level. There are a few tools available on the market to help you with that. I recently used Discovered Byte analyzer with good results (and it is free). You can get it from http://discoveredbyte.com. What I like about it? It will highlight and give you quick view of the system or specific issue that you are dealing with in pre-analyzed report. I see it as big picture of the issue(s).
When I have that - If I see that server utilization is constantly maxing, then it is limitation on the hardware side (unless you have memory leaks or inefficient code that eats up CPU. Unfortunately you can’t check memory leaks with the Discovered Byte analyzer, but you can see CPU usage by heavy methods, and for me it is very important.)
If I see heavy methods or pages - I drill down to the method. I like to use filters and control level of the execution to display heaviest methods that contributed to the bad performance results.
The lowest hanging fruit is bad queries - you can view them as well, but in reality - you are lucky if it is just SQL issue. I recently dealt with repeated SQLs - single query was executed in just a few milliseconds, but was ran many thousands times from the single method! (That was fun to catch?)

Third - once you have the data you can make a decision on how to fix it. HW or custom code – the easiest ones; architectural flows or vendor code usually take longer time to address.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Performance Tuning in Java Web Application