This is a live blog of the sessopm “Damn Quick Drupal: How to Make Drupal Perform and Scale Like a Rockstar!” by Michael Cooper at DrupalCon London.
This is one of the more anticipated sessions here at DrupalCon. One of the criticisms is that Drupal doesn’t scale and that it can get very slow. Looking forward to hearing how to avoid both of those. To give you an idea about how big this issue is – the hall is absolutely packed. There are actually more people in here than this morning’s keynote.
Why are many Drupal sites so slow?
The Answer? Cache!
The internet is one long line of caching… everything is cached because stuff is slow.
How does Drupal cache?
Drupal core and many modules. Successive versions of Drupal have cached more and more and done less on the fly.
How Drupal uses the database to cache:
After loading the cache a page would be rendered with 155 queries in 250ms page rendered in 1.5 seconds. even that is slow. This is before all the elements are added to the basic HTML that a page needs to load.
After adding key-value stores that went down to 107 queries in 36ms
There is no one size fits all setting here: it depends on your server.
There are 7 settings you must set. The values here are based on his very cheap server. You may need to change these based on your config.
(google MySQL performance for more info)
Now we’re down 17ms to run all the queries for the site.
APC compiles your PHP code and makes everything much quicker. Every time a file is read by PHP it is compiled – APC does this once then puts the output into a cached file. After that, it just checks to make sure its the same, then runs. Way less time to get PHP to run.
The last part of this is the session table. it can be added to the APC cache as well.
With all of the above done we’re at 97 queries in 14.8MS page execution time – 180ms
To check this out – use the NET panel in Firebug. Open Firebug, click the NET panel and see how long it takes.
By setting these up you can dramatically reduce page load time. In Drupal 7, you need to set up a PHP file to set up an aggressive cache.
Apache & PHP Issues
This part is way beyond me – I’m not an Apache geek. This is something you’ll definitely want to talk to your ISP or developer about.
One way to help you understand what you’ll need is the Devel module which has performance logging.
Take the amount of memory it takes on average to load a page and divide by the amount of memory you have available for PHP. On his cheap test server:
Max pages per second ended up at about 30, although that’s not a lot when you get slashdotted …
Formula: (P/M) x (e/60) = C
This formula will help you see what kind of performance you can expect.
In his test, setting the maxprocesses to 20 actually hurt performance. This is BIG issue for default Apache. Check this setting: if it’s at 256, your server isn’t configured well.
So in testing and thinking this through: Assume the Worst! Make sure caching is turned on.
Further site optimization
Front End Optimization
Wow – this was a very technical session… but really great!
With Admincredible you can update and manage all your Joomla sites. If you have 5 or 500 sites, Admincredible will make your life easier! Visit Admincredible.com.
All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means: