Categories
Tips & How To's Web Development WordPress

On Scaling WordPress

In yesterday’s post, I mentioned that to scale WordPress you “just cache it.” That’s a pretty big claim to make without any sort of references.

Here’s Peter Chester of Modern Tribe’s talk on the subject from WordCamp LA 2011.

Categories
WordPress

Why I Rejected WordPress (in 2007)

Yesterday Matt Mullenweg – co-founder of WordPress – did an IAMA on Reddit. You should read through the whole thing, he took the time to answer almost everybody’s questions. One of his answers really stood out to me, but before I get to that, some context.

Back in 2007, I was working on the two-man development team of a rapidly growing hip hop news site. In a good month, we’d see nearly 3 million unique visitors and 15 millions of page views. Editorial, design and traffic demands found the site quickly outgrowing it’s CMS. We needed to replace it. We evaluated some of the PHP frameworks and took a serious look at WordPress. Even at that time, in early version 2, WordPress looked promising. After some serious poking around, we felt that all existing frameworks and systems were too bloated, we worried they wouldn’t scale to meet out traffic demands. We ended up building a kick ass custom CMS.

Because of this history, I found Matt’s answer to one question particularly interesting. Reddit user andrewry asked, “if you could break backwards compatibility (which really isn’t a option for WP), what would you really like to completely redo or add to WordPress?” His answer resonated with me:

If backwards compatibility wasn’t a concern I would rename all the inconsistent column names and variables to match our style guide, drop TinyMCE, simplify the user roles and capabilities system, replace widgets with page blocks, redo the admin menu system, denormalize the DB, flatten dependencies and deep hierarchy in function execution, and completely reorganize the code so the bare minimum of files are included with any given request.

This is basically the list of reasons we rejected WordPress as a CMS back in 2007.  It’s re-assuring to hear that Mullenweg acknowledges these issues. As an outsider it’s easy to assume that Auttomatic is either totally ignoring them, or worse, don’t see a problem.

Here’s the thing though.

Even though we managed to built a CMS that included a minimal number for files, didn’t have crazy function dependancies, had a sane database, etc, it didn’t magically scale to handle 800 page views per minute. At the end of the day, we cached. All page output was written to a flat file.

Turns out, this is the how you scale WordPress. Just cache it.

Categories
Web Development WordPress

WordPress Development, Cons & Pros

About a month and a half ago The Big Webshow featured WordPress creator Matt Mullenweg, listening to the interview it became really clear that WP is trying to position itself as a website “operating system.” While there are probably other platforms much more capable of the task, WordPress’ ubiquity is sort of pushing it in that direction regardless. Since that interview I’ve been meaning to take a closer look at WordPress.

Over the weekend I finally had a chance to dive in to theme and plugin development.
Overall, I found WordPress to be very easy to work with, I didn’t find myself running into any dead-ends like I have with other platforms and CMSes. I thought I’d share my impressions in the form of a pros v cons list.

Cons

  • WP is not model-view-controller framework, as far as I can tell from first brush there’s nothing MVC about it. I’ll admit, I’m not really sure how this would improve theme/plugin development or the application as as a whole. I do think that the WordPress codebase has a lack of structure and organization; MVC is a great way to organize a project.
  • WP is not object oriented. With the exception of the database wrapper, I didn’t come across any objects. Poking around WordPress themes and plugins reveals a bunch of global wordpress functions, things like ‘add_filter() ,’ ‘wp_enqueue_script().’ Everything you’d need to do in wordpress is a function. Exposing everything as a global function leads to the potential problem of of introducing a bug by creating a function with the same name an existing wordpress function (minor annoyance) and again, leads to code that’s hard to follow and disorganized. Function names aren’t always clear, some functions accept a call back, other return a value, etc.
  • WP does not use a template engine, all template variables, functions and statements are included as inline PHP tags. Inline PHP is impossible to read, hard to follow, leads to spaghetti and generates even uglier HTML. Additionally, template engines such as Smarty add useful features like robust caching options. I did find a plugin to add smarty support, may be worth investigating.
  • I really feel like these first three issues are pretty close to PHP’s worst practices. The overall lack of structure tends to generate sloppy, hard to read, amateur-looking code; the sort of thing that RoR snobs like to make fun of.
  • Finally, I suspect WordPress might be highly inefficient (but I haven’t done the research). Specifically the way plugins are allowed to add handlers and filters to various points in the application workflow seems like a problem. If every plugin has to be scanned for on every page load…well that’s just not going to scale well. Each installed plugin (hypothetically) increases processing time.

Pros

  • In spite of, or possibly because of issues I mentioned, extending WordPress is fairly simple and easy to pick up.
  • The documentation at wordpress.org is pretty great! On par with php.net‘s own documentation.
  • With such a large userbase, almost every plugin you could possibly want is already written for you.
  • It’s stable. It doesn’t go down randomly. It’s not buggy.

Admittedly a lot of the shortcoming I found are based on a lot of assumptions and only a basic knowledge of WordPress. Also, I will concede that “your code is ugly” is a fairly superficial criticism that doesn’t inherently mean anything. So, in conclusion, I am not anti-wordpress. I like it as a very-extensible blogging platform, but I’m still a little skeptical about is pontential usefulness as a general-purpose CMS or some sort of website framework.

If you’re a wordpress guru, I’d like to hear you input. Tell me why I’m wrong.