|
Comments
|
Today's Top SOA Links
ASP.NET Solutions for Optimizing ASP.NET Applications
The case for third-party acceleration
By: Kent Alstad
Aug. 19, 2008 06:30 PM
Caching ASP.NET offers rich features for implementing caching, and you can use these features to create flexible caching mechanisms that conform to configurable rules and expiration policies, and are triggered by the specific data in the request for the page. In principle, these strategies reduce the amount of work required by the server to process each request, increasing the number of requests each server can handle in a given period of time. Unfortunately, manually implementing any of these caching strategies has drawbacks as well. Coding browser caching or output caching mechanisms is complex and time-consuming, since you have to incorporate caching instructions (such as declarative directives) into all pages and controls that use them. Beyond coding the caching mechanisms, practical time and cost constraints dictate that you can't cache everything. So you have to invest time and resources into identifying those areas of the application where caching will provide the greatest value. The biggest challenge with code-based caching strategies, however, is maintaining cache currency. For caching to work correctly, you have to develop dynamic mechanisms to recognize when the cache is out of date and respond appropriately. ASP.NET 2.0 does offer features to help simplify this process. (Cache expirations can occur automatically when the requesting server recognizes changes to a query result.) But again, actually implementing these mechanisms is not a trivial task. Minimizing Page Size ViewState, a block of data in a hidden form control on the page, plays an important role in almost all ASP.NET applications by storing data vital to the controls on the page. However, depending on the number and type of controls used, ViewState data can get extremely large. Theoretically, you could just disable ViewState, but unfortunately many controls can't function properly without it. Your options are either to examine closely every single page for opportunities to limit ViewState without affecting functionality, or find ways to code around it. ASP.NET 2.0 introduced one option for addressing this problem with ControlState, a new form of hidden control storage that controls can use even when ViewState is disabled. However, this approach depends on controls that actually take advantage of ControlState, and most still only use ViewState. Of course, all of these solutions increase your coding requirements as well. Another technique you can employ to reduce the performance hit from large pages is AJAX-based controls that can refresh sections of a page without requiring a full postback of the page. AJAX has its own shortcomings, however, most notably, the complex, extensive programming required to make it work well. You can use new Microsoft-created controls and JavaScript frameworks aimed at reducing the coding requirements for AJAX, or use runtime optimizations such as Silverlight to improve the perceived performance of the application. As Web-based software techniques, however, all of these strategies put an additional burden on your network and servers. Distribution The traditional solution for scaling an application has been to simply throw more hardware at the problem to distribute the load among more Web servers. The problem with this strategy is that unless you've architected your application from the start to support load-balanced, parallel processing of requests, it doesn't really work. Resource affinities in the code - hidden dependencies that require code to run on a particular thread, CPU, component instance, or server - can lock processes into a specific resource and impede effective load balancing. Ultimately, you can double the Web servers in your server farm only to find that you now have twice as many servers overloaded, and very few additional users getting data. The most common resource affinity problem is in-process session state, which assumes that all requests from a single user session will be processed on the same Web server. To deal with the session state problem, you can take session management out of process - distributing it to a separate shared resource that all Web servers in the farm can access. ASP.NET offers built-in support for storing session state in a separate database or designated state server, but neither strategy provides an ideal solution. Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||