Improving Drupal Performance and Speed on Leland Servers
Drupal performance on the Leland (WWW/AFS) servers can sometimes be sluggish, but there are several things that a site administrator can do to speed it up. A few of the standard Drupal performance enhancements (memcache, Varnish, Squid, etc.) won't work in the Leland environment; the tips listed below will.
- Prime Your Cache with a Cron Job
- Drupal.org Handbook Page on "Managing Site Performance"
- Adding Default Views and Pages in a Custom Module
- Advanced Drupal Performance and Server Configuration
Caching and Compression
At admin/settings/performance, try the following settings:
- Caching mode: enabled
- Minimum cache lifetime: 1 hour
- Page compression: enabled
- Block compression: enabled
Caching only applies to anonymous users, but the CSS/JS optimization should help performance for both authenticated and anonymous users.
(Note: some of these options are not available in Drupal 5.)
Views and Panels Caching
You can speed up the performance of individual Views by enabling caching. On the edit View screen, click the None hyperlink next to the Caching option.
Choose Time-based for the type and click Update.
Choose a duration for caching the queries and the rendered HTML output. For Views that have content changing more often, you would set a shorter duration. The default of 1 hour is usually fine. Click Update.
Your View should now show Caching: 1 hour/1 hour.
Remember to save your View!
The Panels module also provide its own mechanisms for controlling the caching of the HTML output it creates. This article provides an overview of how to configure Views and Panels caching for Drupal 6; Drupal 7 setup is similar.
Validate Your Code
Submit your site to the W3C validator. Browsers will render a valid (X)HTML page much faster than one with many validation errors. WYSIWYG editors are common sources of validation errors; this can be addressed by tweaking the WYSIWYG editor settings, or changing your doctype in your theme's page.tpl.php from XHMTL Strict or Transitional to HTML 4.01.
DB Maintenance Module
Install the DB Maintenance module. Go to PHPMyAdmin and look for all the tables with an entry in the Overhead column. Go to admin/settings/db_maintenance and select all of those tables, and the DB maintenance module will optimize them.
Disable Unused Modules
If a module is not actively being used to drive your site, disable it. Each active module contributes to Drupal's PHP memory footprint. An example might be the Node Clone module, or the Views UI module. Each of these is usually only needed when developing a site, and can be disabled for day-to-day use.
Export Views and Panels to Code
Using a custom module, you can load Views and Panels from code, rather than from the database, speeding up the load time of your Views/Panels.
Add the following code to your drupal/.htaccess file:
Private vs. Public File Handling
Note: Changing to public download requires making changes to your .htaccess file in your files directory.
Set Expires Headers
You can tell the client's browser how long you think it should keep certain types files in the browser cache via mod_expires. This speeds up subsequent page loads by reducing the number of HTTP requests, as well as the total document size delivered over the network.
Add the following lines to your .htacess file:
# Set expires headers for images ExpiresActive On ExpiresByType image/gif "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/png "access plus 1 year"