且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

发现性能瓶颈在传统的ASP / SQL服务器的网站

更新时间:2023-12-04 22:55:16

在哪里发生超时?它是在线路时,ASP是连接/执行SQL?如果是这样的问题或者是与连接到数据库服务器,或在该数据库本身。加载SQL事件探查器在MSSQL看到查询多久。也许是由于数据库锁。

Where is the timeout occurring? Is it at lines when ASP is connecting/executing sql? If so your problem is either with the connection to the db server or at the db itself. Load up SQL profiler in MSSQL to see how long the queries take. Perhaps it is due to locks in the database.

你使用的交易?如果是这样,确保他们不锁定你的数据库很长一段时间。确保在ADO,而不是整个ASP页上使用事务。您也可以使用带有上表(NOLOCK)提示忽略SQL选择锁定。

Do you use transactions? If so make sure they do not lock your database for a long time. Make sure you use transactions in ADO and not on the entire ASP page. You can also ignore lock in SQL Selects by using WITH (NOLOCK) hint on tables.

请确保您的数据库与索引优化。

Make sure you database is optimized with indexes.

另外,还要确保你conencted到数据库为以最短的时间内尽可能即(例如不工作code):conn.open;集RS = conn.execute(); rs.close; conn.close。所以商店的记录在一个变量,而不是通过按住到数据库开放的连接循环。一个好方法是使用GetRows的()函数中的ADO。

Also make sure you are conencted to the DB for as shortest time as possible i.e (example not working code): conn.open; set rs = conn.execute(); rs.close; conn.close. So store recordsets in a variable instead of looping through while holding the connection to the DB open. A good way is to use GetRows() function in ADO.

始终明确关闭并设置ADO对象不了了之。这可能会导致数据库的连接保持打开状态。

Always explicitly close and set ADO objects to nothing. This can cause the connection to the DB to remain open.

启用连接池。

加载ADO常量在global.asa中,如果你正在使用它们

Load ADO constants in global.asa if you are using them

不要任何对象存储在会话或应用范围。

Do not store any objects in session or application scopes.

升级到ADO,MDAC,SQL Server服务包等。

Upgrade to latest versions of ADO, MDac, SQL Server service packs etc.

您确保服务器能够处理的负荷?也许升级呢?它是在共享托管?也许你的应用程序是没有问题的。

Are you sure the server can handle the load? Maybe upgrade it? Is it on shared hosting? Maybe your app is not the problem.

这是很简单的从1行到最后一行定时它来衡量一个脚本的性能。这样,您就可以识别运行较慢的页面。

It is quite simple to measure a script performance by timing it from the 1 line to the last line. This way you can identify slow running pages.