This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Performance and the fly likes Reg. Struts Performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Reg. Struts Performance" Watch "Reg. Struts Performance" New topic

Reg. Struts Performance

Venkatesh Rajendran
Ranch Hand

Joined: May 17, 2001
Posts: 59
I have an application which uses JSP, Servlets and Java Beans. Now we would like to go for Struts framework. Is there a chance to increase its performance because of struts framework implementation?
We feel our website seems to be very slow, it would be great if you could tell me any other methodologies to improve the performance.
Thanks in advance.
Thanks & Regards
Joe Ess

Joined: Oct 29, 2001
Posts: 9138

Originally posted by Venkatesh Rajendran:

We feel our website seems to be very slow, it would be great if you could tell me any other methodologies to improve the performance.

The quickest/easiest way to improve performance: Get better hardware. Hardware is cheap compared to spending months of developer time chasing bottlenecks. I once had a client who complained about a Java web app's performance. Turns out he was trying to run the app server on a dual Pentium 166 with 256megs of RAM that, without the web app running, had a 90% CPU load. Enterprise applications require enterprise-level hardware. We ran the same app with a dual Itanium 800 with 2gigs of RAM (cost about $10k in the year 2000, about the same as a man-month for a developer) and the performance problems went away. Use whatever your platform provides (top on Linux, Task Manager/System Monitor on WinNT/2k/XP) and see if your hardware is maxed out.
Converting to Struts will probably not increase performance. Depending on your current architecture, Struts may make it perform _worse_. Struts performs at least on forward per request, in some cases more. What Struts does do is give you a good framework to build a web application using an MVC architecture. It also decouples the presentation logic from the business/persistence layers so the workflow of the web app is more flexible and it is easier to spread the load across multiple developers.
Try using a profiler like JProbe or Optimizeit to identify bottlenecks in your program. If the bottlenecks aren't in your controller servlet (i.e. the bottlenecks are database calls or jsp page rendering), converting to Struts won't impact the bottlenecks at all. Concentrate only on those areas where your program performs worst. If it is a database call perhaps adding an index to a central table will help, or caching results for tables that don't change often. If the bottleneck is in some Java code, look for the obvious: creating object instances in a loop, using String+String where you should use StringBuffer.append() and so on. There's a bunch of information at Java Performance Tuning Tips. Be warned that performance tuning on maxed-out hardware will probably not yeild significant results unless you have some really bad code!

[How To Ask Questions On JavaRanch]
Corneil du Plessis

Joined: Feb 12, 2004
Posts: 13
Introducing the Struts Framework will not in itself improve your preformance. The only way to improve performance is to measure and to determine why it is performing badly.
I recently worked on improving the performance of an application. We determined that the JSP pages where done badly and the amount of HTML produced was excessive. We needed to re-write and re-organise. At that point the introduction of Struts allowed us to manage the re-write and re-organisation much better than would have been sticking with the existing architecture.
You need to determine if the application is slow because of database, business logic or presentation. Then improve the relevant area.
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
Doing some Struts will sure improve your market value.

SCJP, blog
Paramita Verghese

Joined: Feb 18, 2002
Posts: 20
Originally posted by Corneil du Plessis:
You need to determine if the application is slow because of database, business logic or presentation. Then improve the relevant area.

Could anyone please expand on what could be the possible problems in the presentation layer if a web application is developed using JSP/HTML? If the problems are in the front-end, what can be done by the devloper to make the application faster and lighter??

Some days are diamonds; some days are just stones
Corneil du Plessis

Joined: Feb 12, 2004
Posts: 13
You have to understand your user. Is your user on an Intranet or the Internet. The bandwidth available may be critical and thus the size of the HTML and other files will be an issue. Do not think that the size of HTML or images is not important on an Intranet application. The amount of users your web-server can serve is going to be determined by the throughput you can achieve on the relevant hardware.
We used a commercial tool called Topaz to execute scripts against the website and record performance data. You could do the same thing with JRunner. We use this data to determine which elements are too big and then we decide what can we do about reducing the size.
With graphics the process is simple.
With HTML produced by JSP I have found that most programmers format the JSP to look nice with indenting. The problem is that indenting is usually whitespace and is unneeded whitespace when it comes to the HTML going to the browser. A section inside a loop is the biggest culprit.
Right click on your browser window and view the source, you will be surprised at the extra whitespace.
A have whished for a flag in the JSP processor that can instruct it to remove leading spaces and blank lines.
John Conrad

Joined: Sep 23, 2004
Posts: 1
You can use some tools to inscrease Struts performance.
For example a cache system like Stuc (
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162

another thing you may want to look at is gzip of your html/jsp
watch this link

more servlet - marty hall

But if your code is ****, you may want to change that first.

swimming certificate (A & B), shoelaces diploma, and some useless java ones.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Reg. Struts Performance
It's not a secret anymore!