• 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

Multiple submits and performance?

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have three related questions:
1) When I click a commandLink that performs an action (as shown below), I can see the "autocomplete" method behind the suggestion box getting run twice. I've noticed this a few times, the server seems to run things twice (gets, sets and what have you). Any ideas why and how to stop it?

2) The page has more that one such suggestion box and some can return up to 6,000 items (a lot, I know). If I type into the inputBox, response is reasonable enough but I notice a long delay (10 seconds or so) between my server code finishing its work and browser updating if I demand the full list. That data is just an ArrayList of a SelectItem equivalent and I am trying to figure out where the problem is. RichFaces framework (doubtful)? Network (I don't think so, all machines are local i.e. on my desk), browser JavaScript?

3) Are there any good links to general performance advice? I know I can (and should) set up event queues to stop the server becoming flooded, I am wondering what else I can do.

I am still reading all the documentation I can find, but I can see these performance issues being critical.

Thanks!
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
get/set methods are typically invoked multiple times in the JSF lifecycle, which is why they should not have side-effects.

6000 items in an update is WAY too much, however. I'm suprised you can turn a page around in less than 10 minutes. And I'd hate to be the person who had to read such a monster.
 
Jason Irwin
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
6,000 items is, I agree, excessive from a UI standpoint; but it is what I am being asked to provide.

6,000 items, about 48 characters apiece, that's around 280k.
The RichFaces generated web page is weighing in at around 517k (that's scripts, images, everything bar the selection items).

Compared to the page load time (a second or so), the load time for the items is excessively slow (10 seconds as I said). I swapped to the NEKO parser (and had some fun trying to figure out the dependencies that weren't documented, not that I saw anyway) to see if that helped, but I don't think it did.

My crude timings show that most time is lost in the client-side processing, so I guess I am just going to have to try and make them understand why they don't need all 6,000 items with a rich:suggestionbox.

Thanks for the reply. I would love to cut out the duplicate processing as far as possible.
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you work with AJAX suggestions, the best thing you can do is feed it in small chunks. Generally, you don't make any suggestions at all until about 3 characters have been entered, just to keep from killing client, server, and network. After 2-3 characters, you've usually reduced the number of potential candidates to a more reasonable number. The exact strategy would vary depending on the size and distribution of the suggestible data.
 
Jason Irwin
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's exactly my plan, if I can get agreement on it. About 3 characters cuts the data down far enough that response is acceptable.

Thanks again.
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic