2008 Update on Running Drupal on a Small VPS

For a year or two I was successfully running Drupal with lighttpd and fastcgi. Lighttpd is very efficient, and having 4 fastcgi PHP processes let me limit the memory php used while keeping my small sites responsive enough. But redirects and URL rewriting are done differently, and it was tricky at times to get it to work the way I wanted with Drupal. I eventually got tired of wrestling with rewrites and redirects with every new non-Drupal php-based app I wanted to try, so I started thinking about how to make Apache work for a small site.

Removing RSS Feeds

I am removing the RSS news feeds from this site. Some of them were pretty neat, but they are still out there. This OPML file lists the feeds I had here: http://usr-share-doc.com/usr-share-doc-feeds.opml

VPS and Sneaky CPU Problems

While trying to find the perfect balance to make my sites run well out of my small VPS I noticed that my CPU usage was spiking. Unlike memory issues the Virtuozzo Power Panel didn't issue a QoS alert for CPU overages. Apparently when you use too much CPU you just don't get cycles for a while. Due to the spiky nature of CPU usage you don't see the problem unless you catch it near the top of a spike.

I realized that my backup processes were helping to spike the CPU. I have a cron job to a mysql dump, and I have a remote machine regularly ssh/rsync in to copy files off. ssh and rsync use quite a bit of CPU. I should've realized that would happen, but "duhhhh". I changed all my nonessential scripts to "nice" the commands. rsync was a bit tricky to get "nice"d, but I found the answers via Googling. What's interesting is that Virtuozzo doesn't seem to count the nice'd processes against the VPS's CPU usage. They used spare host cycles apparently, and there are tons of spare host cycles. I think I actually sped my backups up with "nice".

Drupal and Small VPSes: Resource Issues

I never did upgrade my VPS RAM. Part of it is laziness, but part of it is that I keep thinking my web server doesn't do enough and isn't busy enough for 256mb to not be enough.

I'm using mod_php for drupal and CivicSpace on several sites. I'm running Apache 2 with the prefork MLM. The problem with this setup and limited resources is that the running Apache processes bloat to handle the biggest PHP script they've run. To counter that I reduced the number of Apache processes. Per earlier blogs, I also deleted unused drupal modules and all my sites work fine under a PHP memory limit of 12mb. Between those two things I've kept my memory issues at bay.

Funny Javascript News Fader Experience

Over at the Early Retirement Forum, for which I assist in maintaining the forum software, I've been adding RSS icons and "Add to [My Yahoo!, Google, Bloglines, My MSN, etc.]" icons and working on getting a sensible RSS link and info system laid out. I have a news fader/ticker item that lists some of the icons and points to more RSS feed info. After collecting a number of icons in the images directory I decided to make and rss subfolder and move the images there so as not to clutter up the site owner's images directory with RSS icons.

After moving the images I updated all my image links and made a mental note to check the log for 404 erros in the next day or two. The next day I checked, and one IP was creating three 404 errors every 30 seconds looking for the old image locations! Yikes! I tracked which user it was, and it's a user that I know uses RSS but is not destructive. But there were no RSS feed requests associated with the image requests, so my first conclusion that he's requesting RSS feeds to often was not correct. I made symlinks for the images in their original locations to stop the 404 errors and hopefully get the user agent, IE6 on WinXP, to cache the icons and quit requesting them.

Shared and Concurrent Drupal Sites with Symlinking

I'm currently running Drupal 4.6.6, Drupal 4.7 RC3 and CivicSpace 0.8.3 . I preferred to have one set of source files, but I wanted each site (Apache vhost) to have its own root folder.

So, with some symlink magic, here's what I do. Each version of Drupal has its own directory under my servers web root. I have the following directories and symlinks:

  • drupal-4.6.6
  • drupal-4.7.0-rc3
  • civicspace-0.8.3
  • drupal-4.6 -> drupal-4.6.6
  • drupal-4.7 -> drupal-4.7.0-rc3
  • civicspace -> civicspace-0.8.3

Memory Hogging

I've been hitting the limit of my VPS's (virtual private server) 256mb RAM limit since installing CivicSpace, and I keep adjusting the php limit to try to avoid having forked processes fail, but then CivicSpace will fail on certain admin pages.

I now understand that when looking at the module activate/deactivate page it loads *every* module installed, even if it's not activated. (For other pages it only loads activated modules.) Since CivicSpace includes so many modules, this almost guarantees I'm going to run out of php memory if I have the limit set at 20mb or 16mb, and that's about the same range where I bump my head on the server privvmpages limit given my current configuration.

Drupal Module Quick Review

BBCode: (Input format / filter.) I love this module. Most of my intended audience is familiar with BBSes that use BBCode. With auto-url recognition and line breaks this is almost perfect for my needs. Perfect would include formatting buttons. Note that it also allows image links. (Images are so complicated in Drupal, but that's another topic...)

BBCode_wysiwyg: (Formatting buttons.) Sounded like a great addition to the BBCode module, but it's just 4 pushbuttons that don't work as the buttons on the forums. I quickly turned it off. phpBB is GPL; I wonder how hard it would be to use their formatting toolbuttons for Drupal? UPDATE: I looked at phpBB's form, and it's also just html pushbuttons. I had remembered it being fancier.

CivicSpace 0.8.3 Oddities

Although a relative newbie, I have some observations on CivicSpace 0.8.3 as compared to a base Drupal install:

  • The "plain text" input filter allows unfiltered html!
  • The bug list isn't closely monitored. I submitted the unfiltered html issue to CivicSpace as a bug, and 4 1/2 days later it is still unassigned and has no replies.

Upgrading CivicSpace 0.8.3 to Drupal 4.7 rc3

These past two or three weeks I've been working hard on figuring out CivicSpace / Drupal. I'm ditching CivicSpace 0.8.3--based on Drupal 4.6--and going with Drupal 4.7 rc3.

Drupal 4.7 is very new. In fact it hasn't been officially released yet. But there are enough changes I think it's important to go ahead and switch now while my websites are young and shy on content. The big feature for me is the free tagging additions to taxonomy. I don't fully understand these yet but have some ideas on how I want to use them. As I understand it, the backported free tagging / folksonomy patches for 4.6 are sufficiently different from 4.7 as to cause upgraded headaches.

Syndicate content