What is Time to Live ( TTL ) ? [FAQ]

Time to Live or TTL is the time a file is cached on at a CDN ‘edge’ location. Content Delivery Networks (CDNs) work by caching files at numerous world edge locations, when a file is requested for the first time from a CDN the CDN requests the file from the data center and it then caches it at that edge location. The cache at the edge location will be refreshed once the TTL expires. So if the TTL is set to 2 weeks then the files will be cached at the various edge locations for a 2 weeks.

Posted in FAQ | Tagged | Leave a comment

Content Delivery Networks ( CDN ) Pricing Comparison

Contend Delivery Networks (CDN s) pricing is typically broken into bandwidth tiers plus a  charge separate storage charge. To simplify comparison I have used the base bandwidth and storage of each plan for the CDN’s which publish pricing, others such as Level3, Akamai, Edgecast etc usually have a high minimum charge and are not suitable for smaller content publishers.
For comparison purposes the base plan for each CDN has been chosen which for all providers offers at least 5TB of bandwidth out. Other charges such as transactions and bandwidth have been ignored for this comparison as these usually do not have a significant impact on the final cost.

CDN Pricing (March 2010)

Storage
(per GB)
Bandwidth Out
(per GB)
Bandwidth Out > 50TB
(per GB)
Amazon CloudFront 0.15 0.15 0.10
Rackspace CloudFiles 0.15 0.22 0.22
MaxCDN 0.995 0.10 0.075
SimpleCDN * 0.03 0.02

*SimpleCDN does not have a separate storage charge, pricing is in plans for a set amount of storage and bandwidth and overages are not allowed (you are required to upgrade to the next plan). The base plan used for this pricing comparison has 2GB of storage and  5TB of bandwidth per month.

Observations:

  • RackSpace CloudFiles is by far the most expensive CDN, especially in a high bandwidth environment (although the storage is cheaper than MaxCDN) . Its integration with RackSpace Cloud Servers and Cloud Sites mean it will still be a decent choice for RackSpace users who don’t have high bandwidth requirements.
  • SimpleCDN is by far the cheapest CDN although the plan structure will make it much more expensive. You are required to select a set plan which a fixed monthly cost (eg $150 for 5TB bandwidth and 2GB storage), so if you only use 1TB of bandwidth this would work out at around  $0.15 per GB. Similarly storage is a fixed amount and you are required to upgrade to a more expensive plan if your storage exceeds the plan amount. This is inflexible and means the actual cost per GB of storage and bandwidth will be much higher than the published amounts.
  • Amazon’s storage (ie Amazon Simple Storage Solution – S3) works out much cheaper than other providers for very large storage amounts (eg >500TB of storage is priced at $0.105 per GB). It should be noted that CloudFront  is not as tightly integrated into its S3 storage  as the other providers. The CloudFront CDN is essentially a blot-on service to the S3 storage service. This makes CloudFront a bit more complicated to use although there are several third-party integration tools.

Posted in Articles | Tagged , , | Leave a comment

Content Delivery Network ( CDN ) Tutorial

So you’re convinced that a Content Delivery Network ( CDN ) would be a huge benefit to your site (if you’re still on the fence just read this first) and you are unsure of how to integrate it. How to integrate a CDN into your site depends very much on your needs.

The first thing you will need to establish is whether to use http progressive download or true streaming. If you are serving images via the CDN or providing downloads (zip files, exe files or media files for download) then http (or ‘progressive’) download is the mode most suitable, if your app streams audio or video to users then true streaming is optimal. Http download simply dumps the max output possible on the user requesting the file whereas true streaming sets up a two way communication between the requestor and the server which allows for optimizing the stream to fit the user’s bandwidth and provides more intelligent features such as seeking to a point in the file (these features do not need to be implemented by the developer they should be available out-of-the-box with most media players).

Amazon CloudFront

