SlideShare a Scribd company logo
Drupal 超速指引 How to Speed Up Drupal Jimmy Huang 2011 Drupalcamp Taipei email: Jimmy at netivism.com.tw blog: jimmyhub.net
高效能 Drupal 策略 小比大好,少比多好,瘦比胖好 不該出現的不要出現 不需裝的不要裝 不需即時運算的就快取 記憶體比資料庫好 資料庫比檔案好
如何擬定效能改善方針 瓶頸在哪裡? 慢再哪裡? CPU /  記憶體  /  流量? 哪個頁面發生這個問題? 慢再何時? 檢測瓶頸 CPU :  確認是 Apache 還是 MySQL 記憶體  :  確認沒有用到 Swap 磁區 流量  :  確認連線場所網路順暢 頁面  :  確認某些頁面特別久
如何擬定效能改善方針  ( 續 ) 哪個網頁特別龜? 登入時瀏覽和登出時瀏覽的差異? 租用哪家 Server ?有權限做 Server 調整? 每日造訪頁數 ( awstats / google analytics ) ? 很多人看?還是很多爬蟲?
如何擬定效能改善方針  ( 續 ) 安裝模組 ex. memcache, boost, csstidy … 調整 Server ex. Apache MaxClients 數值 ex. Mod Deflate  調整  Drupal  設定 根據檢測出來的頁面,調整對應設定 調整程式碼 非不得已,自行開發模組,再調整程式碼
在  Drupal  如何檢測效能 Devel  觀察記憶體  /  頁面產生速度 Devel  蒐集 Database 使用的狀況 分析 Query 問題、來源 調整出問題之 Views / Panels /  程式碼
在  Drupal  如何檢測效能 ( 續 ) garland, system, block, dblog, filter, menu, node, taxonomy, user, content, date, date_api, date_repeat, date_timezone, number, optionwidgets, text, feeds, feeds_ui, feeds_xpathparser, ctools, job_scheduler, devel, views, views_ui
在  Drupal  如何檢測效能 ( 續 )
 
檢測效能 –  Apache / MySQL
檢測效能 – 流量問題
檢測效能 – 流量問題
實戰  - css / javascript aggregration Before…
實戰  - css / javascript aggregration After…
實戰  - html / css / javascript  壓縮 Before…
實戰  - html / css / javascript  壓縮 ( 續 ) After…
實戰  - html / css / javascript  壓縮 ( 續 ) use: http://www.seoconsultants.com/tools/compression
實戰  - html / css / javascript  壓縮 ( 續 ) Apache mod_deflate  開啟 Page Compression  開啟 第三方模組 Advanced CSS/JS Aggregation CSS Gzip CSSTidy
實戰 – 快取技術 Drupal 快取方式 Menu , Form, Page, Variables, Content, Language … 快取技術 Drupal 內建整頁  HTML 快取 Views / Panels  模組快取 Boost  模組
Drupal 頁面快取
Views 快取
Panel 快取
Boost 快取
實戰 – 記憶體快取 為何把快取放進記憶體? 建立 Database 連線緩慢 MySQL 的效能不足 Database 新增、刪除的動作比記憶體慢 如何做? 安裝 memcached 安裝 php-memcache 安裝 drupal memcache
實戰 – 記憶體快取
Before… # ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33246 bytes Concurrency Level:  100 Time taken for tests:  30.085 seconds Complete requests:  130 Failed requests:  0 Write errors:  0 Total transferred:  4992040 bytes HTML transferred:  4920408 bytes Requests per second:  4.32 [#/sec] (mean) Time per request:  23142.220 [ms] (mean) Time per request:  231.422 [ms] (mean, across all concurrent requests) Transfer rate:  162.04 [Kbytes/sec] received
After Memcache: # ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33246 bytes Concurrency Level:  100 Time taken for tests:  30.021 seconds Complete requests:  432 Failed requests:  0 Write errors:  0 Total transferred:  14976120 bytes HTML transferred:  14761224 bytes Requests per second:  14.39 [#/sec] (mean) Time per request:  6949.333 [ms] (mean) Time per request:  69.493 [ms] (mean, across all concurrent requests) Transfer rate:  487.16 [Kbytes/sec] received
# ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33329 bytes Concurrency Level:  100 Time taken for tests:  30.009 seconds Complete requests:  5113 Failed requests:  0 Write errors:  0 Total transferred:  172425088 bytes HTML transferred:  170310941 bytes Requests per second:  170.38 [#/sec] (mean) Time per request:  586.922 [ms] (mean) Time per request:  5.869 [ms] (mean, across all concurrent requests) Transfer rate:  5611.05 [Kbytes/sec] received After Boost:
Before After
參考資源 Web resource Drupal效能相關模組   (drupal.org) Drupal效能群組   (group.drupal.org) Drupal Performance Handbook  (drupal.org) Drupal Performance Tuning  (2bits) Book Drupal 6 Performance Tips  (PACKT) Drupal Performance and Scalability  (Lullabot)
photo list http://www.flickr.com/photos/17612257@N00/4639794109/ http://gala4th.blogspot.com/2009_09_01_archive.html   http://www.flickr.com/photos/runforcover/3791930953/   http://www.flickr.com/photos/cyberslayer/5874026128/   http://www.flickr.com/photos/marcovdz/4520986339/   http://www.flickr.com/photos/bwjones/4227870410/   http://www.flickr.com/photos/adcuz/3104028585/   http://www.flickr.com/photos/antphotos/3469245178/   http://www.flickr.com/photos/kino/487539637/in/photostream/   http://www.flickr.com/photos/nathey4/5713434731/ http://bumpshack.com/2010/08/06/sara-rue-incredible-weight-loss-before-after-photos/

