构建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 测试,您可以按照以下步骤进行操作:
-
在目标系统上安装 Sysbench 工具。具体安装步骤可能因系统而异。对于基于 CentOS 7 的系统,您可以使用以下命令安装 Sysbench:
yum install -y sysbench
-
安装完成后,可以使用以下命令运行 CPU 测试:
sysbench cpu --threads=<线程数> run
请将
<线程数>
替换为您想要运行的线程数。该命令将运行一个 CPU 压力测试,并输出结果。例如,要使用 4 个线程运行 CPU 测试,可以执行以下命令:
sysbench cpu --threads=4 run
-
Sysbench 将会运行一段时间并显示测试结果,包括每个线程的处理能力以及整体测试结果。
请注意,Sysbench 还提供其他参数和选项,您可以根据需要进行调整。例如,您可以指定测试时间、线程数、运行次数等。
这是一个基本的示例,您可以根据实际需求进行进一步的定制和调整。
根据您提供的 Sysbench CPU 测试结果,以下是一些关键指标的解释:
-
CPU Speed(CPU 速度):表示每秒钟处理的事件数。在您的测试中,CPU 速度为 8427.01 个事件每秒。
-
Throughput(吞吐量):表示在测试时间内处理的总事件数。在您的测试中,吞吐量为 505,647 个事件。
-
Latency(延迟):表示事件的响应时间。其中包括最小值、平均值、最大值和第 95 百分位的值。在您的测试中,延迟的 95% 百分位为 0.48 毫秒。
-
Threads Fairness(线程公平性):表示不同线程的事件分布情况。其中包括事件数量的平均值和标准差,以及执行时间的平均值和标准差。
请注意,这些指标仅代表您在特定条件下进行的一次测试结果。要获取更准确和可靠的结果,建议在不同负载、不同配置和多次运行的情况下进行多次测试,并对结果进行综合分析。
相关文章:

构建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 --namemycentos1 mycentos1 /bin/bash docker exec -it mycent…...

