Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What can be done to optimize the speed of website access?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces what can be done to optimize the access speed of the website, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.

1. Server optimization

Windows series:

64-bit Win2008r2 + Hpyer-V + load balancing + IIS7.5

64-bit Win2003 + virtual machine + load balancing + IIS6

Prohibit the server from accessing the public network. Turn off unnecessary ports.

Remove all permissions from each disk, leaving only the administrators group and system full control.

The IIS7.5 identity uses ApplicationPoolIdentity, and the user who gives the directory permission is: IIS AppPool\ station roll call.

IIS6 needs to create independent users for each site and set permissions for IIS users separately.

IIS disables logging.

II. Database optimization

L 64-bit MSSQL2008:

Use less triggers / cursors / foreign keys. Use multiple storage processes and views. Using an appropriate amount of indexes will improve the query speed a lot, and try not to have more than 3 indexes per table.

Regularly check the deadlock process and waiting process, and clear, but also timely correct the source of the deadlock.

Complex statistical reports require planning to run.

Query the number of records using count (0) instead of count (*).

Do not use * in the table field when select. * it is slow to query all fields.

If the field is an index column, you can use UNION ALL instead of OR and use the index line to query.

Paging queries are used for large recordsets.

Try not to use the TEXT/NTEXT type, but use VARCHAR (MAX) / NVARCHAR (MAX).

Try not to use temporary tables, but use Table table types or embedded views.

III. Back-end optimization

Use DbDataReader more often and try not to use DataTable/DataSet to read data.

L for (int I = 0; I < dt.Rows.Count; iTunes +) should be written as follows:

For (int I = 0, len = dt.Rows.Count; I < len; iTunes +) or

Foreach (DataRow info in dt.Rows) recommends this way of writing.

L use less try catch and use it with finally when using try catch.

L use more using, such as:

Using (DbDataReader dr = Data.GetDbDataReader (strSql)) {while (dr.Read ()) {};}

For large string operations, please use StringBuilder to reduce the use of string, string comparison with Compare, string addition with Concat, and large string addition with StringBuilder Append.

L variables should be defined before they are used. Do not define variables within the loop. Such as:

The wrong way to write it is: for (int I = 1; I < 10; iTunes +) {string s = i.ToString ();}

Correct writing: string s = string.Empty; for (int I = 1; I < 10; iTunes +) {s = i.ToString ();}

There is another thing to note here: when adding strings, if there is an int type, you should first convert to the string type in the addition, reducing unnecessary packing and unpacking operations.

L if you are using a HTML control, you need to disable

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report