免费自适应网站模板,网络品牌营销,郑州专业网站制作的公司,wordpress 4.5 中文版Sysbench是一款开源的多线程性能测试工具#xff0c;可以执行CPU/内存/线程/IO/数据库等方面的性能测试#xff0c;数据库目前支持MySQL/Oracle/PostgreSQL。 一、安装#xff1a; Github地址#xff1a;https://github.com/akopytov/sysbench RHEL/CentOS#xff1a; cur…Sysbench是一款开源的多线程性能测试工具可以执行CPU/内存/线程/IO/数据库等方面的性能测试数据库目前支持MySQL/Oracle/PostgreSQL。 一、安装 Github地址https://github.com/akopytov/sysbench RHEL/CentOS curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bashsudo yum -y install sysbench Sysbench可以测试如下 • oltp_*.lua: a collection of OLTP-like database benchmarks(脚本默认放在/usr/share/sysbench/)
• fileio: a filesystem-level benchmark
• cpu: a simple CPU benchmark
• memory: a memory access benchmark
• threads: a thread-based scheduler benchmark
• mutex: a POSIX mutex benchmark 二、相关信息 1、通用选项 General options: # 通用选项--threadsN 要使用的线程数默认 1 个 [1]--eventsN 最大允许的事件个数默认为[0]--timeN 最大的总执行时间以秒为单位默认为[10]--thread-stack-sizeSIZE 每个线程的堆栈大小默认为[64K]--rateN 指定数量多少事件(事务)平均每秒钟应该执行的所有线程。0(默认)意味着无限的速率,即事件尽快执行--report-intervalN 以秒为单位定期报告具有指定间隔的中间统计信息 0 禁用中间报告默认为0--debug[on|off] 打印更多 debug 信息 [off]--validate[on|off] 尽可能执行验证检查 [off]--help[on|off] 显示帮助信息并退出 [off]--version[on|off] 显示版本信息并退出 [off]--config-fileFILENAME 包含命令行选项的文件--tablesN 表数量数据库测试--table-sizeN 表大小--tx-rateN 废弃改用 --rate [0]--max-requestsN 废弃改用 --events [0]--max-timeN 废弃改用 --time [0]--num-threadsN 废弃改用 --threads [1] 2、数据库专用选项 mysql options: # MySQL 数据库专用选项--mysql-host[LIST,...] MySQL server host [localhost]--mysql-port[LIST,...] MySQL server port [3306]--mysql-socket[LIST,...] MySQL socket--mysql-userSTRING --mysql-passwordSTRING --mysql-dbSTRING --mysql-ssl[on|off] --mysql-ssl-cipherSTRING --mysql-compression[on|off] --mysql-debug[on|off] --mysql-ignore-errors[LIST,...] --mysql-dry-run[on|off] pgsql options: # PostgreSQL 数据库专用选项--pgsql-hostSTRING --pgsql-portN --pgsql-userSTRING --pgsql-passwordSTRING --pgsql-dbSTRING 3、脚本 默认放在/usr/share/sysbench/有如下脚本 bulk_insert.lua;oltp_delete.lua;oltp_point_select.lua;oltp_read_write.lua;oltp_update_non_index.lua;select_random_points.lua;oltp_common.lua;oltp_insert.lua;oltp_read_only.lua;oltp_update_index.lua;oltp_write_only.lua;select_random_ranges.lua 三、测试 这里仅做数据库测试其他测试可以是用sysbench –helpsysbench cpu help等查看相应参数。 流程1、建测试表及数据2、进行测试3清除数据。1、prepare2、run3、cleanup 1、 建测试表及数据线程数据表大小及数量及其他参数按需求修改即可sysbench oltp_read_write.lua --time60 --mysql-host192.168.100.127 --mysql-port3506 --mysql-usertest --mysql-password123456 --mysql-dbpcms --table-size10000 --tables2 --threads2 prepare 2、 测试数据sysbench oltp_read_write.lua --time60 --mysql-host192.168.100.127 --mysql-port3506 --mysql-usertest --mysql-password123456 --mysql-dbpcms --table-size10000 --tables2 --threads2 run 3、 清洗数据sysbench oltp_read_write.lua --time60 --mysql-host192.168.100.127 --mysql-port3506 --mysql-usertest --mysql-password123456 --mysql-dbpcms --table-size10000 --tables2 --threads2 cleanup直接删除测试表当然也可以~转载于:https://blog.51cto.com/bilibili/2173243