Drupal 超速指引 How to Speed Up Drupal Jimmy Huang 2011 Drupalcamp Taipei email: Jimmy at netivism.com.tw blog: jimmyhub.net
高效能 Drupal 策略 <ul><li>小比大好,少比多好,瘦比胖好 </li></ul><ul><li>不該出現的不要出現 </li></ul><ul><li>不需裝的不要裝 </li></ul><ul><li>不需即時運算的就快取 </...
如何擬定效能改善方針 <ul><li>瓶頸在哪裡? </li></ul><ul><ul><li>慢再哪裡? CPU /  記憶體  /  流量? </li></ul></ul><ul><ul><li>哪個頁面發生這個問題? </li></ul>...
如何擬定效能改善方針  ( 續 ) <ul><li>哪個網頁特別龜? </li></ul><ul><li>登入時瀏覽和登出時瀏覽的差異? </li></ul><ul><li>租用哪家 Server ?有權限做 Server 調整? </li><...
如何擬定效能改善方針  ( 續 ) <ul><li>安裝模組 </li></ul><ul><ul><li>ex. memcache, boost, csstidy … </li></ul></ul><ul><li>調整 Server </li>...
在  Drupal  如何檢測效能 <ul><li>Devel  觀察記憶體  /  頁面產生速度 </li></ul><ul><li>Devel  蒐集 Database 使用的狀況 </li></ul><ul><li>分析 Query 問題...
在  Drupal  如何檢測效能 ( 續 ) garland, system, block, dblog, filter, menu, node, taxonomy, user, content, date, date_api, date_r...
在  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  壓縮 ( 續 ) <ul><li>Apache mod_deflate  開啟 </li></ul><ul><li>Page Compression  開啟 </li></ul><u...
實戰 – 快取技術 <ul><li>Drupal 快取方式 </li></ul><ul><ul><li>Menu , Form, Page, Variables, Content, Language … </li></ul></ul><ul><...
Drupal 頁面快取
Views 快取
Panel 快取
Boost 快取
實戰 – 記憶體快取 <ul><li>為何把快取放進記憶體? </li></ul><ul><ul><li>建立 Database 連線緩慢 </li></ul></ul><ul><ul><li>MySQL 的效能不足 </li></ul></u...
實戰 – 記憶體快取
Before… # ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33246 bytes Concurrency Level:  100 ...
After Memcache: # ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33246 bytes Concurrency Leve...
# ab -c 100 -t 30 http://netivism.com.tw/ Document Path:  / Document Length:  33329 bytes Concurrency Level:  100 Time tak...
Before After
參考資源 <ul><li>Web resource </li></ul><ul><ul><li>Drupal效能相關模組   (drupal.org) </li></ul></ul><ul><ul><li>Drupal效能群組   (group...
photo list <ul><li>http://www.flickr.com/photos/17612257@N00/4639794109/ </li></ul><ul><li>http://gala4th.blogspot.com/200...
Upcoming SlideShare
Loading in...5
×

Drupal performance (in DrupalCamp Taipei)

1,609
-1

Published on

Published in: Technology, Design
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,609
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Drupal performance (in DrupalCamp Taipei)

  1. 1. Drupal 超速指引 How to Speed Up Drupal Jimmy Huang 2011 Drupalcamp Taipei email: Jimmy at netivism.com.tw blog: jimmyhub.net
  2. 2. 高效能 Drupal 策略 <ul><li>小比大好,少比多好,瘦比胖好 </li></ul><ul><li>不該出現的不要出現 </li></ul><ul><li>不需裝的不要裝 </li></ul><ul><li>不需即時運算的就快取 </li></ul><ul><li>記憶體比資料庫好 </li></ul><ul><li>資料庫比檔案好 </li></ul>
  3. 3. 如何擬定效能改善方針 <ul><li>瓶頸在哪裡? </li></ul><ul><ul><li>慢再哪裡? CPU / 記憶體 / 流量? </li></ul></ul><ul><ul><li>哪個頁面發生這個問題? </li></ul></ul><ul><ul><li>慢再何時? </li></ul></ul><ul><li>檢測瓶頸 </li></ul><ul><ul><li>CPU : 確認是 Apache 還是 MySQL </li></ul></ul><ul><ul><li>記憶體 : 確認沒有用到 Swap 磁區 </li></ul></ul><ul><ul><li>流量 : 確認連線場所網路順暢 </li></ul></ul><ul><ul><li>頁面 : 確認某些頁面特別久 </li></ul></ul>
  4. 4. 如何擬定效能改善方針 ( 續 ) <ul><li>哪個網頁特別龜? </li></ul><ul><li>登入時瀏覽和登出時瀏覽的差異? </li></ul><ul><li>租用哪家 Server ?有權限做 Server 調整? </li></ul><ul><li>每日造訪頁數 ( awstats / google analytics ) ? </li></ul><ul><li>很多人看?還是很多爬蟲? </li></ul>
  5. 5. 如何擬定效能改善方針 ( 續 ) <ul><li>安裝模組 </li></ul><ul><ul><li>ex. memcache, boost, csstidy … </li></ul></ul><ul><li>調整 Server </li></ul><ul><ul><li>ex. Apache MaxClients 數值 </li></ul></ul><ul><ul><li>ex. Mod Deflate </li></ul></ul><ul><li>調整 Drupal 設定 </li></ul><ul><ul><li>根據檢測出來的頁面,調整對應設定 </li></ul></ul><ul><li>調整程式碼 </li></ul><ul><ul><li>非不得已,自行開發模組,再調整程式碼 </li></ul></ul>
  6. 6. 在 Drupal 如何檢測效能 <ul><li>Devel 觀察記憶體 / 頁面產生速度 </li></ul><ul><li>Devel 蒐集 Database 使用的狀況 </li></ul><ul><li>分析 Query 問題、來源 </li></ul><ul><li>調整出問題之 Views / Panels / 程式碼 </li></ul>
  7. 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. 8. 在 Drupal 如何檢測效能 ( 續 )
  9. 10. 檢測效能 – Apache / MySQL
  10. 11. 檢測效能 – 流量問題
  11. 12. 檢測效能 – 流量問題
  12. 13. 實戰 - css / javascript aggregration Before…
  13. 14. 實戰 - css / javascript aggregration After…
  14. 15. 實戰 - html / css / javascript 壓縮 Before…
  15. 16. 實戰 - html / css / javascript 壓縮 ( 續 ) After…
  16. 17. 實戰 - html / css / javascript 壓縮 ( 續 ) use: http://www.seoconsultants.com/tools/compression
  17. 18. 實戰 - html / css / javascript 壓縮 ( 續 ) <ul><li>Apache mod_deflate 開啟 </li></ul><ul><li>Page Compression 開啟 </li></ul><ul><li>第三方模組 </li></ul><ul><ul><li>Advanced CSS/JS Aggregation </li></ul></ul><ul><ul><li>CSS Gzip </li></ul></ul><ul><ul><li>CSSTidy </li></ul></ul>
  18. 19. 實戰 – 快取技術 <ul><li>Drupal 快取方式 </li></ul><ul><ul><li>Menu , Form, Page, Variables, Content, Language … </li></ul></ul><ul><li>快取技術 </li></ul><ul><ul><li>Drupal 內建整頁 HTML 快取 </li></ul></ul><ul><ul><li>Views / Panels 模組快取 </li></ul></ul><ul><ul><li>Boost 模組 </li></ul></ul>
  19. 20. Drupal 頁面快取
  20. 21. Views 快取
  21. 22. Panel 快取
  22. 23. Boost 快取
  23. 24. 實戰 – 記憶體快取 <ul><li>為何把快取放進記憶體? </li></ul><ul><ul><li>建立 Database 連線緩慢 </li></ul></ul><ul><ul><li>MySQL 的效能不足 </li></ul></ul><ul><ul><li>Database 新增、刪除的動作比記憶體慢 </li></ul></ul><ul><li>如何做? </li></ul><ul><ul><li>安裝 memcached </li></ul></ul><ul><ul><li>安裝 php-memcache </li></ul></ul><ul><ul><li>安裝 drupal memcache </li></ul></ul>
  24. 25. 實戰 – 記憶體快取
  25. 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
  26. 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
  27. 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:
  28. 29. Before After
  29. 30. 參考資源 <ul><li>Web resource </li></ul><ul><ul><li>Drupal效能相關模組 (drupal.org) </li></ul></ul><ul><ul><li>Drupal效能群組 (group.drupal.org) </li></ul></ul><ul><ul><li>Drupal Performance Handbook (drupal.org) </li></ul></ul><ul><ul><li>Drupal Performance Tuning (2bits) </li></ul></ul><ul><li>Book </li></ul><ul><ul><li>Drupal 6 Performance Tips (PACKT) </li></ul></ul><ul><ul><li>Drupal Performance and Scalability (Lullabot) </li></ul></ul>
  30. 31. photo list <ul><li>http://www.flickr.com/photos/17612257@N00/4639794109/ </li></ul><ul><li>http://gala4th.blogspot.com/2009_09_01_archive.html </li></ul><ul><li>http://www.flickr.com/photos/runforcover/3791930953/ </li></ul><ul><li>http://www.flickr.com/photos/cyberslayer/5874026128/ </li></ul><ul><li>http://www.flickr.com/photos/marcovdz/4520986339/ </li></ul><ul><li>http://www.flickr.com/photos/bwjones/4227870410/ </li></ul><ul><li>http://www.flickr.com/photos/adcuz/3104028585/ </li></ul><ul><li>http://www.flickr.com/photos/antphotos/3469245178/ </li></ul><ul><li>http://www.flickr.com/photos/kino/487539637/in/photostream/ </li></ul><ul><li>http://www.flickr.com/photos/nathey4/5713434731/ </li></ul><ul><li>http://bumpshack.com/2010/08/06/sara-rue-incredible-weight-loss-before-after-photos/ </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×