More Related Content

PPTX
Make your web faster
PPTX
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
PPT
Using CDN to improve performance
PPT
Paveo Tweak WordPress
PPTX
前端性能优化&测试
PPT
构建基于Lamp的中型网站架构
PDF
Php及drupal性能优化系列(二)
PPTX
非常靠谱 Html 5
Make your web faster
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
Using CDN to improve performance
Paveo Tweak WordPress
前端性能优化&测试
构建基于Lamp的中型网站架构
Php及drupal性能优化系列(二)
非常靠谱 Html 5

Viewers also liked (6)

PDF
Android with LBS
ODP
Open source business model note in Drupal
ODP
Aegir with drupal
PDF
Drupal Case Study for Taiwan Wheat Traceability Information System
ODP
年輕世代與公共事務參與
PDF
CiviCRM 分享會
Android with LBS
Open source business model note in Drupal
Aegir with drupal
Drupal Case Study for Taiwan Wheat Traceability Information System
年輕世代與公共事務參與
CiviCRM 分享會
Ad

Similar to Drupal performance (in DrupalCamp Taipei) (8)

PDF
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--黃雋
PDF
twMVC#08 | 超。光速 網站最佳化實戰
PDF
超。光速 網站最佳化實戰 -twMVC#8
PDF
Performance 入門 - 前端工程開發實務訓練
PDF
前端性能优化和自动化
PDF
Modern php ch8 ch9 guide 導讀
PDF
NPO 網站改造觀摩賽 - Day 3 - 評審 Richard Tsai 講評
PDF
Joomla CMS 效能調校
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--黃雋
twMVC#08 | 超。光速 網站最佳化實戰
超。光速 網站最佳化實戰 -twMVC#8
Performance 入門 - 前端工程開發實務訓練
前端性能优化和自动化
Modern php ch8 ch9 guide 導讀
NPO 網站改造觀摩賽 - Day 3 - 評審 Richard Tsai 講評
Joomla CMS 效能調校
Ad

More from jimyhuang (12)

ODP
穿越時空的資料新聞學
ODP
從數位公益出發的社會企業 - 網絡行動科技
ODP
賽豬公上太空計畫(twlandsat)
PDF
網路科技於社會工作倡議
PDF
Scaling in Mind (Case study of Drupal Core)
PDF
只會用鍵盤可以改變什麼?
PDF
經營網站前,先設計網站
PDF
Ne tivism intro
ODP
喜願小麥網站分享
PPT
D7 易用性增進
PDF
Drupal sharing in HP7
ODP
Drupal Npo
穿越時空的資料新聞學
從數位公益出發的社會企業 - 網絡行動科技
賽豬公上太空計畫(twlandsat)
網路科技於社會工作倡議
Scaling in Mind (Case study of Drupal Core)
只會用鍵盤可以改變什麼?
經營網站前,先設計網站
Ne tivism intro
喜願小麥網站分享
D7 易用性增進
Drupal sharing in HP7
Drupal Npo

