Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I optimize my website for slow data connections?

The solutions here worked fine however they were quite labour intensive. To anyone looking to perform similar enhancements on old asp.net solutions I would highly recommend switching the project to MVC just to take advantage of the script and style bundling. .aspx files work as expected in MVC projects.


I'm about to start work on performing some performance enhancements for one of our products. Our users connect to the network using radio which is extremely slow. The main bottlenecks in the application are the network and the database. I am going to be focusing on reducing the network footprint of the application.

I am going to start with a few "quick wins" before I get down to the nitty gritty of tearing apart UpdatePanels, removing unnecessary content and whatever else I can think of. Right now I have a few things that I think I'm ready to implement
These include

  • Minifying and combine css Using This
  • Minifying and combine js same as above
  • Removing excess whitespace from html sent to client. Using this

Edit : The assets minification and white space cleaning tools work quite well together.

However I have a few things that I'm not sure how I'll address.

  1. Some microsoft resources (WebResource.axd?d=blahblah and ScriptResource.axd?d=blahblah) are not minified. This and This and a few others depending on the page. Microsoft.Ajax is fine though. How can I manually minify these files if they aren't being minified automatically? Am I missing a setting somewhere?

  2. Is it possible to combine the microsoft resources into a single js file with my javascript?

  3. 401 errors, In fiddler I can see that my first hit to the website always gives a 401 error it is immediately followed by the normal 200. Also other resources will randomly have a 401 on their first call as well. Is this some sort of IIS setting that needs to be configured to remove this unneeded call?

  4. Javascript inside aspx files. Unfortunately we have a lot of js inside our aspx files as well as a lot of javascript that gets rendered using ScriptManager.RegisterStartupScript in our code behinds. How would I go about minifying javascript within <script> tags in the aspx markup?

  5. Favicon, can this be diabled? If not what's the next best thing?

Update

  1. Mads Kristensen's combiner works great. However I've found that there are issues with some pages that include 14+ axd references produce a 404.15 error (query string is too long, ie only bug) My solution for this was to gzip and base64 encode the query string.

  2. I've found that combining my js includes with the .axd files is a fruitless task as the .axd files are different for each page. Having my static js files seperate produces an extra service request but it will remain cached on the client instead of having the client redownload those scripts as a part of the combined js axd file.

  3. I enabled anonymous authentication. No more issues.

  4. No progress.

  5. I've found that putting favicon.ico at the root is necessary. I think this may be just because of the way my application has been designed though.

like image 570
Biff MaGriff Avatar asked Aug 05 '11 18:08

Biff MaGriff


People also ask

How can I increase my website mobile speed?

Compress everything that you can. Compression helps increase page speed by saving bandwidth. Gzip compression is one way to compress files, and it can be set up on most servers, but other options are available. You can also run most code through a minification process, which reduces the size of the final transfer file.

What makes websites load slowly?

Slow site speeds can result from network congestion, bandwidth throttling and restrictions, data discrimination and filtering, or content filtering. If you notice slow speeds when visiting your site, you can run a traceroute between your computer and your website to test the connection.


1 Answers

Merging Microsoft script resources: Check out my ContentGator project which I've used to intercept requests for the WebResource (and other scripts and css) files and merge them together. I haven't updated it in a couple years, so I can't speak to how well it'll work out of the box, you should at least be able to reuse some of the code. I don't think I remember adding minification, but you should be able to add it in pretty easily. I think it also has either hooks into RegisterStartupScript, or an alternative to it, where again you should be able to wire in minification.

Favicon, as far as I know, cannot be disabled, as it is requested by default by the browser. If you really don't want it, you could probably just put up a 1x1 pixel ico so you aren't serving a 404, and subsequent requests will result in a 304. It wouldn't hurt to use a CDN for this and all your other static resources as well.

Additionally, check out http://developer.yahoo.com/yslow/ for other more general web optimization tips.

Other things off the top of my head:

  • Use sprites for images when possible
  • Output Caching
like image 83
Daniel Schaffer Avatar answered Oct 23 '22 12:10

Daniel Schaffer