If you are using Amazon CloudFront then your starting point will be the Simple Storage Solution (S3) which is the static storage component of Amazon Web Services, to upload your files to S3 from your application you will need to use S3′s REST API although some CMS’s do have integrated S3 upload capabilities (see Using S3 in WordPress). Amazon doesn’t provide a GUI to upload files to so you will need to use a third party tool – Jungle Disk provides upload to S3 although it is more of a backup solution than a file manager,  S3 Fox Firefox plugin as an efficient S3 uploading and file management tool, in addition CloudBerry FileExplorer is a full featured desktop app for managing S3 and CloudFront files.
Any file stored in S3 can be served from AWS’s CloudFront CDN. To use CloudFront you are required to sign up for it separately to S3 (you can sign up here)  Files served by CloudFront must exist in S3 and when a file is requested from CloudFront, CloudFront initially requests the file from S3 and then caches it at one of its edge locations. Once you have an account at CloudFront, login to the AWS Management Console and navigate to the CloudFront tab. Under a single CloudFront account you can have various Distributions which are essential ‘buckets’ of storage which can have different attributes.  Click the Create Distribution button which will open the setup dialog, then select either to use http download mode or true streaming, and associate the Distribution with an S3 bucket.

Once the Distribution is created, you will  be given a unique domain which will look similar to dxabw2ae51eqo.cloudfront.net , to request your files from CloudFront instead of S3 simply replace your S3 domain (in the format bucket_name.s3.amazonaws.com) with your CloudFront domain on all your file URL’s – the file names will remain unchanged.

Other CDNs

There are several other popular CDN’s such as CloudFiles, MaxCDN, SimpleCDN. In essence they work in  exactly the same way – you are required to use a custom API if you want to implement uploading to the CDN from your app or you can upload the files manually and then link to from your app.  Most of these provide an online file explorer which allows you to upload and manage files although there is not the same number of third party file management tools as for S3/CloudFront.

If you are using WordPress you can use several plugins to facilitate file serving from a CDN , notably W3 Total Cache  allows you to specific any CDN to serve files from. CDN Tools is  a plugin dedicated to the CloudFiles CDN which provides very tight integration between the WordPress file upload and the CDN.

See our CDN Pricing Comparison for pricing details.

Posted in Articles | Tagged | Leave a comment

Cloud Server Monitoring

Cloud server monitoring  is essential to ensure your server is up and running and performing optimally. The tools to monitor cloud servers range from basic tools to simply check your site is running to those monitoring and diagnosing all aspects of your server:

  • Pingdom : This would definitely fall under the basic tools category and is a tool for both cloud and dedicated servers. Pingdom simply checks that that your site is up and running and will email or SMS you if the site is down. In addition Pingdom will monitor the response time of your site although there are no triggers to alert you if the response is longer than a pre-set period.
  • CloudKick : CloudKick provides complete monitoring of your cloud server’s Disk, IO, load, CPU, bandwidth, memory and presents it in a user-friendly dashboard. In addition it provides  a powerful API to write custom performance logs and tests. CloudKick is compatible with most cloud servers including Rackspace, Amazon, GoGrid, SliceHost.
  • ServerDensity : ServerDensity is a monitoring tool which monitors the server’s load, running processes, disk usage etc. A key advantage of ServerDensity is that it provides server snapshots – very often when there is a problem with the server it may have disappeared by the time an admin comes to diagnose and fix the issue. Snapshots allows the adminstrator to review the exact state of the server as of the time when the issue existed.
    ServerDensity is compatible with all Linux based cloud servers as it requires the installation of a small daemon (which should be a very simple process) and then the  ServerDensity hosted service monitors the diagnostic information sent by the daemon.
  • CloudTest - CloudTest provides a detailed monitoring tool similar to CloudKick and ServerDensity, however in addition to the monitoring capability CloudTest provides browser based testing of html/AJAX web applications. Through a browser based http or https recorder , system testers can record and then run a test on the web application and receive diagnostic information on the running of the test.
Posted in Articles | Tagged , | Leave a comment

Cloud Hosting vs Dedicated Hosting

