如何在一个页面上模拟多个请求(即4000个或更多)以测试性能? [英] How to simulate more than 1 request(i.e. 4000 or more) on a single page to test performance?
本文介绍了如何在一个页面上模拟多个请求(即4000个或更多)以测试性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个名为mysql_query_performance.php的页面,该页面包含用于从表中选择一些记录并对其进行回显的代码.
Suppose I have a page called mysql_query_performance.php which contains code to select some records from table and echo it.
但是我想知道如何模拟多个请求以测试该查询的性能?
But I want to know how can I simulate more than 1 request to test the performance of that query?
这可能吗?如果是,怎么办?
推荐答案
For simple load testing, you might want to try Apache Bench. It's most likely already installed on your system.
ab -n 4000 -c 10 http://www.yoursite.com/mysql_query_performance.php
这是针对4000个请求,一次执行10个(同时)
That's for 4000 requests performed 10 at a time (concurrently)
这篇关于如何在一个页面上模拟多个请求(即4000个或更多)以测试性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文