Drupal performance (in DrupalCamp Taipei)

  • 1. Drupal 超速指引 How to Speed Up Drupal Jimmy Huang 2011 Drupalcamp Taipei email: Jimmy at netivism.com.tw blog: jimmyhub.net
  • 2. 高效能 Drupal 策略 小比大好,少比多好,瘦比胖好 不該出現的不要出現 不需裝的不要裝 不需即時運算的就快取 記憶體比資料庫好 資料庫比檔案好
  • 3. 如何擬定效能改善方針 瓶頸在哪裡? 慢再哪裡? CPU / 記憶體 / 流量? 哪個頁面發生這個問題? 慢再何時? 檢測瓶頸 CPU : 確認是 Apache 還是 MySQL 記憶體 : 確認沒有用到 Swap 磁區 流量 : 確認連線場所網路順暢 頁面 : 確認某些頁面特別久
  • 4. 如何擬定效能改善方針 ( 續 ) 哪個網頁特別龜? 登入時瀏覽和登出時瀏覽的差異? 租用哪家 Server ?有權限做 Server 調整? 每日造訪頁數 ( awstats / google analytics ) ? 很多人看?還是很多爬蟲?
  • 5. 如何擬定效能改善方針 ( 續 ) 安裝模組 ex. memcache, boost, csstidy … 調整 Server ex. Apache MaxClients 數值 ex. Mod Deflate 調整 Drupal 設定 根據檢測出來的頁面,調整對應設定 調整程式碼 非不得已,自行開發模組,再調整程式碼
  • 6. 在 Drupal 如何檢測效能 Devel 觀察記憶體 / 頁面產生速度 Devel 蒐集 Database 使用的狀況 分析 Query 問題、來源 調整出問題之 Views / Panels / 程式碼
  • 7. 在 Drupal 如何檢測效能 ( 續 ) garland, system, block, dblog, filter, menu, node, taxonomy, user, content, date, date_api, date_repeat, date_timezone, number, optionwidgets, text, feeds, feeds_ui, feeds_xpathparser, ctools, job_scheduler, devel, views, views_ui
  • 8. 在 Drupal 如何檢測效能 ( 續 )
  • 9.  
  • 10. 檢測效能 – Apache / MySQL
  • 13. 實戰 - css / javascript aggregration Before…
  • 14. 實戰 - css / javascript aggregration After…
  • 15. 實戰 - html / css / javascript 壓縮 Before…
  • 16. 實戰 - html / css / javascript 壓縮 ( 續 ) After…
  • 17. 實戰 - html / css / javascript 壓縮 ( 續 ) use: http://www.seoconsultants.com/tools/compression
  • 18. 實戰 - html / css / javascript 壓縮 ( 續 ) Apache mod_deflate 開啟 Page Compression 開啟 第三方模組 Advanced CSS/JS Aggregation CSS Gzip CSSTidy
  • 19. 實戰 – 快取技術 Drupal 快取方式 Menu , Form, Page, Variables, Content, Language … 快取技術 Drupal 內建整頁 HTML 快取 Views / Panels 模組快取 Boost 模組
  • 24. 實戰 – 記憶體快取 為何把快取放進記憶體? 建立 Database 連線緩慢 MySQL 的效能不足 Database 新增、刪除的動作比記憶體慢 如何做? 安裝 memcached 安裝 php-memcache 安裝 drupal memcache
  • 26. Before… # ab -c 100 -t 30 http://netivism.com.tw/ Document Path: / Document Length: 33246 bytes Concurrency Level: 100 Time taken for tests: 30.085 seconds Complete requests: 130 Failed requests: 0 Write errors: 0 Total transferred: 4992040 bytes HTML transferred: 4920408 bytes Requests per second: 4.32 [#/sec] (mean) Time per request: 23142.220 [ms] (mean) Time per request: 231.422 [ms] (mean, across all concurrent requests) Transfer rate: 162.04 [Kbytes/sec] received
  • 27. After Memcache: # ab -c 100 -t 30 http://netivism.com.tw/ Document Path: / Document Length: 33246 bytes Concurrency Level: 100 Time taken for tests: 30.021 seconds Complete requests: 432 Failed requests: 0 Write errors: 0 Total transferred: 14976120 bytes HTML transferred: 14761224 bytes Requests per second: 14.39 [#/sec] (mean) Time per request: 6949.333 [ms] (mean) Time per request: 69.493 [ms] (mean, across all concurrent requests) Transfer rate: 487.16 [Kbytes/sec] received
  • 28. # ab -c 100 -t 30 http://netivism.com.tw/ Document Path: / Document Length: 33329 bytes Concurrency Level: 100 Time taken for tests: 30.009 seconds Complete requests: 5113 Failed requests: 0 Write errors: 0 Total transferred: 172425088 bytes HTML transferred: 170310941 bytes Requests per second: 170.38 [#/sec] (mean) Time per request: 586.922 [ms] (mean) Time per request: 5.869 [ms] (mean, across all concurrent requests) Transfer rate: 5611.05 [Kbytes/sec] received After Boost:
  • 30. 參考資源 Web resource Drupal效能相關模組 (drupal.org) Drupal效能群組 (group.drupal.org) Drupal Performance Handbook (drupal.org) Drupal Performance Tuning (2bits) Book Drupal 6 Performance Tips (PACKT) Drupal Performance and Scalability (Lullabot)
  • 31. photo list http://www.flickr.com/photos/17612257@N00/4639794109/ http://gala4th.blogspot.com/2009_09_01_archive.html http://www.flickr.com/photos/runforcover/3791930953/ http://www.flickr.com/photos/cyberslayer/5874026128/ http://www.flickr.com/photos/marcovdz/4520986339/ http://www.flickr.com/photos/bwjones/4227870410/ http://www.flickr.com/photos/adcuz/3104028585/ http://www.flickr.com/photos/antphotos/3469245178/ http://www.flickr.com/photos/kino/487539637/in/photostream/ http://www.flickr.com/photos/nathey4/5713434731/ http://bumpshack.com/2010/08/06/sara-rue-incredible-weight-loss-before-after-photos/