- Avoid server-side validation
Use client-side instead of server-side validation (when it is possible). Server-side validation will just add more round trips to the server.
- Deploy with ‘Release' build and ensure ‘Debug' is set to true in the web.config
Make sure you use Release Build mode and not Debug Build when you deploy your site to production. When you create the application, by default the attribute ‘Debug' is set to "true" in the web.config which is very useful while developing. However, when you are deploying your application, always set it to "false". <compilation debug="false" ... />
- Consider using caching
Caching avoids redundant work. If you use caching properly, you can avoid unnecessary database lookups and other expensive operations.ASP.NET allows you to cache entire pages, fragment of pages or controls. You can cache also variable data by specifying the parameters that the data depends. By using caching you help ASP.NET engine to return data for repeated request for the same page much faster.
- Consider using HTTP compression
HTTP compression is supported by most modern browsers and by IIS. HTTP Compression is a define a way to compress content transferred from Web servers across the world wide Web to browsers. The impact of compression is that the number of transmitted bytes is reduced and thus a higher performance is gained.
- Consider disabling tracing
Before you deploy your application, disable tracing because it is not recommended to turn it on while the application is running in production. Tracing may cause performance issues.
<configuration>
<system.web>
<trace enabled="false" pageOutput="false" />
</system.web>
</configuration>
- Consider using paging for large result sets
Paging large query result sets can significantly improve the performance of an application. The paging can be done at the SQL procedure level this will reduces the back-end work on the database, it be done at the server level to reduce the size of data that is sent to the client and that will be rendered as Html content.
- Use Try/Finally on Disposable Resources
Close the resources in the finally clause. Using a try/finally block ensures that resources are disposed even if an exception occurs. The following code fragment demonstrates this.
try
{
...
conn.Open();
...}
finally
{
if(null!=conn)
conn.close;
}
- String Management
Use the += operator when the number of appends is known.
Use the StringBuilder object when the number of appends is unknown.
- Consider using Server.Transfer instead of Response.Redirect
Both cause a new page to be processed, but the interaction between the client and server is different in each situation. Server.Transfer acts as an efficient replacement for the Response.Redirect method. Response.Redirect specifies to the browser to request a different page. Because a redirect forces a new page request, the browser makes two requests to the Web server, so the Web server handles an extra request. IIS 5.0 introduced a new function, Server.Transfer, which transfers execution to a different ASP page on the server. This avoids the extra request, resulting in better overall system performance
Reference:
Checklist: ASP.NET Performance: http://msdn.microsoft.com/en-us/library/ff647706.aspx
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.