使用 Microsoft Application Center Test 为WEB应用程序获取可量化的性能指标
2005-01-05 11:34
627 查看
Microsoft Application Center Test是VS.Net自带的一个测试工具.使用它可以收集性能信息.确定WEB应用程序的容量.也可以创建测试,模拟同时从WEB应用程序请求网页的多个用户.这些模拟测试有助于确定应用程序的稳定性.速度和响应能力.
我们下面使用两个例子来看看不同的实现方式.
第一个例子比较简单.目的是测试字符串对象使用"+"连接符操作和使用StringBuilder的Append方法进行字符串连接操作的区别.
最终的结果是相同的.即生产10000个A组成的字符串.
这是使用+操作符的代码
文件名:StringPlus.aspx
private void Button1_Click(object sender, System.EventArgs e)
{
string S = string.Empty;
for (int i=0;i<10000;i++)
S += "A";
this.Label1.Text = S.ToString();
}
以下是使用Append方法的代码
文件名:StringAppend.aspx
private void Button1_Click(object sender, System.EventArgs e)
{
StringBuilder S = new StringBuilder();
for (int i=0;i<10000;i++)
S.Append("A");
this.Label1.Text = S.ToString();
}
大家可以看到.以上是同样结果的两种不同实现方式.代码编写完成后,我们用Microsoft Application Center Test 来测试一下其性能差距.
打开"Visual Studio .NETàVisual Studio .NET 企业版功能àMicrosoft Application Center Test" 启动应用程序.
在”测试”项目上点右键.新建项目à录制项目 开始录制 输入网址后.录制要测试的项目的操作.然后按 停止录制.为这个测试项目起个名字.保存.即完成了一个测试项目的创建.
选择一个测试项目点 启动测试 按钮.即开始测试.
以下是测试的结果.
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152547.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是14.5 BPS (BPS--每秒平均请求数)
以同样的方法测试使用Append方法的代码的文件StringAppend.aspx 得出的结果是
![](http://www.hnjzqy.com/price/naola/naola/sf_2004112415268.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是170 BPS (BPS--每秒平均请求数)
可以看出.使用Append方法进行字符串连接比使用”+”操作符要高效得多.(在这个例子里使用Append方法效率提升了12倍)
第二个例子是关于COM+
COM+仅在必要时使用.COM+在提供事务处理,队列等先进性能的同时也额外耗费系统资源.在这个例子里我测试了使用COM+和没有使用Com+两种环境下的应用程序的效率.
WEB页面程序是一样的.所不同的是组件. 不使用COM+的代码是如下代码.
namespace PlentySoft.Naola.ComPlusComponent2
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class I
{
public I()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string getString()
{
You Y = new You();
string sR;
sR = Y.returnV();
return "Demo1's is I,Demo2's value is " + sR ;
}
}
}
使用COM+的代码只是多了个 : ServicedComponent
经过测试.不使用COM+测试结果为
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152620.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是337 BPS (BPS--每秒平均请求数)
使用COM+后.应用程序测试的结果为
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152630.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是245 BPS (BPS--每秒平均请求数)
也可以说不使用COM+ 可提升50%的性能.
但在我们的ERP应用程序里.包括报表都使用的COM+环境.这是没有必要的.可以改良的.
以上两个例子只是Microsoft Application Center Test应用的两个小例子.意只在抛砖引玉.让大家用好这个工具.做出性能更完善的应用程序.
我们下面使用两个例子来看看不同的实现方式.
第一个例子比较简单.目的是测试字符串对象使用"+"连接符操作和使用StringBuilder的Append方法进行字符串连接操作的区别.
最终的结果是相同的.即生产10000个A组成的字符串.
这是使用+操作符的代码
文件名:StringPlus.aspx
private void Button1_Click(object sender, System.EventArgs e)
{
string S = string.Empty;
for (int i=0;i<10000;i++)
S += "A";
this.Label1.Text = S.ToString();
}
以下是使用Append方法的代码
文件名:StringAppend.aspx
private void Button1_Click(object sender, System.EventArgs e)
{
StringBuilder S = new StringBuilder();
for (int i=0;i<10000;i++)
S.Append("A");
this.Label1.Text = S.ToString();
}
大家可以看到.以上是同样结果的两种不同实现方式.代码编写完成后,我们用Microsoft Application Center Test 来测试一下其性能差距.
打开"Visual Studio .NETàVisual Studio .NET 企业版功能àMicrosoft Application Center Test" 启动应用程序.
在”测试”项目上点右键.新建项目à录制项目 开始录制 输入网址后.录制要测试的项目的操作.然后按 停止录制.为这个测试项目起个名字.保存.即完成了一个测试项目的创建.
选择一个测试项目点 启动测试 按钮.即开始测试.
以下是测试的结果.
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152547.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是14.5 BPS (BPS--每秒平均请求数)
以同样的方法测试使用Append方法的代码的文件StringAppend.aspx 得出的结果是
![](http://www.hnjzqy.com/price/naola/naola/sf_2004112415268.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是170 BPS (BPS--每秒平均请求数)
可以看出.使用Append方法进行字符串连接比使用”+”操作符要高效得多.(在这个例子里使用Append方法效率提升了12倍)
第二个例子是关于COM+
COM+仅在必要时使用.COM+在提供事务处理,队列等先进性能的同时也额外耗费系统资源.在这个例子里我测试了使用COM+和没有使用Com+两种环境下的应用程序的效率.
WEB页面程序是一样的.所不同的是组件. 不使用COM+的代码是如下代码.
namespace PlentySoft.Naola.ComPlusComponent2
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class I
{
public I()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string getString()
{
You Y = new You();
string sR;
sR = Y.returnV();
return "Demo1's is I,Demo2's value is " + sR ;
}
}
}
使用COM+的代码只是多了个 : ServicedComponent
经过测试.不使用COM+测试结果为
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152620.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是337 BPS (BPS--每秒平均请求数)
使用COM+后.应用程序测试的结果为
![](http://www.hnjzqy.com/price/naola/naola/sf_20041124152630.jpg)
screen.width-333) {this.width=screen.width-333;this.title='open new window';}" border=0 ;>
性能大约是245 BPS (BPS--每秒平均请求数)
也可以说不使用COM+ 可提升50%的性能.
但在我们的ERP应用程序里.包括报表都使用的COM+环境.这是没有必要的.可以改良的.
以上两个例子只是Microsoft Application Center Test应用的两个小例子.意只在抛砖引玉.让大家用好这个工具.做出性能更完善的应用程序.
相关文章推荐
- 使用 Microsoft Application Center Test 为WEB应用程序获取可量
- WEB压力测试工具 ACT工具(Microsoft Application Center Test)
- 使用ACT(Microsoft Application Center Test) 进行压力测试
- 使用 Microsoft SQL Server 2000 的全文搜索功能构建 Web 搜索应用程序
- 使用Application Center Test (ACT)来做压力测试
- 在 WebSphere Application Server 和 Microsoft .NET 中使用 WS-AtomicTransaction 构建事务 Web 服务
- Microsoft Web Application Stress Tool无法使用问题
- 红薯 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用WebApplicationContext 获取文件内容
- 使用Application Center Test (ACT)来做压力测试
- 1 开发一个注重性能的JDBC应用程序不是一件容易的事. 当你的代码运行很慢的时候JDBC驱动程序并不会抛出异常告诉你。 本系列的性能提示将为改善JDBC应用程序的性能介绍一些基本的指导原则,这其中的原则已经被许多现有的JDBC应用程序编译运行并验证过。 这些指导原则包括: 正确的使用数据库MetaData方法 只获取需要的数据 选用最佳性能的功能 管理连
- Microsoft Web Application Stress Tool使用教程
- 使用Microsoft Web Application Stress Tool对web进行压力测试(转)
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- Microsoft Web Application Stress Tool 使用
- [转]使用Microsoft Web Application Stress Tool对web进行压力测试
- jsp 使用application.getInitParameter来获取web.xml中配置参数
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用 Microsoft SQL Server 2000 的全文搜索功能构建 Web 搜索应用程序