Community Documentation

Optimizing Drupal to load faster (Server, MySQL, caching, theming, HTML)

Last updated October 25, 2012. Created by serjas on August 10, 2012.
Edited by HongPong, jaisenan. Log in to edit this page.

Basic settings

Theme optimization

  • Manually Remove blankspaces and comments from .tpl
  • No indentation in .tpl
  • Turn on CSS and JS aggregation in the performance page
  • Manually reduce css file size by removing duplicate and combine similar together
  • Move codes to functions which should be in a custom common module. Use functions for similar problems instead of coding separately. Refer core API

Coding standard and proper use of already existing core API

Secure codes

DB Query optimization in codes

  • Join db queries whenever possible
  • For Db update and insert, use core API
  • Use drupal standard http://drupal.org/coding-standards

DB table optimization

Disable unnecessary modules

  • Devel
  • Statistics
  • Update status
  • Use syslog instead of Database logging

Remove unnecessary contents and others

Cache modules

Make changes according to Google Pagespeed and yahoo YSlow suggestions

MySQL Settings

  • Cache Size say 32MB in MySQL

Apache settings

  • DNS lookup : OFF
  • set FollowSymLinks everywhere and never set SymLinksIfOwnerMatch
  • Avoid content negotiation. Or use type-map files rather than Options MultiViews directive
  • KeepAlive on, and KeepAliveTimeout very low (1 or 2 sec)
  • Disable or comment access.log settings
  • Enable mod_deflate or mod_gzip
  • Install APC server with higher memry limit apc.shm_size = 64

Comments

Very helpful!

Thanks Serjas,
These tips are very helpful.

Quoting Locutus of Virtualmin

Quoting Locutus of Virtualmin project from https://www.virtualmin.com/node/24493#comment-110641--

It would seem to me that the Drupal guys doesn't overly care about security, if they instruct users to apply the insecure FollowSymlinks everywhere.

They should be made aware of this potentially serious issue and make their software work with SymlinksIfOwnerMatch.

It would be nice if some kind of consensus over this controversial "SymLinksIfOwnerMatch" security thing would be arrived to.

Drupion.com — Drupal-centric, Drupal-specific, Drupal-optimized hosting company.

Page status

Needs technical review

Log in to edit this page

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Audience
Designers/themers, Programmers, Site administrators, Site builders
Level
Advanced
Keywords
optimization
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.