根据wiki百科解释: beanchmark问题就是基准测试问题.

1996 International Workshop on Structural Control 会议上提议组建欧洲、亚洲、和美国3个有关SHM的研究小组,并由 Chen倡导建立Benchmark结构,以便进行各种技术的直接比较.

许多业内比较出名的工具都提供benchmark 功能

1. Apache Beachmark 简称(ab)

他是apache 组织下的一款web压力测试工具, 因使用方便简单而著称.

ab一般常用参数是 –n   -t 和 -c

-c(concurrency)表示用多少并发来进行测试(模拟并发数);

-t表示并发测试持续时间;

-n表示要发送多少次请求;

注意: 大小写敏感

ab [get] 请求

$ ab -n 10 -c 3 https://www.baidu.com/

发送10个请求, 模拟3个并发数

Concurrency Level:      3   #当前并发数

Time taken for tests:   0.624 seconds   #测试消耗时间

Complete requests:      10  # 完成请求数量

Failed requests:        0   #失败的请求数

Total transferred:      8930 bytes # 共传输数据量

Requests per second:    20.24 [#/sec] (mean)  #平均每秒完成请求个数

Time per request:       148.231 [ms] (mean) #每组请求消耗时间

Time per request:       49.410 [ms] (mean, across all concurrent requests) #每个请求消耗时间

Transfer rate:          17.65 [Kbytes/sec] received #传输速率

Percentage of the requests served within a certain time (ms)

50%    104   #104ms内已经完成了50%的请求

80%    161   #161ms内已经完成了80%的请求

ab [post] 请求

$ ab -n 100  -c 10 -p 'postdata.txt' -T 'application/x-www-form-urlencoded' 'http://xxx.api.com/'

-p postfile

-T Content-type header to use for POST/PUT data,

'application/x-www-form-urlencoded' Default is 'text/plain'

2.  Redis-Beachmark

测试实例:

redis-benchmark -h localhost -p 6379 -c 3 -n 6

3个并发, 6个请求 检测端口号6379的redis 性能

$ redis-benchmark -h localhost -p 6379 -c 3 -n 6

====== PING_INLINE ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

6000.00 requests per second

====== PING_BULK ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== SET ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

6000.00 requests per second

====== GET ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== INCR ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== LPUSH ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

6000.00 requests per second

====== RPUSH ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== LPOP ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== RPOP ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

6000.00 requests per second

====== SADD ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== HSET ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== SPOP ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== LPUSH (needed to benchmark LRANGE) ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

====== LRANGE_100 (first 100 elements) ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

66.67% <= 1 milliseconds

100.00% <= 1 milliseconds

3000.00 requests per second

====== LRANGE_300 (first 300 elements) ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

3000.00 requests per second

====== LRANGE_500 (first 450 elements) ======

6 requests completed in 0.01 seconds

3 parallel clients

3 bytes payload

keep alive: 1

50.00% <= 1 milliseconds

100.00% <= 1 milliseconds

1000.00 requests per second

====== LRANGE_600 (first 600 elements) ======

6 requests completed in 0.01 seconds

3 parallel clients

3 bytes payload

keep alive: 1

66.67% <= 1 milliseconds

100.00% <= 1 milliseconds

1000.00 requests per second

====== MSET (10 keys) ======

6 requests completed in 0.00 seconds

3 parallel clients

3 bytes payload

keep alive: 1

100.00% <= 0 milliseconds

inf requests per second

$redis-benchmark -h localhost -p 6379 -q -d 100

测试存取大小为100字节的数据包的性能

$ redis-benchmark -t set,lpush -n 100 -q //测试操作-t(set, lpush)的性能

SET: 20000.00 requests per second

LPUSH: 6666.67 requests per second

$ redis-benchmark -r 1000000 -n 2000000 -t get,set,lpush,lpop -P 16 -q   //redis 管道

SET: 142857.14 requests per second

GET: 117647.05 requests per second

LPUSH: 181818.19 requests per second

LPOP: 200000.00 requests per second

Redis是一种基于客户端/服务端模型, Request/Response遵循TCP协议的服务,也就说:

客户端向服务端发送一个查询请求, 监听socket返回, 通常以阻塞模式, 等待服务端响应. 服务端处理命令, 并将结果返回给客户端.

Redis很早就支持管道(pipelining)技术,因此无论你运行的是什么版本,你都可以使用管道(pipelining)操作Redis。

下面是一个使用的例子:

$ (printf "PING\r\nPING\r\nPING\r\n"; sleep 1) | nc localhost 6379

+PONG

+PONG

+PONG

$ (echo -en "PING\r\n SET key redis\r\nGET key\r\nINCR x\r\nINCR x\r\nINCR x\r\n"; sleep 10) | nc localhost 6379

Using the TCP loopback:

$ redis-benchmark -q -n 100000 -d 256

PING_INLINE: 36023.05 requests per second

PING_BULK: 36697.25 requests per second

SET: 34710.17 requests per second

GET: 35919.54 requests per second

INCR: 36927.62 requests per second

LPUSH: 27151.78 requests per second

RPUSH: 37160.91 requests per second

LPOP: 25348.54 requests per second

RPOP: 29958.06 requests per second

SADD: 34176.35 requests per second

HSET: 33411.29 requests per second

SPOP: 34002.04 requests per second

LPUSH (needed to benchmark LRANGE): 37105.75 requests per second

LRANGE_100 (first 100 elements): 10824.85 requests per second

LRANGE_300 (first 300 elements): 3895.90 requests per second

LRANGE_500 (first 450 elements): 2820.95 requests per second

LRANGE_600 (first 600 elements): 2107.26 requests per second

MSET (10 keys): 27987.69 requests per second

Benchmark测试中最重要的是标准规范,也就是说他是一个评价方式,工具等因素已经不重要,只要大家都用同一标准规范、同一工具进行系统测试,那么测试结果也就具有了比较意义。Benchmark 测试实际上就成了各个厂商展示技术实力的舞台, 任何厂家或者测试者都可以根据组织公布的规范标准, 构建自己最优的系统.

聊聊Benchmark测试【转载】相关推荐

  1. 聊聊benchmark测试

    根据wiki百科解释: benchmark问题就是基准测试问题. 1996 International Workshop on Structural Control 会议上提议组建欧洲.亚洲.和美国3 ...

  2. 使用ab和wrk对腾讯CLS进行benchmark测试

    使用ab和wrk对腾讯云日志服务CLS进行压力测试,以此为例对ab和wrk进行说明 ab ab,全称是apache benchmark,是apache官方推出的工具.该工具是用来测试Apache服务器 ...

  3. benchmark测试

    title: benchmark测试 date: 2021-12-20 17:44:59 categories: go tags: 测试 Go 中的基准测试在许多方面类似于单元测试,但有关键的不同之处 ...

  4. 在线ssd测试软件,AS SSD Benchmark测试

    AS SSD Benchmark测试 ● AS SSD Benchmark AS SSD是基于全方位性能的测试软件,它使用了非常深度的Queue Depth(QD)队列深度,以及非压缩测试. • AS ...

  5. AI Benchmark测试原理、v4测试项变化以及榜单数据解读

    田海立@csdn 2020-10-3 AI Benchmark这里特指ETHZ(苏黎世联邦理工学院)的AI性能评测工具.最新其发布了v4版本以及基于这个版本的soc和手机AI性能数据.本文分析了AI ...

  6. Centos7安装ab(Apache Benchmark)测试工具及使用

    Centos7安装ab(Apache Benchmark)测试工具及使用 Apache Benchmark简称AB 一.安装 yum install -y httpd-tools 二.创建Post请求 ...

  7. 干货 | 如何对京东云GPU云主机进行TensorFlow Benchmark测试

     摘  要  本文介绍基于京东云GPU云主机快速搭建基于Tensorflow深度学习平台的过程,并分享如何利用Tensorflow benchmark工具进行GPU云主机基准性能测试,帮助读者快速.经 ...

  8. YCSB benchmark测试mongodb性能——和web服务器测试性能结果类似

    转自:http://blog.sina.com.cn/s/blog_48c95a190102v9kg.html         YCSB(Yahoo! Cloud Serving Benchmark) ...

  9. YCSB benchmark测试cassandra性能——和web服务器测试性能结果类似

    转自:http://www.itdadao.com/articles/c15a531189p0.html http://www.cnblogs.com/bettersky/p/6158172.html ...

最新文章

  1. 在Eclipse或MyEclipse中安装findbugs插件
  2. [JVM-翻译]揭开java.lang.OutOfMemoryError面纱之一
  3. 用Visual C#做DLL文件
  4. 经典mysql数据库表案例_MySQL数据库的“十宗罪”(附10大经典错误案例)
  5. bootcamp空间不足_Bootcamp安装WinXP补丁时C盘空间不足怎么办?
  6. 组策略应用之一:映射网络驱动器
  7. 《复联4》首轮公映票房27.5亿美金 超《阿凡达》创纪录
  8. Android4.0升级新特性
  9. PSD分层情人节海报模板,让人眼前一亮
  10. 如何使用CommitMonitor工具监控 SVN
  11. 进程间通信 IPC、LPC、RPC
  12. 类似与fiddler的抓包工具 burp suite free edition
  13. [NAACL19]无监督循环神经网络文法 (URNNG)
  14. lableme标注的json文件转为mask r-cnn训练用的coco数据集格式
  15. php重构求圆柱圆锥的体积,圆锥的体积 - 彭阳县第二小学数学教研社区 - 宁夏教育云...
  16. Dapr+Net6 服务调用09:集群指标收集-普罗米修斯
  17. java split保留分隔_String split如何保留分隔符
  18. RF使用技巧--返回值的妙用
  19. 注销consul节点
  20. 【论文汇总】 ECCV 2020 语义分割paper汇总

热门文章

  1. c# 实现金山词霸一样的屏幕取词
  2. 计算机专业用移动硬盘,评测 篇四十三:国产之光,看这款可做移动硬盘又可系统盘的Orico SSD...
  3. PC端和手机端平台的区别
  4. 2021年美赛解题思路汇总Final!!!
  5. 腾讯跟阿里两位王者之间的对比
  6. systemd服务创建服务demo
  7. 2020.8.25 斗鱼Android开发二面面经
  8. ERROR Error loading vue.config.js ERROR Error Command failed git describe --always报错可能的原因
  9. [转]Cloudera Manager和CDH5.8离线安装
  10. win10安装wifi网卡驱动显示“这个 INF 中的服务安装段落无效“