Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Performance Issue: JSP response rendering

Thread view: 
parkarumesh@gmail.com - 08 Oct 2007 14:22 GMT
Hi All,

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.

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.

Thanks in advance
Juha Laiho - 08 Oct 2007 16:37 GMT
parkarumesh@gmail.com said:
>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.

You've already begun to distinguish what your problem is; just
continue further on that path. Hope this message helps in that.

>To elaborate, I am providing the following code snippet
>
[quoted text clipped - 37 lines]
>
>But to render the complete on browser it takes more than 1 minute.

... so, you've shown that your JSP takes 4-5 seconds (which is a high time
in itself!). Yet what is dipslayed on browser takes a lot longer.
Now, where is the problem? In the JSP? No. In the generated HTML? Yes.

>Why is that JSP is taking so long time to just render the HTML string?

How about cutting the JSP completely out of the question: save the page
to a local HTML file. Then load it locally with the browser. Is it still
slow (when it does not make any calls to the browser)? I assume it is
(and if it isn't, it may be some cache playing tricks).

>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?

Whatever it is, it isn't dependent on your JSP or Java code; it's
dependent on what you generate to the browser. Somehow you've
managed to design a page structure that is extremely heavy for the
browser to render. What is needed is to look not at the JSP but
at the complete genrerated HTML and deduce what exactly makes it
heavy.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

mark.donaghue@gmail.com - 08 Oct 2007 22:16 GMT
> parkarum...@gmail.com said:
>
[quoted text clipped - 76 lines]
>          PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
> "...cancel my subscription to the resurrection!" (Jim Morrison)

FWIW, I've heard the IE has difficulty rendering extremely large
tables. I would give it a shot in another browser like Firefox and see
if you get similar results.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.