3

我正在尝试创建一个负载测试 shell 脚本,基本上我想要做的是让脚本产生一些 N 个并发进程,并让每个进程调用一个指定的 URL 并执行一些基本操作。我很难弄清楚这一点 - 任何帮助都会很棒!

4

2 回答 2

2

have a look at this article:

http://prll.sourceforge.net/shell_parallel.html

as described: "Parallel batch processing in the shell

How to process a large batch job using several concurrent processes in bash or zsh

This article describes three methods of parallel execution: the first is not very performant and the other two are not safe to use. A more complete solution is called prll and can be found here. This article is not meant to be good advice, but instead laments the state of scriptable job control in shells."

于 2012-12-03T15:26:14.897 回答
2

如果你真的需要使用 shell,看看Bash:parallel processes。但是有一些负载测试工具,例如ab(Apache HTTP 服务器基准测试)可以为您完成这项工作。

您可以像这样简单地使用ab :

ab -n 10 -c 2 -A myuser:mypassword http://localhost:8080/

有关更多示例,请查看Howto:Webserver 性能基准测试

于 2012-10-22T15:37:17.260 回答