Why WordPress Sucks, and what you can do about it

While great as a CMS, wordpress really sucks as your forward facing production environment. After one week in production with our redesigned wordpress site, we had already racked up 8 hours of downtime due to database failures.

Also, we’re paying a hefty $43 bucks per month to host the Apache/PHP/Mysql monstrosity on Amazon EC2.

When I play the word association game with WordPress these are the things that come to mind:

  • Downtime
  • Database failures
  • Hackers, and hack bots from all over the Internet
  • Slowness
  • Scaling issues
  • Expensive

Also, WordPress has made some very bizarre design decisions around absolute URLs that I would describe as “dumb”.  Here are some actual forum topics on the subject.

How I fixed WordPress

The only thing that can fix bad technology is good technology, so I came up with a solution that involved using Amazon S3 and Node.js/Phantom.js to build a rock solid, high performance frontend for super cheap.

wordpress

By using Phantom.js and Node.js, I was able to crawl the entire site, and pull every single resource from wordpress and the pipe it over to S3 for Static Web Hosting.

If you’re looking for a tutorial on static web hosting, read this excellent post by Chad Thompson.

Life on Amazon S3 is Nice

So now, my production environment on Amazon S3 has these wonderful qualities:

  • 99.99% Uptime
  • $0.01/month Hosting Cost (based on 100MB of data)
  • Fast response times
  • Scales automatically with traffic
  • Built to sustain the loss of two concurrent data centers
  • Hackers now have to hack Amazon (good luck with that)

If you go to the new site, and open up a javascript console, you should see this:

Notice, it’s all the familiar URLs from wordpress, /wp-content and /wp-content/themes, but all coming from Amazon’s rock solid S3 service.

As an added bonus, I have the option of doing additional processing of resources as they are piped, so I could compact and minify JS and CSS resources, or create 2X size images for retina displays or any other kind of processing without ever touching the backend of the wordpress site.  Pretty cool.

Side Note: If you’ve got a WordPress site, and you’re interested in hearing more about this, please feel free to contact me.

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Brad Carleton

Brad is a rockin' fun JavaScript coder who enjoys building cool stuff and long walks on the beach. As the Founder/CTO at TechPines, he has worked with large companies and startups to build cutting-edge applications based on HTML5 and Node.js. He is the creator of Bone.io, a realtime HTML5 framework, and is the author of Embracing Disruption: A Cloud Revolution Manifesto.
This entry was posted in aws, javascript, node.js, phantom.js, wordpress. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Maxime Hardy

    You may want to look at Varnish and NginX as reverse-proxy to achieve these kind of optimisations. There are some WP plugins to handle assets through S3 (I don’t know at which extent they manage CSS and JS minification).
    Your solution sounds a bit of overkill from an operational point of view as there are plenty of existing solutions to scale WP.

    However from a developer and hacker point of view, that looks really fun! ;)

    • techpines

      Cloning the frontend of a web application to a static hosting provider is a good idea in my opinion.

      I think you’re right that a caching layer with Varnish and Nginx would be a good solution towards scaling WordPress. But then you have to worry about keeping your caching servers up and running, as well as WordPress/PHP/Mysql. That is more of an “operational hassle” in my opinion.

      This type of solution can be good for not just WordPress, but other CMS’s. So instead of learning how to scale WordPress, Joomla etc. You just replicate the frontend to an already cheap, high performance, and scalable solution like S3 or a CDN.

  • iamkoch

    Have you taken a look at WP Super Cache? http://wordpress.org/plugins/wp-super-cache/

  • http://trickortip.com/ Andrés Felipe Díaz

    What a wonderful idea Brand, can’t wait to try it out myself as well. You are right that wordpress does have the issues that you meant and this is definitely a great work around.

    However, what I like the most is the benefits of the solution that you would definitely not get even spending months trying to optimize wordpress.

    • techpines

      Thanks, but my name is Brad :)

  • http://mikaelkoskinen.net/ Mikael Koskinen

    Thank you for the post.

    I’ve been trying to achieve the same (generating static HTML files from WordPress) and there’s couple WP Plugins which promise to do that, but they all have had some problems. It would be great if you could post your Phantom.js & Node.js solution somewhere.

    • techpines

      Sure, we’re looking into open sourcing a tool around this. Will let you know.

  • markotom

    Great idea! I’ve considered to do something like that with Node.js using a WordPress plugin that provide me a REST API to my web app, do you recommend use this kind of alternatives to solve the poorly performance of WordPress?

    • techpines

      I recommend it as far as you’re comfortable working with it. I think that the underlying concept of moving a “basically” static site like a WordPress install to a static hosting provider like S3, makes good sense.

  • Andrew Corkery

    Seeing as you’re using AWS, did you consider CloudFront caching? http://aws.amazon.com/cloudfront/dynamic-content/

    I’ve used this on simple sites such as this and it works pretty well. You’ve a lot of control over what gets cached and for how long using HTTP headers. Very easy to set up too with no custom deployments.

    Interested to know why it’s preferable to build your own crawler, apart from just for fun!

    • techpines

      You could use CloudFront directly, but you might run into some awkward problems with the absolute URLs.

      For instance let’s say your CloudFront website is at example.com, and you’re worpdress server is at wp.example.com. All the pages that get grabbed by CloudFront would reference wp.example.com, because of the absolute URLs.

  • rsanchez1

    I work on several sites using WordPress, where we work on a dev environment and push to production. Never have I had issues with images using absolute URLs. We upload all the images on our site using the Media Library. We change the home urls between dev and production. Doing this, we have no issues with absolute URLs.

    Additionally, we solved all those word association issues you mentioned with WordPress by using Varnish. No need to get Amazon involved, no need to set up node.js to crawl the site. Once you set up Varnish, your site is set. No DB downtime, no slowness, best of all Varnish is free to use.

  • Tim Selaty Jr.

    For the $43/month setup, I think you’re referring to the m1.small instance, which has a low CPU count and is throttled on CPU priority/elasticity. That’s your largest bottleneck in performance. Sadly, even a simple switch over to something like Linode.com’s deluxe $40/month plan would yield likely x3-x4 the immediate speed. You’ll have to worry about less of your CPU being stolen too. AWS will still charge an arm and a leg for outgoing bandwidth from your server if you have a heavy and steady traffic flow (images will be the price gouge).

    You’ve developed a brilliant and affordable plan, which is great. For those not so daft, some optimization on the same server could be done to achieve similar results. As others have mentioned dropping Apache for Nginx would immediately help for server static resources and assets as Nginx’s “sendfile” allows it to bypass a lot of the memory overhead that Apache has. It’s ultra-fast and scaleable. Secondly, Varnish is ideal for serving pretty much everything (setting up invalidation is tough, but worth it). It’ll serve both your pages AND assets through memory, which is blazing fast.

  • Hiron Roy

    Great idea Brad. Any movement on open sourcing the node+phantomjs tool? What benefits has cloning using node+phantomjs provided over using a tools like httrack or comparable site cloners? I’d definitely like to hear more about the details.

    Thanks for posting.

  • Kavan Lyles

    What about using multisite with buddypress?