利用minio/warp压测minio集群

2,491 阅读1分钟

1.docker安装 minio/warp

docker pull minio/warp

这个命令是获取最新版本的镜像,如果需要获取指定版本的镜像在后面加上 :版本号 就可以了。

[~]$ docker images
REPOSITORY                      TAG       IMAGE ID       CREATED         SIZE
minio/warp                      latest    8ebca3ef7060   8 days ago      17.9MB

需要看看具体的版本号可以通过 inspect查看

docker image inspect minio/warp:latest |grep -i version

常用参数

参数释义
--benchdata指定压测结果文件的名称(包括文件路径)
--obj.size指定对象的大小
--host指定服务器
--access-key账号
--secret-key密码
--concurrent并发数
--obj.randsize随机大小
--duration持续时间
--autoterm当基准被认为稳定时自动终止

2.利用minio/warp 进行压测

docker run --net host --name warp\
  -v /home/test/result:/result \
  minio/warp put --host=192.168.1.{7...9}:9000 --access-key=minioadmin --secret-key=minioadmin \
  --benchdata /result/put-100 \
  --concurrent 20 \
  --obj.randsize \
  --duration 10m0s \
  --autoterm 

由于warp是运行完之后容器就停止运行了,无法进入容器内部(运行任务的时候也进不去),所以要获取生成的结果文件, 要么是通过 docker cp把文件复制出来(生成的文件默认是直接在根目录下的)

docker cp 0f411107bb2f:warp-mixed-2022-09-27[090405]-rk20.csv.zst /home/test/minio/warp
参数释义
0f411107bb2fdocker run生成的容器的id,如果执行的时候用--name指定了名字,可换成指定的名字
warp-mixed-2022-09-27[090405]-rk20.csv.zstwarp生成的结果文件,可以根据--benchdata指定名字及路径
/home/test/minio/warp你的linux的路径

要么就像上面一样,通过docker的文件映射将文件直接映射到linux上:

参数释义
--benchdata /result/put-100指定将压测结果生成到 容器内result文件夹下,文件名为 put-100 (最终生成的文件的名称为 put-100.csv.zst)
--host=192.168.1.{7...9}:9000压测的环境 7...9 是minio支持的写法,表示 7 8 9
--access-keyminio的登录名
--secret-keyminio的密码
-v /home/test/result:/result设置映射

3.结果分析

warp执行完会把结果打印的控制台,可以在命令后面加上 >result.log 输出到文件,压缩的详细数据存储在.csv.zst后缀的文件中,可以通过 minio/warp analyze 解析文件

docker run --name warp-analyze --net host \
  -v /home/test/result/put-100.csv.zst:/result/put-100.csv.zst \
  minio/warp analyze --analyze.v /result/put-100.csv.zst >put-100-result-detail.log

因为是创建容器去分析,所以需要把文件映射到容器内部

参数释义
-v /home/test/result/put-100.csv.zst:/result/put-100.csv.zst把文件映射到容器
>put-100-result-detail.log把解析结果输出到log文件

结果

warp: Preparing server.
Clearing Prefix "warp-benchmark-bucket/"...warp: Starting benchmark in 3s...
warp: Benchmark starting...
Throughput 110.6MiB/s within 7.500000% for 14.623s. Assuming stability. Terminating benchmark.
warp: Saving benchmark data...
warp: Benchmark data written to "/result/put-100.csv.zst"

----------------------------------------
Operation: PUT
* Average: 111.06 MiB/s, 11.11 obj/s

Throughput by host:
 * http://192.168.1.7:9000: Avg: 17.79 MiB/s, 1.78 obj/s
 * http://192.168.1.8:9000: Avg: 17.27 MiB/s, 1.73 obj/s
 * http://192.168.1.9:9000: Avg: 76.05 MiB/s, 7.61 obj/s

Throughput, split into 57 x 1s:
 * Fastest: 121.3MiB/s, 12.13 obj/s
 * 50% Median: 111.5MiB/s, 11.15 obj/s
 * Slowest: 99.0MiB/s, 9.90 obj/s
warp: Starting cleanup...
Clearing Prefix "warp-benchmark-bucket/0uvYTk18/"...warp: Cleanup Done.

analyze的详情数据


----------------------------------------
Operation: PUT (766). Ran 1m9s. Concurrency: 20. Hosts: 3.

Requests considered: 616:
 * Avg: 1.73s, 50%: 917ms, 90%: 4.098s, 99%: 10.721s, Fastest: 176ms, Slowest: 13.593s

Requests by host:
 * http://192.168.1.7:9000 - 125 requests: 
        - Avg: 3.759s Fastest: 1.019s Slowest: 13.593s 50%: 2.801s 90%: 7.984s
 * http://192.168.1.8:9000 - 121 requests: 
        - Avg: 3.907s Fastest: 1.131s Slowest: 12.458s 50%: 3.108s 90%: 7.635s
 * http://192.168.1.9:9000 - 520 requests: 
        - Avg: 833ms Fastest: 176ms Slowest: 2.428s 50%: 771ms 90%: 1.347s

Throughput:
* Average: 111.06 MiB/s, 11.11 obj/s

