Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tối ưu hóa Drupal

Tối ưu hóa Drupal

Slide của Sang trình bày các vấn đề để tối ưu hóa cho Drupal.

Lê Thanh Sang

July 18, 2013
Tweet

Other Decks in Research

Transcript

  1. Lê Thanh Sang • http://drupal.org/user/204321 • Skype: mr.lamphong • 5

    years with Drupal • Captain of Sang.IO • Senior Drupal Developer at GO1 Thursday, July 18, 13
  2. Hardware • Many CPU as possible • Faster disk IO

    as possible (Sata < SAS < SSD < PCI Flash) Thursday, July 18, 13
  3. Web Server • Reverse Proxy • Nginx for static file

    • Percona Database server • PHP-FPM + Opcode (APC, Xcache, eAccelerator) • Redis or Memcache Thursday, July 18, 13
  4. Web Server - Reverse Proxy • Use nginx or varnish

    • Cache content on RAM (Create a mount point using tmpfs) • Allow flush cache on Internal IP. Use purge module on Drupal. Thursday, July 18, 13
  5. Web Server • Using nginx if you can. Apache is

    fine, use Reverse Proxy for faster. • Using mod_pagespeed (http:// code.google.com/p/modpagespeed/) • For nginx: https://github.com/pagespeed/ ngx_pagespeed Thursday, July 18, 13
  6. Database Server • PerconaDB or MariaDB • Don’t use same

    server with Drupal if you can. • Use master for write • Slave replication for read Thursday, July 18, 13
  7. PHP-FPM • Running via socket (faster than TCP/IP) • Only

    install extension we need • Set max_request • Turn off log for production Thursday, July 18, 13
  8. Drupal • Use Pressflow (Require PHP 5) • Block cache

    • Redis cache • Authenticated cache • Remove slow module (Statistics, admin_menu, tagadelic, nice menus) • Using xdebug or xhprof for profiling Thursday, July 18, 13
  9. Drupal theme • Never use a function in the tpl

    file, always on the preprocess function • In tpl only print variables • Only use hook_theme (theme, process, preprocess) Thursday, July 18, 13
  10. Drupal search • Don’t use default DB search • Use

    search_api • Solr or Elastic Search Thursday, July 18, 13
  11. FrontEnd • Browser can send 4~6 request per domain (2

    for IE). • CSS/JS aggregation • CDN, Gzip compression, sprites, image optimization (Done if using mog_pagespeed) Thursday, July 18, 13