关于考试系统的ajax提交单个答案的压力测试
来源:互联网 发布:获取python关键字 编辑:程序博客网 时间:2024/05/20 11:21
其实我一直想知道,究竟一题一题ajax提交答案,也就是说,点击一题的答案,就ajax请求一下服务器,提交一次答案,能否撑到100个用户同时考试呢?
准备环境
asp.net 2.0 + sql2000
ado.net插入数据
web stress application tool(微软出产的web开发压力测试软件)
1.建数据库exam_stress
脚本如下:
CREATE DATABASE exam_stress
GO
USE exam_stress
GO
CREATE TABLE [dbo].[Answer](
[ID] [int] NOT NULL identity primary key, --ID
[QID] [int] NOT NULL, --题目ID
[Answer] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, --答案
[PAID] [int] NOT NULL, --答卷ID
[PID] [int] NOT NULL --试卷ID
) ON [PRIMARY]
GO
表的设计,是二范式与三范式之间
2.建web应用程序
1.建一Default.aspx页面,上面有几个按钮,点击时,发出ajax请求AnswerHandler.ashx
页面代码如下:
界面如下:
2.建AnswerHandler.ashx文件,直接插入一条数据到Answer表中,代码如下:
然后发布到IIS中,进行下一步的压力测试
在http://download.microsoft.com/download/a/8/2/a82e7ba7-c772-4ec4-b186-2cf147f42c11/setup.exe
下载Microsoft Web Application Stress Tool,进行压力测试
相关使用,请参考帮助,或上网查询相关使用资料,其实看得懂英文的话,一般都会使用了。
用户量100,平均1秒点击2次,测试20分钟,操作如下:
先点录制
再输入部署好的站点地址
然后点击100下“提交答案”的按钮
然后停止录制
把用户数设成100个
把delay(延迟)设成0到500
然后开始20分钟的测试
如图所示:
结果如下:
Overview
================================================================================
Report name: 2010-7-4 7:37:53
Run on: 2010-7-4 7:37:53
Run length: 00:20:01
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 453922
Requests per Second: 378.27
Socket Statistics
--------------------------------------------------------------------------------
Socket Connects: 454006
Total Bytes Sent (in KB): 230898.13
Bytes Sent Rate (in KB/s): 192.42
Total Bytes Recv (in KB): 381243.94
Bytes Recv Rate (in KB/s): 317.70
Socket Errors
--------------------------------------------------------------------------------
Connect: 0
Send: 0
Recv: 0
Timeouts: 0
RDS Results
--------------------------------------------------------------------------------
Successful Queries: 0
Script Settings
================================================================================
Server: 192.168.1.3
Number of threads: 100
Test length: 00:20:00
Warmup: 00:00:00
Cooldown: 00:00:00
Use Random Delay: Yes
Min Delay Time: 0
Max Delay Time: 500
Follow Redirects: Yes
Max Redirect Depth: 15
Clients used in test
================================================================================
localhost
Clients not used in test
================================================================================
Result Codes
Code Description Count
================================================================================
200 OK 445094
404 Not Found 8828
Page Summary
Page Hits TTFB Avg TTLB Avg Auth Query
================================================================================
POST /check_outchain.php 4415 0.07 0.07 No No
POST /check_outchain.php 4413 0.10 0.10 No No
GET /t/Default.aspx 4413 9.41 9.41 No No
GET /t/js/jquery-1.3.2.min.js 4412 0.13 0.41 No No
POST /t/AnswerHandler.ashx 4412 16.44 16.45 No No
POST /t/AnswerHandler.ashx 4411 11.84 11.85 No No
POST /t/AnswerHandler.ashx 4411 11.63 11.64 No No
POST /t/AnswerHandler.ashx 4410 12.27 12.29 No No
POST /t/AnswerHandler.ashx 4410 11.54 11.55 No No
POST /t/AnswerHandler.ashx 4409 14.62 14.64 No No
POST /t/AnswerHandler.ashx 4409 16.02 16.04 No No
POST /t/AnswerHandler.ashx 4408 14.91 14.93 No No
POST /t/AnswerHandler.ashx 4406 16.85 16.86 No No
POST /t/AnswerHandler.ashx 4406 18.19 18.20 No No
POST /t/AnswerHandler.ashx 4405 16.10 16.12 No No
POST /t/AnswerHandler.ashx 4402 14.75 14.76 No No
POST /t/AnswerHandler.ashx 4401 16.66 16.68 No No
POST /t/AnswerHandler.ashx 4401 22.10 22.11 No No
POST /t/AnswerHandler.ashx 4398 19.43 19.44 No No
POST /t/AnswerHandler.ashx 4398 19.73 19.74 No No
POST /t/AnswerHandler.ashx 4397 24.50 24.51 No No
POST /t/AnswerHandler.ashx 4397 21.16 21.17 No No
POST /t/AnswerHandler.ashx 4396 15.99 16.01 No No
POST /t/AnswerHandler.ashx 4394 22.11 22.13 No No
POST /t/AnswerHandler.ashx 4392 19.94 19.96 No No
POST /t/AnswerHandler.ashx 4391 21.69 21.70 No No
POST /t/AnswerHandler.ashx 4391 27.34 27.36 No No
POST /t/AnswerHandler.ashx 4388 26.66 26.67 No No
POST /t/AnswerHandler.ashx 4388 23.75 23.76 No No
POST /t/AnswerHandler.ashx 4387 31.67 31.68 No No
POST /t/AnswerHandler.ashx 4386 34.30 34.32 No No
POST /t/AnswerHandler.ashx 4386 33.95 33.96 No No
POST /t/AnswerHandler.ashx 4384 24.80 24.82 No No
POST /t/AnswerHandler.ashx 4383 28.05 28.07 No No
POST /t/AnswerHandler.ashx 4382 30.93 30.94 No No
POST /t/AnswerHandler.ashx 4382 21.14 21.15 No No
POST /t/AnswerHandler.ashx 4380 24.25 24.26 No No
POST /t/AnswerHandler.ashx 4379 19.11 19.13 No No
POST /t/AnswerHandler.ashx 4378 13.20 13.21 No No
POST /t/AnswerHandler.ashx 4378 11.38 11.40 No No
POST /t/AnswerHandler.ashx 4376 12.11 12.12 No No
POST /t/AnswerHandler.ashx 4376 13.20 13.21 No No
POST /t/AnswerHandler.ashx 4375 11.87 11.88 No No
POST /t/AnswerHandler.ashx 4375 11.66 11.67 No No
POST /t/AnswerHandler.ashx 4374 10.81 10.82 No No
POST /t/AnswerHandler.ashx 4373 11.21 11.23 No No
POST /t/AnswerHandler.ashx 4372 11.44 11.45 No No
POST /t/AnswerHandler.ashx 4371 10.60 10.62 No No
POST /t/AnswerHandler.ashx 4371 12.34 12.35 No No
POST /t/AnswerHandler.ashx 4370 10.45 10.46 No No
POST /t/AnswerHandler.ashx 4369 11.56 11.58 No No
POST /t/AnswerHandler.ashx 4368 11.74 11.75 No No
POST /t/AnswerHandler.ashx 4366 10.62 10.63 No No
POST /t/AnswerHandler.ashx 4364 11.07 11.09 No No
POST /t/AnswerHandler.ashx 4362 11.30 11.31 No No
POST /t/AnswerHandler.ashx 4361 10.97 10.99 No No
POST /t/AnswerHandler.ashx 4360 11.31 11.33 No No
POST /t/AnswerHandler.ashx 4359 11.61 11.62 No No
POST /t/AnswerHandler.ashx 4358 10.95 10.96 No No
POST /t/AnswerHandler.ashx 4354 11.06 11.08 No No
POST /t/AnswerHandler.ashx 4353 11.30 11.31 No No
POST /t/AnswerHandler.ashx 4352 10.14 10.16 No No
POST /t/AnswerHandler.ashx 4352 10.14 10.15 No No
POST /t/AnswerHandler.ashx 4352 10.05 10.06 No No
POST /t/AnswerHandler.ashx 4350 9.83 9.84 No No
POST /t/AnswerHandler.ashx 4350 11.49 11.50 No No
POST /t/AnswerHandler.ashx 4350 11.34 11.35 No No
POST /t/AnswerHandler.ashx 4349 11.20 11.21 No No
POST /t/AnswerHandler.ashx 4348 10.16 10.18 No No
POST /t/AnswerHandler.ashx 4344 10.64 10.66 No No
POST /t/AnswerHandler.ashx 4343 11.88 11.89 No No
POST /t/AnswerHandler.ashx 4343 10.80 10.82 No No
POST /t/AnswerHandler.ashx 4342 10.65 10.66 No No
POST /t/AnswerHandler.ashx 4341 10.74 10.75 No No
POST /t/AnswerHandler.ashx 4341 10.76 10.77 No No
POST /t/AnswerHandler.ashx 4339 10.38 10.39 No No
POST /t/AnswerHandler.ashx 4336 11.50 11.52 No No
POST /t/AnswerHandler.ashx 4335 10.19 10.21 No No
POST /t/AnswerHandler.ashx 4332 10.23 10.24 No No
POST /t/AnswerHandler.ashx 4331 11.84 11.86 No No
POST /t/AnswerHandler.ashx 4331 10.30 10.31 No No
POST /t/AnswerHandler.ashx 4330 10.39 10.41 No No
POST /t/AnswerHandler.ashx 4330 11.02 11.03 No No
POST /t/AnswerHandler.ashx 4330 10.98 10.99 No No
POST /t/AnswerHandler.ashx 4330 12.65 12.67 No No
POST /t/AnswerHandler.ashx 4329 11.91 11.93 No No
POST /t/AnswerHandler.ashx 4329 13.10 13.12 No No
POST /t/AnswerHandler.ashx 4327 12.03 12.04 No No
POST /t/AnswerHandler.ashx 4327 12.73 12.74 No No
POST /t/AnswerHandler.ashx 4327 10.87 10.89 No No
POST /t/AnswerHandler.ashx 4326 12.39 12.40 No No
POST /t/AnswerHandler.ashx 4325 11.56 11.57 No No
POST /t/AnswerHandler.ashx 4325 10.53 10.54 No No
POST /t/AnswerHandler.ashx 4324 11.65 11.67 No No
POST /t/AnswerHandler.ashx 4324 11.34 11.35 No No
POST /t/AnswerHandler.ashx 4323 12.32 12.34 No No
POST /t/AnswerHandler.ashx 4323 12.23 12.24 No No
POST /t/AnswerHandler.ashx 4323 10.85 10.87 No No
POST /t/AnswerHandler.ashx 4322 11.30 11.31 No No
POST /t/AnswerHandler.ashx 4322 11.03 11.05 No No
POST /t/AnswerHandler.ashx 4319 11.49 11.51 No No
POST /t/AnswerHandler.ashx 4317 11.49 11.50 No No
POST /t/AnswerHandler.ashx 4317 9.75 9.77 No No
POST /t/AnswerHandler.ashx 4316 11.54 11.56 No No
性能一直惟持这种状态
我想,采用这种方式,是可以接受的,既然点击一次提交一次,100个线程,200个用户(我想,可以算是打开100个浏览器来做请求吧)内可以接受,那么这样决定就行了,也不用搞什么一段时间批量保存一下答案这样麻烦,因为,测试是成本,维护也是成本。越复杂的功能,bug就越多。就要越要经过精力与时间的考验
我们做开发的,只想把成本降到最低,无论是开发,维护或者是测试
也许可以换成linq,再做一个测试,对比一下性能。我也想知道,linq在压力下,会是怎样的表现,以前用的,都是开发出来就算了,都没有了解过linq是不是想像中的慢,不过我今天看了一下linq生成的实体类的代码,发觉用到反射的部分很少
这个是Linq写的一般处理程序的代码
性能一直是这样,cpu占用比ado.net高出了一倍
运行的测试报告如下:
Overview
================================================================================
Report name: 2010-7-4 8:30:07
Run on: 2010-7-4 8:30:07
Run length: 00:20:01
Web Application Stress Tool Version:1.1.293.1
Number of test clients: 1
Number of hits: 451511
Requests per Second: 376.26
Socket Statistics
--------------------------------------------------------------------------------
Socket Connects: 451593
Total Bytes Sent (in KB): 229702.12
Bytes Sent Rate (in KB/s): 191.42
Total Bytes Recv (in KB): 379495.73
Bytes Recv Rate (in KB/s): 316.25
Socket Errors
--------------------------------------------------------------------------------
Connect: 0
Send: 0
Recv: 0
Timeouts: 0
RDS Results
--------------------------------------------------------------------------------
Successful Queries: 0
Script Settings
================================================================================
Server: 192.168.1.3
Number of threads: 100
Test length: 00:20:00
Warmup: 00:00:00
Cooldown: 00:00:00
Use Random Delay: Yes
Min Delay Time: 0
Max Delay Time: 500
Follow Redirects: Yes
Max Redirect Depth: 15
Clients used in test
================================================================================
localhost
Clients not used in test
================================================================================
Result Codes
Code Description Count
================================================================================
200 OK 442724
404 Not Found 8787
Page Summary
Page Hits TTFB Avg TTLB Avg Auth Query
================================================================================
POST /check_outchain.php 4394 0.35 0.36 No No
POST /check_outchain.php 4393 0.39 0.40 No No
GET /t/Default.aspx 4393 11.35 11.37 No No
GET /t/js/jquery-1.3.2.min.js 4393 0.68 1.18 No No
POST /t/AnswerHandler.ashx 4390 19.46 19.46 No No
POST /t/AnswerHandler.ashx 4388 17.96 17.97 No No
POST /t/AnswerHandler.ashx 4388 16.80 16.81 No No
POST /t/AnswerHandler.ashx 4386 15.71 15.72 No No
POST /t/AnswerHandler.ashx 4384 16.22 16.22 No No
POST /t/AnswerHandler.ashx 4384 14.29 14.30 No No
POST /t/AnswerHandler.ashx 4383 15.16 15.17 No No
POST /t/AnswerHandler.ashx 4381 15.59 15.59 No No
POST /t/AnswerHandler.ashx 4380 16.06 16.06 No No
POST /t/AnswerHandler.ashx 4379 15.66 15.67 No No
POST /t/AnswerHandler.ashx 4379 14.94 14.95 No No
POST /t/AnswerHandler.ashx 4378 18.04 18.05 No No
POST /t/AnswerHandler.ashx 4377 15.39 15.39 No No
POST /t/AnswerHandler.ashx 4377 16.72 16.73 No No
POST /t/AnswerHandler.ashx 4375 16.97 16.98 No No
POST /t/AnswerHandler.ashx 4374 16.13 16.14 No No
POST /t/AnswerHandler.ashx 4373 17.30 17.31 No No
POST /t/AnswerHandler.ashx 4371 16.08 16.09 No No
POST /t/AnswerHandler.ashx 4370 16.49 16.50 No No
POST /t/AnswerHandler.ashx 4366 16.15 16.16 No No
POST /t/AnswerHandler.ashx 4364 16.46 16.47 No No
POST /t/AnswerHandler.ashx 4364 17.08 17.09 No No
POST /t/AnswerHandler.ashx 4363 15.89 15.90 No No
POST /t/AnswerHandler.ashx 4362 16.52 16.52 No No
POST /t/AnswerHandler.ashx 4360 15.68 15.69 No No
POST /t/AnswerHandler.ashx 4359 14.91 14.92 No No
POST /t/AnswerHandler.ashx 4358 16.85 16.86 No No
POST /t/AnswerHandler.ashx 4358 15.89 15.90 No No
POST /t/AnswerHandler.ashx 4357 16.63 16.63 No No
POST /t/AnswerHandler.ashx 4355 17.08 17.09 No No
POST /t/AnswerHandler.ashx 4354 15.35 15.36 No No
POST /t/AnswerHandler.ashx 4354 14.51 14.52 No No
POST /t/AnswerHandler.ashx 4353 15.72 15.73 No No
POST /t/AnswerHandler.ashx 4352 15.01 15.02 No No
POST /t/AnswerHandler.ashx 4352 14.64 14.64 No No
POST /t/AnswerHandler.ashx 4352 13.98 13.99 No No
POST /t/AnswerHandler.ashx 4352 14.27 14.28 No No
POST /t/AnswerHandler.ashx 4352 14.02 14.03 No No
POST /t/AnswerHandler.ashx 4350 15.28 15.29 No No
POST /t/AnswerHandler.ashx 4350 13.24 13.25 No No
POST /t/AnswerHandler.ashx 4350 15.30 15.31 No No
POST /t/AnswerHandler.ashx 4350 13.84 13.84 No No
POST /t/AnswerHandler.ashx 4348 15.68 15.69 No No
POST /t/AnswerHandler.ashx 4347 15.14 15.14 No No
POST /t/AnswerHandler.ashx 4344 15.24 15.25 No No
POST /t/AnswerHandler.ashx 4342 14.89 14.89 No No
POST /t/AnswerHandler.ashx 4341 17.35 17.36 No No
POST /t/AnswerHandler.ashx 4340 16.19 16.20 No No
POST /t/AnswerHandler.ashx 4338 17.02 17.02 No No
POST /t/AnswerHandler.ashx 4338 15.78 15.79 No No
POST /t/AnswerHandler.ashx 4336 16.24 16.25 No No
POST /t/AnswerHandler.ashx 4334 17.36 17.36 No No
POST /t/AnswerHandler.ashx 4333 16.02 16.03 No No
POST /t/AnswerHandler.ashx 4333 16.80 16.81 No No
POST /t/AnswerHandler.ashx 4333 16.43 16.44 No No
POST /t/AnswerHandler.ashx 4331 16.45 16.46 No No
POST /t/AnswerHandler.ashx 4331 17.80 17.81 No No
POST /t/AnswerHandler.ashx 4331 17.47 17.47 No No
POST /t/AnswerHandler.ashx 4331 15.41 15.42 No No
POST /t/AnswerHandler.ashx 4329 17.27 17.28 No No
POST /t/AnswerHandler.ashx 4328 17.59 17.60 No No
POST /t/AnswerHandler.ashx 4328 15.90 15.90 No No
POST /t/AnswerHandler.ashx 4326 15.88 15.89 No No
POST /t/AnswerHandler.ashx 4325 15.17 15.18 No No
POST /t/AnswerHandler.ashx 4324 16.58 16.59 No No
POST /t/AnswerHandler.ashx 4324 15.57 15.58 No No
POST /t/AnswerHandler.ashx 4324 15.45 15.46 No No
POST /t/AnswerHandler.ashx 4324 16.18 16.18 No No
POST /t/AnswerHandler.ashx 4323 16.73 16.74 No No
POST /t/AnswerHandler.ashx 4321 15.43 15.44 No No
POST /t/AnswerHandler.ashx 4321 17.23 17.24 No No
POST /t/AnswerHandler.ashx 4318 16.23 16.23 No No
POST /t/AnswerHandler.ashx 4316 15.75 15.76 No No
POST /t/AnswerHandler.ashx 4315 16.06 16.06 No No
POST /t/AnswerHandler.ashx 4315 17.51 17.52 No No
POST /t/AnswerHandler.ashx 4315 15.75 15.76 No No
POST /t/AnswerHandler.ashx 4315 15.14 15.15 No No
POST /t/AnswerHandler.ashx 4315 16.75 16.76 No No
POST /t/AnswerHandler.ashx 4314 16.85 16.86 No No
POST /t/AnswerHandler.ashx 4312 14.60 14.61 No No
POST /t/AnswerHandler.ashx 4311 17.96 17.97 No No
POST /t/AnswerHandler.ashx 4311 15.57 15.58 No No
POST /t/AnswerHandler.ashx 4311 17.74 17.75 No No
POST /t/AnswerHandler.ashx 4311 17.61 17.62 No No
POST /t/AnswerHandler.ashx 4311 16.29 16.30 No No
POST /t/AnswerHandler.ashx 4307 16.37 16.38 No No
POST /t/AnswerHandler.ashx 4307 16.10 16.11 No No
POST /t/AnswerHandler.ashx 4306 15.52 15.53 No No
POST /t/AnswerHandler.ashx 4305 15.24 15.25 No No
POST /t/AnswerHandler.ashx 4303 14.00 14.01 No No
POST /t/AnswerHandler.ashx 4303 14.13 14.14 No No
POST /t/AnswerHandler.ashx 4303 14.82 14.83 No No
POST /t/AnswerHandler.ashx 4302 16.16 16.17 No No
POST /t/AnswerHandler.ashx 4302 16.94 16.95 No No
POST /t/AnswerHandler.ashx 4299 15.43 15.44 No No
POST /t/AnswerHandler.ashx 4298 13.62 13.63 No No
POST /t/AnswerHandler.ashx 4296 15.04 15.05 No No
POST /t/AnswerHandler.ashx 4295 15.76 15.77 No No
POST /t/AnswerHandler.ashx 4295 15.00 15.01 No No
POST /t/AnswerHandler.ashx 4295 14.38 14.38 No No
对比之下,其实响应也没有多大差别,不过就是使用linq的话,要求机器的配置要高一些
这只是简单插入的测试比较。
如果是关于复杂的sql语句查询的话(如分数统计等),那就不知道了,有时间,还想亲自测试一下。
- 关于考试系统的ajax提交单个答案的压力测试
- 关于SQLSERVER的压力测试
- jmeter get post 压力测试及ab 的压力测试及单个接口xhprof对比
- 系统压力测试的一些基本概念
- io系统的压力测试工具-fio
- io系统的压力测试工具-fio
- io系统的压力测试工具-fio
- io系统的压力测试工具-fio
- 压力测试和系统优化的技巧
- 关于网站导航的压力测试
- 关于压力测试,监控数据表的问题!
- 关于mmorpg游戏的压力测试
- 考试的几道简答题答案
- 服务器的压力测试
- 压力测试的步骤
- 简单的压力测试
- MONGODB的压力测试
- 关于ajax和submit提交的问题
- 在linux下使用rsync进行同步
- 给FCKEDITOR添加中文字体
- 全面解读WM_NOTIFY
- 关于SkinMagic的破解
- MFC应用程序中指针的使用
- 关于考试系统的ajax提交单个答案的压力测试
- 2010年5月27日俱乐部晚场活动,“iPhone应用成功经验分享”主题研讨活动
- SendMessage 参数
- CSDN回帖得分大全(近两年)
- [sql server] 分拆列值
- fatal error C1010: unexpected end of file解决方案
- 常用正则表达式
- Word中插入页面 目录无页码与正文页码第一页
- datagriedview 显示行号