1. Performance parameters:
1. Throughput
2. Response time
3. Execution time
4. Scalability
2. Performance factors:
1. ASPX execution environment
2. Write code logic
3. Methods to improve performance:
1. Avoid unnecessary operations. For example: using IsPostBack in Page_Load;
2. Minimize the use of server-side controls
3. Close unnecessary page sessions and control ViewState < %@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. Turn off the Debug mode of ASP.Net
8. Use ASP.Net’s Output Cache buffering
<%@ OutputCache Duration=60 VaryByParam=”None” %>
<%@ OutputCache Duration=60 VaryByParam=”TextBox1,TextBox2” %>
Note: Duration is to set the expiration time of Cache;
VarByParam is whether the setting changes according to the parameters. When None, all parameters use the same Cache. When TextBox1 is set, the cache is cached separately according to the different values of TextBox1; when there are multiple parameters, the cache must be combined;
9. Do not use Exception to control program flow
try
{
result=100/num;
}
catch(Exception e)
{
result=0;
}
if(num!=0)
result = 100/num;
else
result=0;
4. Buffer classification:
1 Page buffering: Different buffering processes are performed according to VarByParam.
2 Fragment buffering: Use page buffering in page controls. When the same page control is used multiple times in a page, different buffering processes need to be performed based on VarByControl.
3 Data buffer: Cache (the scope is the same as 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));