The choice between cloud hosting or dedicated hosting often comes down to your requirements for your host, we break this down into the key areas for any hosting solution:

  • Scale - This is probably the biggest single advantage of cloud hosting, scaling up beyond a single server is notoriously difficult on a dedicated server setup – load balancing, maintaining sessions across different machines and a host of other issues make scaling up very tricky.
    Cloud hosting by comparison allows painless scaling by spinning up more instances as required, instances can be programatically spun up and destroyed as required meaning the application can handle all the scaling without need for intervention. In addition to writing custom code, third-party products such as RightScale can sit on top of a cloud hosting instance and automatically implement all the scaling.
  • Cost - Dedicated hosting still has a pricing advantage for small installations. A single low-spec (2GB RAM, 160 GB Storage, 2Ghz single-core CPU) dedicated server will cost about $130 per month for dedicated hosting, but this usually comes with a huge amount of bandwidth (2TB per month on Server Beach for example).  By contrast, cloud hosts charge a little less for the ‘hardware’ – a similar spec’d server at RackSpace Cloud Servers costs about $90 per month, however bandwidth is usually charged between $0.11 – $0.14 per GB , so if your users will require a lot of bandwidth cloud hosting can work out more expensive (although it should be noted, if you are using a lot of bandwidth you should be using a CDN)
  • Requirement for OS/Hardware Access – A major drawback of cloud hosting is the lack of access to the operating system and/or hardware. If you need to fine-tune the software/hardware stack then dedicated hosting is the only way to go.
  • Security - Theoretically a cloud server should be less secure than a dedicated host, if your ‘instance’ is part of a cluster of machines that will inherently be less secure than an isolated machine which has fewer connections. However, against this must be weighed the fact that cloud hosts will (or should!) have a dedicated security team to patch the OS when necessary and implement security best practices which will often not be fully adhered to if you have to manage the security of a dedicated host yourself.
    In practice, the greatest vulnerabilities are usually at the application level which is independent of the platform.
  • Simplicity - Cloud servers are far simpler to administrate than dedicated servers, adding servers can be done via a control panel and all the OS patching is fully managed.
  • Reliability – There is no definitive winner here, cloud servers have built in failover so you will not notice a hardware/server failure. However it should be remembered that a cloud host is actually in  a cluster of servers which you share with other users, severe slowdowns can occur from the other users running long running queries on the cluster.

So cloud hosting stacks up very well against dedicated hosts and if you run a simple application such as a CMS powered website then a cloud host is almost certainly the right choice, however if you need a very specialized solution then dedicated hosting (or co-lo) can still be the best choice.

Posted in Articles | Tagged | Leave a comment

Using Amazon S3 and CloudFront on WordPress

For the past six months I have used Amazon Simple Storage Solution (S3) to store all the newly uploaded images on my WordPress installations and it works like a snap. But why should you host all your images on S3 when your can simply upload them to your own hosting account? There are several reasons why S3 storage is a superior solution to using your own hosting :

  • Hosting images on a separate domain speeds up site load times as most browsers can only make two simultaneous requests to a domain. Thus if all your file are on a single domain the requests are queued and handled two at a time which slows the load time.
  • Moving hosts is easier if the file locations do not change (a major difficulty in changing hosts is downloading, then uploading all the images and finally changing all <img> the references in your articles).
  • If the files are on S3 it is very easy to transfer them to Amazon’s CloudFront Content Delivery Network (CDN).  CloudFront will give an additional performance boost for user’s who are located geographically far away from your server as CloudFront caches the files in 14 locations around the world.
  • If you are approaching your hosts storage limit then using S3 will probably be cheaper than purchasing additional storage space on your host.

The S3 for WordPress plugin modifies the standard WordPress image upload dialog to upload the images to your designated S3 bucket, from there uploading files to S3 is seemless as it is the standard file uploading process.
You will of course require an S3 account, and you should add a separate ‘bucket’ for file storage (buckets in AWS are similar to directories).

CloudFront in WordPress

Any file stored in S3 can be used with AWS’s CloudFront CDN. To use CloudFront you are required to sign up for it separately to S3 (you can sign up here)  Files served by CloudFront must exist in S3 and when a file is requested from CloudFront, CloudFront initially requests the file from S3 and then caches it at one of its edge locations.