Throughput by host:
 * http://192.168.1.7:9000:
        - Average:  17.79 MiB/s, 1.78 obj/s
        - Fastest: 31.6MiB/s
        - 50% Median: 17.7MiB/s
        - Slowest: 9.9MiB/s
 * http://192.168.1.8:9000:
        - Average:  17.27 MiB/s, 1.73 obj/s
        - Fastest: 26.0MiB/s
        - 50% Median: 17.3MiB/s
        - Slowest: 11.4MiB/s
 * http://192.168.1.9:9000:
        - Average:  76.05 MiB/s, 7.61 obj/s
        - Fastest: 98.9MiB/s
        - 50% Median: 76.4MiB/s
        - Slowest: 49.7MiB/s

Throughput, split into 57 x 1s:
 * Fastest: 121.3MiB/s, 12.13 obj/s (1s, starting 06:26:42 UTC)
 * 50% Median: 111.5MiB/s, 11.15 obj/s (1s, starting 06:26:59 UTC)
 * Slowest: 99.0MiB/s, 9.90 obj/s (1s, starting 06:26:41 UTC)

4.文档

官方地址:github.com/minio/warp

参数释义

NAME:
  warp - Benchmark tool for S3 compatible object storage systems.
  For usage details see https://github.com/minio/warp

USAGE:
  warp [global options] command [command options] [arguments...]

VERSION:
  0.6.3 - d691c32

AUTHOR:
  MinIO, Inc.

COMMANDS:
  mixed      benchmark(基准) mixed objects
  get        benchmark get objects
  put        benchmark put objects
  delete     benchmark delete objects
  list       benchmark list objects
  stat       benchmark stat objects (get file info)
  select     benchmark select objects
  versioned  benchmark mixed versioned objects
  retention  benchmark PutObjectRetention
  multipart  benchmark multipart object
  analyze    analyze existing benchmark data
  cmp        compare existing benchmark data
  merge      merge existing benchmark data
  client     run warp in client mode, accepting connections to run benchmarks

GLOBAL FLAGS:
  --no-color        disable color theme
  --debug           enable debug output
  --insecure        disable TLS certificate verification
  --autocompletion  install auto-completion for your shell
  --help, -h        show help
  --version, -v     print the version
NAME:
  warp put - benchmark put objects

USAGE:
  warp put [FLAGS]
  -> see https://github.com/minio/warp#put

FLAGS:
  --no-color             disable color theme
  --debug                enable debug output
  --insecure             disable TLS certificate verification
  --autocompletion       install auto-completion for your shell
  --host value           host. Multiple hosts can be specified as a comma separated list. (default: "127.0.0.1:9000") [$WARP_HOST]
  --access-key value     Specify access key [$WARP_ACCESS_KEY]
  --secret-key value     Specify secret key [$WARP_SECRET_KEY]
  --tls                  Use TLS (HTTPS) for transport [$WARP_TLS]
  --region value         Specify a custom region [$WARP_REGION]
  --encrypt              encrypt/decrypt objects (using server-side encryption with random keys)
  --bucket value         Bucket to use for benchmark data. ALL DATA WILL BE DELETED IN BUCKET! (default: "warp-benchmark-bucket")
  --host-select value    Host selection algorithm. Can be "weighed" or "roundrobin" (default: "weighed")
  --concurrent value     Run this many concurrent operations (default: 20)
  --noprefix             Do not use separate prefix for each thread
  --prefix value         Use a custom prefix for each thread
  --disable-multipart    disable multipart uploads
  --md5                  Add MD5 sum to uploads
  --storage-class value  Specify custom storage class, for instance 'STANDARD' or 'REDUCED_REDUNDANCY'.
  --obj.size value       Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary. (default: "10MiB")
  --obj.generator value  Use specific data generator (default: "random")
  --obj.randsize         Randomize size of objects so they will be up to the specified size
  --benchdata value      Output benchmark+profile data to this file. By default unique filename is generated.
  --serverprof value     Run MinIO server profiling during benchmark; possible values are 'cpu', 'mem', 'block', 'mutex' and 'trace'.
  --duration value       Duration to run the benchmark. Use 's' and 'm' to specify seconds and minutes. (default: 5m0s)
  --autoterm             Auto terminate when benchmark is considered stable.
  --autoterm.dur value   Minimum duration where output must have been stable to allow automatic termination. (default: 10s)
  --autoterm.pct value   The percentage the last 6/25 time blocks must be within current speed to auto terminate. (default: 7.5)
  --noclear              Do not clear bucket before or after running benchmarks. Use when running multiple clients.
  --syncstart value      Specify a benchmark start time. Time format is 'hh:mm' where hours are specified in 24h format, server TZ.
  --warp-client value    Connect to warp clients and run benchmarks there.
  --analyze.dur value    Split analysis into durations of this length. Can be '1s', '5s', '1m', etc.
  --analyze.out value    Output aggregated data as to file
  --analyze.op value     Only output for this op. Can be GET/PUT/DELETE, etc.
  --analyze.host value   Only output for this host.
  --analyze.skip value   Additional duration to skip when analyzing data. (default: 0s)
  --analyze.v            Display additional analysis data.
  --serve value          When running benchmarks open a webserver to fetch results remotely, eg: localhost:7762
  --help, -h             show help