Saturday, February 28, 2015

WebAPI GZip and Deflate Compression

Today, I implemented the ability to compress our return Json.

After trying a number of options, this was the one that seemed to give me the flexibility and consistency:

Microsoft.AspNet.WebApi.MessageHandlers.Compression

And although I've not found a lot of documentation to this fact, best practice seems to dictate that you do not want to compress every single response.  For objects less than ~4kb the time, and server resources, it takes to compress is more than the time save for sending the smaller package over the wire. I would love to see more on this subject, though.

No comments:

Post a Comment