Practical Tips to Boost Performance of a Java Application

The performance of a web application is very critical for the success of the project, in any company and with any client. We should have a good thought process about possible bottlenecks and their solutions.

Recently, Sriman, one of the blog readers, asked me this question to me. Well, I assumed that answer to this question might help a larger group of you guys, so I am posting the answer here.

1. Steps to Identify Performance Improvement Areas

Many of us agree that performance is itself a relative term. An awesome performing application can be a total disappointment for another person or your customer. So, like any other relative measurements, you have to follow the basics here as well.

It is crucial to follow all the steps to get improvement results that can be measured and demonstrated.

1.1. Define (awesome) performance benchmarks

The very first thing you need to do is to decide what is good performance for you. It should be a measurable goal regarding time units or resource utilization.

1.2. Identify problem areas

Once you define the benchmark figures, use performance monitoring tools (such as VisualVM or JMeter) to identify areas where the application lags behind benchmark numbers. Deep dive to the statement level in your code. Identify which pieces of code is causing the degraded performance. List each of them and keep track of each piece in the whole process.

Note: Please remember that over-optimization often results in more harm. So choose wisely.

1.3. Solve each problem and measure the difference

Brainstorm each problem with your team member, and find the best way to solve that problem. One at a time. Compare each solution to each problem, and record their result.

1.4. Measure overall performance improvement

At last, measure overall application performance improvement and compare with benchmarks. If the application is still lagging, then repeat all steps.

2. Food for Thoughts

While, the above steps are complete in sense of what needs to be done exactly – to improve performance in a measurable way, you need to keep a few things in mind:

  • Think out of the box. e.g. If Database querying takes time, then instead of over-optimizing the SQL statement, think of using caching.
  • Never assume/guess anything. Always make proposed changes, and record its performance.
  • Take help of automation. Use tools to capture performance after every change. It will make life much easy.
  • Avoid over-optimization. Prefer simplicity and maintainability of code.
  • Consider using advanced and more capable hardware/network solutions as well. They make a big impact sometimes.

And always remember, performance is a relative experience. Ask your customers for feedback. If they are happy, then never attempt to fix anything in your application.

I hope that the above thought process will help you in overcoming that complex situation when you are optimizing an application’s performance.

Happy Learning !!

Comments

Subscribe
Notify of
guest
2 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.