sysbench

sysbench是一个开源的、模块化的、跨平台的多线程性能测试工具,可以用来进行CPU、内存、磁盘I/O、线程、数据库的性能测试。

安装 sysbench:

apt install -y sysbench

ICE-EVB 开发板测试:

  • 测试线程:

    ```bash root@thead-910:/# ./sysbench --test=threads --num-threads=32 --thread-yields=100 --thread-lock=8 run sysbench 0.5: multi-threaded system evaluation benchmark

    Running the test with following options: Number of threads: 32 Random number generator seed is 0 and will be ignored

Threads started!

General statistics: total time: 2.9138s total number of events: 10000 total time taken by event execution: 93.1165s response time: min: 0.14ms avg: 9.31ms max: 82.38ms approx. 95 percentile: 32.83ms

Threads fairness: events (avg/stddev): 312.5000/14.83 execution time (avg/stddev): 2.9099/0.00


  换算:

  14.83/2.9099=5.1



其他测试项目:

- 测试CPU:

  ```bash
  root@thead-910:~# ./sysbench --test=cpu --cpu-max-prime=20000 --num-threads=2 run
  sysbench 0.5:  multi-threaded system evaluation benchmark

  Running the test with following options:
  Number of threads: 2
  Random number generator seed is 0 and will be ignored


  Primer numbers limit: 20000

  Threads started!


  General statistics:
      total time:                          15.0576s
      total number of events:              10000
      total time taken by event execution: 30.1038s
      response time:
           min:                                  3.00ms
           avg:                                  3.01ms
           max:                                  3.12ms
           approx.  95 percentile:               3.01ms

  Threads fairness:
      events (avg/stddev):           5000.0000/0.00
      execution time (avg/stddev):   15.0519/0.00
  • 测试IO:

    root@thead-910:~# .sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare
    sysbench 0.5:  multi-threaded system evaluation benchmark
    
    128 files, 16384Kb each, 2048Mb total
    Creating files for the test...
    Extra file open flags: 0
    Creating file test_file.0
    Creating file test_file.1
    ...
    Creating file test_file.125
    Creating file test_file.126
    Creating file test_file.127
    2147483648 bytes written in 110.50 seconds (18.53 MB/sec).
    

    ```bash root@thead-910:~# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run sysbench 0.5: multi-threaded system evaluation benchmark

    Running the test with following options: Number of threads: 20 Random number generator seed is 0 and will be ignored

Extra file open flags: 0 128 files, 16Mb each 2Gb total file size Block size 16Kb Number of IO requests: 10000 Read/Write ratio for combined random IO test: 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random r/w test Threads started!

Operations performed: 6000 reads, 4000 writes, 12800 Other = 22800 Total Read 93.75Mb Written 62.5Mb Total transferred 156.25Mb (34.834Mb/sec) 2229.38 Requests/sec executed

General statistics: total time: 4.4856s total number of events: 10000 total time taken by event execution: 0.8171s response time: min: 0.01ms avg: 0.08ms max: 20.83ms approx. 95 percentile: 0.08ms

Threads fairness: events (avg/stddev): 500.0000/179.75 execution time (avg/stddev): 0.0409/0.02


  ```bash
  root@thead-910:~# ./sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup
  sysbench 0.5:  multi-threaded system evaluation benchmark

  Removing test files...
  • 测试内存:

    ```bash root@thead-910:~# sysbench --test=memory --memory-block-size=8k --memory-total-size=1G run sysbench 0.5: multi-threaded system evaluation benchmark

    Running the test with following options: Number of threads: 1 Random number generator seed is 0 and will be ignored

Threads started!

Operations performed: 131072 (374615.49 ops/sec)

1024.00 MB transferred (2926.68 MB/sec)

General statistics: total time: 0.3499s total number of events: 131072 total time taken by event execution: 0.2768s response time: min: 0.00ms avg: 0.00ms max: 0.06ms approx. 95 percentile: 0.00ms

Threads fairness: events (avg/stddev): 131072.0000/0.00 execution time (avg/stddev): 0.2768/0.00




- 测试mutex:

  ```bash
  root@thead-910:~# sysbench --test=mutex --num-threads=64 run
  sysbench 0.5:  multi-threaded system evaluation benchmark

  Running the test with following options:
  Number of threads: 64
  Random number generator seed is 0 and will be ignored


  Threads started!


  General statistics:
      total time:                          1.2616s
      total number of events:              64
      total time taken by event execution: 76.6870s
      response time:
           min:                               1066.46ms
           avg:                               1198.23ms
           max:                               1254.10ms
           approx.  95 percentile:            1251.30ms

  Threads fairness:
      events (avg/stddev):           1.0000/0.00
      execution time (avg/stddev):   1.1982/0.05

results matching ""

    No results matching ""