我在这里尝试负载测试。我的后端在 Rails(3) 上的 Ruby(2.2) 中。我阅读了很多关于如何使用 Ab 测试的页面。
这是我尝试过的: ab -n 100 -c 30 url
结果:
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 52.74.130.35 (be patient).....done
Server Software: nginx/1.6.2
Server Hostname: 52.74.130.35
Server Port: 80
Document Path: url
Document Length: 1372 bytes
Concurrency Level: 3
Time taken for tests: 10.032 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 181600 bytes
HTML transferred: 137200 bytes
Requests per second: 9.97 [#/sec] (mean)
Time per request: 300.963 [ms] (mean)
Time per request: 100.321 [ms] (mean, across all concurrent requests)
Transfer rate: 17.68 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 9 25.0 5 227
Processing: 176 289 136.5 257 1134
Waiting: 175 275 77.9 256 600
Total: 180 298 139.2 264 1143
Percentage of the requests served within a certain time (ms)
50% 264
66% 285
75% 293
80% 312
90% 361
95% 587
98% 1043
99% 1143
哪些接缝可以完美工作。但我的问题是我想测试许多 API,而不仅仅是一个。所以我必须编写一个脚本,在其中编写所有具有特定概率(权重)的 Api 并对它们进行负载测试。
我知道Locust是如何实现的,但是 locust 不支持嵌套的 json 作为参数传递。
有人可以帮忙吗?也让我知道问题本身是否有任何问题/歧义。