CDN for API Orchestration.


Content Delivery Network(CDN) is a globally deployed distributed network of servers that serves the content with high accelerated, high performance, and high availability. Traditionally CDN is being used mostly to serve static assets like images, videos, JS/CSS. With the recent trend of API based service developments, the adoption of CDN is also getting involved with serving API responses.

API content delivery network (API CDN) is a version of CDN that specifically focuses on API caching and other benefits. They do not maintain any business logic, but only serve copies of content for requests they have seen before and have previously pulled from the original source. Every request offloaded to an API CDN is one less request to the application servers. Serving requests from an API CDN are usually cheaper in terms of bandwidth cost than serving same bandwidth from servers. API CDN can also reduce latency by caching content in data centers across the country or world and deliver responses from the closest available node to users.

While API CDN is similar to a regular CDN, the key differentiator of an API CDN is that it provides critical API-specific features (see below) in addition to static content delivery.

API CDN Features.

  • SSL support. You can own SSL certificate.
  • Geographical distribution.
  • Token authentication and Management.
  • DDoS mitigation. An API CDN should be able to recover from attacks without significant service degradation.
  • Web Application Firewall. An API CDN provides support for rules automatically mitigating XSS or injections attacks.
  • Support for SPDY and/or HTTP/2.
  • API for URL invalidation and other cache management functionality.
  • SLAs and support process.
  • Effortless up and running.
  • Support to Fixed and per request/bandwidth pricings.

There are plenty of commercial players in CDN market, but there are few specialized in serving API over CDN.

Fastly

Fastly specializes in API caching. It serves a significant number of large-scale tech-savvy clients including Github, Twitter, Yelp, Etsy and more. Fastly supports. It has supports to SSL, Geo, Token Authentication and easy maintenance. From the pricing perspective, it seems to be very competitive and can be online instantly with a trial account. It also supports SAN certificates.

The only thing missing from Fastly support to a Web application firewall.

Mashery/Intel

One of the original players in the API CDN space. Very mature product with a large number of enterprise clients. It supports most of the features listed above including a Web application firewall. One of the not so good thing about Mashery compared to Fastly is unclear pricing structure and slow setup.

Akamai

The biggest CDN vendor in the world. Akamai is known primarily for hosting static web traffic and does not have a dedicated API solution. While it may be possible to make Akamai work as an API CDN, but doing a deep analysis of Akamai for this evaluation due to Akamai’s limited functionality in this area is time consuming as compared to the other platforms under consideration.

DIY Varnish

The self-hosted option. Varnish is the most popular open source cache server. It would be possible to deploy Varnish instances across availability zones. This option will likely cost a significant amount in terms of additional DevOps hours and hosting and will not be as full-featured as fully-managed products.

Cost Estimation.

Consider the site has 500,000,000 requests 15,000 GB of bandwidth requirement for a certain time frame. Pricing is generally based on usage, we can estimate the price on the based average usage.

Based on estimated traffic, the Fastly cost of about $1,975/Month(Price is based on $0.0075 per 10,000 requests and $0.12 per GB and $100/mo for certificate maintenance). Mashery price calculation is available over the phone but with previous records it would easily cost more than $5,000/Month.

Using the AWS pricing calculator, we can estimate the cost of usage and bandwidth for an uncached site through application servers. Consider we have a need to serve 15,000 GB of outbound traffic for a month, we would need 10 large servers (in terms of CPU, RAM, etc). The cost of this would be around $2,500/mo to Amazon. If we are able to cache most API requests, we can reduce usage to 4 medium servers and 2,000 GB at a monthly cost of $750, leading to a cost reduction of $1,750.

This infrastructure saving of $1,750 can be largely offset by the cost of Fastly API CDN while getting away additional number of critical features at the same time.

Summary

API CDN has a list of significant features including speed, DDoS support, token authentication at a very minimal price. Most of the cost can be covered by saving bandwidth on servers. There are a couple of players in API CDN with proven track record with large enterprise clients, upfront about capabilities, service levels, pricing, and have excellent documentation.