Alachisoft StorageEdge - Online Documentation

Caching SharePoint ViewState

 
SharePoint web interface is an ASP.NET application running on WFE servers and just like any other ASP.NET application it also has to deal with ViewState becoming a performance overhead. StorageEdge helps you cache ViewState on WFE servers and send a much smaller payload to the user's browser containing only a unique ID for this ViewState. As a result, your page performance improves and your SharePoint also scales much better.
 
Why Cache ViewState?
 
ViewState is an encrypted text string containing the state of web form controls and widgets and is sent to the user's browser to preserve this state across post-backs. For forms with lot of controls, DataGrid control, or some other complex controls, the ViewState can become quite large. Here are some reasons why you should consider caching the ViewState.
 
  • ViewState is large (tens of kb) on large forms & DataGrid
  • Large ViewState slows down page download time
  • Large ViewState slows down post-back request time
  • It can cache ViewState on WFE servers & send only a token to user
  • ViewState cache is distributed to all WFE servers in the farm
 
How StorageEdge Caches ViewState?
 
ViewState is included in the response of a web request as a hidden form field called __VIEWSTATE. On all page visits during the save ViewState stage, the Page class gathers the collective ViewState for all of the controls in its control hierarchy and serializes the state to a base-64 encoded string.
ViewState is included in the response of a web request as a hidden form field called __VIEWSTATE. On all page visits during the save ViewState stage, the Page class gathers the collective ViewState for all of the controls in its control hierarchy and serializes the state to a base-64 encoded string.
 
 <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzg0MDMxMDA1D2QWAmYPZBYCZg9kFgQCAQ9kFgICBQ9kFgJmD 2QWAgIBDxYCHhNQcm V2aW91c0NvbnRyb2xNb2RlCymIAU1pY3Jvc29mdC5TaGFyZVBvaW50LldlYkNvbnRyb2xzLlNQQ29udHJ vbE1vZGUsIE1pY3Jvc29md C5TaGFyZVBvaW50LCBWZXJzaW9uPTEyLjAuMC4wLCBDdWx0dXJlPW5ldXRy YWwsIFB1YmxpY0tleVRva2VuPTcxZTliY2UxMTFlOTQyOWMBZAIDD2QWDgIBD2 QWBgUmZ19lMzI3YTQwM F83ZDA1XzRlMjJfODM3Y19kOWQ1ZTc2YmY1M2IPD2RkZAUmZ18yNDQ3NmI4YV8xY2FlXzRmYTVfO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GQCEw8PFgQfC2gfBmhkZAI VDw8WAh8GaGRkAhcPFgIfBmhkAhkPFgIfBmhkAhsPDxYCHwZ nZGQCAw9kFgICAw8PFgQeGHBlcnNpc3Rl ZEVycm9yQWN0aW9uVHJlZWQeG3BlcnNpc3RlZEVycm9yQWN0aW9uVHJlZUlkc2RkZAIlD2QWAgIHDw8WA h8GaG QWAgIFD2QWAgIBDzwrAAkBAA8WAh4NTmV2ZXJFeHBhbmRlZGdkZAIvD2QWAgIED2QWDgIDDxYCHw ALKwQBZAIFDxYCHwALKwQBZAIHD2QWAmYPDxYCHwZoZG QCCQ9kFgJmDw8WAh8GaGRkAgsPZBYCZg8PFgI fBmhkZAIND2QWAmYPDxYCHwZoZGQCDw9kFgJmDw8WAh8GaGRkGAIFOWN0bDAwJG0kZ181NmIxMzIzMV9k YjllXzRlYTZfOTc5ZF9iYWZlNDk3MDkyOWUkY3RsMDEkZ3JpZA8UKwADPCsACgEIZgL/////DwL/////D 2QFRWN0bDAwJFBsYWNlSG9sZGVyVG9wTmF2QmFy JFBsYWNlSG9sZGVySG9yaXpvbnRhbE5hdiRUb3BOYX ZpZ2F0aW9uTWVudQ8PZAUKQWxsIGluIE9uZWQiMPVaPthHdSA3rH8zgoNOvWxd4w==" />
 
Once NCache caches this ViewState, it replaces the “id” and “value” fields with its own data. Here is an example of that.
 
< input type = "hidden" name = "__NCPVIEWSTATE" id = "__NCPVIEWSTATE" value = "vs:cf8c8d3927ad4c1a84da7f891bb89185" /> < input type = "hidden" name = "__VIEWSTATE" id = "__VIEWSTATE" value = "" />
 
Notice, how it is preserved the original "__VIEWSTATE" hidden field so everything works as if there was no ViewState. But, it has inserted its own "__NCPVIEWSTATE" field that it will read when a post-back request comes from the user to the web server. NCache uses the "value" as the key to fetch the corresponding original ViewState from the in-memory cache and serves it to the ASP.NET page so it can populate the web form with data from the ViewState.
And, since the in-memory cache is distributed and synchronized across all web servers, even if the post-back request goes to a different web server in the farm than the original server where the ViewState was created, StorageEdge is able to find the ViewState value in the cache.
 
 
 
 
See Also

 
Copyright © 2012 Alachisoft. All rights reserved.