And: As a result, CloudFront improves response time for requests from those locations.Amazon.com: AWS
Last updated: 9/14/2013
Performance. A CDN improves performance for all pages on your server. The load of the server is reduced due to fewer requests. The downside is that another DNS lookup will occur for your content delivery network, which may take several milliseconds.
But: Overall, even those files are faster to download because of the server locality.
Start. To get started with CloudFront, you must go to Amazon Web Services and make an account. If you already have an Amazon account, then you can use that. You must also create an AWS account.
Note: Amazon provides a lot of cloud computing resources, including computational ones, but CloudFront is only for content delivery.
Once you create your CloudFront account, you may also need to receive an automated phone call from Amazon for security purposes. This requires about 30 seconds of your time. It is easy to start.
Security credentials. Before you can access or upload data to your CloudFront bucket, you must receive your security credentials. These are displayed on the Amazon Web Services, Account screens.
Also: You will need your Access Key ID and your Secret Access Key. These are available on the site.
CloudBerry. You will need to upload your data files to Amazon CloudFront, and the simplest way to do this is to use a client program. If you are using Windows, you can use a program such as CloudBerry Explorer.
Note: There are many other options for Windows and other platforms. You can even use the CloudFront API to develop your own software.CloudBerry Explorer
Using CloudBerry Explorer. You can think of this program as sort of an FTP client. You will need to enter your security credentials into CloudBerry when you first start it up so that it can access your Amazon CloudFront account.
Then: You can, inside CloudBerry, create a bucket, and then drag and drop files from your local computer into the cloud.
Next, you will need to get the web URL for the CloudFront data you upload. If you upload a file into the cloud, it will retain its file name. You can address the file using your unique, generated CloudFront web server URL.
Cyberduck. Another tool that interacts with Amazon S3 and CloudFront is Cyberduck. This is a free program. It asks for donations. It has some occasional bugs. If you frequently use it, consider donating to support further development.Cyberduck: cyberduck.ch
Cost. How much does the Amazon CloudFront service cost? I don't know the complete results for this yet. But for five hours of peak traffic for Dot Net Perls, I incurred about six cents ($0.06) of costs.
The costs for the web server running the website is many times higher than that per day. If Amazon CloudFront can reduce the need to upgrade that server, it will likely save me money.
Update: In the long term, CloudFront saves considerable costs. The savings are significant and durable.
Benchmark. The CloudFront cache is where the big performance gains come into play. CloudFront uses edges (servers in local regions) and these servers have caches. If a local server has a cache of the data, the user will quickly receive it.
HTTP timing results static 6.70 KB 73 ms X-Cache: Hit from cloudfront ~timespan 5.60 KB 1170 ms X-Cache: Miss from cloudfront
The above results show the difference in a hit and a miss response from CloudFront. The file "static" was loaded in only 73 milliseconds and was a hit. The file "~timespan" was loaded in 1.17 seconds and was a miss.
Note: Most of the time spent on the cache miss was latency, not transferring data.
Note 2: In this time, CloudFront's edge location had to pull the file from the central location (Amazon S3).
Tip: Increasing cache hits are the most effective way to improve CloudFront performance.
Optimization. First, we can reduce object size. The CloudFront edges (servers at various locations) use caches. The objects on the servers are expired based on a variety of characteristics, including frequency and object size.
This means that one way to ensure your object is in the cache more of the time is to make it smaller. Large objects used a medium number of times may be expired, but smaller objects would be kept.
So: If you can't make objects more popular, you can make them smaller. The performance result may be similar.
Key: The key here is to isolate them: don't combine them with less popular data that might change based on the user or the page.Minify CSS
You may end up with more HTTP requests and slightly more files. Another benefit here is that when you isolate popular data, the less popular files become smaller and are therefore more likely to be in the cache themselves.
Edge locations. Does CloudFront's design help with people accessing data from other continents? To answer this, I looked at the number of requests coming in from each edge location. I found the following percentages of edge locations were used.
Edge location usage: United States: 39% Europe: 41% Japan: 3% Hong Kong and Singapore: 16%
Even though 100% of the pages on this website come from the United States, the most popular edge location is in Europe. According to the CloudFront algorithms, the largest group of users can download files fastest from Europe.
The Content-Type header is important to use on files from CloudFront. It can help indicate how long files need to be kept on the edges. I don't have data on how much this affects performance, but this Content-Type header is effective.
Cache-Control header: 1 day Cache-Control: public, max-age=86400
Tip: Hosting static files in a distributed way is effective for improving website performance and decreasing costs.
So: It becomes more important to approach site optimization from the perspective of the cache algorithm on the edge locations.
Summary. I looked at the Amazon CloudFront content delivery network. This is a web service. It provides an easy and fast cloud computing approach to performance optimization on websites and other programs.
And: By hoisting resources to CloudFront, I was able to improve performance and potentially save money on hardware.