This article covers CloudFlare Railgun and how to enable it for your domain at DreamHost. CloudFlare provides your domain with 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:
To enable CloudFlare Railgun for your site:
- 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.
- Once you add a hosting plan to your domain, click the Edit button to the right of the domain under the ‘Web Hosting’ column.
- Scroll down to the ‘CloudFlare Services’ section of the page.
- 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.
- Check the 'Enable CloudFlare Railgun?' check box.
- Scroll down and click the Change Settings button to save your changes.
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.
- 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 () 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:
- On your keyboard, click CTRL + Shift + I. This opens Developer Tools.
- Click the 'Network' tab. Data collection starts when you hit F5 to refresh the page.
- Once you have network data listed, click on an object.
- Click on the headers tab to view the details.
- Click the ‘Develop’ tab.
- From the dropdown, choose ‘Show Web Inspector’.
- Install a tool such as Firebug:
- Once you open it, click on the ‘Net’ tab.
- 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:
- Run a test of your website
- Click on an object that is being cached by CloudFlare on your site.
- Click the 'Response' tab to the right of the request.
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