Easily build complex reports
Monitoring and efficiency metrics
Custom cost allocation tags
Network cost visibility
Organizational cost hierarchies
Budgeting and budget alerts
Discover active resources
Consumption-based insights
Alerts for unexpected charges
Automated AWS cost savings
Discover cost savings
Unified view of AWS discounts
COGS and business metrics
Model savings plans
Collaborate on cost initiatives
Create and manage your teams
Automate cloud infrastructure
Cloud cost issue tracking
Detect cost spikes
by Vantage Team
Contents
Note: This blog post has been done as an independent pricing evaluation for the benefit of Vantage users and the broader infrastructure community. While Vantage employees have met with both representatives of AWS and Fastly to confirm details, this is not a sponsored post and was not commissioned by either party.
Fastly is a global content delivery network (CDN) used to decrease latency and improve performance for images, video, software downloads and more through the Fastly edge cloud. CloudFront is a managed CDN service operated by AWS.
For this comparison, we’ll match Fastly against CloudFront to see who can deliver the most bytes the fastest for the least cost. This post is really more about explaining pricing structure than annointing winners but for the example service, CloudFront is 73% cheaper than Fastly. However, with a small architecture change, the script is flipped and Fastly comes out 24% cheaper than CloudFront.
A content delivery network (CDN) is a set of servers, one of which is located geographically close to the user of your application, and sends data to that user’s device. Serving requests with cached content, especially bulkier media like video and images, closer to users is ideal: The data arrives faster, there are less transit fees, there’s less buffering and timeouts to the end-user.
The software infrastructure that powers CDNs is complex and involves solving numerous difficult computer science problems in networking and distributed systems. These days most companies buy versus build their CDNs. Companies like Akamai, Fastly, and Cloudflare and solutions like AWS CloudFront and Google Cloud CDN expose CDN services for a fee based on levels of usage and what kinds of requests are served.
Let’s look at two examples of how companies use Fastly and Amazon Cloudfront.
LaunchDarkly has done years of work with Fastly to get the lowest latency possible. LaunchDarkly gives companies programmable feature flags, where they can enable new features in their app with a switch - or disable the feature if it is not working. They serve more than 20 trillion feature flag responses every day.
Moving feature flag evaluation closer to the user with Fastly
LaunchDarkly uses Fastly Compute@Edge to actually evaluate whether they should return TRUE or FALSE for a particular feature on the CDN layer instead of their servers. By doing this, they can return a response in 25 ms. That’s faster than the 40-60 ms latency of most multiplayer games!
In 2016, Slack gave a talk on how they reduced their API response times using CloudFront. The Slack REST API is used not only by developers building bots and integrations but also by the core messaging product itself. The Slack API returns things like channel lists when you first load the app.
Note the impact of edge SSL termination on Slacks’ API response times
Slack wants channel lists show up right away so their app feels very fast. To reduce response times they put their entire API behind CloudFront, and saw a 50% drop in latency. Technically, the CDN is caching things like HTTPS headers when it passes traffic through to Elastic Load Balancer. This means that the SSL session can persist at the edge which avoids long roundtrips.
With so many benefits that come from CDNs, most large software companies adopt them by default. Choosing a provider then comes down to cost, in addition to the feature set available. For each provider, the first table has traditional CDN pricing for bandwidth and requests. The second table shows pricing for edge compute, which is also what we focus on with an example workload.
Fastly has 3 products with usage based pricing: a CDN, security solutions, and edge compute. Generally you see about a 30% discount after the first 10 TB of bandwidth are consumed. The regions below refer to where the cache is serving your content. Users located in Asia and India for example, have more expensive bandwidth and requests than in North America, and this is true across managed CDN providers. One reason is there are fewer data centers and racks available for these companies to purchase, in proportion to the greater number of users.
Pricing by Gigabyte (GB) and HTTP requests for Fastly
On-demand pricing like this is the most expensive way to use Fastly on a per-unit basis. Fastly also offers tiers with a committed use amount, similar to the concept of coverage in cloud infrastructure pricing. For example on the Professional Plan customers get 10 TB per month at a lower rate than $0.12 per GB.
In addition to CDN, Fastly offers products in three other areas. On-demand pricing is not publicly available for Fastly’s Next-Gen WAF (firewall) or Observability (logging) products. Its latest offering, Fastly Compute@Edge is a very interesting serverless and edge compute product with usage-based pricing based on the amount of memory consumed by the function. This is the product LaunchDarkly is using above, albeit at massive volume discounts.
Usage based pricing for Fastly Compute@Edge
How can we reason about this? Let’s say I have a function that executes for 100 ms and uses 128 MB of memory and my service calls it 1M times a month. Start by getting the price per 128 MB and total runtime for the month in ms. Then convert to seconds and multiply. Calling this function 1M times would cost $0.44 + $0.50 for the million requests. Under $1 for 1M functions seems great.
Not so fast though. Each of these functions runs for 100 ms, of which 20 ms are included and each additional 10 ms increment is charged. That means our 1M requests have 80M ms of charged CPU time. Convert to seconds and multiply and we get a compute charge of $3.60 for this batch of function calls. Add everything together and serving 1M requests costs under $4.54.
Who says performance doesn’t matter anymore? If our functions were under 20 ms in runtime, we would save 80% of this monthly bill. With economics like this, you can see why a URL shortener like bit.ly that could take advantage of an edge compute architecture can serve unlimited requests for free.
CloudFront pricing is based on GBs of bandwidth, number of requests, and GBs of compute memory.
CloudFront pricing by Gigabyte (GB) and by HTTP Request
CloudFront actually has more tiers and discounts up to 5 PB per month available. We can assume these are competitive to Fastly. CloudFront’s firewall product, Origin Shield, does have a price per request available. There is also a logging charge of $0.01 for every 1M log files published to CloudWatch or another logging destination.
As we might expect with CloudFront as well, there is an edge compute product - although actually there are two: CloudFront Functions and Lambda@Edge. CloudFront functions are really constrained and meant for things like rewriting URL headers. Lambda@Edge is more closely analogous to Compute@Edge from Fastly and is administered through the AWS Lambda console.
Pricing for two AWS edge computing products: CloudFront Functions and Lambda@Edge
How much do 1M requests for our 128 MB function that runs for 100 ms cost now? (pause for time to calculate).
All together this is 100M ms of runtime, convert to seconds and multiply by $0.00000625 and we have a total cost of $0.63 + $.60 for the request and a total of $1.23. That means that running this application through CloudFront is 73% cheaper than through Fastly. As we saw above though, if our function calls all had shorter runtimes, it would be Fastly that is 24% cheaper than CloudFront.
Before you get started piping hundreds of millions of requests and Petabytes of data through Fastly or CloudFront, you can always test them out for free! Of course, like the example above, each service has some areas where it would be more advantageous to use one or the other.
Fastly looks at your overall bill and says the first $50 of spend are free. They also throw in 5 free certificates from non profit certificate authorities (CAs) like Let’s Encrypt.
Amount of free usage on the Fastly free tier
Like we saw in the paid analysis, Fastly does very well with the number of HTTP requests made.
CloudFront gives you a quota of each type of product it offers. Once you hit this quota, you start paying the charges outlined above.
Amount of free usage on the CloudFront free tier
Similar to the paid discussion, CloudFront’s bandwidth is more generous and the number of requests it will serve is far less. Function calls are dependent on the runtime of the function.
We can see that Fastly has cheaper requests through their CDN and lower prices if the edge functions execute quickly. CloudFront bandwidth is a better deal, notwithstanding what we do not know about how Fastly pricing scales. You can see why LaunchDarkly would go with Fastly for their Feature Flags at the Edge product. It’s the most economical platform for that usage pattern. On the other hand, Slack is getting more mileage out of the bandwidth that it’s sending through CloudFront for its API.
The same holds true of compute. Fastly dominates short lived functions but prices quickly escalate when more compute needs to be done. The richness and variety of software services today dictate that there is ample room in the market for both - and which one to choose comes down to more than cost.
We have touched on use case a bit here in the pricing conversation but there are other factors worth noting as well:
RDS Extended Support allows customers to continue receiving security updates for older database versions, but it comes at a significant hourly per-vCPU cost that increases over time.
MongoDB Atlas is the cost-effective choice for production workloads where high-availability is a requirement.
Grafana is a strong competitor to the monitoring and observability features of Datadog for a fraction of the price.