Slow server? Don’t overthink it. (And don’t forget what’s running on it.)

I’ve just spent the better part of a week troubleshooting server performance problems for one of my clients. They’re running a number of sites on a dedicated server, with plenty of RAM and CPU power. But lately the sites have been really slow, and the server has frequently run out of memory and started the dreaded process of thrashing.

Fearing inefficient code in cms34 may be to blame, I spent a few days trying to optimize every last bit of code that I could, which did make a slight improvement, but didn’t solve the problem.

Then I spent a few more days poring over the Apache configuration, trying to optimize the prefork settings and turning off unnecessary modules. Still, to no avail, although getting those prefork settings optimized, and thus getting Apache under control, did allow me to notice that MySQL was consuming CPU like mad, which I had previously overlooked.

Hmmm… that got me thinking. I fired up phpMyAdmin and took a look at the running processes. Much to my surprise, almost every MySQL process was devoted to an abandoned phpBB forum. Within moments I realized the forum must be the source of the trouble, which was confirmed when I found that it had over 500,000 registered users and several million posts, almost all of which were spam.

As quickly as I discovered the problem, I was back in the Apache configuration, shutting down the forum. Then a quick restart of MySQL (and Apache, for good measure), and the sites were faster than I’ve seen them in months.

The moral of the story: if you have a web server that suddenly seems to be grinding to a halt, don’t spend days optimizing your code before first looking for an abandoned forum that’s been overrun by spammers.

On innovation, litigation and exasperation

I was just reading Craig Grannell’s new blog post, There’s no justification for piracy, but there are obvious reasons why it happens, and I found myself once again agreeing exactly with what he says. The post was prompted both by the amazing Matt Gemmell’s The Piracy Threshold, as well as by yesterday’s Oatmeal comic, I tried to watch Game of Thrones and this is what happened, which basically explains piracy not as justifiable, but as the inevitable result when a person exhausts every reasonable avenue for obtaining content legally.

As Grannell points out, there are arguments to the contrary, but I think what it all really comes down to is simple: People want your content. They will make a reasonable effort to obtain it legally, at a reasonable price. But when you build a wall around your content, by charging exorbitant prices, deliberately misunderstanding the concept of fair use by fighting format shifting, or simply making it unavailable altogether, a lot of people are going to find a way around that wall.

I don’t condone torrenting, nor do I participate in it. In that regard, I don’t know if I’m in the minority on the Internet or not. But I can understand why it happens. More importantly, I believe it would not be that difficult for content owners to eliminate, or at least diminsh to irrelevancy. They just need to try.

But trying means change. It means meeting content consumers halfway. First, it means recognizing them as potential customers, not as potential thieves.

Change can be hard to accept. But I just cannot comprehend how “big media” doesn’t recognize the potential here. Instead of fighting desperately to hang onto dwindling DVD and CD sales, there’s a huge potential market for online distribution. But it requires thinking differently. Prices may go down, but so will distribution costs, by a lot. Like, almost zero. Margins may be slimmer, but that can be more than made up for with volume.

Would making everything readily available online, legally, at a modest price, eliminate piracy? Probably not. But that’s not the right way to think about it. Every advancement in technology since the printing press has presented the risk of IP theft (though, granted, that’s a modern concept), but it has also presented far greater opportunity for those who aren’t afraid of it.

So, you can resent and sue your would-be customers. Or, you can respect and engage them. I think we’re all fed up with how things are working right now. Let’s be reasonable.

WordPress is great, but the documentation leaves a little to be desired…

Alas, the woes of using open source software rear their heads. WordPress abounds with undocumented, or at least very poorly documented, features.

My dilemma: the default function for displaying a list of page links (used on this site to populate the Points of Interest panel in the sidebar) sorts links alphabetically, and there isn’t any obvious way to make it sort by the database’s menu_order field, which logically, to me at least, should be the default especially given that this is how they’re sorted in the admin tool.

Finding little help in the documentation or by my usual means (Google), I decided it couldn’t be done without modification. In my previous installation of WordPress I actually modified the core code itself to change the sort order, but when I upgraded to version 2.1.1 today, it overwrote that change. This time I decided to try the plug-in approach, so my changes would actually stick through version changes, and so I could get familiar with the powerful but arcane plug-in system WordPress uses for extensibility.

After poking around futilely trying to get my plug-in to work (to the point where it was sorting all of my blog posts the way I wanted the pages to be, but not the page list), I stumbled upon a relevant post in the WordPress forums, where a snide jab at “theme designers” (which seemed to be such a broad swipe that it included me) happened to mention an input parameter in the function that calls the page list!

Silly me… the system has built right in a very simple way to sort the list by whatever field you want, and all you have to do is pass in the right parameters in your theme files. The change couldn’t have been simpler… but learning that it was possible certainly could have!