Performance work on the run-up to Rails 2.0

May 21, 2007 on 11:26 pm | In ajax, http |

By way of the Ajaxian coverage of RailsConf 2007, it looks like the next major release of Rails will have two key performance improvements we’ve discussed here.

First up is JavaScript and CSS streamlining where all scripts and stylesheets linked to a document can be combined and gzipped with one command:

<%= javascript_include_tag :all, :cache => true %>
<%= stylesheet_link_tag :all, :cache => true %>

I discussed this technique briefly most recently here, though really that post is just a link to hard work done by someone else. As a refresher, this technique is useful because it reduces both the total bytes downloaded and the number of round trips to the server. As we continue to see, the best way to reduce the load time of a page is to reduce the number of trips back to the server. This is especially true in the case of JavaScript as these server requests are serialized, so we get no benefit from connection parallelism.

Speaking of connections, the second performance trick in Rails 2.0 implements the host renaming technique I discussed in detail here. The config syntax looks like this:

config.action_controller.asset_host = 'assets%d.highrisehq.com'

I have not seen a more detailed transcript of the presentation, but I hope the asset mapping is smart enough to remember what objects were mapped to what connections. That could lead to suboptimal balancing of connections used on a given page, but the alternative (potentially remapping objects to different hosts on each page) would blow caching all to hell.

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^