Method for improving ASP.NET performance

xiaoxiao2021-03-06  77

First, performance parameters:

1, throughput

2, response time

3, execution time

4, scalability

Second, performance factors:

1, ASPX execution environment

2, write code logic

Third, improve performance method:

1. Avoid unnecessary operations. For example: use ispostback in Page_Load;

2, try to minimize the use of server-side controls

3. Close unnecessary page session and control ViewState <% @ Page EnableSessionState = "false"%>

4, disable VB and JSP dynamic type <% @ page language = "vb" strake = "true"%>

5, use stored procedures

6, use datereader instead of DataSet

7. Close the Debug mode of ASP.NET

8, use the Output Cache buffer using ASP.NET

<% @ OutputCache Duration = 60 VarybyParam = "None"%>

<% @ Outputcache duration = 60 varybyparam = "TextBox1, TextBox2"%>

Explanation: Duration is the expiration time of setting Cache;

VarbyParam is the setting of whether or not the parameter is changed, and all parameters when NONE uses the same cache. When settings TextBox1, the different values ​​of TextBox1 are cached separately; when there are multiple parameters, the cache is combined;

9, do not use the Exception control program process

Try

{

Result = 100 / NUM;

}

Catch (Exception E)

{

Result = 0;

}

IF (Num! = 0)

Result = 100 / NUM;

Else

Result = 0;

Fourth, buffering classification:

1 Page buffer: Different buffer processing according to VarbyParam.

2 Squares: Use the page buffer in the page control. When you use the same page control multiple times in a page, you need to perform different buffer processing according to VarbyControl.

3 Data buffer: cache (range is like Application, all users)

Cache.Insert ("MyData", Source, Null, New Cached "))));

Cache.Insert ("MyData", Source, Null, DateTime.now.addhours (1), Timespan.zero;

Cache.Insert ("MyData", Source, Null, DateTime.maxValue, Timespan.fromminutes (20));

转载请注明原文地址:https://www.9cbs.com/read-108188.html

New Post(0)