$ http_load -rate 20 -seconds 10 urls.txt
111 fetches, 89 max parallel, 5.91142e+06 bytes, in 10.0001 seconds
53256.1 mean bytes/connection
11.0998 fetches/sec, 591134 bytes/sec
msecs/connect: 100.384 mean, 211.885 max, 38.214 min
msecs/first-response: 2163.51 mean, 7862.77 max, 933.708 min
HTTP response codes:
code 200 -- 111
sysbench
sysbench 的 CPU 基准测试
最典型的子系统测试就是 CPU 基准测试。该测试使用 64 位整数,测试计算素数直到某
个最大值所需要的时间。 下面的例子将比较两台不同的GNU/Linux 服务器上的测试结果。
第一台机器的 CPU 配置如下 :
[servert ~]$ cat /proc/cpuinfo
model nane + AMD Opteron(tm) Processor 246
stepping a
cpu Miz + 192.857
cache size: 1024 KB
这台服务器上运行如下的测试 :
[serverl ~]$ sysbench -testccpu -cpu-max-prime=20000 run
sysbench v0.4.8: multithreaded system evaluation benchnark
Test execution summary: total tine: 121.74048
第二台服务器配置了不同的 CPU ,
[server2 ~]$ cat /proc/cpuinfo
model name: Intel(R) Xeon(R) CPU 5130 @ 2.00GH2
stepping
cpu Miz
测试结果如下 :
[serverl ~]$ sysbench --test=cpu --cpu-max-prime=20000 run
sysbench v0.4.8: multithreaded system evaluation benchnark
Test execution summary: total time: 6.85965
基准测试
http_load
可以通过一个输入文件提供多个 URL,Hpttp_load 在这些 URL 中随机选择进行测试。 也可以定制 axtp_1oad,使其按照时间比率进行测试,而不仅仅是测试最大请求处理
下面通过一个简单的例子来演示如何使用 http_1oad。首先创建一个 urls.txt文件,输入 如下的 URL :
hitp_load 最简单的用法,就是循环请求给定的 URL 列表。测试程序将以最快的速度请 求这些 URL :
测试的结果很容易理解,只是简单地输出了请求的统计信息。下面是另外一个稍微复杂 的测试,还是尽可能快地循环请求给定的 URL 列表,不过模拟同时有五个并发用户在 进行请求 ;
另外,除了测试最快的速度,也可以根据预估的访问请求率 〈比如每秒 5 次) 来做压力 模拟测试。
最后,还可以模拟更大的负载,可以将访问请求率提高到每秒 20 次请求。请注意,连 接和请求响应时间都会随着负载的提高而增加。
sysbench
sysbench 的 CPU 基准测试
最典型的子系统测试就是 CPU 基准测试。该测试使用 64 位整数,测试计算素数直到某 个最大值所需要的时间。 下面的例子将比较两台不同的GNU/Linux 服务器上的测试结果。 第一台机器的 CPU 配置如下 :
这台服务器上运行如下的测试 :
第二台服务器配置了不同的 CPU ,
测试结果如下 :
测试的结果简单打印出了计算出素数的时间,很容易进行比较。在上面的测试中,第二 人台服务器的测试结果显示比第一台快两倍。