gpt4 book ai didi

ruby-on-rails - 如何检查我的应用每秒可以处理多少请求?

转载 作者:行者123 更新时间:2023-12-04 17:50:58 25 4
gpt4 key购买 nike

我创建了一个新应用程序,我计划添加缓存、cdn 和其他性能改进方法。我想检查当前的性能,并且在每种方法之后我想再次检查性能。
这是一个 Rails 应用程序。

我该怎么办?有没有我可以用来检查这个的命令?我需要进行测试吗?如何?
从我搜索的内容来看,新遗物似乎提供了很多此类信息,但在我看来,这仅适用于实时数据,我想测试应用程序可以处理的最大值(例如之前和之后执行上述更改)以及监控实时数据。

最佳答案

一种简单的方法是使用 apache bench :

ab -n 2000 -c 200 http://yourdomain.com/

其中 n 是要发出的请求数,c 是要使用的客户端数。

你会得到一个报告
Document Path:          /
Document Length: 36153 bytes

Concurrency Level: 200
Time taken for tests: 4.544 seconds
Complete requests: 2000
Failed requests: 0
Write errors: 0
Total transferred: 72732000 bytes
HTML transferred: 72306000 bytes
Requests per second: 440.17 [#/sec] (mean)
Time per request: 454.366 [ms] (mean)
Time per request: 2.272 [ms] (mean, across all concurrent requests)
Transfer rate: 15632.19 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 72 77 59.1 73 1075
Processing: 160 357 96.3 325 636
Waiting: 73 196 95.9 165 488
Total: 234 434 109.9 398 1340

Percentage of the requests served within a certain time (ms)
50% 398
66% 419
75% 440
80% 468
90% 607
95% 671
98% 688
99% 700
100% 1340 (longest request)

关于ruby-on-rails - 如何检查我的应用每秒可以处理多少请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16297560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com