Note: This post was created awhile back on another platform and I migrated to my current one.
Drupal 6 Performance Issues and Optimization
Drupal 6 is incredibly slow right now. Adam and I just installed a lot of modules and enabled them.
Setup
Debian 5 with Apache 2
1st Assumption: Database
Accessing the database could be the reason for the slowdown. Checking the MySQL logs (/var/log
) reveals nothing—perhaps I didn’t enable logging. I’ll check on that later.
2nd Assumption: Modules
Let’s disable all the modules! This helped just a little. During this process, I also disabled all caching options in Drupal.
A Surprising Discovery
After taking a day-long break, I checked the website again, and it was fast! However, when clicking on the administration URL, it was still very slow. Here’s what I found on the Drupal support forum:
“The admin pages in Drupal 6 are slow because they perform a lot of housekeeping and rebuilding (thousands of queries, as you noticed, and these are not just cosmetic). Caching probably won’t help with that.
If it is unworkable, disabling the update status module will probably help a bit. There are open issues for reducing the number of queries in future updates, but don’t expect the D6 admin pages to become snappy. They take the hit for some tasks that make the user part of the site more reliable.
About the normal site pages… the usual optimization methods should apply.”
— cog.rusty, February 21, 2009
Optimization Steps
Alright, let’s optimize the webpage.
Installed Tools:
- Life-of-Request Info extension
- Devel module (Where is this log file?)
1st Optimization: PHP Optimization with APC
I installed the APC package for PHP (read about it here).
Here’s a tutorial on using APC:
APC on Debian Lenny
Performance Results:
Accessing main Drupal as webmaster:
- 1st try: 1.3s
- 2nd try (browser cache cleared): 0.661s
- 3rd try: 0.877s
As a non-user:
- 0.536s
Enabling All Modules
- Main page: 1.114s - 1.124s
- Content-generated pages: ~0.224s, at most < 0.5s (no images, just text)
Yay, it’s faster! 🚀