Last Mile Acceleration (LMA) compresses content before delivery to the end-user when the requesting client—the browser or device—supports gzip decompression. This can provide significant improvement in transfer times to clients with slow connections.
How it works
Your property reviews the request header in a client request for the Accept-Encoding: gzip entry. If it’s included, this indicates that the requesting client can decompress gzip content. The property then reviews what’s set as Compression Response to determine how to deliver content to the client.
Features and options
Field | What it does | Options |
---|---|---|
Compress Response | Select whether to compress responses to clients that support gzip. Eligible clients include the Accept-Encoding: gzip header in their requests. |
|
If you’re using a custom origin, the Same-origin as response option is affected by your setting for Supports Gzip Compression in the Origin Server behavior. The Same-origin response option always uses whatever you have set for Supports Gzip Compression for the applicable origin server.
What you can compress
860 bytes is the smallest object that Akamai edge servers will gzip compress and serve to the client. Any smaller than this, and the overhead required to compress and decompress the content eliminates any advantage gained by compression. Keep this in mind when adding LMA to your property. Ideally, you should add LMA to compress objects that are greater than 4.2 KB in size, and are these file types:
text/html*
application/x-javascript*
text/css*
application/javascript*
text/javascript*
text/plain*
text/xml*
application/json*
application/vnd.ms-fontobject*
application/x-font-opentype*
application/x-font-truetype*
application/x-font-ttf*
application/xml*
font/eot*
font/opentype*
font/otf*
image/svg+xml*
image/vnd.microsoft.icon*
What you can’t compress
Don’t use LMA compression for any of these files types:
- Small files. This includes anything smaller than 860 bytes in size, regardless of file type.
- Content that is already compressed. This includes Gzip, .zip, .7z, etc. The system attempts to compress this content, even though it’s already compressed, and it won’t decrease its size. This will just delay the delivery of the content.
- PDFs. If LMA tries to compress a PDF, an error is thrown.
- Image files. We recommend against this, even if you think they’ll compress. If you’re working with JPEG images, consider using Adaptive Image Compression to compress your images.
- Chunked content. This includes any content that’s delivered as content-encoding: chunked. If your property includes the Chunked Transfer-Encoding behavior, you need to ensure that any rule’s Criteria that contains the LMA behavior excludes any file formats that may be chunked. To be sure that you’re safe—and you’re only including LMA-supported file-formats—apply LMA by including the Minimize payload rule.
- Streaming media content. Often, this content is compressed for delivery using other means. It won’t benefit from LMA compression.