I'm currently working on a large asp .net project that's been around for some years now. Recently some performance optimization time has been allocated because the number of requests and the bandwidth for them was too large so I did some research into that area and besides other solutions, I've also implemented ViewState compression by overriding LoadPageStateFromPersistenceMedium and SavePageStateToPersistenceMedium and also enabled dynamic compression from IIS. Both of these have shown significant improvements on load testing.
My question is, as stated in the title of this, does http compression also compress ViewState before sending requests? If so, is it worth keeping ViewState compression and why?
Thank you.
HTTP compression compresses data sent from server to client. If you configure dynamic content compression, your viewstate, part of the HTML in the form of a hidden input element, will be compressed by IIS.
Those huge viewstates, only compressed from server to client, will still have to be uploaded for each request, as clients don't do compression.
So if you apply your compression before writing the viewstate to HTML, the postback from the client will be smaller. As discussed here, it usually makes no sense compressing compressed data again, as it will mostly only increase the size.
However, the dynamic content compression can compress other elements of the response, perhaps still gaining a net result. You'll have to measure it. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With