问题
I am developing a small intranet based web application. I have YSlow installed and it suggests I do several things but they don't seem relevant for me. e.g I do not need a CDN. My application is slow so I want to reduce the bandwidth of requests.
- What rules of YSlow should I adhere to?
- Are there alternative tools for smaller sites?
- What is the check list I should apply before rolling out my application?
I am using ASP.net.
回答1:
Bandwidth on intranet sites shouldn't be an issue at all (unless you have VPN users, that is). If you don't and it's still crawling, it's probably something to do with the backend than the front-facing structure.
If you are trying to optimise for remote users, some of the same things apply to try and optimise the whole thing:
- Don't use 30 stylesheets - cat them into one
- Don't use 30 JS files, cat them into one
- Consider compressing both JS and CSS using minifiers or the YUI compressor.
- Consider using sprites (images with multiple versions in - eg button-up and button-down, one above the other)
- Obviously, massive images are a no-no
- Make sure you send expires headers to make sure stylesheets/js/images/etc are all cached for a sensible amount of time.
- Make sure your pages aren't ridiculously large. If you're in a controlled environment and you can guarantee JS availability, you might want to page data with AJAX.
回答2:
To begin,
limit the number of HTTP requests made for images, scripts and other resources by combining where possible. Consider minifying them too. I would recommend Fiddler for debugging HTTP
Be mindful of the size of Viewstate, set EnableViewState = false where possible e.g. For dropdown list controls that never have their list of items changed, disable Viewstate and populate in Page_Init or override OnLoad. TRULY understanding Viewstate is a must read article on the subject
Oli has posted an answer while writing this and have to agree that bandwidth considerations should be secondary or tertiary for an intranet application.
回答3:
I've discovered Page speed since asking this question. Its not really for smaller sites but is another great fire-bug plug-in.
Update: As of June 2015 Page Speed plugins for Firefox and Chrome is no longer maintained and available, instead, Google suggests the web version.
回答4:
Pingdom tools provides a quick test for any publicly accessible web page.
来源:https://stackoverflow.com/questions/468739/yslow-alternatives-optimisations-for-small-websites