Performance Tuning and Optimizing ASP.NET Applications

Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The information in this book is distributed on an " as is " basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the authors nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. ASP.NET STATE MANAGEMENT is the ability of a Web application to persist information , both at the application and session levels. There are two main types of state in a Web application: • Application state: This is information that applies to all clients of the Web application. This information is shared by, and managed for, multiple clients. • Session state: This is information that applies to a specific client session. You manage this information for individual clients. Application and session state management are important for personalizing Web applications and for persisting information that is widely used across a Web application. ASP.NET expands the range of options available for managing application and session state. In particular, it overcomes previous limitations of classic ASP for managing state across Web farms. You continue to manage application state using the Application object (technically , the HttpApplicationState class). In addition, ASP.NET provides the Cache class, which offers more granular control over managing application data. Session state management has been greatly expanded compared to classic ASP; you are no longer confined to just using in-process Session objects. In classic ASP, developers liked Session objects for their ease of use but disliked them for negatively impacting application scalability and performance. ASP.NET faces similar challenges; however, the actual performance implications may surprise you. As we discuss in this chapter, Session objects are not necessarily performance killers. On the contrary, when used correctly, they can greatly improve the performance of your application and minimally impact scalability. Most books simply make a cursory reference to the " performance impact " of using Session objects. We, on the other hand, take the discussion a step further by running performance tests for each session mode and examining the numbers. ASP.NET provides a …