Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Performance Issue: JSP responses rendering on IE

 
Maya Dolas
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our application has a dynamic left navigation tree where entities of
the tree a fetched from database, appropriate HTML structure is formed
for each node and is the string is then rendered on the JSP as JSP
response.

To elaborate, I am providing the following code snippet

In my leftnav.jsp

<%
LeftNavTree leftNavTree = new LeftNavTree();
%>

<%= leftNavTree.outputTree()%>

I have the function outputTree in LeftNavTree.java which builds the
tree structure and returns a string of the HTML structure which is
rendered on the browser.

A sample string is

<table>
<tr>
<td>
<a href="....">Entit1</a>
</td>
</tr>
</table>

This is just a sample for one node, the string which is getting
rendered is huge as number of entities are many and also there is
nesting amongst the nodes. In fact after I do "View Source" of the page after rendering and just copy the tree related source to a different file, the source is nearly 1.47MB.

I have checked for the code on server-side, it takes merely 4-5
seconds. I have inserted the following code in the above mentioned JSP

<% long startTime = System.currentTimeMillis(); %>

<%= leftNavTree.outputTree()%>

<% long endTime = System.currentTimeMillis();
System.out.println("@@@@JSP Render Tree Time: "+ (endTime - startTime)
+" ms");
%>

But to render the complete on browser it takes more than 1 minute.

Why is that JSP is taking so long time to just render the HTML string?
Is it because browert(IE 6.0) is taking time to render this huge
string? Is it that DOM structure takes so much time to get rendered?

What is the reason behind such a behavior and what are the workarounds
for the same?

Any help is highly appreciated as my project schedule has hit a lot
due the performance issue.

We are using Tomcat 5.0.28. Can we do some tweaking in tomcat so that the buffering mechanism can be adjusted or anything which can help to resolve this issue?

Thanks in advance
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like your tests show that the bottleneck is in the browser, not the server so speeding things up on the server side probably wouldn't show a noticeable improvement from the user's perspective.

Let me know if you would like this moved to our HTML/Javascript forum where browser issues are discussed.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maya Dolas:
In fact after I do "View Source" of the page after rendering and just copy the tree related source to a different file, the source is nearly 1.47MB.


That is an awfully large page.
If this were my project, I'd start by looking for other ways to present this data.
 
rajesh bala
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I completely agree that its a large page. Anyways, its good that you gave the facts.

Now, letz check few things...

1. Can you post the snippet of outputTree() . What I am interested in is, how are you flushing the data to the outputstream.

2. Are you writing to the stream string by string?. Or are you constructing a StringBuilder/Buffer and flushing the stream at the end.

3. What is the JSP buffer size you have given?

4. What is the buffer size of the outputstream you are using.

Best way to check if browser is a problem!!!
1. Just copy paste your source code as static page and try accessing it in webpage. Put this html in your webserver and access it. If it can render in less than your jsp, we can think of tuning your JSP.

~Rajesh.B
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!