Return to
HomePage
Checklist: ASP.NET Performance
Source:
http://msdn.microsoft.com/library/en-us/dnpag/html/ScaleNetCheck03.asp J.D. Meier, Srinath Vasireddy, Ashish Babbar, Rico Mariani, and Alex Mackman
Design Considerations
* Consider security and performance.
* Partition your application logically.
* Evaluate affinity.
* Reduce round trips.
* Avoid blocking on long-running tasks.
* Use caching.
* Avoid unnecessary exceptions.
Threading
* Tune the thread pool by using the formula to reduce contention.
* Consider
minIoThreads and
minWorkerThreads for burst load.
* Do not create threads on a per-request basis.
* Avoid blocking threads.
* Avoid asynchronous calls unless you have additional parallel work.
Resource Management
* Pool resources.
* Explicitly call Close or Dispose on resources you open.
* How can we scan code for the best finalize pattern
* Do not cache or block on pooled resources.
* Know your application allocation pattern.
* Possible?
* Obtain resources late and release them early.
* Possible?
* Avoid per-request impersonation.
* This should be easy to scan for right?
Pages
* Trim your page size.
* What is a large page size.
* How do we find the size?
* Enable buffering.
* How to scan for it.
* Use
Page.IsPostBack to minimize redundant processing.
* Easy to check for.
* Partition page content to improve caching efficiency and reduce rendering.
* How can we scan for this
* Ensure pages are batch compiled.
* may be scan for dir structure?
* compilation batch="true|false"
* batchTimeout="number of seconds"
* maxBatchSize="maximim number of pages per
batched compilation"
* maxBatchGeneratedFileSize="maximum combined size (in KB)
of the generated source file per
batched compilation"
* Ensure debug is set to false.
* <compilation debug="true|false"
* Optimize expensive loops.
* All loops should be highlighted and marked for review
* Exception handling verified.
* Consider using Server.Transfer instead of Response.Redirect.
* Scan for respose.redirect
* Check for end response. Without Causes lots of exceptions.
* Use client-side validation.
* Simple scan can check to see if any goes on but how do we do checking for excessive postbacks?
Server Controls
* Identify the use of view state in your server controls.
* Use server controls where appropriate.
* Avoid creating deep hierarchies of controls.
Data Binding
* Avoid using
Page.DataBind. * Minimize calls to
DataBinder.Eval.
Caching
* Separate dynamic data from static data in your pages.
* Configure the memory limit.
* Cache the right data.
* Refresh your cache appropriately.
* Cache the appropriate form of data.
* Use output caching to cache relatively static pages.
* Choose the right cache location.
* Use
VaryBy attributes for selective caching.
* Use kernel caching on Microsoft® Windows Serverâ„¢ 2003.
State Management
* Store simple state on the client where possible.
* Consider serialization costs.
Application State
* Use static properties instead of the Application object to store application state.
* Use application state to share static, read-only data.
* Do not store single-threaded apartment (STA) COM objects in application state.
Session State
* Prefer basic types to reduce serialization costs.
* Disable session state if you do not use it.
* Avoid storing STA COM objects in session state.
* Use the
ReadOnly attribute when you can.
View State
* Disable view state if you do not need it.
* Minimize the number of objects you store in view state.
* Determine the size of your view state.
HTTP Modules
* Avoid long-running and blocking calls in pipeline code.
* Consider asynchronous events.
String Management
* Use Response.Write for formatting output.
* Use
StringBuilder for temporary buffers.
* Use
HtmlTextWriter when building custom controls.
Exception Management
* Implement a Global.asax error handler.
* Monitor application exceptions.
* Use try/finally on disposable resources.
* Write code that avoids exceptions.
* Set timeouts aggressively.
COM Interop
* Use ASPCOMPAT to call STA COM objects.
* Avoid storing COM objects in session state or application state.
* Avoid storing STA components in session state.
* Do not create STA components in a page constructor.
* Supplement classic ASP
Server.CreateObject with early binding.
Data Access
* Use paging for large result sets.
* Use a
DataReader for fast and efficient data binding.
* Prevent users from requesting too much data.
* Consider caching data.
Security Considerations
* Constrain unwanted Web server traffic.
* Turn off authentication for anonymous access.
* Validate user input on the client.
* Avoid per-request impersonation.
* Avoid caching sensitive data.
* Segregate secure and non-secure content.
* Only use Secure Sockets Layer (SSL) for pages that require it.
* Use absolute
URLs for navigation.
* Consider using SSL hardware to offload SSL processing.
* Tune SSL timeout to avoid SSL session expiration.
Deployment Considerations
* Avoid unnecessary process hops.
* Understand the performance implications of a remote middle tier.
* Short-circuit the HTTP pipeline.
* Configure the memory limit.
* Disable tracing and debugging.
* Ensure content updates do not cause additional assemblies to be loaded.
* Avoid XCOPY under heavy load.
* Consider precompiling pages.
* Consider Web garden configuration.
* Consider using HTTP compression.
* Consider using perimeter caching.
Return to
HomePage