The Effects of GZip Compression in a Django API Server

Enabling GZip compression in Django only requires you to add one line to your core settings file. Simply add django.middleware.gzip.GZipMiddleware to the MIDDLEWARE section and compression will be applied to all eligible calls. (Compression is disabled for non-200 responses, if the client does not indicate they can accept gzipped content, etc.).

Despite the ease of implementation, the amount of data you can avoid sending over the wire can be significant. The changes described below were seen when loading some simple animal movement data.

|Format|Payload|Time| |---|---|---| |JSON|1.4mb|6.14s| |JSON + gzip|168kb|4.35s| |Arrow|350kb|3.73s| |Arrow + gzip|204kb|3.46s|