当前位置: 首页 > news >正文

构建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 bashdocker run --rm arm-sysbench
./configure --without-mysql && \
./configure 

方式2:ubuntu 16.04

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

FROM ubuntu:xenialRUN apt-get updateRUN 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-devRUN git clone https://github.com/akopytov/sysbench.git sysbenchWORKDIR sysbench
RUN ./autogen.sh
RUN ./configure --with-mysql --with-pgsql
RUN make -j
RUN make installWORKDIR /root
RUN rm -rf sysbenchENTRYPOINT sysbench

方式2:centos 7

vi DockfileFROM arm64v8/centos:7RUN yum update -y && \yum install -y epel-release && \yum install -y git gcc automake libtool pkgconfig openssl-devel postgresql-devel mysql-devel makeRUN git clone https://github.com/akopytov/sysbench.git /tmp/sysbenchWORKDIR /tmp/sysbenchRUN ./autogen.sh && \./configure \make && \make installRUN rm -rf /tmp/sysbench && \yum remove -y git gcc automake libtool pkgconfig openssl-devel postgresql-devel mysql-devel && \yum clean allCMD [ "sysbench", "--version" ]

查看版本

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 helpGeneral 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 informationPseudo-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 testcpu - CPU performance testmemory - Memory functions speed testthreads - Threads subsystem performance testmutex - Mutex performance testSee 'sysbench <testname> help' for a list of options for each test.

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

您需要替换 、、、 和 分别为您 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 helpGeneral 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 driverpgsql - PostgreSQL drivermysql 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 testcpu - CPU performance testmemory - Memory functions speed testthreads - Threads subsystem performance testmutex - Mutex performance testSee 'sysbench <testname> help' for a list of options for each test.

CPU压测

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

http://www.lryc.cn/news/90881.html

相关文章:

  • leetcode解题思路分析(一百四十)1201 - 1208 题
  • FPGA设计的指导性原则 (一)
  • 【架构】常见技术点--服务治理
  • 手撕数据结构—单链表
  • Benewake(北醒) 快速实现 TF02-i-RS485 与电脑通信操作说明
  • 【分享】科大讯飞星火认知大模型(初体验)
  • logstash 采集应用日志切割问题
  • 计算机网络实验:认识Packet Tracer软件
  • 【MySQL新手到通关】第六章 时间日期函数
  • 深蓝学院C++基础笔记 第 1 章 C++初探
  • 【配电网重构】基于混合整数二阶锥配电网重构研究(Matlab代码实现)
  • Kubernetes mysql 实战以及外部存储处理 [一]
  • 使用【Python+Appium】实现自动化测试
  • 位图和布隆过滤器
  • Eclipse 教程Ⅳ
  • Webpack搭建本地服务器
  • 基于Go开发PaaS平台3
  • 虎牙直播在微服务改造的实践总结
  • 设置线程池的大小
  • Vue3 除了 keep-alive,还有哪些实现页面缓存的方法
  • JavaScript闭包
  • 华为OD机试之不含101的整数(Java源码)
  • SpringCloud Ribbon 学习
  • 预告:XuperOS Global 国际化进展
  • 炫技操作--递归实现翻转链表(java)
  • 华为OD机试真题 Java 实现【求最小公倍数】【牛客练习题】
  • [java]两数之和 II - 输入有序数组
  • Linux-0.11 boot目录head.s详解
  • 离散数学_十章-图 ( 3 ):由旧图构造新图
  • Golang每日一练(leetDay0083) 汇总区间、多数元素II