我正在尝试负载测试。我的后端是在Rails上的Ruby(2.2)(3)。 我阅读了许多关于如何使用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作为参数传递。
有人可以帮忙吗? 如果问题本身存在任何问题/含糊之处,也请告诉我。