English 中文(简体)
YSlow替代方案-小型网站的优化措施
原标题:
  • 时间:2009-01-22 11:22:47
  •  标签:

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.

  1. What rules of YSlow should I adhere to?
  2. Are there alternative tools for smaller sites?
  3. What is the check list I should apply before rolling out my application?

我正在使用ASP.net。

最佳回答

Intranet网站的带宽根本不应该是问题(除非您有VPN用户)。如果您没有,但它仍然很慢,那可能是与后端而不是面向前端的结构有关。

如果你尝试为远程用户进行优化,一些同样的事情适用于尝试优化整个事情:

  • 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.
问题回答

开始,

  1. 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

  2. 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在写这篇文章时已经发表了一个答案,我必须同意带宽考虑在内部网络应用程序中应是次要或第三要考虑的。

自我提问后,我发现了Page speed。它不是为较小的网站设计的,但它是另一个很棒的火狐插件。

更新:从2015年6月开始,Firefox和Chrome的页面速度插件不再得到维护和提供,取而代之的是Google建议使用网页版。

Pingdom工具提供了一个快速的测试,可用于任何公共可访问的网页。





相关问题
热门标签