ELMSLN performance tuning
Update 2: Apache tuning / Costs
There’s another posting thats dedicated to the cost and scale metrics of ELMSLN vs D6 legacy systems we were using. This is an example performance pack of conf settings that should work to do sane tuning on ANY apache system let alone drupal.
Update 1: CIS / MOOC stats
See bottom of article for an update from the original post after additional tuning!
These are some metrics based on the extensive performance tuning that I’ve had to do as part of the ELMS Learning Network project. Trying to do a ton of systems on limited resources can be challenging but fortunately there are tons of experts in and outside the drupal community to help make this hapen. If you haven’t checked it out yet, I highly recommend reading through @mcarper ‘s DIY Drupal 7 Performance presentation. It’s an excellent resource and helped me take things a little further then they already were.
These are the results I’ve been able to achieve. For understanding of system, these are running on a VM running on VMWare, it’s running:
- RHEL 6, 64bit
- 4 gigs of ram, 2 cores
- Apache, PHP 5.3.x, Mysql 5.x, APC (duh)
- Drupal 7 loaded in Galaxy packaging format (the way ELMSLN is structured)
Hitting a rather complex page with multiple views, as user 1 with 155 modules, my final result from devel was:
Hitting a very simple page (a node) with a few blocks as user 1 with 159 modules enabled, my final result from devel was:
You can review the process of applying each patch / technique listed at https://gist. github.com/btopro/d424c961273ff5adc968
15 Megs for an authenticated user isn’t terrible though I’d obviously still like to drive it lower. Some of the patches and approaches push queries into RAM which means they might show up as more RAM usage but it’ll prevent the DB from locking (I have almost exclusively authenticated traffic).
The part you care about. This is a combination of the DIY article and my own past testing of how to optimize drupal cache bins. They are scary when you first talk about it but it’s actually really easy to optimize drupal’s cache bins without getting extensively into backend / other projects. We use a combination of Filecache, APC, entitycache, Display cache, blockcache alter, HTTPRL, and advagg. I’ve attached a quick drush recipe that will grab and enable all these modules on a site (I’m lazy and hope you are too).
You can copy and paste these at the end of your associated files down the stack if you have permission to do so:
To manage these cache bins, you’ll want to apply something like this shared settings example from ELMSLN example configuration. You’ll need to uncomment the APC and filecache sections if you plan on using them but I’ve optimized for each. If you choose to use APC you’ll want to do some kind of nightly apache restart to avoid memory fragmentation. I’ve also selected cache bins with this in mind. More pervasive cached data gets pushed into APC. Things that are large and may change more frequently get pushed into filecache.
Between the two of them you can get to higher scale for authenticated and non-authenticated traffic on just about any Drupal site. Are there other techniques? Obviously, but these are pretty easy to apply without getting into Varnish land. Varnish isn’t terribly difficult to get up and going, it’s just another thing to manage, configure and only works for anonymous traffic.
The techniques above help all traffic, regardless of authenticated or not. Hope this helps you scale even simple sites.
Update CIS / MOOC stats
After additional module disabling / clean out. I’ve been able to get CIS down to:
That’s 14 less queries, 67ms less per request and a whopping 12.75MB less per page load! The biggest bloat on these requests was a side block that allows for masquerading from any page. I think in the future we’ll want to take people to a dashboard page that provides the masquerade block for this reason. Also, the DHTML Menu module was enabled and was displaying an admin list on every page, which would invoke menu_tree_load for all items in the list (30ish items). Now with that out it’s dropped dramatically for the home page (as user 1).
Here’s MOOC after doing some permission / optional functionality decoupling
That’s 2MB lower, 23 less queries, and 40ms less per page load, per user. This is not marginal stuff and proves the old addag in drupal that you need to make sure you’ve only got the modules enabled that you really need to function.