The Hidden Dangers of Beautiful Themes

A Tale of Seduction and Betrayal

Some of the best-designed and officially featured WordPress themes aren’t built to handle mid-volume traffic. Just one incoming link from a semi-popular page can take your server down.

A New Blog for a Web App

The featured "News" theme that crashed my server

Everything started out smoothly. Like thousands of developers do every day, I set up a new WordPress installation to support a new web app I’m getting online. I’ve got a Linode 1536 which is perfect for this . It has gigs of free disk space and 800MB of unused RAM just for cache. And these virtual servers are fast. Mine hosts about 15 Rails and WordPress apps and the system load never gets up to 1.0.

For me, the hardest (and most fun) part of setting up a new blog is choosing the theme. I didn’t want to waste time, so I looked only at WordPress’s one-page “featured” themes list and chose News — a conservative theme with personality.

I wrote a few posts to get started, posted a link to one on Reddit, and went to sleep.

I Woke Up but My Server Wasn’t There

The network traffic graph gives a dramatic view of the server crash

At around 9am, I was in for a shock: no web pages were loading and it took 2 minutes to simply ssh in. There were about a million Apache processes running and the system was out of memory. Checking on Reddit, I saw that the post was getting a good amount of traffic: it was at the top of the r/programming subreddit. It had a couple of hundred up-votes; a lot, but certainly not an apocalypse. So this was odd. I also saw that someone reposted it to the Hacker News. (Nice!) Except that the posts were only noting that the site was offline (Not nice.)

Discovering the Culprit: the Theme

A helpful Hacker News reader suggested “Caching is your friend”. That was my first thought as well. WordPress by default is just a PHP app, doing a lot of repetitious work with every request. But that didn’t feel right. This was a brand new blog, after all, and the requests were all for one simple page.

The “Twenty Eleven” theme: saved my server

The web server logs held the answer. Every visit to that blog post was generating 46 server requests for theme assets. 36 of those were for images. I couldn’t believe that the theme linked to that many individual files. This is a huge issue: it’s very important to reduce the number of external files required by a web page. No amount of server caching and optimization can help a site designed like this.

I used a trick to re-gain access to the web site. I stopped Apache, restarted it, and then jumped in before more web requests would arrive. I changed to the simpler but very well designed Twenty Eleven theme and … my web sites began to come back to life. I re-checked the server logs. Each visit was now generating only 7 requests.

The Moral: Trust But Verify Your Theme

Even highly promoted beautiful themes can have flaws that will crash an entire server under even modest traffic. Before you permanently change to a new theme, look at the HTML it generates. Analyze it with YSlow or Page Speed.

FIRST do a trademark search, THEN start using your mark

Michael Atkins, Seattle Trademark Lawyer:

It’s good Bluebox Now was able to solve its problem and move on. It’s just too bad it had to suffer through what I imagine were at least a few stressful days and sleepless nights. All over an issue that could have been avoided through a careful trademark search.

Definitely.

And I’ll mention that I’m the creator of the trademark search iPhone app, Quisitive.

Identifying an Anonymous Blogger

An attorney friend asked me how to identify a blogger or possibly get their “ip address.” My answer:

This is difficult to do, but it’s an interesting question. There are two main ways to write a blog: (a) at a blogging platform like wordpress.com, or (b) at a personal / corporate custom web site.

The only methods I know of for identifying the blogger in scenario (a) are

  1. A subpoena;
  2. detective work, i.e. using clues in the content to figure out who & where the person is.

In the case of (b), the custom web site, it’s a lot easier. This is because the blogger will probably be connected to the registration of the domain name as well as the organization itself.

Another idea: I once identified a person who was stalking a friend by looking at technical clues in emails the stalker sent. I did it by examining the usually-hidden portions; the “message headers”. So if your victim has received emails from the antagonist, they could contain helpful info.

Note that if this is a copyright, trademark, or possibly even defamation matter, then the person’s identity isn’t as important. One can deal directly with the webhost and ISP using DMCA-style takedown notices.

Speeding up my Mac: Web Browsers and the RAM They Use

If speed’s what we want, why test RAM usage?

I’m interested in how all my apps perform, not just the web browser. The Mac is smart and will use every extra leftover bit of RAM to speed everything up.

RAM in computers is like kitchen counter space: the more space you have, the less shuffling around you need to do, and the more time you can spend cooking.

How I tested

I used my Mac running OS X 10.6.8 (Snow Leopard with all updates). Disabled all plugins in the browsers, and noted the Real Memory used by several browsers for typical usage. I double-checked the results by running each test on each browser twice.

Task 1: Startup the browser, go to reddit.com in one tab and stackoverflow.com in another.

Task 2: After finishing task 1, load three more typical sites I use: google mail, google docs, and washingtonpost.com.  Pull up a Wapo article and scroll through it.

Results

Lower numbers are better.

Task 1 (MB) Task 2 (MB)        Versions (all are latest)
Raven 63.3 269.9 v. 0.6.11515 Beta
Opera 78.4 309.0 v. 11.52 build 1100
Safari 77.3 313.1 v. 5.1.1
Firefox 162.9 423.2 v. 8.0
Chrome 206.9 429.8 v. 15.0.874.120

 

What the numbers mean

Mac users who do the kind of web browsing I do can save 100 – 200 megabytes by choosing their web browser wisely. People can potentially save even more RAM, if these savings continue linearly with increased usage — e.g. 10 or 20 tabs open. The extra couple of hundred megabytes can make a big difference if the computer is doing other RAM-intensive work such as running a VM.

The browsers broke out into three groups, as I’ve shown in the table. Raven, the new browser for Mac deserves a serious look. They sponsor Dan Benjamin’s 5by5, which is how I heard about it. I’m going to start using it for daily tasks and see how it holds up. I’m also going to revisit Opera (I haven’t used this new version yet) and see how it is as a browser compared to Safari, against which it performed nearly identically.