使用下面脚本压测:html
siege -q -c1000 -r100 -lsiege.log -b http://127.0.0.1:8081/hello_world
而后mochiweb启动选项:web
1使用选项:shell
{acceptor_pool_size, 200}
压测结果:code
$siege -q -c1000 -r100 -lsiege.log -b http://127.0.0.1:8081/hello_world Transactions: 100000 hits Availability: 100.00 % Elapsed time: 6.69 secs Data transferred: 1.24 MB Response time: 0.04 secs Transaction rate: 14947.68 trans/sec Throughput: 0.19 MB/sec Concurrency: 565.82 Successful transactions: 100000 Failed transactions: 0 Longest transaction: 3.31 Shortest transaction: 0.00
2.使用选项:xml
{acceptor_pool_size, 20}
输出结果:htm
$siege -q -c1000 -r100 -lsiege.log -b http://127.0.0.1:8081/hello_world Transactions: 100000 hits Availability: 100.00 % Elapsed time: 7.36 secs Data transferred: 1.24 MB Response time: 0.03 secs Transaction rate: 13586.96 trans/sec Throughput: 0.17 MB/sec Concurrency: 473.18 Successful transactions: 100000 Failed transactions: 0 Longest transaction: 7.04 Shortest transaction: 0.00
能够看到次数相同,但响应时间是20个链接池的较快,但其余数值是200个链接池的较好。显然,20 - 200间个某个特殊值可能会达到最优,由于这里面的差距没有1个数量级。it