• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP Loading Time

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Manjit Barman
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic