Sunday, March 11, 2012

Combining all AXD scripts into one?

Hate to bump this, but does anyone have any insight on this? I am finding it difficult to believe that the framework doesn't support rolling up the axd's into one when there are 15 that are rendered currently for our application. This is bad design as would be stated on any speed test and tweeks for performance improvements.

Thanks,
Matt


If you run the scriptmanager in 'Release' mode instead of 'debug' then you will find that all of the white space is taken out and the scripts are significantly smaller...think all of them combined are only 18-20kb...versus the 120 for the debug versions of the scripts...

There is nothing to prevent you from combining them all - and no its not really bad design actually. Not every one will need every script. So whats the point of downloading one huge one when you need a subest of them. Besides - they will only be downloaded once if users aren't using 'check every page refresh' - so in most enviroments you will be fine...

But - if you take a look at the migration doc and the whitepaper it is explained how to override the .js so that you can roll your own and send that instead...


Actually it is bad design. I am not talking about keeping all of the scripts, I am talking about rolling the scripts that are used into one AXD. Multiple requests to any server is bad design when it can be prevented. If you have to download all of the scripts for the page to work it makes complete sense to have the scripts come down in one file. Multiple just adds time, not convienience. We host 16 webservers with millions of hits per day and hundreds of thousands in transactions a single js IS the solution on this.

Figured I would go ahead and post our solution.

We had 15 axd's being pulled down on the initial page load for our MS Ajax implementation. The total size of the files with compression was 82.614k. Maybe this is small, but for dialup users this is somewhat large. The file size isn't as much of the killer as is the 15 requests.

Our file size is now 49.982kb (~40% reduction) and we only have 4 requests for axd's. We would have less on the size & requests, but the MS Ajax framework is 3 of those requests and we cannot modify how those AXD's are handled easily. We stuck with modifying how the Ajax Control Toolkit scripts are handled. We also compressed all of the compiled js files by removing all char returns, comments, extra whitespace. Our time improvement on dialup was quadrupled because of all of these changes Broadband users see an avg. decrease of about 8-10 seconds on initial page load. This is out of a total of about 15 seconds for load time. We are almost under the 4 second rule for page load time.

We had to make this specific for our company and is somewhat cumbersome to do if there is a new release. This performance is a must have for MS Ajax. If everything were ableto be rolled into one axd we would see even less time on page load.

Just my $.02

Matt


P.S. I am not seeing any whitespace removal in the axd's when the site is compiled as a release. The size doesn't change. We are using compression which does get used if debug is set to false in your web.config. If I am missing something, please let me know.

No comments:

Post a Comment