Once you have an account at CloudFront, login to the AWS Management Console and navigate to the CloudFront tab. Under a single CloudFront account you can have various Distributions which are essential ‘buckets’ of storage which can have different attributes.  Click the Create Distribution button which will open the setup dialog, where you choose whether to use Download (for images) or Steaming (for video) and associate the Distribution with an S3 bucket. Once the Distribution is created, you will  be given a unique domains which will look like dxabw2ae51eqo.cloudfront.net , to request your files from CloudFront simply replace your S3 domain (in the format bucket_name.s3.amazonaws.com) with your CloudFront domain on all your file URL’s – the file names will remain unchanged. Unfortunately the S3 plugin in WordPress only works with S3 and you must manually change the file URL’s after uploading although a global find/replace plugin can be used for this.

Posted in Articles | Tagged , , , | Leave a comment

3 Tools to Test and Diagnose Site Performance

So your site is running a bit slow but you have followed the golden rules or site optimization, how do you find where the bottlenecks are and how to fix them. These tools should help you identify performance issues with your site and even how to fix them.

PageSpeed – This is Firefox addon from Google which can run automatically on all page loads or on-demand. It provides very detailed analysis on the page load and grades the page on its adherance to best practices (eg using compression on javascript files). This tool supercedes the YSlow Firefox addon from Yahoo, the information is extremely detailed  but can become a bit overwhelming.

WebPageTest – This is currently my favorite testing tool, it is an online tool where you input your URL and then the test page refreshes with the performance test results. The results include both the ‘waterfall’ graphic of load times for the page components and a grading of the adherence to best practices. There isn’t the same information overload as with Google PageSpeed and it offers the ability to test the load speed from five different geographic locations (which can help test if your CDN is working for you) .
WebPageTest crucially allows loads to be tested on different browsers, this is a great addition as browsers vary in their ability to load page resources simultaneously which can have a dramatic impact on the page load time.

Pingdom Load Test – Pingdom offers a very robust website monitoring service but it also offers a free page load test tool. This is a very simple tool which can be quickly run to determine the speed of the components in a page load. This tool runs a little faster than the WebPageTest tool but has few of its features.

Posted in Articles | Tagged , | Leave a comment

10 Best Practices to Speed Up Your Site – Part I

A sluggish website not only reduces your site’s ability to attract and retain visitors it also looks unprofessional and will not be attractive to advertisers. If your site is hosted on the cloud it is also an indication that the site is not properly optimized and will be consuming too many system resources which increases your hosting bill.

These 10 best practices will ensure that your site is running at full speed.

1. Caching

If someone put a gun to my head and gave me one way to improve a site’s performance it would be caching. Caching buffers your pages in the server’s memory and so avoids database/server roundtrips, resulting in faster response times and reduced server loads (and thus reduced hosting charges). If your site gets less than 1000 pageviews per day you probably wont see much speed improvement from caching. Your CMS should support caching (if not you should move on ASAP) and you should turn it on. For WordPress, WP Super Cache is the standard and still the best caching plugin.
Still not convinced? Take a look at the response times for a site where I was turning caching on and off, all the spikes in the graph are when I had caching turned off.

2.Use a Content Delivery Network (CDN)

CDN’s were previously very expensive to use with high monthly minimum’s but several new entrants (notably AWS CloudFront and RackSpace Cloud Files) have made it affordable for smaller sites to use CDNs. CDN’s work by caching files at different geographical (‘edge’) locations and therefore reducing the lag users who are geographically far away from the server experience. The larger the files, the greater the benefit of using a CDN, video files are a must but you should also consider hosting images and even css/js files on a CDN.

3. Place Scripts at The Bottom of the Page

Html pages load sequentially, so a reference to an external javascript files placed above the body tag will need to be loaded before the page’s content. This can make the page loading appear sluggish.
Even scripts such as javascript files for AJAX operations used on the page can be placed below the content. This will mean users cannot interact with the site content when it is first displayed, but research by Facebook showed that users prefer to see content as soon as possible even if it cannot be interacted with.
Scripts such as Google Analytics code should always be placed at the bottom of pages.

