sysbench是一个开源的、模块化的、跨平台的多线程性能测试工具,可以用来进行CPU、内存、磁盘I/O、线程、数据库的性能测试。目前支持的数据库有MySQL、Oracle和PostgreSQL。
官方站点:https://github.com/akopytov/sysbench/ rpm包下载:https://packagecloud.io/akopytov/sysbench/packages/el/7/sysbench-1.0.15-1.el7.centos.x86_64.rpm 源码包下载:https://github.com/akopytov/sysbench/archive/1.0.15.tar.gz 本地下载:http://xiazai.Vevb.com/201807/yuanma/sysbench_jb51.rar如果是编译安装,需要先安装好mysql的开发包(尽管编译错误时提示的是缺少Mysql库文件)。
yum -y install mysql-community-develtar xf 1.0.15.tar.gzcd sysbench-1.0.15./autogen.sh./configuremake -jmake install |
安装后,只有一个二进制文件sysbench,还提供了很多个lua脚本。
[root@s1 ~]# rpm -ql sysbench | grep 'bin/|lua' /usr/bin/sysbench/usr/share/sysbench/bulk_insert.lua/usr/share/sysbench/oltp_common.lua/usr/share/sysbench/oltp_delete.lua/usr/share/sysbench/oltp_insert.lua/usr/share/sysbench/oltp_point_select.lua/usr/share/sysbench/oltp_read_only.lua/usr/share/sysbench/oltp_read_write.lua/usr/share/sysbench/oltp_update_index.lua/usr/share/sysbench/oltp_update_non_index.lua/usr/share/sysbench/oltp_write_only.lua/usr/share/sysbench/select_random_points.lua/usr/share/sysbench/select_random_ranges.lua/usr/share/sysbench/tests/include/inspect.lua/usr/share/sysbench/tests/include/oltp_legacy/bulk_insert.lua/usr/share/sysbench/tests/include/oltp_legacy/common.lua/usr/share/sysbench/tests/include/oltp_legacy/delete.lua/usr/share/sysbench/tests/include/oltp_legacy/insert.lua/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua/usr/share/sysbench/tests/include/oltp_legacy/oltp_simple.lua/usr/share/sysbench/tests/include/oltp_legacy/parallel_prepare.lua/usr/share/sysbench/tests/include/oltp_legacy/select.lua/usr/share/sysbench/tests/include/oltp_legacy/select_random_points.lua/usr/share/sysbench/tests/include/oltp_legacy/select_random_ranges.lua/usr/share/sysbench/tests/include/oltp_legacy/update_index.lua/usr/share/sysbench/tests/include/oltp_legacy/update_non_index.lua |
本文介绍的是新版本sysbench oltp lua脚本的用法(/usr/share/sysbench/*.lua),所以不涉及传统的lua(tests/include/oltp_legacy/*.lua),如果想要了解这些传统Lua脚本的用法,网上随便找。
以下列出了sysbench对测试mysql时常用的选项。
[root@xuexi ~]# sysbench --helpUsage: sysbench [options]... [test_lua] [lua_options] [command]Commands implemented by most tests: prepare run cleanup help |
通用选项:以下中括号中的值表示默认值
--threads=N 指定线程数[1]
新闻热点
疑难解答