网站优化有多重要?
目前我正在运行 Apache 和 MySQL,我听到人们谈论 GZipping 内容、ETags、使用 CDN、添加过期标头、缩小文本文档、组合脚本文件等。我下载了一个名为 YSlow 的 Firefox 插件,然后我注意到许多网站并未采用所有这些策略。我相信即使是 Google 也有 D 评级。所以我问,这些优化有多重要?
Currently I am running Apache and MySQL and I hear about people talking about GZipping content, something about ETags, using a CDN, adding expire headers, minifying text documents, combining script files, etc. I downloaded a Firefox add-on called YSlow and I noticed that many websites do not employ all of these tactics. I believe even Google has a D rating. So I ask, SO, how important are these optimizations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它们高度依赖于您的流量和您可以使用的资源。
如果您在一个偏僻的地方为 Joe's Pizza 创建网站,则没有必要浪费时间优化网站,它可能每天都会有少量的访问量。
但 Stack Overflow 每分钟收到数千次点击(可能更多),因此他们使用 CDN、远程过期标头、缩小等。
They depend highly on your traffic and resources at your disposal.
If you make the website for Joe's Pizza in the middle of nowhere, there is no real need to waste time optimising the site, it will likely have a handful of visits a day.
But Stack Overflow receives thousands of hits a minute (probably more), so they use a CDN, distant expiry headers, minification, etc.
老实说,如果人们没有抱怨,那可能没什么大不了的。如果人们抱怨,请先查看数据库。
在我多年的 Web 开发生涯中,大多数 Web 应用程序性能问题都源于数据库(这并不意味着所有性能问题都来自数据库,但它是一个很好的起点)。虽然我对缩小的 JS 和 CSS 精灵之类的东西很着迷,但我怀疑这些东西不会对“普通 Web 开发人员的一天”产生影响。
考虑这些事情是件好事,但除非您在流量极高的网站上工作,否则可能不会产生任何影响。
Honestly, if people aren't complaining it's probably not a big deal. If people are complaining, start by looking at the database.
In my years of web development most web application performance problems have stemmed from the DB (this doesn't mean that all performance problems come from the DB but it's a good place to start). While I am fascinated for things like minified JS and css sprites, I suspect that these things do not make a difference in a "day in the life of your average web developer".
It's good that you consider these things, but unless you are working at an extremely high traffic site, it probably won't make a difference.
这一切都取决于您的应用程序。
例如,缩小对于非常依赖外部 .js 的应用程序可能非常有用。没有理由不这样做——不需要任何开销,并且可能节省相当多的字节。
压缩对于某些内容类型来说非常有用,但对于其他内容类型来说却很糟糕,并且在传输页面时会产生轻微的开销。
CDN 取决于您的承受能力、内容类型以及内容的动态程度。您显然不需要 Akamai 来备份普通的 Drupal 站点。
等等,等等,等等
It all depends on your application.
Minifying, for example, might be great for an application that is very external .js dependent. There is no reason NOT to do this - there is no overhead required and it potentially saves quite a few bytes.
Compression is great for certain content types - terrible for others and involves a slight overhead while transporting pages.
CDNs are up to your affordability, content type and how dynamic the content is. You obviously don't need Akamai backing up the average Drupal site.
etc, etc, etc