Jeffrey Costa

Akamai API Capabilities

Blog Post created by Jeffrey Costa Employee on Dec 23, 2015

Application Programing Interfaces (APIs) allow applications to talk to other applications, and have become crucial backend services to websites and mobile apps. Since APIs are the connective tissue for online business and the driver behind Internet of Things (IoT), optimized APIs can help make your business much more agile. Akamai can help improve the performance and reliability of these crucial assets. Here are five ways to optimize your APIs with Akamai:

API Acceleration

Akamai offers core technologies, such as SureRoute, that can improve the performance of delivering your APIs. SureRoute chooses the most optimal path to your origin server to ensure that dynamic API content is delivered to consumers via the fastest, most reliable route. Inside the Akamai network, proprietary techniques are used to avoid Internet congestion points and unnecessarily long routes. An optimal path between your origin infrastructure and Akamai Edge servers is selected based on real-time data collected by Akamai.

API Caching

Another way to increase the performance your API is to offload common requests that do not require back end processing to Akamai. Frequently, the content of a JSON API response is a mix of cacheable and non-cacheable content. This is largely based on early design decisions made by developers who may not have considered API responses as cacheable.

API responses can be cached and Akamai will hold this data at the Edge (even for mere seconds) to position the content closer to the consumer requesting it. This minimizes data transfer time to consumers of APIs such as mobile apps, where latency is crucial.

Caching APIs generally requires a review of your API content to determine which data does not change frequently. A few examples of long-lived data types include: 

  • physical (store) locations
  • SKU numbers
  • product descriptions
  • geographic destinations

In the sample API response to the left, the data name-value pairs shown in red are non-cacheable, as they are dynamic and likely change frequently. This includes items such as product price and quantity. However, name-value pairs such as product description, SKU number, and sustainability rating do not change often, and are candidates for caching. Caching these responses reduces the time to load any dynamic data, as the static data will be ready to be served immediately from cache.

API Compression

Another feature Akamai can deliver today is compression of API responses that use text formats such as JSON or XML. Compression of API responses can reduce the payload size and thus the delivery time of API responses. If the API consumer supports GZIP decompression, you can enable it easily at origin and the Akamai configuration to accomplish 60-90% reduced payload size. You might also enable HTTP/2 (H2) to ensure request headers are compressed as well (NOTE: you must verify that the API consumer uses the network libraries which support HTTP/2).

API-based Authentication

Akamai can also help with authentication of API consumers at the Edge. In the example below (based on an actual Akamai customer), each request from a mobile application is authenticated by an external authorization server. If authentication succeeds, the content server returns the requested data to the mobile app. This configuration, while common, also adds additional latency to each request, while incurring the operating costs of the authorization server. Note that even if static responses were stored in the Edge server cache, the mobile app still incurs the 75ms delay needed to verify that a requesting client is authorized.

This workflow with multiple servers in the example above would take between 100ms to 150ms to complete, and can be optimized down to 25ms - 75ms by using Akamai Advanced Edge Authorization. The Akamai server can authenticate encrypted tokens using a shared secret right at the Edge, then provide the content from its cache without any additional network round-trips to external servers. This can significantly increase the performance of the mobile application while also reducing infrastructure costs. (NOTE: The metrics above are used for illustrative purposes only, and are not actual)

API Versioning At the Edge

Another API optimization that can be done at the Edge is to help translate or orchestrate certain types of requests. It is easy to craft logic on the Akamai Edge to modify request parameters such as sorting or converting query-strings, altering request paths, or changing request and response headers.

One use of this functionality is to dynamically translate API calls on-the-fly between a legacy API format and a newly-released format (illustrated in the diagram below). This optimization allows Akamai customers to focus their internal development on the new API version, allowing Akamai to handle translation of requests from the legacy version to the new and optimized API format.

API versioning at the Edge reduces infrastructure costs by taking over the API format version translation from internal servers, as well as reducing overhead costs that might otherwise be incurred by manual code edits. Furthermore, some online devices are not capable of changing the API call version they run. Versioning at the Edge helps you overcome the hurdles of maintaining ancient infrastructure while retaining support for legacy devices. 

API Prioritization

API call volumes can be unpredictable, and a peak event could overwhelm your infrastructure, resulting in a poor end-user experience. The Akamai API Prioritization Cloudlet provides a configurable policy that, when activated, will respond to a percentage of API calls with an alternate, non-html asset, such as JSON or XML. These files can be deployed to Akamai NetStorage, and help alleviate strain on the API service, and protect it from becoming overloaded. The Cloudlet can also be used to define and prioritize particular traffic segments to an API, while serving other consumers an alternate static experience.

You can find the Akamai Cloudlet in the Akamai Marketplace.

APIs have become the language of the Internet. With the growing adoption of Internet of Things, more devices are coming online, and these devices and the applications they run need a common language to communicate. Therefore, optimizing the performance of these APIs becomes crucial.

Akamai can help you optimize the performance of your APIs as outlined in the examples above. Please contact your account team if you would like to learn more about our capabilities in optimizing your APIs.