4. Use External CSS Files

Pages which are heavy with Html load a lot slower than pages which reference CSS for styles, positioning etc. For starters CSS is more compact than Html for positioning and styling page elements, furthermore if it is placed in an external file it will be cached on the user’s browser so that it will not need to be loaded for subsequent page loads in the same session.
You should always review the outputted source code (ie view the rendered page and then look at the source code by right clicking and selecting View Source or similar command) to look for Html which can be replaced by CSS.

5. Host Files on a Separate Domain

A quirk of most browsers is that they can only make a two simultaneous requests to a domain. If your page has several images and external files (such as CSS or javascript files) these must be queued and requested two at a time. Hosting images or files on a separate domain (or a subdomain) allows the browser to make most simultaneous requests and render the page quicker. This is also an additional reason to use a CDN as the files will always be on a separate domain.

Next, Part II of Best Practices to Speed Up Your Site

Posted in Articles | Tagged , | 2 Comments

Windows Cloud Hosting

Initial cloud hosting offerings focused on the LAMP stack, however in the past 6 months several viable Windows cloud hosting options have become available. Both Rackspace and Amazon now have Windows cloud offerings and most notably Microsoft has just launched Windows Azure which is actually a new cloud operating system and not fully compatible with existing Windows applications.

Provided your web site/application is running on the Windows stack now (Windows Server/IIS/ASP.NET) it should be compatible with the cloud offerings from Rackspace Cloud, Amazon, GoGrid and others. In this article I will focus on the big two cloud providers (Rackspace and AWS) as well as the new Windows Azure service which could be consider as worthy rivals to  traditional Windows Hosting.

Rackspace Cloud provides two Windows cloud hosting offerings, Cloud Sites and Cloud Servers. Cloud Sites is a standardised product which provisions a website with a fixed windows setup – Windows Server 2008/IIS 7 and ASP.NET (2.0 and 3.5 both supported). If you run a website powered by a Windows based content management system (CMS), or customer relationship management system the Rackspace Cloud Sites will probably be the best option. Cloud Sites only provides FTP access to the server and no Remote Desktop access to the server is possible. Cloud Sites basic package starts at $150 per month plus $10 per month for a 100MB SQL Server database.
If the application setup is more complicated and operating system access is required, Rackspace Windows Servers will be the best option which starts at about $112 per month for 2 GB RAM /  80 GB Hard Drive server (smaller instances are also available). This service is currently in beta and a major weakness is that this does not come with a SQL Server installation and users are required to make their own arrangements.

Amazon AWS has been offering Windows cloud hosting options since early 2009.  1.7 GB of memory / 160 GB (1 core) EC2 instance are priced at $80 per month. SQL Server is available, however it does get expensive as a lease on SQL Server standard edition starts at $750 per month.

The new entrant to Windows cloud hosting is Microsoft with its new Windows Azure service. As noted above, all Windows applications will need at least some modification to run on Azure. The biggest change is probably with SQL Server, where  the cloud variant (SQL Azure) has numerous incompatibilities making migration a challenge at best. SQL Azure databases are priced at $10 per month for 1GB and $100 per month for 10GB.
Windows Azure pricing is slightly different from Rackspace and AWS which bundle a the RAM/CPU/Drive space in a virtual server package. Windows Azure is broken out between compute ($84 per month), storage ($0.15 per GB per month), storage transactions ($0.01 for 10,000 transactions) and data transfer at $0.10 in / $0.15 out per GB. This makes comparisons difficult in pricing, however Azure looks to be slightly more expensive than AWS and cheaper than Rackspace (the $10 per month SQL Azure instances can make Azure a lot cheaper as n0 equivalent exists on the other providers).
For an overview of Windows Azure see Windows Azure First Impressions , or Who Will Use Azure

Summary

