File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP Loading Time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Loading Time" Watch "JSP Loading Time" New topic
Author

JSP Loading Time

Manjit Barman
Greenhorn

Joined: Apr 04, 2005
Posts: 25
Hi All,
Here is the Problem:
I have couple of Java Serializable objects, which i am calling from JSP to display some reports based on some criteria. In the code snippet below, Report is one of the Java Serializable object. Report in turn call some other Java Objects.
Now, it takes me more than 6 minutes to load the JSP page which display reports calling the Report Java Object.

can anybody give me some tips on that??


Here is a code snippet for your reference! Any help would be appreciated!


<der:getreports connection="<%= conn %>" user="<%= admin %>" target="report">
<%
//if (((Report) pageContext.getAttribute("report")).currentStatus() < ReportHistory.ASSIGNED_TO_ENGINEER || (((Report) pageContext.getAttribute("report")).currentStatus() < ReportHistory.COMPLETED && ((Report) pageContext.getAttribute("report")).engineersAvailable(conn)))
if (((Report) pageContext.getAttribute("report")).currentStatus() < ReportHistory.ASSIGNED_TO_ENGINEER || (((Report) pageContext.getAttribute("report")).currentStatus() < ReportHistory.COMPLETED && ((Report) pageContext.getAttribute("report")).engineersAvailable(conn)))
{
recordsFound = true;
%>
<tr>
<td class="resultgrid" bgcolor="#<%= highlight ? "F0F0F0" : "FFFFFF" %>" nowrap="nowrap"><a title="Click to View Original Report" href="javascript: popUpInfo('submission', <%= ((Report) pageContext.getAttribute("report")).getId() %> ; "><%= ((Report) pageContext.getAttribute("report")).getId() %></a>  </td>
<td class="resultgrid" bgcolor="#<%= highlight ? "F0F0F0" : "FFFFFF" %>" nowrap="nowrap"><a title="Click to View Contact Info" href="javascript: popUpInfo('contact', <%= ((Report) pageContext.getAttribute("report")).getId() %> ; "><%= ((Report) pageContext.getAttribute("report")).getUser().getFirstName() %> <%= ((Report) pageContext.getAttribute("report")).getUser().getLastName() %></a>  </td>
<td class="resultgrid" bgcolor="#<%= highlight ? "F0F0F0" : "FFFFFF" %>" nowrap="nowrap"><a title="Click to View Equipment Info and Problem Description" href="javascript: popUpInfo('equipment', <%= ((Report) pageContext.getAttribute("report")).getId() %> ; "><%= ((Report) pageContext.getAttribute("report")).getEquipment().getName() %></a>  </td>
<td class="resultgrid" bgcolor="#<%= highlight ? "F0F0F0" : "FFFFFF" %>" nowrap="nowrap" align="right">
<%
if (((Report) pageContext.getAttribute("report")).engineersAvailable(conn))
{
%>
<%= ((Report) pageContext.getAttribute("report")).currentStatus() >= ReportHistory.ASSIGNED_TO_ENGINEER ? "<a title=\"Click to View Assigned Engineers\" href=\"javascript: popUpInfo('engineers', " + ((Report) pageContext.getAttribute("report")).getId() + "); \">*</a> " : "" %><select name="assign_engineer_<%= ((Report) pageContext.getAttribute("report")).getId() %>" size="1">
<option value="-1" selected="selected">- Choose Engineer -</option>
<der:getengineers connection="<%= conn %>" department="<%= ((Report) pageContext.getAttribute("report")).getDepartment() %>" category="<%= ((Report) pageContext.getAttribute("report")).getEquipment().getCategory() %>" target="engineer">
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Manjit,

There are two things you can do to make this code more easily read by everyone at Javaranch.

1.) Use the UBB Code tags at the beginning and end of your code.
This preserves the indenting.

2.) At the bottom of the edit page is a checkbox for disabling those annoying smilies ( ).

Making it more legible means more people are likely to read it and lend a hand.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Manjit Barman
Greenhorn

Joined: Apr 04, 2005
Posts: 25
Sure, i will do that! Thanks!






[ May 05, 2005: Message edited by: Manjit Barman ]
[ May 05, 2005: Message edited by: Manjit Barman ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If the number of reports is small and each one is hit often,
you might want to consider caching them.

Is the serialized object calling other serialized objects?
How much data are you talking about?

Are you allocating enough memory for the server to work with this app (is the machine swapping/paging)?

I don't suppose re-writing this to use a relational database is on the table?
[ May 05, 2005: Message edited by: Ben Souther ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

One thing that jumps out is the number of repeated casts combined with getAttribute calls. This can be expensive (both on the CPU and the eyes).



The Report object can be pulled from page context and downcasted once, then assigned to a variable.


[ May 05, 2005: Message edited by: Ben Souther ]
[ May 05, 2005: Message edited by: Ben Souther ]
Manjit Barman
Greenhorn

Joined: Apr 04, 2005
Posts: 25
Dear Ben,

Is the serialized object calling other serialized objects?

YES ! This application has 9 serialized object which is being called by the Report seialized object. If you don't mind and curious to know, i can send you a java file if i have your email id ?

How much data are you talking about?

Right now we have around 1600 records in the database. But its going to increase.

Are you allocating enough memory for the server to work with this app (is the machine swapping/paging)?
YES

I don't suppose re-writing this to use a relational database is on the table?
I am not sure

Thanks a lot!

[ May 06, 2005: Message edited by: Manjit Barman ]
[ May 06, 2005: Message edited by: Manjit Barman ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Loading Time
 
Similar Threads
Display error message in div tag
Display error when record not found
When Validation Error I Lose My Bean Value-Struts 2
Html to database
Menu positioning