views:

215

answers:

3

We have a Java Swing application which is basically a two tier application - An UI layer which connects to a database and which does some heavy-lifting across both the layers.

We have been observing some performance issues with the application and are looking for strategies to load test the application.

Basically our goal is to launch multiple instances of this application and simulate a load which would help us figure out these performance conditions in a test environment.

I am looking for suggestions on how we can do this:

  • Any tools that you would recommend?
  • Approaches (Virtualization? / Citrix)

Please let me know if you need further information to help you answer this question.

+2  A: 

Before you go and work on performance tests for the app, you should ensure that you are following the correct threading guidelines for Swing applications. It is important to keep your database access in a separate thread from your GUI painting. See this link for more information.

akf
@akf - Thanks for your response! - To give you some context, I have inherited this application and my goal is to find the use cases which has the most pressing issues and work on fixing them. My plan is basically to introduce performance logging in the application - I am considering to use perf4j with AOP - and then give a modified version of the application to the actual users and figure out from the logs as to where the bottlenecks are.What I am trying to do for the longer term is to give a load testing framework which would help me identify issues for higher loads.
KM
A: 

When it comes to any sort of testing, performance included, it is much easier to test the application when the UI and the business logic are separated. You mentioned that you have a UI that does some heavy lifting and that is generally not a good thing. You'd like to be able to test the application just using its APIs (using the APIs the UI calls).

When performance testing the entire application with the UI, there are some performance testing tools you can use to help. JMeter is one that comes to mind, and some Google searches will surely find others.

It really makes testing easier to modularize the code and separate out the UI and business code, so it will be easier to isolate the components and determine where your performance bottlenecks are. If most of the logic is outside the UI, you can use standard Java profilers as well to see where most of the time is being spent.

Jeff Storey
+3  A: 

OK, I was pretty sure you had JTable.... This is probably a HUGE part of the problem.

But it can be solved, I don't know how to copy the link for a previous answer I made but basically for financial data and JTable, you want to read the following...

Sun has a tutorial precisely for this purpose called the "Christmas tree" that specifically address the "frequently updated data like financial ones" Swing/JTable slowness problems.

Here you go, "How to create frequently updated JTable that perform well":

http://java.sun.com/products/jfc/tsc/articles/ChristmasTree/

One of the thing that I found really amazing was to constantly display the memory used: you may want to do that.

You'll be amazed at how much needless crap is generated by a default JTable, slowing everything down and making of course the GC trigger way more often than it should: needless objects creation, needless graphical redrawing, etc. It all makes for an application unusable, even on very fast setups.

So start implementing all the tricks given in the link I gave you and you'll see that everything shall run much smoother. I'm now running very complex and "constantly updated" JTable and all is fine now :)

Basically, besides for the simplest case and tiny amounts of data, the default JTable implementation is really terribly bad.

Once you start working with "real world data" (like financial stuff ;), you need to follow the steps outlined there if you want your JTable to perform well.

I'm not saying it's your only cause of slowdown, but I've been there and implementing most of the hints hinted by Sun in that article greatly helped. Actually I went from an unusable application to a very enjoyable one.

Webinator
See also http://stackoverflow.com/questions/2219988/java-jtable-with-frequent-update/2220040#2220040
trashgod