Akamai Connector For Varnish

The Akamai Connector for Varnish was created to ease your life as a Varnish administrator or developer. Using the Connector, you will be able to signal the effects of cache rule changes to Akamai automatically. Changes at the origin Varnish Cache server will take effect in real time. This also ensures that you are maximizing offload at multiple application tiers for better performance.

Once installed, the Connector automatically syncs with the Akamai Platform based on your Varnish configuration and forwards your cache purges, making Varnish the source of truth for cache storage.

How It Works

The Akamai Connector for Varnish is a VMOD that transparently syncs Varnish cache configuration and purges to the Akamai platform using VCL (Varnish Configuration Language).

This allows you to communicate caching rule changes, issue and synchronize purge requests, and defer ESI processing to the Akamai platform, as well as applying best practice Akamai settings at origin, and making it easier to work with device characteristics by parsing the inbound EDC header into a VCL object.

The Akamai Connector will automatically add Edge-Control headers with the appropriate post-check attribute that correctly handles the Varnish grace period. This eliminates race conditions between the Edge and Varnish which can result in Varnish serving stale objects to the Edge which are then cached. The Connect will also push Edge Side Include (ESI) processing out to the Edge by sending a dca=esi attribute along with the Edge-Control header.

The Akamai Connector will also remove extraneous (non-Content-Encoding) Vary headers which can cause the Edge to cache too many variants of an object resulting in excessive cache misses.

When a request is received from the Edge, the Connector will set the True-Client-IP header correctly, as well as parse the Akamai Device Characteristics header in to a more useable VCL object. Each element of the X-Akamai-Device-Characteristics will be available via req.http.X-ADC-<CHARACTERISTIC>, for example the value of is_mobile will be available as the req.http.X-ADC-is_mobile header.

Additionally, the Connector will automatically respond with a static test object for SureRoute tests, avoiding an unnecessary trip to origin.

All of these features are enabled by default by including the akamai_auto.vcl configuration in your VCL configuration. They can be configured and tweaked just like any other VCL option.

Installation

Installation is easy. Varnish Cache users will need to compile the VMOD using provided tarballs, while Varnish Plus users have the added option of using a system package manager (apt, or yum). Once installed, you must copy the VCL and configuration files into place:

Varnish Cache

            
    $ wget [URL]
    $ tar -xvzf akamai-connector-VERSION.tar.gz
    $ cd akamai-connector-VERSION
    $ ./configure && make && make check
    $ make install
            

NOTE: [URL] will be provided as part of access.

Varnish Plus

            
    # Ubuntu/Debian
    $ apt-get install varnish-plus-vmods-extra

    # RHEL/CentOS
    $ yum install varnish-plus-vmods-extra
            

Install Configuration & VCL

Next, install the default configuration and VCL files:

            
    $ akamai-connector-setup.sh install
    

Automatic VCL Integration

To enable the default configuration (recommended) add the following lines to your configuration:

            
    import std;
    import akamai;
    include "akamai_auto.vcl";
            

NOTE: If you have already imported std, you should not do so again.

Verify Installation

Once you have reloaded Varnish, you can verify your installation by checking the Via header returned by Varnish:

            
    # Using cURL
    $ curl -s -I -X GET -H "Via:akamai.net(ghost) (AkamaiGHost)" http://example.com

    # Using httpie
    $ http -ph GET http://example.org "Via:akamai.net(ghost) (AkamaiGHost)"
            

The Via header in the response will indicate that the Akamai Connector is being used.

Verify Cache Purge

To use cache purging, you must first configure Varnish to enable it. A common way to do this is by adding support for a PURGE HTTP method only accessible from your internal systems. See the Varnish Documentation for further details.

Once purging is enabled, you can verify purge sync by submitting a purge request and verifying on the Edge.

            
    # Using cURL
    $ curl -X PURGE http://example.org/path

    # Using httpie
    $ http PURGE http://example.org/path
            

NOTE: By default, the Connector will perform cache invalidation rather than purge.

Documentation

Akamai Connector for Varnish

Full documentation for the Akamai Connector for Varnish.

Varnish Documentation

General Varnish setup and configuration

Blog Post: Introducing Akamai Connector for Varnish

An introduction to the Akamai Connector for Varnish

FAQ

What version of Varnish do I need to use the Connector?
Varnish 4.1 or later.
Is this a trial or fully functional version of the Connector?
There is no trial version. The Connector is fully functional.
Does this work only with Varnish Plus?
The Connector works with both Varnish Plus and Varnish Cache.
What license is this product released with?
The Connector has a BSD license.
Who provides support for the Connector?
Akamai AkaTec provides first-level support, while Varnish provides second-level support.
How much does it cost?
Akamai provides the Connector free to all Akamai customers using Varnish.
How long will it take to get Access?
Access links to download the Akamai Connector will be sent within 1-2 business days.