So I had the time and figured I’d try out Ext.Direct and see what
happened. A little background on what this is: ExtJS uses the traditional AJAX
calls to communicate with the server, and that’s definitely the easiest way to
execute calls. The issue comes up when you have a bunch of little calls that
need to be executed on page load. For example, on the tool I'm developing I have 16
stores that each make their own call to ColdFusion to populate their data (little things like dropdown stores, and bigger things like stores that are used to populate the actual interface etc). After a certain number of calls
that are executed concurrently, the browser itself will STOP making calls so as
to not flood the server with hits (essentially stopping itself from being a mini Denial of Service
attack). The problem with this is, depending on how many calls you make at once
it can take a while to get everything needed back.
So Ext Direct is one method of getting around this. It sets
up an API that allows for the database to accept a bundle of calls and then
distribute those calls as necessary to the different functions on the server
side. Then it bundles those results into one result back to the browser,
getting around that browser restriction that they all have. There are other
features but that’s the one I’m talking about for the timing breakdowns.
Anywho, I put together some metrics since I compiled
everything from my master branch and then a separate compilation for my master-ExtDirect
branch. I did a few runs each for refreshing application data (clearing the
cache in ColdFusion), and then for just going to the page (no f5, just hitting enter. There
is a difference ;)) Also Firebug uses 2 different times. One from total time
executing and another from page hit to ‘onload’
execution,.
Using ExtDirect: Total/Onload
- appRefresh Average: 1063.5ms/937.5ms
- Page Hit Average: 926ms/893.25ms
Regular AJAX calls: Total/Onload
- appRefresh Average: 3200ms/771.33ms
- Page Hit Average: 2770ms/883ms
So what this really says is that the onload times are pretty
much the same for each, which makes sense since all you are doing is loading JavaScript files and I already have that compiled in one nice and pretty file (thanks to JSBuilder! But this is actually part of another blog post due to 'issues' around loading of packages and executing the addProvider function). The real benefits show up
on the total time. Ext Direct is faster by almost 2 seconds in both scenarios. I
know that doesn’t sound like much, but if it’s 2 seconds faster in our closed
and ‘perfect scenario’ network, imagine how much faster it can be out there in
internet land. Pretty slick stuff ;)