SuperEvilMegacorp / vainglory-assets

Community provided art, schemas, and other assets that make using the Vainglory API easier
https://developer.vainglorygame.com
MIT License
54 stars 40 forks source link

Feature/Bug: Telemetry files too large & uncompressed #192

Closed schneefux closed 7 years ago

schneefux commented 7 years ago

A 20 minute match is `~1.3 MB large, which takes 0.5s to download on a 100 MBit/s connection.

> time curl https://gl-prod-us-east-1.s3.amazonaws.com/assets/semc-vainglory/sg/2017/05/14/19/09/e2f7cb9d-38d8-11e7-9e7a-0242ac11000e-telemetry.json -s -I -H "Accept-Encoding: gzip"

HTTP/1.1 200 OK
x-amz-id-2: …
x-amz-request-id: …
Date: Wed, 05 Jul 2017 19:34:23 GMT
Last-Modified: Sun, 14 May 2017 19:09:44 GMT
ETag: "…"
Accept-Ranges: bytes
Content-Type: application/json
Content-Length: 1297020
Server: AmazonS3

curl  -s -I -H "Accept-Encoding: gzip" 0,03s user 0,01s system 7% cpu 0,538 total

Using gzip compression, the JSON's size can be reduced to 57kb ~ 100kb (5%!!! depending on --fast or --best). As you can see in the response headers, the http response is not compressed. Without having further knowledge about your infrastructure, maybe this blog post is what would be helpful to drastically improve response times and reduce traffic costs.

svperfecta commented 7 years ago

Hey dudes - Yeah, we can do this. Great one. I'll add a compresses version of the telemetry.

svperfecta commented 7 years ago

This will ship tomorrow or monday. What we did:

Example:

    {
      "type": "asset",
      "id": "2be27e6f-2fa0-11e7-8833-0242ac110009",
      "attributes": {
        "URL": "https://cdn.gamelockerapp.com/semc-vainglory/na/2017/05/03/01/31/2be27e6f-2fa0-11e7-8833-0242ac110009-telemetry.json",
        "contentType": "application/json",
        "createdAt": "2017-05-03T01:31:03Z",
        "description": "",
        "filename": "telemetry.json",
        "name": "telemetry"
      }
    },

Then:

ext.bcorrigan@BCORR1ML1 11:17:32 ~/code/gamelocker/gamelocker-core-stack/terraform |master {1} ✓| →  time curl -so /dev/null https://cdn.gamelockerapp.com/semc-vainglory/na/2017/05/03/01/31/2be27e6f-2fa0-11e7-8833-0242ac110009-telemetry.json

real    0m0.172s
user    0m0.020s
sys 0m0.019s
ext.bcorrigan@BCORR1ML1 11:17:33 ~/code/gamelocker/gamelocker-core-stack/terraform |master {1} ✓| →  time curl -so /dev/null -H "Accept-Encoding: gzip, deflate" https://cdn.gamelockerapp.com/semc-vainglory/na/2017/05/03/01/31/2be27e6f-2fa0-11e7-8833-0242ac110009-telemetry.json

real    0m0.101s
user    0m0.020s
sys 0m0.015s
ext.bcorrigan@BCORR1ML1 11:17:38 ~/code/gamelocker/gamelocker-core-stack/terraform |master {1} ✓| →  time curl -so /dev/null https://cdn.gamelockerapp.com/semc-vainglory/na/2017/05/03/01/31/2be27e6f-2fa0-11e7-8833-0242ac110009-telemetry.json
schneefux commented 7 years ago

@genexp

Retroactively update all asset urls

Can I safely rewrite the domain of all cached URLs in our database?