1

I'm developing an API that has a tree hierarchy. I thinking of supporting asynchronous load of all the nodes in the tree, and I'm not sure if it's a good idea. I'm planning on using reactive extensions for this.

Each node has a Load method which won't complete until all its child-nodes has been loaded (things are loaded depth first). So for a simple structure:

1
|-- 1.1 
| |- 1.1.1
| |- 1.1.2
|-- 1.2
  |- 1.2.1
  |- 1.2.2

Node 1 loads 1.1 and 1.2 asynchronously and waits for them to complete, which in turn loads 1.1.1, 1.1.2, 1.2.1, 1.2.2... so that is 6 asynchronous load operations. The tree can have potentially 10 000 nodes... that's a lot of asynchronous load operations - Question 1 - will this create problems?

I want to implement this in a way where I can spread the load across a certain time-span, so the user can tweak load time to avoid the application freezing if a lot of nodes needs to be loaded at once. Question 2 - How would I go about doing this in reactive extensions? What components do I need to look into, custom observables, subjects? Not sure where to start.

Pking
  • 953
  • 1
  • 14
  • 33

1 Answers1

1

My initial thoughts are to use Observable.Join patterns ... consider my answer here (and the link provided to an example, here: https://stackoverflow.com/a/3868608/13131) https://stackoverflow.com/a/16462959/13131.

HTH

Richard Anthony Hein
  • 10,550
  • 3
  • 42
  • 62