Which of the providers is best really depends on your needs. If it is a simple website then Rackspace Cloud Sites is definitely the way to go. If you have a more complex application (which for example runs windows services or requires access to the OS) then AWS is probably the best bet. Azure promises to be the ultimate windows cloud with features such as SQL Azure databases which can be scaled up on demand, although it does have compatibility issues with existing windows apps and is still in its infancy (having just been released in February 2010).

(note – I have used monthly charges to compare pricing although all the above providers bill the services hourly)

Posted in Articles | Tagged , , | Leave a comment

Rackspace Cloud Sites Review

I’ve been using Rackspace Cloud Sites for around six months now and decided it was time to do a full Cloud Sites review. I run about 10 sites with varying amounts of traffic – from 2000 uniques/ 4000 pagesviews per month to 500,000 uniques/ 1.2 million pageviews per month. The sites mainly serve text and images but with the occasional video tutorial.

I’ve had a good chance to try out the Cloud Sites service and my experiences are below:

Gettting Started

Signup is very easy and I was up and running with 15 minutes. The main control panel is very clean and easy to navigate, performance is good and there are no slow loading pages.

Site Setup

Rackspace Cloud Sites supports both Windows Server/IIS/ASP.NET  and Linux/Apache/PHP . You can mix Windows Server and Linux sites on a single account although you are not able to configure the setup such as the version of PHP etc (if you need to configure the setup you should consider Rackspace Servers).

Adding a site is relatively easy although it isn’t quite a clean as it could be since the interface caters for users setting up their own sites and for resellers setting up sites for clients (if you are setting up your own site just ignore the different ‘plans’ you are presented with as each site’s resources comes out of a single pool and there is no throttling of sites which breach their plan limits).
It only takes about 5 minutes to have the site up and provisioned and ready to go.

Databases

Rackspace Cloud Sites supports MySQL and SQL Server. There is no control over the version or setup of the databases, at time of writing MySQL 5 and SQL Server 2008 (Web version) are being offered.

MySQL databases are free whereas SQL Server databases cost $5 per 100MB and $10 for 200MB. The SQL Server pricing is definitely on the high side and the size is quite limiting.

Adding a database is a snap, once again the interface is clean and intuitive and the database should be ready within a couple of minutes. Databases are closely associated with sites so you will first have to select a site and then add a database in the ‘Features’ tab.
Once setup, databases can be administered using phpMyAdmin , Rackspace Cloud Sites provides a link to the phpMyAdmin although you will have to enter your login details to access phpMyAdmin. If you prefer using MySQL administration sorftware on your local PC (such as MySQL Administrator or MySQL Query Browser) you can connect to your database. If you are using SQL Server you will need to connect via SSMS.

Monitoring / Reporting

The monitoring and reporting is quite limited. Only a single page of data is provided which provides data on the Bandwidth DiskSpace and Compute Cycles and gives a breakdown per site. However there is no costing information or a breakdown by date/time. Also no information on downtime, response time etc.
You will definitely need to monitor your sites by yourself and should subscribe to third party services such as Pingdom.

Tools

Tooling is very limited and you will need to write your own routines or utilize third-party tools (Rackspace Cloud has a listing of third-party tools on the site).
Backup is a major omission, the files are backed up and available on FTP for download. There are several backups made per day and they are available for a month, however the timing of the backups cannot be configured. Importantly there is no backup for databases and you will need to backup up your databases by writing a cron (crons are supported) or using a third party tool.

Performance

Looking at the response times of my sites (previously they were hosted on mid-spec’d dedicated box at Server Beach) they are very comparable at approx 500ms load time. I noticed some timeout issues when I first migrated to Rackspace Cloud Sites , I contacted support and they informed me that another account was running some long running queries which slowed down the cluster (really thought they would be implementing more rigorous resource throttling) but this got sorted out very quickly.

Support

Email and live support is free (unlike with Amazon) and the quality and responsiveness was excellent. Live support was available within 5 minutes and emails were normally turned around within 2-6 hours. All problems were dealt with (although in truth I didnt have many complex requests).

Posted in Reviews | Tagged , , | 5 Comments