深度评测,华为云Flexus X实例在Sysbench性能测试中的亮眼表现【玩转华为云】
前言
本文章评测了华为云Flexus X实例在Sysbench性能测试中的亮眼表现。Flexus X凭借其新一代处理器和智能算力技术,在CPU、内存、磁盘I/O及网络性能上均展现出了卓越的能力。通过
Sysbench
的详尽测试,Flexus X实例
在多核计算能力、内存吞吐量、磁盘响应速度及吞吐能力方面均获得了高分。其高主频、多核支持以及智能资源调配机制,确保了在各种工作负载下的稳定高效运行。
链接直达:华为云Flexus云服务器X实例
sysbench介绍
Sysbench
是一款功能强大的开源性能测试工具,支持跨平台操作,专注于评估数据库(如MySQL、PostgreSQL等)
及系统其他组件(CPU、内存、文件I/O等)
在高负载下的性能表现。通过提供丰富的测试选项和统计数据,Sysbench
帮助用户发现系统瓶颈,优化性能配置,并满足特定的测试需求。其易于使用和可扩展性使得它成为系统管理员和开发者在性能测试领域的首选工具之一。sysbench包含以下内建的基准测试:
oltp_*.lua
:一系列类似OLTP的数据库基准测试案例fileio
:文件系统级的基准测试cpu
:一个简单的CPU性能测试memory
:内存访问性能测试threads
:基于线程的调度器测试mutex
:POSIX互斥锁性能测试
安装sysbench
在线安装
[root@flexusx-251f ~]# curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
[root@flexusx-251f ~]# sudo yum -y install sysbench
验证是否安装成功
[root@flexusx-251f ~]# sysbench --version
sysbench 1.0.20
离线安装
如果因为网络问题导致不能拉取源文件,可以手动导入,点击下载源文件
# 可以看到导入成功
[root@flexusx-251f yum.repos.d]# ls
akopytov_sysbench.repo docker-ce.repo hce.repo mysql-community.repo mysql-community-source.repo
# 清理缓存
[root@flexusx-251f sysbench]# yum clean all
34 files removed
# 构建缓存,并进行gpg验证
[root@flexusx-251f sysbench]# yum makecache
akopytov_sysbench 164 B/s | 833 B 00:05
akopytov_sysbench 2.0 kB/s | 3.9 kB 00:01
Importing GPG key 0x04DCFD39:
Userid : "https://packagecloud.io/akopytov/sysbench-prerelease (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: 9789 8D69 F99E E5CA C462 A0F8 CF10 4890 04DC FD39
From : https://packagecloud.io/akopytov/sysbench/gpgkey
Is this ok [y/N]: y # 输入y
akopytov_sysbench 998 B/s | 6.5 kB 00:06
akopytov_sysbench-source 224 B/s | 833 B 00:03
akopytov_sysbench-source 4.1 kB/s | 3.9 kB 00:00
Importing GPG key 0x04DCFD39:
Userid : "https://packagecloud.io/akopytov/sysbench-prerelease (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
Fingerprint: 9789 8D69 F99E E5CA C462 A0F8 CF10 4890 04DC FD39
From : https://packagecloud.io/akopytov/sysbench/gpgkey
Is this ok [y/N]: y # 输入y
akopytov_sysbench-source 264 B/s | 1.3 kB 00:05
Docker CE Stable - x86_64 448 kB/s | 53 kB 00:00
HCE 2.0 base 66 MB/s | 6.1 MB 00:00
HCE 2.0 updates 1.9 MB/s | 14 MB 00:07
MySQL Connectors Community 82 kB/s | 74 kB 00:00
MySQL Tools Community 56 kB/s | 1.3 MB 00:24
MySQL 5.7 Community Server 164 kB/s | 3.1 MB 00:19
Metadata cache created.
# 执行命令进行安装
[root@flexusx-251f sysbench]# yum -y install sysbench
Last metadata expiration check: 0:03:36 ago on Thu 19 Sep 2024 04:44:05 PM CST.
Dependencies resolved.
==================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================
Installing:
sysbench x86_64 1.0.20-1.el8 akopytov_sysbench 443 k
Installing dependencies:
libpq x86_64 13.12-1.hce2 updates 194 k
mariadb-connector-c x86_64 3.1.13-1.r2.hce2 updates 184 k
Transaction Summary
==================================================================================================================================================================
Install 3 Packages
Total download size: 822 k
Installed size: 2.4 M
Downloading Packages:
(1/3): mariadb-connector-c-3.1.13-1.r2.hce2.x86_64.rpm 4.0 MB/s | 184 kB 00:00
(2/3): libpq-13.12-1.hce2.x86_64.rpm 3.8 MB/s | 194 kB 00:00
(3/3): sysbench-1.0.20-1.el8.x86_64.rpm 153 kB/s | 443 kB 00:02
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 284 kB/s | 822 kB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: mariadb-connector-c-3.1.13-1.r2.hce2.x86_64 1/1
Preparing : 1/1
Installing : mariadb-connector-c-3.1.13-1.r2.hce2.x86_64 1/3
Installing : libpq-13.12-1.hce2.x86_64 2/3
Installing : sysbench-1.0.20-1.el8.x86_64 3/3
Running scriptlet: sysbench-1.0.20-1.el8.x86_64 3/3
Verifying : sysbench-1.0.20-1.el8.x86_64 1/3
Verifying : libpq-13.12-1.hce2.x86_64 2/3
Verifying : mariadb-connector-c-3.1.13-1.r2.hce2.x86_64 3/3
Installed:
libpq-13.12-1.hce2.x86_64 mariadb-connector-c-3.1.13-1.r2.hce2.x86_64 sysbench-1.0.20-1.el8.x86_64
Complete!
验证是否安装成功
[root@flexusx-251f ~]# sysbench --version
sysbench 1.0.20
帮助命令
[root@flexusx-251f ~]# 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 lim it 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 rat e [0]
--report-interval=N periodically report intermediate statistics wi th 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 repr esenting the amount of time in seconds elapsed from start of test when report ch eckpoint(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,paret o} [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 specia l distribution) [1]
--rand-spec-res=N percentage of 'special' values to use (for special distribu tion) [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). Us e 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 av ailable 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 clie nt library [off]
--mysql-ssl-cipher=STRING use specific cipher for SSL connections []
--mysql-compression[=on|off] use compression, if available in the client l ibrary [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 ca lls 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 <testname> help' for a list of options for each test.
开始测试
CPU性能测试
参数命令解析:
- –cpu-max-prime: 素数生成数量的上限 (默认值10000)
- –threads: 线程数(默认值1)
- –time: 运行时长,单位秒
# 素数上限2万,默认10秒,2个线程
[root@flexusx-251f ~]# sysbench --test=cpu --cpu-max-prime=20000 --threads=2 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 2 # 两个线程(默认为1)
Initializing random number generator from current time
Prime numbers limit: 20000 # 每个线程均产生2万个素数(默认10000)
Initializing worker threads...
Threads started!
CPU speed:
events per second: 2271.63 # 所有线程每秒完成了
General statistics:
total time: 10.0009s # 共耗时约10秒
total number of events: 22722 # 10秒内所有线程一共完成了22722 event
Latency (ms):
min: 0.87
avg: 0.88
max: 8.92
95th percentile: 0.89
sum: 19994.63
Threads fairness:
events (avg/stddev): 11361.0000/1.00
execution time (avg/stddev): 9.9973/0.00
华为云flexusx实例云服务器在sysbench CPU性能测试中展现出强大的计算能力,以每秒2271.63个事件的高效率完成了2万个素数的生成和验证任务,总耗时约10秒,且延迟低、线程间负载均衡几乎完美,体现了该实例在处理高计算需求任务时的卓越性能。
线程测试
参数命令解析:
- –thread-yields:每个请求产生多少线程,默认值100
- –thread-locks: 每个线程锁的数量,默认值8
- –num-threads: 发送请求线程的数量
# 64个测试线程请求,每个线程请求产生100个数量,每个线程的锁数量为2
[root@flexusx-251f ~]# sysbench --test=threads --num-threads=64 --thread-yields=100 --thread-locks=2 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 64
Initializing random number generator from current time
Initializing worker threads...
Threads started!
General statistics:
total time: 10.0034s
total number of events: 77335
Latency (ms):
min: 0.02
avg: 8.28
max: 166.09
95th percentile: 41.10
sum: 640087.96
Threads fairness:
events (avg/stddev): 1208.3594/83.24
execution time (avg/stddev): 10.0014/0.00
在华为云flexusx实例云服务器上进行的sysbench线程性能测试中,64个线程以平均每个线程产生1208个事件的速度高效运行,总耗时约10秒完成了77335个事件,尽管存在一定的延迟波动,但系统展现了良好的线程负载平衡能力,确保了整体性能的稳定和高效。
磁盘IO性能测试
准备测试数据
# 准备测试数据
[root@flexusx-251f ~]# sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
128 files, 24576Kb each, 3072Mb total
Creating files for the test...
Extra file open flags: (none)
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
............................
Creating file test_file.125
Creating file test_file.126
Creating file test_file.127
3221225472 bytes written in 19.62 seconds (156.54 MiB/sec).
磁盘IO压测测试
# 磁盘IO压测测试(指定最大创建16个线程,创建的文件总大小为3G,文件读写模式为随机读。)
[root@flexusx-251f ~]# sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 16
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 24MiB each
3GiB total file size
Block size 16KiB
Number of IO requests: 0
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
Initializing worker threads...
Threads started!
File operations:
reads/s: 7032.06
writes/s: 4687.25
fsyncs/s: 15190.90
Throughput:
read, MiB/s: 109.88
written, MiB/s: 73.24
General statistics:
total time: 10.5196s
total number of events: 281077
Latency (ms):
min: 0.00
avg: 0.59
max: 593.86
95th percentile: 1.23
sum: 166993.52
Threads fairness:
events (avg/stddev): 17567.3125/178.37
execution time (avg/stddev): 10.4371/0.00
清理测试数据
# 清除测试数据
[root@flexusx-251f ~]# sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Removing test files...
通过sysbench工具在华为云flexusx实例云服务器上进行的磁盘IO性能测试表明,该服务器在16个线程并发执行随机读写操作时,实现了高达109.88 MiB/s的读取吞吐量和73.24 MiB/s的写入吞吐量,平均延迟仅为0.59毫秒,展现了卓越的性能和稳定性,充分验证了其在处理IO密集型任务时的高效能力。
内存测试
sysbench内存性能测试,主要是针对不同大小的块进行连续读写或者随机读写操作。在内存性能测试中,events指的是读/写一个内存块。
# 指定本次测试整个过程是在内存中传输 3G 的数据量,每个 block 大小为 8K,存储器存取方式为随机
[root@flexusx-251f ~]# sysbench --test=memory --memory-block-size=8k --memory-total-size=3G --memory-access-mode=rnd run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 8KiB
total size: 3072MiB
operation: write
scope: global
Initializing worker threads...
Threads started!
Total operations: 393216 (299501.95 per second)
3072.00 MiB transferred (2339.86 MiB/sec)
General statistics:
total time: 1.3113s
total number of events: 393216
Latency (ms):
min: 0.00
avg: 0.00
max: 0.03
95th percentile: 0.00
sum: 1270.86
Threads fairness:
events (avg/stddev): 393216.0000/0.00
execution time (avg/stddev): 1.2709/0.00
华为云flexusx实例云服务器在内存性能测试中表现出色,通过sysbench工具以随机访问模式写入3GB数据,实现了高达2,339.86 MiB/sec的传输速率,全程耗时仅1.3秒,平均延迟几乎为零,最大延迟极低,且线程执行公平,充分展示了其卓越的内存处理能力和高效性能。
mysql数据库读写性能测试
创建数据库和用户
[root@flexusx-251f ~]# mysql -uroot -p
Enter password:
mysql> CREATE DATABASE sbtest;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'sbuser'@'localhost' IDENTIFIED BY 'Abc123!@#';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT ALL PRIVILEGES ON sbtest.* TO 'sbuser'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
准备Sysbench测试表,创建10张表,每张表个10万行,16线程
[root@flexusx-251f ~]# sysbench oltp_read_write --mysql-db=sbtest --mysql-user=sbuser --mysql-password='Abc123!@#' --tables=10 --table-size=100000 prepare
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 100000 records into 'sbtest2'
Creating a secondary index on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 100000 records into 'sbtest3'
Creating a secondary index on 'sbtest3'...
Creating table 'sbtest4'...
Inserting 100000 records into 'sbtest4'
Creating a secondary index on 'sbtest4'...
Creating table 'sbtest5'...
Inserting 100000 records into 'sbtest5'
Creating a secondary index on 'sbtest5'...
Creating table 'sbtest6'...
Inserting 100000 records into 'sbtest6'
Creating a secondary index on 'sbtest6'...
Creating table 'sbtest7'...
Inserting 100000 records into 'sbtest7'
Creating a secondary index on 'sbtest7'...
Creating table 'sbtest8'...
Inserting 100000 records into 'sbtest8'
Creating a secondary index on 'sbtest8'...
Creating table 'sbtest9'...
Inserting 100000 records into 'sbtest9'
Creating a secondary index on 'sbtest9'...
Creating table 'sbtest10'...
Inserting 100000 records into 'sbtest10'
Creating a secondary index on 'sbtest10'...
运行测试
--threads=8
表示使用8个线程来执行测试。--time=30
表示测试运行30秒。--report-interval=10
表示每10秒报告一次结果
[root@flexusx-251f ~]# sysbench oltp_read_write --mysql-db=sbtest --mysql-user=sbuser --mysql-password='Abc123!@#' --tables=10 --table-size=100000 --threads=8 --time=30 --report-interval=10 run
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 8
Report intermediate results every 10 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 10s ] thds: 8 tps: 1900.81 qps: 38031.40 (r/w/o: 26622.54/7606.44/3802.42) lat (ms,95%): 8.58 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 8 tps: 1974.71 qps: 39490.84 (r/w/o: 27644.40/7897.03/3949.41) lat (ms,95%): 7.98 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 8 tps: 1992.49 qps: 39852.60 (r/w/o: 27896.36/7971.26/3984.98) lat (ms,95%): 7.30 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read: 821674
write: 234764
other: 117382
total: 1173820
transactions: 58691 (1956.00 per sec.)
queries: 1173820 (39119.99 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0042s
total number of events: 58691
Latency (ms):
min: 1.68
avg: 4.09
max: 49.22
95th percentile: 7.84
sum: 239943.20
Threads fairness:
events (avg/stddev): 7336.3750/15.39
execution time (avg/stddev): 29.9929/0.00
清理数据库
[root@flexusx-251f ~]# sysbench --threads=16 --time=600 --report-interval=1 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-db=sbtest --mysql-user=sbuser --mysql-password='Abc123!@#' --tables=10 --table-size=100000 oltp_read_write cleanup
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Dropping table 'sbtest1'...
Dropping table 'sbtest2'...
Dropping table 'sbtest3'...
Dropping table 'sbtest4'...
Dropping table 'sbtest5'...
Dropping table 'sbtest6'...
Dropping table 'sbtest7'...
Dropping table 'sbtest8'...
Dropping table 'sbtest9'...
Dropping table 'sbtest10'...
在华为云flexusx实例上,通过Sysbench工具对MySQL数据库进行了读写性能测试,成功创建了包含100万行数据的10张表,并在8线程并发下持续30秒,实现了每秒约1956笔事务处理,展现出优异的并发处理能力和低延迟特性,最终通过清理功能恢复了数据库整洁状态。这次测试全面评估了华为云flexusx实例上MySQL数据库在负载条件下的稳定性和性能表现。
体验和感受
深入评测了华为云Flexus X实例
在Sysbench性能测试
中的卓越表现,这款面向中小企业和开发者的柔性算力云服务器,以其非凡的性能和灵活的资源配置能力,成为了云计算领域的璀璨明星。Flexus X实例
在Sysbench
测试中,无论是CPU的多核计算能力、内存的吞吐量,还是磁盘I/O的响应速度和吞吐能力,均展现出了顶尖水平。其配备的最新一代处理器,结合智能算力技术,能够精准感知业务负载变化,自动调整资源配置,确保资源的高效利用。此外,Flexus X实例还支持多种特殊的CPU与内存配比,如1:3、2:5等,用户可根据实际需求灵活定制,实现“按需取用”,大大降低了资源浪费和成本支出。
- 点赞
- 收藏
- 关注作者
评论(0)