MySQL基准测试---sysbench_MySQL
bitsCN.com
MySQL基准测试---sysbench
一、 在对网站整体性能进行benchmark时,可以使用多种工具,比如大名鼎鼎的ab
(Apache bench),http_load等工具。这里我们不关注他们的使用,如果你想了解,可以去
这里http://en.wikipedia.org/wiki/ApacheBench。
重点来说MySQL的基准测试如何进行,也有很多种工具来供我们选择,比如mysqlslap、
sysbench、Super Smack等,其中mysqlslap的使用MySQL官网给出了介绍,Super Smack
是服务器压力测试强有力的工具,那么sysbench便是我们进行MySQL基准测试的很漂亮的工具了。
sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的
性能测试。数据库目前支持MySQL/Oracle/PostgreSQL;
在本次试验中,sysbench版本为:0.4.12 MySQL版本为:5.1.61 ubuntu版本为:10.10
sysbench的基本用法通过 man sysbench 或者 sysbench --help可以方便的看到:
sysbench [general-options]... --test=
general-options 暂且不说,test-name 包括fileio/cpu/memory/threads/mutex/oltp 等测试,
command包括prepare/run/cleanup/help/version等
(1)cpu测试
sysbench采用寻找最大素数的方式来测试:命令如下
root@ubuntu:~#sysbench --test=cpu --cpu-max-prime=1500 run
从total time: 一行可以看出在求得1500以内的最大素数时使用了3.2214s
(2)fileio测试
使用fileio测试,首先得生成文件,然后对文件或读或写,测试fileio性能
生成文件:sysbench --test=fileio prepare ,使用fileio命令时,会有很多参数,可以使用
--file-block-size指定单个文件大小,可以使用--file-total-size指定整个文件的大小,但是这里
使用默认参数,单个文件大小为16M,整个文件大小为2G。如下所示:
这里总共生成了128个文件。读写文件sysbench --test=fileio --file-test-mode=rndrw run,
如下所示:
在这份报告中,有两个参数很值得我们关注,即每秒的请求数和总体的吞吐量,比如上面的就
是785.16 Requests/sec 和12.268Mb/sec,这两个参数对于评估磁盘的性能很有帮助。在完成测
试后,需要将测试数据删除: sysbench --test=fileio cleanup
(3)oltp 测试
首先生成数据:sysbench --test=oltp --oltp-table-size=2000000 --oltp-table-name=tt -
-mysql-db=test --mysql-user=root --msyql-password=123 prepare ,这里测试用户名:root
密码:123
生成数据后,进行测试,使用8个线程进行测试,如下所示:
以上数据对于分析多线程事务处理很有帮助,比如事务总统计数,每秒事务的处理量等等,
sysbench对于其他的测试类似。。。
二、对于MySQL的性能分析,在服务器内部有很多很好的命令来供我们使用,比如
show status/show processlist/show innodb status
使用show status 中,“Select%”一般指不同类型的连接执行计划,“Handler%”一般指存储引
擎的相关信息,“Sort%”一般指排序的相关信息,“Created%”一般指新建临时表的相关信息。
一般也可以使用mysqlreport对信息进行统计打印。而show processlist 也打印出了相关参数,
此时可以使用Innotop代替进行方便分析,或者使用mytop来分析。如果是在回话中使用,则需要
添加session 参数,即show session status; 使用show processlist 可以定位到mysql连接和进
程故障,这一功能一般需要和prep netstat psof ps等联合使用。使用tcpdump工具可以抓包分析
流量。innotop 和tcpdump的强大功能以后再分析。
bitsCN.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Websites for learning C language: 1. C Language Chinese Website; 2. Rookie Tutorial; 3. C Language Forum; 4. C Language Empire; 5. Script House; 6. Tianji.com; 7. Red and Black Alliance; 8, 51 Self-study network; 9. Likou; 10. C Programming. Detailed introduction: 1. C language Chinese website, which is a website dedicated to providing C language learning materials for beginners. It is rich in content, including basic grammar, pointers, arrays, functions, structures and other modules; 2. Rookie tutorials, This is a comprehensive programming learning website and more.

Do you frequently visit the same website at about the same time every day? This can lead to spending a lot of time with multiple browser tabs open and cluttering the browser while performing daily tasks. Well, how about opening it without having to launch the browser manually? It's very simple and doesn't require you to download any third-party apps, as shown below. How do I set up Task Scheduler to open a website? Press the key, type Task Scheduler in the search box, and then click Open. Windows On the right sidebar, click on the Create Basic Task option. In the Name field, enter the name of the website you want to open and click Next. Next, under Triggers, click Time Frequency and click Next. Select how long you want the event to repeat and click Next. Select enable

In macOS Sonoma and Safari 17, you can turn websites into "web apps," which can sit in your Mac's dock and be accessed like any other app without opening a browser. Read on to learn how it works. Thanks to a new option in Apple's Safari browser, it's now possible to turn any website on the internet you frequently visit into a standalone "web app" that lives in your Mac's dock and is ready for you to access at any time. The web app works with Mission Control and Stage Manager like any app, and can also be opened via Launchpad or SpotlightSearch. How to turn any website into

Sometimes, we want to block certain websites on Microsoft Edge for many reasons, whether it is for parental control, time management, content filtering, or even security concerns. A common motivation is to be more productive and stay focused. By blocking distracting websites, people can create a conducive environment for working or studying, minimizing potential distractions. Finally, content filtering is important to maintaining a safe and respectful online environment. Blocking websites that contain explicit, offensive or objectionable content is particularly important in educational or professional settings where upholding appropriate standards and values is crucial. If you can relate to this situation, this article is for you. Here’s how to block access to the Internet in Edge

By default, most iPhone users use Safari browser on their iPhone. They browse and visit different types of websites on Safari browser. Some iPhone users have reported that they are tired of seeing frequently visited websites on the splash screen after launching Safari on their iPhone. In order to change the appearance of the splash screen, you should edit it. If you wish to remove frequently visited websites from Safari, we are here with some simple steps explaining how to do it easily. How to Delete Frequently Visited Websites from Safari on iPhone Step 1: You should first launch the Safari browser on your iPhone. 2nd

To solve the problem of Python website access speed, use database optimization methods such as indexing and caching. In the process of developing and maintaining Python websites, we often encounter the problem of slow website access speed. In order to improve the response speed of the website, we can use some database optimization methods, such as indexing and caching. This article will introduce how to use these methods to solve Python website access speed problems, and provide corresponding code examples for reference. 1. Use indexes to optimize database queries. Indexes are a fast search structure for data in the database, which can greatly

PHP website: 1. Facebook, one of the largest social media platforms in the world; 2. WordPress, an open source content management system for quickly creating and managing various types of websites; 3. Magento, a powerful e-commerce platform , used to create and manage online stores; 4. Joomla, a popular open source content management system used to build various types of websites; 5. Wikipedia, a free online encyclopedia that provides knowledge and information on various topics; 6. Digg, social news sites and more.

7 Effective Ways to Quickly Solve Go Language Website Access Speed Problems With the rapid development of the Internet, website access speed is crucial to user experience. As a high-performance programming language, Go language is widely used in building high-concurrency network applications. However, in actual development, we may encounter the problem of slow access to Go language websites. This article will introduce 7 effective ways to solve this problem and provide corresponding code examples. Caching is one of the most common and effective ways to improve website access speed.
