Today Google celebrated the birthday of Bob Moog, the creator of the Moog keyboard, with an interactive doodle. If you haven't played with it, it's pretty cool. Check out, for example, this version of the Legend of Zelda theme music composed with today's doodle.
You're Going to See Some Traffic
The top result when you search for Moog on Google is MoogMusic.com. The site celebrates Bob Moog's legacy and sells versions of his keyboards and other devices (including a pretty sweet iPhoneapp). Google contacted the site owners to give them notice that there was going to be a doodle four days ago. The only catch, they had to keep the information strictly confidential until the doodle went live in Australia (the first region to see new doodles every day). Oh, and, by the way, Google noted, they should prepare for a crushing load of traffic to their website.
That presented a bit of a conundrum. Moog Music turned to their web developers, a technically savvy shop called PurpleCat.net. The site was designed to handle half a million hits a day, so the team at PurpleCat spent the next threedays making several improvements to the site to increase its capacity. They migrated the site to new hardware, secured a dedicated gigabit port, migrated the mysql database to its own server, upgraded the backend of the site replacing Apache with NGINX and added layers of caching and optimizations. Needless to say, it was a busy three days for the PurpleCat team while they did all the upgrades to prepare for the traffic surge. The site, however, was on a single virtual private server (VPS) with limited resources and it didn't make sense to upgrade the whole infrastructure for a one-day spike in traffic.
Turning to CloudFlare to Help
As soon as the doodle went live in Australia and the embargo was lifted, PurpleCat called us at CloudFlare and explained what was about to happen. We were happy to help having had a lot of experience dealing with floods of traffic from events like these. The MoogMusic.com site went live behind CloudFlare and we saw the trafficbegin to rise.
Things were ok at first, but as the sun rose in Asia, errors started to be returned from the stressed MoogMusic.com VPS. CloudFlare's Always Online technology kicked in and served cached versions of the page, but the dynamic portions were at times inaccessible and the pages loaded slowly as our servers waited for a response or timeout from the backend. It wasn't ideal.
Page Rules and Advanced Caching to the Rescue
We knew we could help even more, so our support team worked with the folks at PurpleCat to setup Page Rules for the MoogMusic.com site. While some of the site is dynamic, large portions are relatively static. That meant a Page Rule could define the static portions -- like the front page and a history of Moog's legacy -- and instruct CloudFlare to Cache Everything, even the HTML. That means we will serve all requests to the pages that match the rule from our infrastructure without any requests getting sent to the VPS.
The results were dramatic. Approximately 92% of requests that would have previously hit the VPS were instead fielded directly by CloudFlare. We also reduced bandwidth needed to serve the requests to MoogMusic.com by more than 90%. With all the static requests offloaded to CloudFlare, the VPS had plenty of capacity to return the dynamic, uncachable HTML of the site.
Focus On Great Content, We'll Keep It Online
MoogMusic.com is currently averaging more than 100 requests per second. (What's pretty incredible is that's less than 1/1,000th of CloudFlare's overall load.) The VPS is doing more traffic every 15 minutes than the VPS it's running on is designed to handle over 24 hours. Peter from PurpleCat sent us a nice post thanking us for our help. He also shared the following with John on our team:
your ceo will like this.we built a separate server to just serve this page up:
But thanks to cloudflare, we never had to put it up.
He's right, I do love that. And so does everyone else at CloudFlare. It's exactly why our whole team comes to work every day excited to solve what seem like impossible challenges... like scaling a single VPS to deal with the traffic from the Google doodle.