优化以减少网站加载时间 [英] Optimizations to reduce website loading time

查看:115
本文介绍了优化以减少网站加载时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以对网站进行一些重要的优化以减少加载时间?

解决方案

删除/最小化任何瓶颈在服务器端。为此,使用类似Xdebug或Zend Debugger的分析器来确定应用程序在执行昂贵和缓慢操作的位置。尽可能实现缓存。使用OpCode缓存。如果这还不够快,可以考虑投资更多的CPU或RAM或SSD(取决于您是CPU,IO还是内存绑定)



对于一般服务器/客户端侧面优化,请参阅Yahoo YSlow!用户指南



它基本上总计为:



  1. 最小化HTTP请求

  2. 使用内容传送网络

  3. 添加到期或高速缓存控制标题


  4. 将StyleSheets放在顶部

  5. 将脚本放在底部

  6. 避免使用CSS表达式

  7. 使JavaScript和CSS外部化

  8. 减少DNS查询


  9. 避免重定向

  10. 删除重复脚本

  11. 配置ETags

  12. Make AJAX Cacheable

  13. 对AJAX请求使用GET

  14. 减少DOM元素数量

  15. 否404s

  16. 减少Cookie大小

  17. 将无Cookie网域用于组件


  18. 不要在HTML中缩放图片

  19. 使favicon.ico小巧且可缓存




同时查看下面提供的评论,因为它们为其他用户提供了一些额外的有用信息。


What are some important optimizations that can be made to a website to reduce the loading time?

解决方案

Remove/Minimize any bottlenecks on the server side. For this purpose, use a profiler like Xdebug or Zend Debugger to find out where your application is doing expensive and slow operations. Implement caching where possible. Use an OpCode Cache. If this still isn't fast enough consider investing in more CPU or RAM or SSDs (depending on whether you are CPU, IO or Memory bound)

For general server/client side optimizations, see the Yahoo YSlow! User Guide.

It basically sums it up to:

  1. Minimize HTTP Requests
  2. Use a Content Delivery Network
  3. Add an Expires or a Cache-Control Header
  4. Gzip Components
  5. Put StyleSheets at the Top
  6. Put Scripts at the Bottom
  7. Avoid CSS Expressions
  8. Make JavaScript and CSS External
  9. Reduce DNS Lookups
  10. Minify JavaScript and CSS
  11. Avoid Redirects
  12. Remove Duplicate Scripts
  13. Configure ETags
  14. Make AJAX Cacheable
  15. Use GET for AJAX Requests
  16. Reduce the Number of DOM Elements
  17. No 404s
  18. Reduce Cookie Size
  19. Use Cookie-Free Domains for Components
  20. Avoid Filters
  21. Do Not Scale Images in HTML
  22. Make favicon.ico Small and Cacheable

Also see the comments contributed below, as they contain some additional useful information for other users.

这篇关于优化以减少网站加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