# Text object compression by CDN

**URL:** <https://discuss.httparchive.org/t/text-object-compression-by-cdn/267>\
**Category:** Analysis\
**Created:** [June 6, 2014, 5:33am UTC](https://discuss.httparchive.org/t/text-object-compression-by-cdn/267 "2014-06-06T05:33:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blakecrosby](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/blakecrosby/32/1292_2.png) [@blakecrosby](https://discuss.httparchive.org/u/blakecrosby)\
**Post date:** [June 6, 2014, 5:33am UTC](https://discuss.httparchive.org/t/text-object-compression-by-cdn/267/1 "2014-06-06T05:33:04Z")

</div>

I was trying to answer the question of “Which CDNs are doing compression from edge to client?”.

The idea being that a CDN should, by default, compress text files. This would be part of their “speeding up the web” strategy.

```sql
select * from (
select count(*),
  lower(regexp_extract(regexp_extract(resp_content_type,r'(^[\w\/\-]+)'),r'\/(?:x-)?(.*)')) as content_type,
  resp_content_encoding,
  _cdn_provider 
from [httparchive:runs.latest_requests] 
where _cdn_provider !='' 
group by content_type,
   resp_content_encoding,
   _cdn_provider
     ) foo 
where regexp_match(content_type,r'javascript|css|plain') 
and (resp_content_encoding = 'gzip' or resp_content_encoding = '')

```

The query above will:

- Normalize content types (for example, turn ‘application/x-javascript’ to ‘javascript’)
- Only return results were the content encoding is gzip or none (I don’t care about deflate…)
- Only return results where a CDN was used.
- Count the number of requsts (for text, javascript, and css) that were gzip compressed versus not, grouping by content type and CDN.

I tossed the results in an Excel sheet to create a pivot chart, [here are the results](http://snag.gy/XL6zr.jpg)

![](https://yyz1.discourse-cdn.com/flex035/uploads/httparchive/179/44f9c144165f47e7.png)

The majority of CDNs are compressing \>90% of their text assets. This is good. However, I didn’t do any analysis on the size of the object at all (ie, are they compressing files that are already small).
