Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between X-Cache and X-Cache-Remote Akamai Headers

Tags:

caching

akamai

I searched a lot but couldn't find a single page on the internet which explained the difference between X-Cache and X-Cache-Remote Akamai header. Every time I receive two different values for these headers which indicates that they are not the same. Any information regarding the different between the two will be of great help.

like image 347
Abhishek Sirari Avatar asked May 02 '16 10:05

Abhishek Sirari


People also ask

What is Akamai cache?

At ​Akamai​, caching refers to objects retrieved from your origin server and stored at any number of edge servers. Edge servers can quickly deliver the cached objects to your API consumers. Caching decreases the load on your origin server and reduces latency in serving objects to the end client.

Can Akamai servers cache different versions of the content?

The Akamai servers cannot cache different versions of the content based on the values of the Vary header. As a result, objects received with a Vary header that contains any value (s) other than "Accept-Encoding" will not be cached.

What is X-cache header in Akamai?

This header simply indicates whether this particular URL can be cached on Akamai or not. Request ID provides a unique request identifier on Akamai network. Value of this header can be used to trace a request on Akamai network by support representative. X-Cache: TCP_MISS from a165-254-246-9.deploy.akamaitechnologies.com

What are the X-cache headers for remote requests?

X-Cache-Remote: TCP_HIT from a23-67-252-148.deploy.akamaitechnologies.com Values of X-Cache headers mention which Akamai servers participated in serving your request.

What are ​Akamai​ pragma headers?

This is the list of ​Akamai​ Pragma headers you can use when creating a request in the Request Content (CURL) tool and Advanced URL Health Check problem scenario. Returns information about how the edge server response was served. Returns information about how the parent server response was served.


2 Answers

As you probably know, Akamai does two levels of redirections.

  1. The DNS points to one of the addresses closest to the client.
  2. But it is not the address of the actual server that services the request. Rather the request gets serviced by one of the "edge" servers.

There is a possible third level. Sometimes the edge server, if the content is not in its cache, instead of sending the request to the origin server it redirects to another edge server in the hope that the latter may have the content in its cache. "X-Cache" and "X-Cache-Remote" are the status of cache check on these two edge servers respectively. If the first edge server serves the request from its cache or if it fetches from the origin directly, "X-Cache-Remote" header is absent.

There is practically no difference between the first and the second edge servers except in one aspect. In the second edge server, detection of user location, any check related to user location returns "false". For example if your criterion says "Is the user country one of ("US")?" would return "false" and the opposite "Is the user country NOT one of ("US")?" would also return false. So if you have rules that use user location, you have somehow pass that information from the first edge server to the second. Custom outgoing request headers can be used for this.

None of the above is from the Akamai documentation. Rather they are based on a series of experiments performed on Akamai. Akamai does give a clue to this effect by emitting a warning: "The behaviors and matches enclosed within a User Location Data match will only be executed by the Akamai edge server that receives the client request. If the request is forwarded to another Akamai server, the matches and behaviors enclosed will be ignored. If you are unsure about how this will affect your property please contact your Akamai Technical representative."

like image 118
Thiruvalluvan M. G. Avatar answered Oct 30 '22 16:10

Thiruvalluvan M. G.


There is a single page that explains all of the various x-akamai-* headers (if you're logged in to the Akamai Customer Community) that you can use with Akamai.

The possible values of those two specific headers (x-akamai-cache and x-akamai-cache-remote) are available in a separate Customer Community document.

In short, the x-akamai-cache header tells you how the initially responding Edge server handled the object. The x-akamai-cache-remote header tells you how the Parent Tier handled the object.

In many circumstances, your configuration may have something called "Tiered Distribution" (or "Cache Hierarchy") enabled which uses a multi-layered caching system. There's a good video created by Akamai employees that talks about Tiered Distribution and other caching behaviors available to you through the Akamai platform. There's also a little more on this multi-tiered caching system on Akamai's Developer site.

like image 35
Josh Cheshire Avatar answered Oct 30 '22 18:10

Josh Cheshire