日期:2012-10-22  浏览次数:21260 次

二、测试环境

   本测试总共用到了21个ASP文件,这些文件可以从本文后面下载。每一个页面设置成可以运行三种不同的查询,分别返回0、25、250个记录。这将帮助我们隔离页面本身的初始化、运行开销与用循环访问记录集的开销。

   为便于测试,数据库连接字符串和SQL命令串都在Global.asa中作为Application变量保存。由于我们的测试数据库是SQL Server 7.0,因此连接串指定OLEDB作为连接提供者,测试数据来自SQL Server的Northwind数据库。SQL SELECT命令从NorthWind Orders表提取7个指定的字段。
< SCRIPT LANGUAGE=VBScript RUNAT=Server >
Sub Application_OnStart
Application("Conn") = "Provider=SQLOLEDB; " & _
         "Server=MyServer; " & _
         "uid=sa; " & _
         "pwd=;" & _
         "DATABASE=northwind"
Application("SQL") = "SELECT   TOP 0   OrderID, " & _
         "      CustomerID, " & _
         "      EmployeeID, " & _
         "      OrderDate, " & _
         "      RequiredDate, " & _
         "      ShippedDate, " & _
         "      Freight " & _
         "FROM   [Orders] "
         End Sub
< /SCRIPT >

'alternate sql - 25 records
Application("SQL") = "SELECT   TOP 25  OrderID, " & _
         "      CustomerID, " & _
         "      EmployeeID, " & _
         "      OrderDate, " & _
         "      RequiredDate, " & _
         "      ShippedDate, " & _
         "      Freight " & _
         "FROM   [Orders] "

'alternate sql - 250 records   
Application("SQL") = "SELECT   TOP 250 OrderID, " & _
         "      CustomerID, " & _
         "      EmployeeID, " & _
         "      OrderDate, " & _
         "      RequiredDate, " & _
         "      ShippedDate, " & _
         "      Freight " & _
         "FROM   [Orders] "




   测试服务器配置如下:450 Mhz Pentium,512 MB RAM,NT Server 4.0 SP5,MDAC 2.1(数据访问组件),以及5.0版本的Microsoft脚本引擎。SQL Server运行在另外一台具有类似配置的机器上。和第一部分一样,我们仍旧使用Microsoft Web Appli