Intersoft WebGrid Documentation
Optimizing Performance
See Also Send comments on this topic.
Intersoft WebGrid > WebGrid Features Overview > Optimizing Performance

Glossary Item Box

Nowadays, developers are required to make their applications as light-weight and faster as possible. This topic explains how to optimize and fine-tune WebGrid to achieve the performance you desired.

This topic contains the following sections:

SmartWebResources Deployment

Oftentimes, developers found it too complex in order to deploy their web application that used third party components. There are too much things that need to be recalled before a web application can be successfully deployed. For an instance, the javascript files, images and other runtime client files need to be copied in order for the component to run properly.

In order to simplify the deployment process, WebGrid provides an advanced deployment infrastructure called SmartWebResources. This enables WebGrid control to function perfectly right out-of-the-box when deployed with a simple XCOPY deployment.

For more information, see SmartWebResources Deployment

Improved Data Caching (for traditional data binding)

The data caching feature in WebGrid has been significantly improved to avoid memory leaks and lower usage of allocated resources when the DataCacheStorage is set to PageCache (default).

Note that the built-in data caching is disabled by default when the WebGrid is bound to DataSource control. The data caching is provided for the usage when the WebGrid is bound to DataSource object (i.e. through InitializeDataSource event). When bound to DataSource control, the data caching is handled at DataSource control level (through EnableCaching property) and thus no longer need to be handled by WebGrid.

For more information about datasource control support, see Declarative DataSource Control.

Another new feature related to built-in data caching is the ability to store the cache to physical disk. WebGrid now adds a new option in the DataCacheStorage called "FileServer". When you choose this option, the data cache will be stored to the path defined in CacheServerConnection property. This new option allows better scalability and reliability to your web application, as the data caches are no longer stored in ASP.NET's worker process or Session.

New Cache-To-Disk option for ViewStateStorage

In previous version of Framework, we have introduced three kind of storage for saving ViewState. They are PageCache, Session and Client.

In 2007 R2, the Framework now includes new option to save the state to physical disk. The option called FileServer enables the view state to be saved to a physical disk in the local computer or a shared drive in network.

The FileServer cache option solved many barriers around view state topic. With FileServer, you no longer have to worry about memory leaks or limited server resources.

Some of benefits using FileServer cache are:

  • Highly scalable. You can choose a network drive to store the caches which enable multiple web servers to access the state.
  • Decent performance. With more than dozen of high performance hard drives, you can choose a near-memory speed with high random access and sequential read write hard drive to store the caches.
  • Easily extensible. Unlike memory (RAM), you can easily extend hard drives with larger one when it becomes insufficient.

Features of FileServer:

  • Automatic cleaning. When the cache for the viewstate has expired, the caches will be automatically deleted.
  • Easily configurable for application-wide through web.config.
  • Allow customizations on cache policy and expiration duration.

Enhanced Client-Server Programmability

WebGrid's key design is to enable seamless interactions between client and server. In previous version, many tasks become difficult to be implemented because the limitation of the architecture. The new version's improvements in the core architecture now allow you to perform client tasks easily. To give you an idea of what is possible, here we list a few of commonly used tasks:

The tutorial for this enhancement can be found in ServerProgrammability.aspx.

Sample code:

C# Copy Code
private void WebGrid1_Load(object sender, System.EventArgs e)
{
    if (!IsPostBack)
    {
        // always select first row on first page load
        WebGrid1.SetSelectedObject(new SelectedObject(WebGrid1.RootTable, 0));
               
        // set focus to grid
        WebGrid1.SetFocus();
               
        // in v3.5, this event indicates that the datasource has been populated
        // and rows has been loaded so you can access row's value directly.
        // let's try to change the second row's style.
        WebGrid1.RootTable.Rows[1].Style.BackColor = Color.AliceBlue;
               
        // access to cell
        WebGrid1.RootTable.Rows[2].Cells[0].Text = "New Text";
    }
}

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.