Methods to Improve ASP. NET performance

Source: Internet
Author: User

1. performance parameters:
1. Throughput
2. Response Time
3. execution time
4. scalability
 
Ii. performance factors:
1. ASPX execution environment
2. write code Logic

 
3. Methods to Improve performance:
1. Avoid unnecessary operations. For example, use IsPostBack in Page_Load;
2. Minimize the use of server-side controls
3. disable unnecessary Page Sessions and ViewState of the Control <% @ Page EnableSessionState = "false" %>
4. Disable VB and JSP dynamic types <% @ Page Language = "VB" Strict = "true" %>
5. Use stored procedures
6. Use DateReader instead of DataSet
7. Disable ASP. Net Debug mode
8. Use the Output Cache buffer of ASP. Net
<% @ OutputCache Duration = 60 VaryByParam = "None" %>
<% @ OutputCache Duration = 60 VaryByParam = "TextBox1, TextBox2" %>
Note: Duration sets the Cache expiration time;
VarByParam is used to set whether the parameter changes. If None is used, all parameters use the same Cache. When TextBox1 is set, the Cache is cached based on different TextBox1 values. When multiple parameters exist, the Cache is combined;
9. Do not use Exception to control program processes
Try

{
Result = 100/num;
}
Catch (Exception e)

{
Result = 0;
}
 
If (num! = 0)
Result = 100/num;
Else
Result = 0;
 
Iv. Buffer classification:
1. Page buffering: Different buffering processes are performed based on VarByParam.
2. Fragment buffering: Use Page Buffering in the page control. When the same page control is used multiple times in a page, different buffer processing needs to be performed based on VarByControl.
3. Data Buffer: Cache (the range is the same as that of Application, all users)
Cache. Insert ("MyData", Source, null, new CacheDependency (Server. MapPath ("authors. xml ")));
Cache. Insert ("MyData", Source, null, DateTime. Now. AddHours (1), TimeSpan. Zero );
Cache. Insert ("MyData", Source, null, DateTime. MaxValue, TimeSpan. FromMinutes (20 ));

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.