Link to home
Start Free TrialLog in
Avatar of autoknowledge
autoknowledge

asked on

Performance: Download/display a JSP vs HTML

Hi Experts,

We have a JSP app and one of our page that displays a list of product info from the database is really long and it is taking too much time (7 seconds) to display. We did some diagnosis and found out that the bottle neck is not database/server code. Rather, it starts from the server renders the JSP then browser downloads it and displays it. To test that theory, we saved that page on the browser as a seperate HTML document and put it back on the server. Now when we try to access that HTML on the server it came  back less than 2 seconds. The file size is about 400K so I think we've got pretty decent network speed. The problem seems to be pointing to the production server that is sitting 30 miles away from our office rendering the JSP. However, the same JSP shows up in 2 seconds when it is on our development server in the office.

I will really appreciate if anyone have any insight to our problem. I am going to assign 500 points for this question, hope this is a good incentive for all experts here.

Thanks

Stephen
SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of autoknowledge
autoknowledge

ASKER

Splitting the list in multiple pages is an option, we actually used to do it that way. But for usesability reason we swicted to have it displayed on a single page.

Downloading here I meant the browser has to download the page from the server (30 miles away) before opening it. Sorry for the confusion.

Thanks for the input, I will consolidate all inputs from everyone and will award points after that.

Stephen
Downloading here I meant the browser has to download the page from the server (30 miles away) before DISPLAYING it
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

If you use cache, you will be slow when downloading the data by first time but the next time, it would be faster.

Regards
Dave
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
First of all, thanks for the replies. All are nice thoughts.

Yes we are using cache already. First time loading the page is much slower than 2nd or 3rd time, but even for the non-first time load it takes 7 seconds, which is too slow.

Okay let me clarify this a little bit.
It takes 2 seconds to load up the JSP from the development environment (local).
It takes 7 seconds to load up the JSP from the production server (30 miles away --> network issue?).
It takes 2 seconds to load up the HTML from the production server. This HTML is obtained by doing a "save as" on the IE to "full HTML document" when we see the JSP page on the browser. We put that 400K HTML file on the server just to test the network speed because I was trying to see whether rendering JSP or network latency is the main driver for that.

The result came back was inconclusive because the 2 seconds for HTML may suggest that network speed is decent, while the 2 seconds for JSP in development environment may suggest it's the network, and server rendering is fast (production server is a much better machine than our development).

Thanks

Stephen
okay your result suggests that your jsp is taking too much of time to connect to the database while its on the production server ( may be because production database is much larger than your test database, or the database and production server connection is slow..)
if your HTML from production server is coming back in 2 seconds then its not your network... it has to be your database access..
Since we are caching the data, there is no database connection calls from the 2nd time on
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
bloodredsun,

The code you post here is a can measure how fast our server generate the page? Are you suggesting me to create a JSP that contains that code and put the timing function call to wrap around the getURL(final String pURL). Could you explain how does this code help diagnose my problem a little bit?

Thanks

Stephen
karanw,

Thanks for the suggestion, tried that. It speeds up the first time, but not subsequent accesses.

Thanks

Stephen
The method allos you to create either an app or a JSP where you can measure the start and stop time of the request.

long t0 = System.currentMillis();
String returnedJSP = getUrl("http://yourhost.com/yourapp/index.jsp");
long t1 = System.currentMillis();
System.out.println("request (network and processing) took: " + (t1-t0) + "ms") ;
System.out.println("JSP took: " +returnedJSP + "ms") ;

This allows you to look at the time taken over the network. If you create a JSP that ouputs the processing time as it's HTML than you can also look at just the processing time.