Dropping compression makes bid requests bigger, yet it lets the bidder use less memory. It sounds backwards, but once a request arrives uncompressed, the bidder can read it in place instead of copying it into its own memory, and that becomes practical when the bidder runs inside the exchange’s cluster.
Over the internet, a bidder decodes every compressed request. Decoding means copying each field into new objects in the bidder’s memory, about 4.4 KB per request with protobuf, and dropping them once the bidder has decided. It is like printing a whole document to check three lines and throwing the paper in the bin, for every request. In Go, Java or C# the garbage collector, the part of the program that frees unused memory, empties that bin. Each time it runs it has to walk through everything the bidder keeps, to see what is still in use. After each cleanup Go counts the data still in use, and by default it starts the next cleanup when memory reaches twice that. With 2 GB of campaigns the bidder can use 4 GB, and half of it is a full bin. The setting can be tuned either way, but it only trades memory for CPU: less garbage held means more cleanups.
There is little to do about it there, since requests are usually gzipped to save on egress and gzip must be unpacked before anything can be read. Inside the exchange’s cluster compression becomes optional, and a zero-copy format like FlatBuffers, SBE or Karmem from my last two posts lets the bidder read fields straight from the bytes it received. There is nothing to copy, so there is nothing to clean and no trade between memory and CPU to tune.
I tested it with the exchange and the bidder in one program on 4 cores, without a network between them, sending the same 20,000 real bid requests over and over until 2 million per format, 3 runs each, with 2 GB of data standing in for campaigns. With protobuf, memory peaked at 6.4 GB. With FlatBuffers, SBE or Karmem it stayed at 2.6 to 2.8 GB, and the garbage collector never ran once. The slowest 1 in 1,000 requests also dropped from 122 µs to 5 to 9 µs, because during a cleanup the collector takes a quarter of the cores, and requests that arrive then must help it clean before they continue.
A few microseconds matter little in the auction. Memory matters more: about 4 GB less for every bidder pod in this test. That memory can hold a bigger model, and inside the exchange the bidder also has more time for decisioning, since the request no longer spends that time reaching the bidder.
A bidder running inside the exchange’s cluster can drop compression and read requests in place, so its memory and CPU go to bidding, with almost none spent holding and cleaning garbage. The same machines do more useful work, so the bidder can take more of the exchange’s traffic without asking for more of them. The bidder needs less memory, keeps its slowest requests fast, and has room for a bigger model.




