Load Balancing in ASP.NET

For large companies, load balancing is an important feature to use to increase performance. Large companies with the available resources will use web farms. Web farms give your applications the ability to use multiple servers for resources more commonly known as pooling resources. Load balancing helps distribute user requests through a dispatch application that redirects to the different web farm servers.

There are several examples of using a web farm. Whenever you have a web form with a control located on the form, the information entered sends a post back to the web server. If you have a drop down list control located on a form, and the user changes the information selected and clicks a submit button, the form will send a post back to the server. The idea, in general, is to redirect the user to the correct dynamic page that presents the data associated with the selected value in the drop down list.

EnableViewStateMac

The trick, however, is if you have a web farm and the application is located on web server #1 but information is posted to web server #2, the event is never fired. There are some ways to circumvent this. The first is to place a line in the system.web tag in the machine.config file.
<system.web>
<pages enableViewStateMac="false" />
</system.web>

This configuration setting tells the machine if it should do a machine authentication check when sending a request from the client. Machine authentication checks help prevent end users from tampering with the view state when sending a request to a web server. The problem is that it also disables requests to be processed by multiple servers, which are the main avenues for a web farm.

MachineKey

Another important configuration aspect of a web farm is the machine key that needs to be the same across the whole web farm.
<machineKey validationKey='<generated key>' decryptionKey='<generated decryption key' validation='SHA1'/ >

This generated key tells the web server what validation key to use. This same key must be used across the entire web farm servers, or post backs to multiple servers will not work. Allowing multiple servers to services requests will greatly increase application performance.

If your organization is large and in need of a performance tune, then consider a web farm for your internet transactions. The load balancing efforts will greatly increase performance for users and reduce the frustration from online customers. Web farms can bring your companies simple web site into a high powered resource infrastructure.