CloudFlare Railgun

From DreamHost
Jump to: navigation, search

Overview

This wiki covers CloudFlare Railgun and how to enable it for your domain at DreamHost. CloudFlare provides your domain a suite of technologies that protects and optimizes your website, and CloudFlare Railgun is a specific Cloudflare technology that can be enabled to improve the performance of your site even further.

Railgun improves the performances of the domain by caching content on your website that has traditionally been uncachable. It does this by tracking changes to website content on the byte level and improving the connection between DreamHost’s servers, CloudFlare’s servers, and the visitor. Sites with slowly-changing dynamic content would benefit the most from Railgun.

Railgun is a special technology that’s offered free of charge to CloudFlare enabled domains. It’s normally only offered by CloudFlare as part of its Business subscription, but Railgun is available to both Basic plans or CloudFlare Plus at DreamHost.

For more detailed information on CloudFlare and how to enable it, please see the CloudFlare article.

How does Railgun work?

Railgun uses alternative compression techniques to dramatically speed up the performance of your site. It proxies traffic through a special protocol that would normally travel between CloudFlare and your web server over HTTP, which speeds up and secures the connection. According to CloudFlare, this achieves a 99.6% compression ratio and on average, a 730% performance increase.

Typically, the markup of websites does not change that frequently from one request to the next. Instead of transferring the entire request between CloudFlare and your environment, Railgun transfers only the changes in markup from one request to the next. This cuts down on bandwidth, transfer time, and overall page load times. Railgun caches these differences in memory to make page processing as fast as possible.

Railgun was made available on DreamHost on January 28th, 2013.

You can read more about how CloudFlare railgun works on CloudFlare's site:

Enabling Railgun

To enable CloudFlare Railgun for your site:

  1. Go to (Panel > ‘Domains’ > ‘Manage Domains’).
    • You must add a hosting plan to your account in order to use any CloudFlare Services. Visit the Adding Domains & Subdomains article for instructions.
  2. Once you add a hosting plan to your domain, click the Edit button to the right of the domain under the ‘Web Hosting’ column.
  3. Scroll down to the ‘CloudFlare Services’ section of the page.
    01 CloudFlare Railgun.fw.png
    • Be sure you check the 'Enable CloudFlare on this domain?' check box CloudFlare before proceeding. Visit the CloudFlare article for instructions on how to enable it.
  4. Check the 'Enable CloudFlare Railgun?' check box.
  5. Scroll down and click the Change Settings button to save your changes. .

Disabling Railgun

To disable Railgun, repeat the steps above but make sure to uncheck the 'Enable CloudFlare Railgun?' check box.

How to check if Railgun is working

There are various ways you to confirm if CloudFlare Railgun is working on a website. Since Railgun inserts header information in to requests, you’ll need a way to check these headers. When looking at these headers, you’re looking for CloudFlare headers such as:

  • cf-railgun: e95b1c46e0 0.02 0.037872 0030 9878
  • cf-ray: 478149ad1570291

You can use the following methods to check the Railgun headers.

Using a browser

Most browsers offer built in options or plugins that can check headers.

Chrome

    Claire extension
    If you use Google Chrome, CloudFlare has created a special browser extension called Claire that you can download and install:
    If you have the Claire plugin enabled you’ll see a cloud icon (02 CloudFlare Railgun.fw.png) in your address bar.
    In the cloud icon in the previous sentence, there are three letters: the second one is ‘R’. Since it’s NOT highlighted in this above image, it means Railgun is not enabled. Only when this character is highlighted does it confirm that Railgun is working.
    Chrome Developer Tools
    This is built into Chrome:
    1. On your keyboard, click CTRL + Shift + I. This opens Developer Tools.
    2. Click the 'Network' tab. Data collection starts when you hit F5 to refresh the page.
    3. Once you have network data listed, click on an object.
    4. Click on the headers tab to view the details.

Safari

  1. Click the ‘Develop’ tab.
  2. From the dropdown, choose ‘Show Web Inspector’.

Firefox

  1. Install a tool such as Firebug:
  2. Once you open it, click on the ‘Net’ tab.
  3. Reload the page and you’ll then see the headers listed.

Using an online site

You can use an online site that tests your website and shows you headers such as webpagetest.org:

  1. Run a test of your website
  2. Click on an object that is being cached by CloudFlare on your site.
    03 CloudFlare Railgun.fw.png
  3. Click the 'Response' tab to the right of the request.

Using CURL

You can use CURL or other command line tools.

If you have access to a terminal, you can check using the CURL command or other command line tools that allow you to examine headers. To check, use CURL -I to show the headers only:

curl -I http://www.cloudflare.com

See also