Notes

Home >> Musings >> Notes

Drupal igbinary and caching performance

Drupal makes heavy use of the PHP serialize and unserialize functions which can bog down its performance and memory useage. You'll notice this pretty much right away if you spend any time profiling Drupal. Switching to igbinary_serialize and igbinary_unserialize shows a significant improvement in both CPU time and memory useage... HOWEVER, simply replacing all instances of serialize/unserialize with their igbinary is a core hack and you'd have to repeat the process for each module you installed if you want optimal result.

Running Drupal Cron with Drush

Due to security restrictions on my Nginx setup I prefer to not allow individual php scripts be allowed to run on my Drupal installs. Instead of explicitly allowing the cron script in my setup I prefer to setup Drush Site Aliases and run cron through that. To do that I did the following:

Fun with Postfix/Dovecot/MySql

I needed to set up a basic email server for a client and I used the really great tutorial from the linode library here:https://library.linode.com/email/postfix/postfix2.9.6-dovecot2.0.19-mysq...

A few things I picked up along the way:

Speeding up Drupal 6

I've been trying to bring some life back to an older Drupal 6 site that's been getting pretty slow and eating up more memory than it should, the following implementations have cut down page load times from about 4s per page to sub 1s for authenticated users. Memory use per page load has dropped from 120MB down to 45MB!

 

Set up Unattended Upgrades on Ubuntu

To keep up with the security updates that are constantly released for my webservers I've installed the unattended-upgrades package and configured them to just do security updates and notify me via email when done. Easy as this:

sudo apt-get install unattended-upgrades

Configuration here:

nano /etc/apt/apt.conf.d/50unattended-upgrades

and enable it all here, check and dl once a day, clean files once a week:

 nano 10periodic

APT::Periodic::Update-Package-Lists "1";

Drupal Slow Page Load / Gateway Timeout

I recently migrated my webserver to a new machine and after a restart one of my Drupal sites was returning a 502 Gateway Timeout from Nginx. Other Drupal sites on the same server were loading just fine. The timeout was happening due to PHP configuration setting giving up processing after about 30s but that didn't explain why the page was taking so long to load in the first place. As it turns out the server didn't have DNS configured correctly after migration. Needed to update the gateways in /etc/resolv.conf and restart networking.

PHP-FPM Dying after a few days with 502 Gateway Error

For some reason a few of my sites running FPM would randomly crash after a few days. A simple killall of php5-fpm and restart of the service brings it back, but for some reason the master process stops spawning children when this happens and the whole fpm gets locked up (hence the 502 errors.) I suspect it had something to do with runaway memory consumption.

Radeon 5450 Passthrough to WIN7 in ESXI

I got this working on my Ubuntu 12 VM the other day but I've been trying like crazy to get it working on Windows 7. Here's what I did to finally get it working:

 

Resetting ESXI 5.5 usb controller passthrough issues

I run ESXI 5.5 off of a USB stick and I made the mistake of trying to passthrough the USB controller from the mobo. When I did so it screwed up the graphics passthrough also. In trying to remove the passthrough mode would persist even after I unchecked the USB controllers and rebooted the host. The trick was to boot from a linux recovery disk and then mount the USB partitions 5 & 6.

mkdir /mnt/sdf5

mount /dev/sdf6 /mnt/sdf5

mkdir /mnt/sdf6

mount /dev/sdf6 /mnt/sdf6

Zoneminder on Nginx

There appears to be limited info on this setup so since I'm an Nginx kind of guy and I don't really want the additional resource utilization of running apache on my server also here's my notes in getting Zoneminder set up to run smoothly with Nginx.