# Loading page components asynchronously

**URL:** <https://www.ruby-forum.com/t/loading-page-components-asynchronously/113220>\
**Category:** Rails\
**Created:** [August 28, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/loading-page-components-asynchronously/113220 "2007-08-28T23:34:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [August 28, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/loading-page-components-asynchronously/113220/1 "2007-08-28T23:34:52Z")

</div>

I’m debating as to whether to use ajax to load parts of the page  
asynchronously. It would make the view layouts much easier to work  
with and result in less code. We have a lot of different widgets that  
can get displayed in different combinations on different pages. Views  
usually have forms that need to submit to various controllers. For  
example say we have a user profile page. There are links and forms to  
edit various types of content such as files, blogs, settings  
information, etc… So we need to have forms that submit to any  
number of different controllers yet keep the same view layout in place  
regardless of what controller they are hitting. So far I’ve been  
using some before filters to set the layout, using the referring url  
to redirect back to, etc… It works but it could be a lot cleaner  
with ajax.

My concern is the type of traffic this is going to put on our mongrel  
clusters. The requests will be smaller and do less work, but I have a  
feeling that the per request overhead is going to start adding up.  
On the other hand I can see ajax making certain things easier to  
scale. In most large apps I’ve worked on you eventually start to use  
parallel requests to aggregators/caches of some type in the web app.  
Ajax kind of gives this to you for free in a way, but I have no  
experience actually implementing it on a large scale.

Thoughts?

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [August 28, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/loading-page-components-asynchronously/113220/2 "2007-08-28T23:47:54Z")

</div>

> using some before filters to set the layout, using the referring url  
> experience actually implementing it on a large scale.
> 
> Thoughts?

Dunno, but you might find this interesting…

> **[Advanced Rails Caching.. on the Edge](http://revolutiononrails.blogspot.com/2007/08/advanced-rails-caching-on-edge.html)**
>
> When trying to scale a portal to millions of users with complex personalization, we had to rethink the application design. We needed partial...

Or not. 🙂
