search
HomeDatabaseMysql Tutorial使用 sysbench 0.5 测试 MySQL 的性能

鉴于最近对OpenStack的兴趣和激情,我想要确保我可以做恰当的系统性能评估。我主要开始转向sysbench,是因为它带来一系列丰富的针

鉴于最近对OpenStack的兴趣和激情,我想要确保我可以做恰当的系统性能评估。我主要开始转向sysbench,,是因为它带来一系列丰富的针对不同层面的测试(通过 -test=option 来获知),包括有: 

  • fileio - 文件 I/O测试

  • cpu - CPU系能测试

  • memory - 内存功能速度测试

  • threads - 线程子系统系能测试

  • mutex - 互斥性能测试

  • 正如你所看到的的,sysbench将让你的心思着重放在你的硬件和基础架构的许多基础组件上,例如你的磁盘子系统,以及你的CPUs和内存。有一个额外的选项,是用来执行对MySQL的模拟压力测试,并且当我在0.5版本中没有看到以上的所提到的可支持测试项时候,我很惊讶,尽管它可以用来显示“联机事务处理 – 联机事务处理测试”。-test=oltp到底怎么回事??

    这个列表来自于sysbench最近的发布版本0.5——如果你仅仅是在这个版本上使用它,使用 Frederic Descamps(感谢lefred!)所提供的 包。

     包下载地址:

    ------------------------------------------分割线------------------------------------------

    免费下载地址在

    用户名与密码都是

    具体下载目录在 /2014年资料/9月/6日/使用 sysbench 0.5 测试 MySQL 的性能

    下载方法见

    ------------------------------------------分割线------------------------------------------

    如果你用的(系统)是EPEL,Ubuntu 14.04 或者 Debian 7,就可以使用0.4.12版本(检查sysbench的版本 -version)。那么,测试类型OLTP再也不会出现。这个版本做了什么呢?我使劲挠头,直到我询问Percona IRC才知道在0.5版本里的标准OLTP测试类型被替换成了不一样的语法,它使用传递参数到sysbench,替换掉了引用脚本写入lua的方式。它的优点是,现在你有了一个接口,可以写入你特定的负载测试中(提供你了解的lua(接口),用起来也不难)。如果你还想要运行预定义负载测试,它们还是存在的,但是你必须把它们作为RPM的一部分去安装,或者直接拷贝到你的系统。

    幸运的是,如果你使用lefred提供的包,你会发现下面这些lua脚本(这里使用了截止至2014年8月4号的Amazon ami):

    [root@pxc-control ~]# ls -l /usr/share/doc/sysbench/tests/db/
    total 44
    -rw-r--r-- 1 root root 3585 Sep 7 2012 common.lua
    -rw-r--r-- 1 root root 340 Sep 7 2012 delete.lua
    -rw-r--r-- 1 root root 830 Sep 7 2012 insert.lua
    -rw-r--r-- 1 root root 2925 Sep 7 2012 oltp.lua
    -rw-r--r-- 1 root root 342 Sep 7 2012 oltp_simple.lua
    -rw-r--r-- 1 root root 425 Sep 7 2012 parallel_prepare.lua
    -rw-r--r-- 1 root root 343 Sep 7 2012 select.lua
    -rw-r--r-- 1 root root 3964 Sep 7 2012 select_random_points.lua
    -rw-r--r-- 1 root root 4066 Sep 7 2012 select_random_ranges.lua
    -rw-r--r-- 1 root root 343 Sep 7 2012 update_index.lua
    -rw-r--r-- 1 root root 552 Sep 7 2012 update_non_index.lua

    所以诀窍(如果你希望这么叫它)不是通过单一词语传递--test指令,而是通过传递一个lua脚本的完整路径。

    下面首先是旧的方式(sysbench 0.4.12来自EPEL库):

    --test=oltp --oltp-test-mode=complex

    下面是新的方式(sysbench 0.5):

    --test=/usr/share/doc/sysbench/tests/db/insert.lua

    下面是我在一个3个节点的PXC集群上跑haproxy,做一个仅插入的测试类型,下面是我传递给sysbench的全部命令:

    [root@pxc-control ~]# cat sys_haproxy.sh
    #!/bin/bash
    sysbench
    --test=/usr/share/doc/sysbench/tests/db/insert.lua
    --mysql-host=pxc-control
    --mysql-port=9999
    --mysql-user=sysbench-haproxy
    --mysql-password=sysbench-haproxy
    --mysql-db=sbtest
    --mysql-table-type=innodb
    --oltp-test-mode=complex
    --oltp-read-only=off
    --oltp-reconnect=on
    --oltp-table-size=1000000
    --max-requests=100000000
    --num-threads=3
    --report-interval=1
    --report-checkpoints=10
    --tx-rate=24
    $1

    更多详情见请继续阅读下一页的精彩内容:

    linux

    Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

    The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

    How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

    Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

    How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

    Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

    What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

    Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

    How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

    The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

    How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

    Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

    How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

    The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

    How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

    Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Tools

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    SublimeText3 English version

    SublimeText3 English version

    Recommended: Win version, supports code prompts!

    MinGW - Minimalist GNU for Windows

    MinGW - Minimalist GNU for Windows

    This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    Integrate Eclipse with SAP NetWeaver application server.