leetcode解题思路分析(一百四十)1201 - 1208 题
丑数3 给你四个整数:n 、a 、b 、c ,请你设计一个算法来找出第 n 个丑数。丑数是可以被 a 或 b 或 c 整除的 正整数 。 容斥原理二分法 class Solution { public:int nthUglyNumber(int n, int a, int b, int c) {long long ab lcm((long long)a, (lo…...

FPGA设计的指导性原则 (一)
这一部分主要介绍FPGA/CPLD设计的指导性原则,如FPGA设计的基本原则、基本设 计思想、基本操作技巧、常用模块等。FPGA/CPLD设计的基本原则、思想、技巧和常用模 块是一个非常大的问题,在此不可能面面俱到,只能我们公司项目中常用的一些设计原则与 方法提纲携领地加以介绍,希…...

【架构】常见技术点--服务治理
导读:收集常见架构技术点,作为项目经理了解这些知识点以及解决具体场景是很有必要的。技术要服务业务,技术跟业务具体结合才能发挥技术的价值。 目录 1. 微服务 2. 服务发现 3. 流量削峰 4. 版本兼容 5. 过载保护 6. 服务熔断 7. 服务…...

手撕数据结构—单链表
✅作者:简单^不简单 🔥系列专栏:C语言数据结构 💖如果文章有错误,时刻欢迎大家的指正。当然觉得博主的文章还不错的话,请点赞👍收藏⭐️留言📝 💬格言:希望我…...

Benewake(北醒) 快速实现 TF02-i-RS485 与电脑通信操作说明
目录 一、前言二、工具准备1. USB-RS485 转接器2. TF02-i-RS4853. 兆信直流电源4.连接线、绝缘胶带、螺丝刀5. PC:Windows 系统6. 串口助手软件 三、连接方式1. USB-RS485 转接板接口说明2. TF02-i-RS485 引脚定义3. 连接图 四、TF02-i-RS485 与电脑通信操作说明1. …...

【分享】科大讯飞星火认知大模型(初体验)
前言: 哈喽,大家好,我是木易巷~ 随着人工智能技术的迅猛发展,自然语言处理(NLP)成为了热门话题。在众多NLP模型中,科大讯飞星火认知大模型成为了一个备受瞩目的新秀,今天我们来了解…...

logstash 采集应用日志切割问题
1.logstash [oswatch@rce1 conf]$ cat test.conf input { file { path=>["/tmp/test/test.log*"] } } output { stdout { codec=>rubydebug{} } } 2.python脚本: [oswatch@rce1 conf]$ cat t1.py #!/usr/bin/python # -*- coding: UTF-…...

计算机网络实验:认识Packet Tracer软件
目录 前言实验目的实验内容及要求相关知识点实验指导实验过程总结 前言 计算机网络是当今信息技术的重要组成部分,它涉及到多种硬件和软件的协同工作,以实现数据的传输和交换。为了更好地理解和掌握计算机网络的基本原理和技术,我们需要进行…...

【MySQL新手到通关】第六章 时间日期函数
文章目录 1.获取日期时间函数1.1 获取当前日期时间1.2 获取当前日期1.3 获取当前时间 2.日期格式化★★★2.1 日期转指定格式字符串2.2 字符串转日期 3.日期间隔3.1 增加日期间隔 ★★★3.2 减去一个时间间隔★★★3.3 日期相差天数(天)3.4 相差时间&…...

深蓝学院C++基础笔记 第 1 章 C++初探
第 1 章 C初探 1.从Hello World 谈起 Hello World: #include <iostream> int mian() { std::cout << "Hello World!" << std::endl; }函数: 一段能被反复调用的代码,可以接收输入,进行处理并(或)产生输出-返回…...

【配电网重构】基于混合整数二阶锥配电网重构研究(Matlab代码实现)
💥💥💞💞欢迎来到本博客❤️❤️💥💥 🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。 ⛳️座右铭&a…...

Kubernetes mysql 实战以及外部存储处理 [一]
在 Kubernetes 中部署 MySQL 数据库需要考虑以下几个方面: 部署方式:可以选择使用 StatefulSet 或者 Deployment 进行部署,如果需要有状态的服务,使用 StatefulSet 更加合适。存储:MySQL 需要一个持久化存储来保存数据。可以使用 Kubernetes 提供的 PersistentVolumeClaim…...

使用【Python+Appium】实现自动化测试
一、环境准备 1.脚本语言:Python3.x IDE:安装Pycharm 2.安装Java JDK 、Android SDK 3.adb环境,path添加E:\Software\Android_SDK\platform-tools 4.安装Appium for windows,官网地址 Redirecting 点击下载按钮会到GitHub的…...

位图和布隆过滤器
位图和布隆过滤器 位图的概念位图的简单模拟实现位图set位图reset位图test 位图总的代码和实现位图的应用布隆过滤器布隆过滤器的简单实现相关操作讨论布隆过滤器的结构设计布隆过滤器插入布隆过滤器查找 布隆过滤器总代码 布隆过滤器优点和缺陷海量数据面试题哈希切割位图应用…...

Eclipse 教程Ⅳ
Eclipse 工作空间(Workspace) eclipse 工作空间包含以下资源: 项目文件文件夹 项目启动时一般可以设置工作空间,你可以将其设置为默认工作空间,下次启动后无需再配置: 工作空间(Workspace)有明显的层次结构。 项目在最顶级&…...

Webpack搭建本地服务器
1 开启本地服务器 2 HMR热模块替换 3 devServer配置 4 开发和生成环境 需要本地服务的目的就在每次我们保存项目源文件的时候都可以自动打包新的打包文件, 这里主要讲webpack-dev-server: 先安装: npm install webpack-dev-server -D 需要…...

基于Go开发PaaS平台3
Go开发PaaS平台核心功能 代码仓库地址GitHub - yunixiangfeng/gopaas 10-18 中间件前端页面以及核心API开发(中) C:\Users\Administrator\Desktop\gopaas\middlewareapi\handler\middlewareApiHandler.go package handlerimport ("context"…...

虎牙直播在微服务改造的实践总结
博主介绍:✌全网粉丝4W,全栈开发工程师,从事多年软件开发,在大厂呆过。持有软件中级、六级等证书。可提供微服务项目搭建与毕业项目实战、定制、远程,博主也曾写过优秀论文,查重率极低,在这方面…...

设置线程池的大小
线程池的理想大小取决于被提交任务的类型以及所部署系统的特性。在代码中通常不会固定线程池的大小,而应该通过某种配置机制来提供,或者根据Runtime. availableProcessors来动态计算。 幸运的是,要设置线程池的大小也并不困难,只需要避免“过大”和“过…...

Vue3 除了 keep-alive,还有哪些实现页面缓存的方法
有这么一个需求:列表页进入详情页后,切换回列表页,需要对列表页进行缓存,如果从首页进入列表页,就要重新加载列表页。 对于这个需求,我的第一个想法就是使用keep-alive来缓存列表页,列表和详情…...

JavaScript闭包
定义 定义:在计算机科学中,闭包(Closure)是一个函数及其相关引用环境组合而成的实体。简单来说,闭包是指一个函数以及该函数访问的外部变量的集合。在一些编程语言中,函数可以访问在其定义时所处的上下文中…...

华为OD机试之不含101的整数(Java源码)
不含101的数 题目描述 小明在学习二进制时,发现了一类不含 101的数,也就是: 将数字用二进制表示,不能出现 101 。 现在给定一个整数区间 [l,r] ,请问这个区间包含了多少个二进制不含 101 的整数? 输入描述…...

SpringCloud Ribbon 学习
SpringCloud Ribbon 学习 文章目录 SpringCloud Ribbon 学习1. Ribbon 是什么?2. LB(Load Balance)3 Ribbon 架构图&机制4 Ribbon 常见负载均衡算法5 测试 1. Ribbon 是什么? Spring Cloud Ribbon 是基于 Netflix Ribbon 实现的一套客户端 负载均衡…...

预告:XuperOS Global 国际化进展
XuperOS新年致辞中,我们提到XuperOS成长计划的最后一个阶段是国际化。伴随前三个阶段创世、监督、共建先后落地,很多用户特来咨询XuperOS国际化进展,我们在此统一说明。 按照之前的规划,XuperOS将在海外部署一条新的开放链XuperOS…...

炫技操作--递归实现翻转链表(java)
递归实现链表的逆序 leetcode 206题。 翻转链表递归解法普通方式实现链表翻转链表专题 leetcode 206题。 翻转链表 leetcode链接用于测试 题目:描述 将一个链表翻转: 输入:head [1,2,3,4,5] 输出:[5,4,3,2,1] 递归解法 解题思路…...

华为OD机试真题 Java 实现【求最小公倍数】【牛客练习题】
一、题目描述 正整数A和正整数B 的最小公倍数是指 能被A和B整除的最小的正整数值,设计一个算法,求输入A和B的最小公倍数。 数据范围:1≤a,b≤100000 。 二、输入描述 输入两个正整数A和B。 三、输出描述 输出A和B的最小公倍数。 四、解…...

[java]两数之和 II - 输入有序数组
两数之和 II - 输入有序数组 leetcode 167 原题链接解题思路解题代码排序专题 leetcode 167 原题链接 167. 两数之和 II - 输入有序数组 – 原题链接 题目描述: 给你一个下标从 1 开始的整数数组 numbers ,该数组已按 非递减顺序排列 ,请你从数组中找出…...

Linux-0.11 boot目录head.s详解
Linux-0.11 boot目录head.s详解 模块简介 在head.s中,操作系统主要做了如下几件事: 重新设置中断描述符和全局描述符检查A20地址线是否开启检查数学协处理器初始化页表并开启分页跳转到main函数执行 过程详解 重新设置IDT和GDT 在setup.s中我们已经…...

离散数学_十章-图 ( 3 ):由旧图构造新图
📷10.3 由旧图构造新图 概念1. 子图2. 真子图3. 导出的子图 旧图构造新图的方法1. 删除或增加图中的边2. 边的收缩3. 删除顶点 有时解决问题只需要图的一部分。 比如我们现在只关心大型计算机网络中涉及济南,广州,深圳的计算机中心࿰…...