# Architectural question reg acts\_as\_tree (+ caching?)

**URL:** <https://www.ruby-forum.com/t/architectural-question-reg-acts-as-tree-caching/185542>\
**Category:** Rails\
**Created:** [March 22, 2010, 2:42pm UTC](https://www.ruby-forum.com/t/architectural-question-reg-acts-as-tree-caching/185542 "2010-03-22T14:42:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [March 22, 2010, 2:42pm UTC](https://www.ruby-forum.com/t/architectural-question-reg-acts-as-tree-caching/185542/1 "2010-03-22T14:42:10Z")

</div>

hi,  
in one view i use a partial to render children and each children renders  
the  
same partial again and again and again to display a tree. now, the model  
utilizes acts\_as\_tree, the table consists of ~4500 records, but it will  
go  
higher, final amount estimated to 10k. now my problem is, that it takes  
forever to display the site. right now its all in dev-mode, and im still  
a  
newbie.  
so i dont know whether caching would be the best solution here or rather  
do  
a remote call to pull the children the user wants…  
any experience / advise?

thx

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [March 22, 2010, 3:58pm UTC](https://www.ruby-forum.com/t/architectural-question-reg-acts-as-tree-caching/185542/2 "2010-03-22T15:58:42Z")

</div>

I think you’d want to look into a “load on demand” approach…

Why marshal up all the data for all the nodes when most won’t be  
visible? I’m assuming you show the subsidiary level(s) collapsed by  
default…

Smells like a perfect situation for some AJAX implementation.

I’m not sure caching is the route to go. Caching would probably yield a  
much faster response after the initial load, but that is still a lot of  
data to push to the client when the client will only be seeing a small  
part at any one time.
