In April 2014, we were preparing to launch our data store. At the time, we had a simple Wordpress site, and had chosen Fastly as our content delivery network (CDN). We chose Fastly because it's one of the few CDNs that is not only superfast, but also supports SSL CDN for Apex Domains (aka 2nd level domains). We require SSL communication for all our web properties because Crate.io is included in the HSTS preload list of Chromium. Combined with Dyn, our DNS provider, we're able to cache not only cdn.crate.io for static assets, but also (and more importantly) our main property, crate.io.
Fastly is built from Varnish, an open source web application accelerator that is also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents.
Before the April 2014 launch, we had installed the Fastly Wordpress plugin. We knew that Wordpress wasn't optimized for speed (most dynamic sites are not, since the php needs to be prepared every time a HTTP request comes along). CDN caching plugins make the site load much faster -- caching really quickly and then purging quickly is the secret. Yet, it's a difficult balance to maintain.
The Aftermath of Being #1 on Hacker News
We were preparing to launch Crate on April 24, at the Next Web Conference in Amsterdam. To present on stage at the conference, we had to get as many upvotes as possible, since only 10 companies with the most votes got to present. To help drum up support, we began emailing friends and family on April 18, hoping to collect the votes we needed. Then, like a bolt of lightning from the sky, someone put us on Hacker News and we suddenly shot up to the #1 spot.
Take a look at a few charts from Fastly's analytics (demo here). This is what traffic looked like jumping from a sleepy company in half stealth mode to #1 on Hacker News:
A screen shot taken from Fastly's analytics
As our traffic increased, our website performance remained consistently strong, which we attribute to Fastly's Wordpress Plugin.
How the Fastly Wordpress Plugin Works
The great thing about Fastly's Wordpress plugin is that it does all the necessary purging immediately and automatically. As soon as you edit a post, add a category, or receive a new comment on your Wordpress-based website, the plugin quickly purges all the affected URLs whose content has changed. And, of course, it does so through the Fastly API for PHP. To get it working, you need to enter your API Key and Service ID once, which you can get from your Fastly account settings.
Other than this GitHub page, there isn't a lot of documentation about the plugin. I've decided to correct that wrong here:
1. Downloading the plugin
You can either install from source, or from the Wordpress plugin directory.
2. Configuring the plugin
Once your plugin is installed and activated, you should be able to set up the Fastly plugin inside your Wordpress config panel. Simply navigate to Settings â†’ Fastly and fill in the required fields with your API key and Service id.
Where and how do I get these?
If you haven't already sent Fastly a support request asking to have the Wordpress feature turned on for your account, you should do so now. Then add a new Wordpress config to a Service and set up the path to the Wordpress install.
- If your blog is at
http://blog.example.com/, your path is
- If your blog is at
http://example.com/blog/, your path is
Finally deploy the new version of the Service and you should be given your API credentials.
3. Some problems you may encounter
You may have to disable other caching plugins like W3TotalCache or WP-Cache to avoid getting odd cache behaviour.
You can learn more about Fastly here: fastly.com