Data Compression¶
BidSwitch supports JSON, Zstandard (zstd), and Compressed JSON (gzip) as data formats for bid requests and
bid responses.
Zstandard is the preferred data compression format for BidSwitch.
Zstandard Data Compression Format¶
BidSwitch recommends using Zstandard (zstd). Zstandard is a lossless data compression format that offers the following perks:
Faster compression and decompression than gzip. At comparable compression levels, zstd compresses at ~510 MB/s and decompresses at ~1,550 MB/s, versus gzip’s ~105 MB/s compression and ~390 MB/s decompression.
Better compression ratios (2.896 vs 2.743 on standard benchmarks).
Configurable compression levels.
Thus, switching from gzip to zstd means the same bid traffic can be sent and received using less bandwidth and less CPU, which helps handle higher QPS without adding infrastructure.
Zstandard needs to be supported by both sides (sender and receiver). It is signaled via the standard Content-Encoding: zstd HTTP header.
Gzip Data Compression Format¶
Gzip format should only be used if using Zstandard is not possible.
Gzip is signaled using the Accept-Encoding: gzip header. Here is what BidSwitch has observed with gzip traffic:
When enabled, gzip compression ratios tend to be in the range of x1.4 to x2.0 (depending on the size of the request/response)
There is no tangible extra CPU load due to compressing/decompressing traffic, i.e. there is no extra cost
Sending Bid Responses to BidSwitch¶
Sending bid responses in Compressed JSON does not require special configuration. The
bidder is only required to send a Content-Encoding: gzip header in the responses
where the compression is used.
Receiving Bid Requests from BidSwitch¶
In order for the Buyer to receive Compressed JSON bid requests, please contact BidSwitch support at support@bidswitch.com.
Once enabled, BidSwitch starts sending bid requests in Compressed JSON. All such bid
requests carry an extra HTTP header Content-Encoding: gzip. It is recommended for
the bidder to check for this HTTP header to distinguish between JSON and Compressed
JSON bid request formats, as even when compression is enabled some Bid Requests may
arrive uncompressed. In this case the Content-Encoding: gzip header is absent.