欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

siege用法

发布时间:2025/6/17 编程问答 53 豆豆
生活随笔 收集整理的这篇文章主要介绍了 siege用法 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

相信大家对siege还是比较了解的,它是一款比较功能比较强大的压力测试软件。可能大家平常也会用,但直到前阵子,发现自己对它的参数理解还不够深刻,分享出来希望对大家有所帮助。

如果我用以下这样的参数去进行压力测试,具体是怎样的?

siege -r1000 -c20 "127.0.0.1:1823"

是不是“20个并发用户,每个用户重复请求1000次,去压本地的1823端口”。

好的,那接下来的问题来了,每个用户的每个请求之间会不会有延时?如果有延时的话,会不会对得到的性能指标有所影响呢?

这就我们之前很可能忽视的一个参数:

-b, --benchmark BENCHMARK: no delays between requests. ‘ –delay=NUM ‘ Each siege simulated user is delayed for a random number of seconds between one and NUM. If you are benchmarking performance, it is recommended that you use a 1 second delay ( -d1 ). The default value is three (3 ). This delay allows for the transactions to stagger rather then to allow them to pound the server in waves.

 

所以正确的压力测试参数应该是:

siege -r1000 -c20 -b "127.0.0.1:1823"

 

参考文章:

http://www.php-oa.com/2010/06/25/siege.html

转载于:https://www.cnblogs.com/lengyuhong/archive/2012/08/14/2638272.html

总结

以上是生活随笔为你收集整理的siege用法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。