?
Solved

Design how to display 10+K node large hierarchy structure

Posted on 2005-03-16
7
Medium Priority
?
164 Views
Last Modified: 2010-03-31
hi,

I have a design problem that needs some suggestions in it.

I need to show a large tree to the client for selection. The tree is so large that contains 10K nodes. If I store the tree in the session, it is not good for scalability. Besides, pulling out too much data from database at once may not be good as well. I am open for suggestion to minimize the impact to my site. If there is link to some products or open source project that will be great! I want to focus on performance and scalability. Technologies are open for suggestion, like applet, javascript, DHTML, Servlet...

thanks

ray

0
Comment
Question by:rayhon88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 13557044
>>If I store the tree in the session, it is not good for scalability.

In what way?
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13557214
Does the tree-structure change between users?

If it doesn't, put it in the application scope?

If you can't, look at caching like osCache from opensymphony http://www.opensymphony.com/oscache/ which alows you to store data in session scope but for a shorter period than the duration of the session, e.g. in the session scope but only for 6 minutes.
0
 

Author Comment

by:rayhon88
ID: 13560003
hi, CEHJ

Because it is in the clustered environment. If I put a tree with 10K of nodes in the session, it will be very costy for session in-memory replication.

ray

0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Accepted Solution

by:
java_dev earned 1000 total points
ID: 13562641
It sounds to me like you are describing requires a lazy loader. Rather than load the entire tree from the database, just get those records that the user cares about. This would involve initially showing the children of the root node, and then when the user selects one of those nodes, you retrieve the information from the database for that node's children.

If you don't want to build this yourself, you might be able to find a open source or commercial widget to do this. I did a very brief search for "lazy load jsp tree" and found this link...

http://www.jscape.com/webgalileofaces/

It uses JSF, and I can't say for sure if it will work for you. It does support both lazy loading on the client and the server. Here's the link for it's tree features http://www.jscape.com/webgalileofaces/tree.html

Good luck
0
 

Author Comment

by:rayhon88
ID: 13584861
I decide to drop the tree approach. In exchange, I use the window-like UI.

     A
   /  /\
  B  C  D
     /|\
    E F G
       |
       H


node C will be display as:

A/B/C <-- a path which is clickable, that can be used to go back to the previous node
------------
E
F  <-- display folder image means it has children
G

With this display, i can use lazy loading approach. Subnodes are loaded when the folder is clicked.

However, I need to do some manipulation like selecting a node and move it to the right panel. The drawback is each click on the arrow will trigger a round trip to the server. and the state of the right hand panel need to put in the session.

=========================
|                   |               |                |
|                   |               |                |
|                   |       >      |                |
|                   |               |                |
|                   |       <      |                |
|                   |               |                |
|                   |               |                |
=========================

any comment of the new design?

thanks

ray




0
 

Expert Comment

by:java_dev
ID: 13592528
I like the "path" approach, not only does it give you lazy loading, but also gives your user a way to return to any one of the previous "parent" nodes.

As far as the "round trip to the server" issue, perhaps you could use cookies to store the "selection", rather than putting it into the session. Once the user is done selecting nodes, you can provide a "finish" button that the user presses, which when submitted uses the cookie value (which contains all of the user selections). You would only need to store the values of the node ID's in the cookie, and you only need one cookie for all the nodes. This cookie could contain a comma separated list of node ID's (or whatever separator you care to use).

0
 

Author Comment

by:rayhon88
ID: 13596356
good to know that you like this approach. However, to leverage cookie may not be ok b/c we don't know whether users have turned off the cookie. I want to have a solution that works without relying on anything that may cause problem in the user side.

ray
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question