Download pdf - Optimize drupal

Transcript
Page 1: Optimize drupal

Optimize DrupalMake your Drupal site faster

Sunday, May 12, 13

Page 2: Optimize drupal

Lê Thanh Sang

• http://drupal.org/user/204321

• Skype: mr.lamphong

• Module Development

• 5 years with Drupal

Sunday, May 12, 13

Page 3: Optimize drupal

Agenda

• Hardware

• WebServer

• Drupal

• FrontEnd

• Monitor

Sunday, May 12, 13

Page 4: Optimize drupal

Hardware

• Many CPU as possible

• Faster disk IO as possible (Sata < SAS < SSD < PCI Flash)

Sunday, May 12, 13

Page 5: Optimize drupal

Web Server

• Reverse Proxy

• Nginx for static file

• Percona Database server

• PHP-FPM + Opcode (APC, Xcache, eAccelerator)

• Redis or Memcache

Sunday, May 12, 13

Page 6: Optimize drupal

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.

Sunday, May 12, 13

Page 7: Optimize drupal

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

Sunday, May 12, 13

Page 8: Optimize drupal

Database Server

• PerconaDB or MariaDB

• Don’t use same server with Drupal if you can.

• Use master for write

• Slave replication for read

Sunday, May 12, 13

Page 9: Optimize drupal

PHP-FPM

• Running via socket (faster than TCP/IP)

• Only install extension we need

• Set max_request

• Turn off log for production

Sunday, May 12, 13

Page 10: Optimize drupal

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

Sunday, May 12, 13

Page 11: Optimize drupal

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)

Sunday, May 12, 13

Page 12: Optimize drupal

Drupal search

• Don’t use default DB search

• Solr or Elastic Search

Sunday, May 12, 13

Page 13: Optimize drupal

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)

Sunday, May 12, 13

Page 14: Optimize drupal

SummaryUpgrade your hardware is alway a best solution

Sunday, May 12, 13

Page 15: Optimize drupal

Question?Lê Thanh Sang

[email protected]

Sunday, May 12, 13


Recommended