After a little over a year running on Tech Blog 2.0, you are now viewing version 3.0. Â For this version, we’ve returned to WordPress from BlogEngine. Â There are several issues that colluded to drive this change, most of which surrounded PHP and its crazy behavior. Â (Geeky details follow – skip to the paragraph starting with “Bottom line:” if you don’t want the geek stuff. Â I bolded it so it would be easy to spot.)
PHP’s recommended configuration is to run under Apache using the pre-fork multi-processing module (MPM). Â The advantage to this is that Apache does not have to spin off another process to handle each request; it handles it in the same thread. Â However, this means that each instance of the server must have all enabled modules loaded. Â This means that each instance of the server (AKA “thread”) is very large, so the number of threads run is lower (typically 5-15 in a server the size we’re on). Â Also, this means that each thread can only handle one request at a time; if you have 7 threads configured, each serving one of 7 requests, and an 8th request comes it, it has to wait for one to finish. Â If the requests are served quickly, this may not be a problem; however, the avalanche of request that follow the typical front-page mention on mega-blogs can easily overwhelm it.
To fix this problem, there is another MPM, this one called worker. Â In this scenario, there are spare thread waiting to fill requests, and these can spawn other threads to do further work if required. Â So, the Apache threads would realize that a request needs to be handled by PHP, and pass it off to that process to be completed. Â The Apache memory footprint is much smaller; it serves the images, scripts, and other static files, and passes off the requests that require heavy lifting. Â PHP, then, has a (FastCGI) process where it receives these requests, processes them, and returns the response to the caller. Â Because each of these threads only has to load the PHP requirements, they are smaller too, so you can have more threads processing at the same time; you just might survive that front-page mention! Â (This is the same technique applied by LightTPD and Nginx, two other servers I tried at various times.)
It is in this scenario where PHP fails to live up to its expectations. Â These PHP processes would simply stop responding, but the controller thinks they’re still there. Â The end result to the user is a site that just sits and waits for output that will never come. Â Eventually, they may receive a Gateway Timeout or Bad Gateway error. Â The problem is worse on slower sites, but even popular sites seemed to fall victim to this from time to time. Â This was also a problem whether PHP controlled its threads, or Apache controlled them.
The one thing that really perturbs me is instability. Â If something is broken, I can fix it; if it works, I can fix it ’til it’s broke. Â
 But something that works sometimes, and other times doesn’t, simply won’t fly.  I was able to introduce some stability by restarting the server 4 times a day, but that’s a band-aid, not a long term solution.  I was tired of fighting.
Bottom line: the configuration required for a stable server is in opposition to a lean-and-mean configuration. Â So, I installed the required Apache modules, and will continue to run my PHP-serving server at a configuration twice as large as it needs to be. Â I’ll eventually move the Mono (.NET) processes to another machine, where the fast configuration won’t stability problems.
But, PHP isn’t all. Â While I would still heartily recommend BlogEngine.NET to someone who was going to serve the blog from a Windows machine, but I had some issues getting upgrades to go smoothly under Mono. Â It also is optimized for fast serving, at the expense of RAM. Â At this point, that’s not the tradeoff we need.
Finally, with this update, the blog has received its first new theme. Â It’s a clean, clear theme that should serve the content well. Â Plus, the social media icons up in the corner are just too cool, IMO. Â I’ve also applied tags to all posts except the “My Linux Adventure” series, and this theme displays them. Â (Comments are not here now, but will be migrated shortly.)
So, there you have it. Â Enjoy!