Tuesday, July 14, 2009

Understanding Akamai Headers to debug slowness or cache related problems

If your website is akamaized or basically cached by akamai, you would expect to see your web pages loaded faster, but in some cases you won't find the difference which might be related to your akamai settings or the response headers that your website is sending via akamai. Hence in order to debug and fine tune, it is necessary to understand the headers that akamai send along with the regular HTTP headers. To inspect those headers you can download the latest version of EdgeSuite Booster for Internet Explorer on Akamai’s portal (https://control.akamai.com/) under Support > Documentation > EdgeSuite > Tools or use Live HTTP Headers firefox plugin. Here is a sample of a response headers via akamai where the highlighted ones are akamai specific headers,


GET /common/global.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
Cache-Control: max-age=0

HTTP/1.x 200 OK
Content-Type: text/html
Etag: W/"26100-124692218130400"
Cache-Control: max-age=120
Date: Tue, 14 Jul 2009 18:01:27 GMT
X-Cache: TCP_MEM_HIT from a69-174-50-208 (AkamaiGHost/5.7.2-5726413) (-)
X-Cache-Key: S/L/2649/75069/6h/www.example.com/common/global.html
X-True-Cache-Key: /L/www.example.com/common/global.html
X-Serial: 2649

Connection: keep-alive
Vary: Accept-Encoding
X-Check-Cacheable: YES

The X-Cache headers are related to akamai and here are the different headers you might get to see and their respective meanings,

X-Cache HTTP Response Header
Returned from request using "Pragma: akamai-x-cache-on":

TCP_HIT: The object was fresh in cache and object from disk cache.
TCP_MISS: The object was not in cache, server fetched object from origin.
TCP_REFRESH_HIT: The object was stale in cache and we successfully refreshed with the origin on an If-Modified-Since request.
TCP_REFRESH_MISS: Object was stale in cache and refresh obtained a new object from origin in response to our IF-Modified-Since request.
TCP_REFRESH_FAIL_HIT: Object was stale in cache and we failed on refresh (couldn't reach origin) so we served the stale object.
TCP_IMS_HIT: IF-Modified-Since request from client and object was fresh in cache and served.
TCP_NEGATIVE_HIT: Object previously returned a "not found" (or any other negatively cacheable response) and that cached response was a hit for this new request.
TCP_MEM_HIT: Object was on disk and in the memory cache. Server served it without hitting the disk.
TCP_DENIED: Denied access to the client for whatever reason
TCP_COOKIE_DENY: Denied access on cookie authentication (if centralized or decentralized authorization feature is being used in configuration)

X-Cache-Key HTTP Response Header
Returned from request using "Pragma: akamai-x-get-cache-key"; the value is the internal cache key for the page or object on the Akamai server.


Mike Hagen said...

This is excellent information. Just what I was looking for! Where did you find this info?

onewebclick said...

If you install the EdgeSuite Booster plugin for IE from akamai , you can find a documentation that talks about some of the information.

Anonymous said...

this rocks the kasbar! great info!

There was an error in this gadget