• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

performance issue with large collections of data

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a performance issue when using Struts in the following situation:

Some of our screens display one or more lists of data. These lists are only for display purpose and every time a request is sent to the server, the data for the lists will be read again.

Unfortunately, when a request is sent back to the server, all the data on the screen (that is defined in the ActionForm) will also be sent back to the server - including the lists.
This is not a problem when the lists are small, but when they contain a lot of rows, it takes a long time to 'pack' the data and sent it off.


Is there any way I can tell Struts not to send the list data back to the server?
or is there any way I can remove data from the actionForm manually (i.e. using a javascript function)?
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't call the same action again for the second request. Have a different action with a different form (or form name) for the second action.
 
Mette Russell
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Don't call the same action again for the second request. Have a different action with a different form (or form name) for the second action.



Sorry, but I'm not sure I understand your suggestion - maybe because I'm fairly new to Struts.
I'm trying to 'patch' an existing Struts application, so I'm not too interested in changing a whole lot of "infrastructure".

Back to your suggestion.
How exactly would I call another action with another form for the second request? Can I define 2 forms in my html (and thereby call another action)?

BTW, my form contains other data than the lists - and this data the server needs in order to fulfill my request.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Couple of things, if you don't want the values sent back to the application server, why are you displaying them in input fields? If you just display them as straight text then they won't be submitted with the form.

If you are required to display them in input fields you could use standard html (not struts custom) tags for the inputs <input type=.../>. Then you could use a bean:write or a nested:write to set the value of the input field value=<bean:write.../>. The only other consideration would be to make sure the name of the input fileds you make doesn't match the name of any fields in your form. The data will still be sent to the app server in the request but struts won't populate it from the request object, hopefully this will help your performance.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Explain exactly what the performance issue is.
 
Mette Russell
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some more detailed info.

Often my jsp pages contain one or more listboxes. The listboxes are populated thru a generic ListObject in the ActionForm:

Here is the definition in my actionForm ....
public class KonterkodeActionForm extends SuperActionForm {
private String konterkode = "";
private String konternavn = "";
private ListObject konterlinie = new ListObject();
.......

and here is the ListObject class ....
public class ListObject {

private Log log = LogFactory.getLog(this.getClass());
private Vector rows = new Vector();
private String selectedValue = Constants.EMPTY_STRING;
private String[] selectedValues = new String[]{};
private Vector headers = new Vector();
private String name = null;
private int noOfColumnNo = 0;
 
Mette Russell
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some more detailed info.

Often my jsp pages contain one or more listboxes. The listboxes are populated thru a generic ListObject in the ActionForm:

Here is the definition in my actionForm ....
public class KonterActionForm extends SuperActionForm {
private String konterkode = "";
private String konternavn = "";
private ListObject konterlinie = new ListObject();
.......


and here is the data in the ListObject class ....
public class ListObject {

private Log log = LogFactory.getLog(this.getClass());
private Vector rows = new Vector();
private String selectedValue = Constants.EMPTY_STRING;
private String[] selectedValues = new String[]{};
private Vector headers = new Vector();
private String name = null;
private int noOfColumnNo = 0;
........


In my jsp page I have the following code to display the list:
...
<table summary="" border="0" width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td class="subheading"><bean:message key="label.kde.konterLinie"/></td>
</tr>
<tr>
<td>
<html:hidden property="konterlinie.name" />
<html:hidden property="konterlinie.noOfColumns" />
<logic:iterate id="rows" name="konterActionForm" property="konterlinie.rows" indexId="count">
<input type="hidden" name="konterlinie.rowData[<bean:write name='count' />].combinedValue" value="<bean:write name='rows' property='value' />" />
<input type="hidden" name="konterlinie.rowData[<bean:write name='count' />].rowNumber" value="<bean:write name='rows' property='rowNumber' />" />
<input type="hidden" name="konterlinie.rowData[<bean:write name='count' />].combinedDisplayedValue" value="<bean:write name='rows' property='displayedValue' />" />
</logic:iterate>
<logic:iterate id="rows" name="konterActionForm" property="konterlinie.headers" indexId="count">
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].label" value="<bean:write name='rows' property='label' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].name" value="<bean:write name='rows' property='name' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].percentageWidth" value="<bean:write name='rows' property='percentageWidth' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].displayed" value="<bean:write name='rows' property='displayed' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].type" value="<bean:write name='rows' property='type' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].length" value="<bean:write name='rows' property='length' />" />
<input type="hidden" name="konterlinie.headerData[<bean:write name='count' />].decimal" value="<bean:write name='rows' property='decimal' />" />
</logic:iterate>
<table summary="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table summary="" width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<th class="selectheading" width="8%" align="right" height="20">
<bean:message key="label.list.konterkode.loenartnr"/></th>
<th class="selectheading" width="5%" align="left">
<bean:message key="label.list.konterkode.loebenr"/></th>
<th class="selectheading" width="4%" align="left" height="20">
<bean:message key="label.list.konterkode.debkre"/></th>
<th class="selectheading" width="22%" align="left">
<bean:message key="label.list.konterkode.kontonr"/></th>
<th class="selectheading" width="32%" align="left">
<bean:message key="label.list.konterkode.kontonavn"/></th>
<th class="selectheading" align="left" width="8%">
<bean:message key="label.list.setup.konterkode.afdeling"/></th>
<th class="selectheading" align="left" width="8%">
<bean:message key="label.list.setup.konterkode.udbetal"/></th>
<th class="selectheading" align="left" width="13%">
<bean:message key="label.setup.konterkode.indtastkode"/></th>
<th class="selectheading" align="left" width="11%">
<bean:message key="label.list.setup.konterkode.medkode"/></th>
</tr>
</table>
</td>
</tr>
<tr>
<td class="listborder">
<div style="overflow-y:auto;height:300px;width:725px" class="div">
<table summary="" class="valuelist" border="0" width="100%" >
<logic:iterate id="rows" name="konterActionForm" property="konterlinie.rows">
<tr>
<td class="listrow" nowrap>
<bean:write name="rows" property="displayedValue"/>
</td>
</tr>
</logic:iterate>
</table>
</div>
</td></tr></table></td></tr></table>.....


(Sorry, it's quite a long 'cut-out', but I hope you can read it. I have to admit that I'm not sure what exactly is going on, and if all the above code is necessary .... )

All this works fine when displaying data.
My performance problem arises when I submit the form to the server and there is a lot of data in the listbox.
I.e. it takes 4 - 5 seconds before the request hits the server with appr. 700 lines in the listbox.
I assume the time is spent 'packing' all the data and sending it.

I can't see that I'm using input text fields to display the data, but I do have some input hidden fields.
 
Mette Russell
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The good news is that the problem has been solved

By removing the iterations over the hidden fields connected to the list box, the performance problem went away - and everything seems to work anyway.

The bad news is that I have a lot of code to remove all over the system

Thanks for your suggestions that led me to the solution.

Mette
 
And then the flying monkeys attacked. My only defense was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic