Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does http compression also compress the viewstate?

Tags:

c#

asp.net

iis

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.

like image 990
Avram Tudor Avatar asked Dec 23 '13 12:12

Avram Tudor


1 Answers

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. :-)

like image 172
CodeCaster Avatar answered Oct 23 '22 04:10

CodeCaster