• arm & docker & sysbench


    方式1:先docker run一个镜像,手动安装好commit

    docker run -it --name mycentos arm64v8/centos:7 /bin/bash
    docker commit -a "PX Bai" mycentos mycentos1
    docker run -it -d --name=mycentos1 mycentos1 /bin/bash
    docker exec -it mycentos1 bash
    
    docker run --rm arm-sysbench
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    ./configure --without-mysql && \
    ./configure 
    
    • 1
    • 2

    方式2:ubuntu 16.04

    xenial:这是指定基础镜像的标签或版本。Ubuntu使用代号来标识每个发行版,xenial是Ubuntu 16.04 LTS版本的代号。

    FROM ubuntu:xenial
    
    RUN apt-get update
    
    RUN apt-get -y install make automake libtool pkg-config libaio-dev git
    
    # For MySQL support
    RUN apt-get -y install libmysqlclient-dev libssl-dev
    
    # For PostgreSQL support
    RUN apt-get -y install libpq-dev
    
    RUN git clone https://github.com/akopytov/sysbench.git sysbench
    
    WORKDIR sysbench
    RUN ./autogen.sh
    RUN ./configure --with-mysql --with-pgsql
    RUN make -j
    RUN make install
    
    WORKDIR /root
    RUN rm -rf sysbench
    
    ENTRYPOINT sysbench
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    方式2:centos 7

    vi Dockfile
    
    FROM arm64v8/centos:7
    
    RUN yum update -y && \
        yum install -y epel-release && \
        yum install -y git gcc automake libtool pkgconfig openssl-devel postgresql-devel mysql-devel make
        
    RUN git clone https://github.com/akopytov/sysbench.git /tmp/sysbench
    
    WORKDIR /tmp/sysbench
    
    RUN ./autogen.sh && \
        ./configure \
        make && \
        make install
    
    RUN rm -rf /tmp/sysbench && \
        yum remove -y git gcc automake libtool pkgconfig openssl-devel postgresql-devel mysql-devel && \
        yum clean all
    
    CMD [ "sysbench", "--version" ]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    查看版本

    sysbench --version
    sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
    
    sysbench --help
    Usage:
      sysbench [options]... [testname] [command]
    
    Commands implemented by most tests: prepare run cleanup help
    
    General options:
      --threads=N                     number of threads to use [1]
      --events=N                      limit for total number of events [0]
      --time=N                        limit for total execution time in seconds [10]
      --warmup-time=N                 execute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled [0]
      --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
      --thread-stack-size=SIZE        size of stack per thread [64K]
      --thread-init-timeout=N         wait time in seconds for worker threads to initialize [30]
      --rate=N                        average transactions rate. 0 for unlimited rate [0]
      --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
      --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
      --debug[=on|off]                print more debugging info [off]
      --validate[=on|off]             perform validation checks where possible [off]
      --help[=on|off]                 print help and exit [off]
      --version[=on|off]              print version and exit [off]
      --config-file=FILENAME          File containing command line options
      --luajit-cmd=STRING             perform LuaJIT control command. This option is equivalent to 'luajit -j'. See LuaJIT documentation for more information
    
    Pseudo-Random Numbers Generator options:
      --rand-type=STRING   random numbers distribution {uniform, gaussian, pareto, zipfian} to use by default [uniform]
      --rand-seed=N        seed for random number generator. When 0, the current time is used as an RNG seed. [0]
      --rand-pareto-h=N    shape parameter for the Pareto distribution [0.2]
      --rand-zipfian-exp=N shape parameter (exponent, theta) for the Zipfian distribution [0.8]
    
    Log options:
      --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
    
      --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
      --histogram[=on|off] print latency histogram in report [off]
    
    General database options:
    
      --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers)
      --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
      --db-debug[=on|off] print database-specific debug information [off]
    
    
    Compiled-in database drivers:
    
    Compiled-in tests:
      fileio - File I/O test
      cpu - CPU performance test
      memory - Memory functions speed test
      threads - Threads subsystem performance test
      mutex - Mutex performance test
    
    See 'sysbench  help' for a list of options for each test.
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57

    Postgres压测

    sysbench --db-driver=postgres --threads=4 --time=60 --rate=0 --report-interval=1 \
             --pgsql-host=<host> --pgsql-port=<port> --pgsql-user=<user> \
             --pgsql-password=<password> --pgsql-db=<database> \
             --test=oltp --oltp-table-size=100000 --oltp-test-mode=complex \
             --oltp-read-only=on --oltp-skip-trx=on --max-requests=0 run
    
    • 1
    • 2
    • 3
    • 4
    • 5

    您需要替换 、、、 和 分别为您 PostgreSQL 数据库的主机名、端口号、用户名、密码和数据库名。您需要将 替换为您要使用的线程数, 替换为测试的持续时间(以秒为单位), 替换为每秒钟执行的事务数(或设置为 0 来达到最大吞吐量),、、、 和 替换为您的 PostgreSQL 数据库的连接参数。您还可以根据需要指定其他测试选项和参数。

    sysbench
    sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
    
    Reading the script from the standard input:
    
    ^C
    [root@172-16-130-214 ~]# sysbench --help
    Usage:
      sysbench [options]... [testname] [command]
    
    Commands implemented by most tests: prepare run cleanup help
    
    General options:
      --threads=N                     number of threads to use [1]
      --events=N                      limit for total number of events [0]
      --time=N                        limit for total execution time in seconds [10]
      --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
      --thread-stack-size=SIZE        size of stack per thread [64K]
      --rate=N                        average transactions rate. 0 for unlimited rate [0]
      --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
      --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
      --debug[=on|off]                print more debugging info [off]
      --validate[=on|off]             perform validation checks where possible [off]
      --help[=on|off]                 print help and exit [off]
      --version[=on|off]              print version and exit [off]
      --config-file=FILENAME          File containing command line options
      --tx-rate=N                     deprecated alias for --rate [0]
      --max-requests=N                deprecated alias for --events [0]
      --max-time=N                    deprecated alias for --time [0]
      --num-threads=N                 deprecated alias for --threads [1]
    
    Pseudo-Random Numbers Generator options:
      --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
      --rand-spec-iter=N number of iterations used for numbers generation [12]
      --rand-spec-pct=N  percentage of values to be treated as 'special' (for special distribution) [1]
      --rand-spec-res=N  percentage of 'special' values to use (for special distribution) [75]
      --rand-seed=N      seed for random number generator. When 0, the current time is used as a RNG seed. [0]
      --rand-pareto-h=N  parameter h for pareto distribution [0.2]
    
    Log options:
      --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
    
      --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
      --histogram[=on|off] print latency histogram in report [off]
    
    General database options:
    
      --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers) [mysql]
      --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
      --db-debug[=on|off] print database-specific debug information [off]
    
    
    Compiled-in database drivers:
      mysql - MySQL driver
      pgsql - PostgreSQL driver
    
    mysql options:
      --mysql-host=[LIST,...]          MySQL server host [localhost]
      --mysql-port=[LIST,...]          MySQL server port [3306]
      --mysql-socket=[LIST,...]        MySQL socket
      --mysql-user=STRING              MySQL user [sbtest]
      --mysql-password=STRING          MySQL password []
      --mysql-db=STRING                MySQL database name [sbtest]
      --mysql-ssl[=on|off]             use SSL connections, if available in the client library [off]
      --mysql-ssl-cipher=STRING        use specific cipher for SSL connections []
      --mysql-compression[=on|off]     use compression, if available in the client library [off]
      --mysql-debug[=on|off]           trace all client library calls [off]
      --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
      --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]
    
    pgsql options:
      --pgsql-host=STRING     PostgreSQL server host [localhost]
      --pgsql-port=N          PostgreSQL server port [5432]
      --pgsql-user=STRING     PostgreSQL user [sbtest]
      --pgsql-password=STRING PostgreSQL password []
      --pgsql-db=STRING       PostgreSQL database name [sbtest]
    
    Compiled-in tests:
      fileio - File I/O test
      cpu - CPU performance test
      memory - Memory functions speed test
      threads - Threads subsystem performance test
      mutex - Mutex performance test
    
    See 'sysbench  help' for a list of options for each test.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85

    CPU压测

    要使用 Sysbench 进行 CPU 测试,您可以按照以下步骤进行操作:

    1. 在目标系统上安装 Sysbench 工具。具体安装步骤可能因系统而异。对于基于 CentOS 7 的系统,您可以使用以下命令安装 Sysbench:

      yum install -y sysbench
      
      • 1
    2. 安装完成后,可以使用以下命令运行 CPU 测试:

      sysbench cpu --threads=<线程数> run
      
      • 1

      请将 <线程数> 替换为您想要运行的线程数。该命令将运行一个 CPU 压力测试,并输出结果。

      例如,要使用 4 个线程运行 CPU 测试,可以执行以下命令:

      sysbench cpu --threads=4 run
      
      • 1
    3. Sysbench 将会运行一段时间并显示测试结果,包括每个线程的处理能力以及整体测试结果。

    请注意,Sysbench 还提供其他参数和选项,您可以根据需要进行调整。例如,您可以指定测试时间、线程数、运行次数等。

    这是一个基本的示例,您可以根据实际需求进行进一步的定制和调整。

    根据您提供的 Sysbench CPU 测试结果,以下是一些关键指标的解释:

    • CPU Speed(CPU 速度):表示每秒钟处理的事件数。在您的测试中,CPU 速度为 8427.01 个事件每秒。

    • Throughput(吞吐量):表示在测试时间内处理的总事件数。在您的测试中,吞吐量为 505,647 个事件。

    • Latency(延迟):表示事件的响应时间。其中包括最小值、平均值、最大值和第 95 百分位的值。在您的测试中,延迟的 95% 百分位为 0.48 毫秒。

    • Threads Fairness(线程公平性):表示不同线程的事件分布情况。其中包括事件数量的平均值和标准差,以及执行时间的平均值和标准差。

    请注意,这些指标仅代表您在特定条件下进行的一次测试结果。要获取更准确和可靠的结果,建议在不同负载、不同配置和多次运行的情况下进行多次测试,并对结果进行综合分析。

  • 相关阅读:
    Spring-boot-starter-actuator的可视化spring-boot-admin
    Minecraft 1.16.5模组开发(五十) 书籍词典 (Guide Book)
    基于STC15单片机温度光照蓝牙传输-proteus仿真-源程序
    数电实验-----实现74LS139芯片扩展为3-8译码器以及应用(Quartus II )
    异地容灾系统和数据仓库系统设计和体系结构
    leetcode难度:困难773. 滑动谜题
    STM32H723加上ThreadX,时钟不准确
    如果焊接也需要打怪升级,你在哪一级?
    【MySql】MySQL查询中的笛卡尔积现象解析
    深入了解5米DEM:地表高程的数字呈现与广泛应用
  • 原文地址:https://blog.csdn.net/hezuijiudexiaobai/article/details/130911285