1 / 23

WordPress 系统优化

WordPress 系统优化. 优雅、稳定、快速. 陈少钧 paveochen@72pines.com 2007 年 9 月 1 号北京. 优美、稳定、快速. WordPress 系统不仅是 WordPress 优雅 – 简单高效就是优美 稳定 – 任何时间、任何地点它都差不多 快速 – 让你的站点访问快如闪电. 捷径在哪?. 99% 的 WordPress 系统无需优化 WordPress 本身无需优化 选择合适的主机 选择 Linux. 噩梦. 好主机. Linux Apache MySQL PHP(mod or fcgi)

daria-downs
Télécharger la présentation

WordPress 系统优化

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WordPress 系统优化 优雅、稳定、快速 陈少钧 paveochen@72pines.com 2007年9月1号北京

  2. 优美、稳定、快速 • WordPress系统不仅是WordPress • 优雅 –简单高效就是优美 • 稳定 –任何时间、任何地点它都差不多 • 快速 –让你的站点访问快如闪电 七十二松 72pines

  3. 捷径在哪? • 99%的WordPress系统无需优化 • WordPress本身无需优化 • 选择合适的主机 • 选择Linux 七十二松 72pines

  4. 噩梦 七十二松 72pines

  5. 好主机 • Linux Apache MySQL PHP(mod or fcgi) • 合理的加速 – APC or eAccelerator 、Zend Optimizer • 相对可靠的网络 • 有信誉的专业主机提供者 • Apache 1/2,PHP 4/5,MySQL 4/5 • CPH主机现在大约 30 requests/sec • EACC = 70%性能提高 七十二松 72pines

  6. 优雅使用WordPress • 使用WordPress 2.2 • 轻量级的WordPress • 谨慎使用插件 • 使用官方的源代码 + 中文MO文件 • SSH and SVN • SVN –最方便的WordPress文件管理工具 七十二松 72pines

  7. 更多和更少 • 使用WP内置的缓存机制 • // Enable the WordPress Object Cache:define(ENABLE_CACHE, true); • 减少SQL查询 • 如果你的MySQL很好的支持InnoDB,那么请使用它 七十二松 72pines

  8. 安全 • Admin SSL • http://haris.tv/2007/04/24/admin-ssl-new-wordpress-plugin/ • 避免数据库问题(定期优化表和检查表) • PhpMyAdmin 七十二松 72pines

  9. 你的WordPress就是你的网站 • 来自Yahoo!的 14 Rules • 不要让你的站点让其他站点拖慢 • 合理使用图形格式 • 压缩静态文件(.js .css) • 推迟Javascript脚本(使用script标签的 defer属性) • <script src="script.js" type="text/javascript" defer="defer"></script> 七十二松 72pines

  10. 14 Rules for High Performance Web Sites • Rule 1 –尽可能减少 HTTP 请求 • Rule 2 –使用CDN • Rule 3 –添加 Expires Header • Rule 4 –压缩静态文件(Gzip) • Rule 5 –把CSS放到页面头部 • Rule 6 –把脚本移到页面底部 • Rule 7 –避免使用CSS表达式 • Rule 8 –让JavaScript 和 CSS 成为外部文件 • Rule 9 –减少DNS查询 • Rule 10 –尽量少用JavaScript • Rule 11 –避免重定向 • Rule 12 –移除重复的脚本 • Rule 13 –关闭 ETags • Rule 14 –把AJAX 脚本变小,让它可被缓存 七十二松 72pines

  11. http:// http:// http:// http:// http:// http:// http:// http:// http:// http:// 七十二松 72pines

  12. HTTP请求 • 每个好看的Web页面背后有无数的HTTP请求 • 每个请求都占用一点时间 • 很多请求占用了很多的时间 • 有的连接看起来的确不太理想 • 你的站点快慢严重依赖于其它站点 • 那么,请减少HTTP请求 七十二松 72pines

  13. 简单配置 • 关闭Etag: FileETag none • 压缩静态文件: mod_deflate and mod_gzip • 添加 Expires Header: Mod_expires <IfModule mod_expires.c>ExpiresActive OnExpiresByType application/x-javascript A2592000ExpiresByType text/css A2592000ExpiresByType image/gif A604800ExpiresByType image/png A604800ExpiresByType image/jpeg A604800</IfModule> 七十二松 72pines

  14. 把CSS放到页面头部 • 把脚本移到页面底部 • 让JavaScript 和 CSS 成为外部文件 • 尽量少用JavaScript • 避免重定向 • 移除重复的脚本 七十二松 72pines

  15. Killer WP-Cache http://mnm.uib.es/gallir/wp-cache-2/ cos-html-cache http://www.storyday.com/html/y2007/1114_cos-html-cache2.html 300 requests/sec 七十二松 72pines

  16. WP-Cache的一个问题 七十二松 72pines

  17. High End My WordPress • 几千次每秒的请求 • 虚拟独享主机(VPS)或者独立主机(Dedicated Hosting) • “不使用或者限制插件和图片” • 静态化页面 • Litespeed • Load Balancing • Memcache 七十二松 72pines

  18. 90%的请求是静态文件请求 • 分离前台和后台 • Nginx • Varnish or Squid • 独立的MySQL数据库服务器 • HyperDB • MySQL Proxy 七十二松 72pines

  19. 优化MySQL • key_buffer = 256M • max_allowed_packet = 1M • table_cache = 256 • sort_buffer_size = 1M • read_buffer_size = 1M • read_rnd_buffer_size = 4M • myisam_sort_buffer_size = 64M • thread_cache_size = 8 • query_cache_size= 64M • 使用InnoDB ( phpMyAdmin > table > Operations ) • innodb_buffer_pool_size=512M (大于你的数据库容量) • innodb_additional_mem_pool_size=20M • innodb_flush_log_at_trx_commit=0 • innodb_log_buffer_size=8M 七十二松 72pines

  20. 优化Apache • 内存是关键 • MaxClient 七十二松 72pines

  21. 还需要更多? 七十二松 72pines

  22. let’s have a talk paveochen@gmail.com 七十二松 72pines

  23. 七十二松 72pines

More Related