Benching Tools You don’t have to roll your own benching system, and in fact you shouldn’t unless there’s a good reason why you can’t use one of the available ones. There are a wide variety of tools ready for you to use. We show you some of them in the following sections. Full-Stack Tools Recall that there are two types of benchs: full-stack and single-component. Not surprisingly, there are tools to bench full applications, and there are tools to stress-test MySQL and other components in isolation. Testing the full stack is usually a better way to get a clear picture of your system’s performance. Existing fullstack tools include: ab ab is a well-known Apache HTTP server benching tool. It shows how many requests per second your HTTP server is capable of serving. If you are benching a web application, this translates to how many requests per second the entire application can satisfy. It’s a very simple tool, but its usefulness is also limited because it just hammers one URL as fast as it can. More information on ab is available at http://httpd.apache.org/docs/2.0/programs/ab.html. http_load This tool is similar in concept to ab; it is also designed to load a web server, but it’s more flexible. You can create an input file with many different URLs, and http_load will choose from among them at random. You can also instruct it to issue requests at a timed rate, instead of just running them as fast as it can. See http://www.acme.com/software/http_load/ for more information. JMeter JMeter is a Java application that can load another application and measure its performance. It was designed for testing web applications, but you can also use it to test FTP servers and issue queries to a database via JDBC. JMeter is much more complex than ab and http_load. For example, it has features that let you simulate real users more flexibly, by controlling such parameters as ramp-up time. It has a graphical user interface with built-in result graphing, and it offers the ability to record and replay results offline. For more information, see http://jakarta.apache.org/jmeter/. Benching Tools | 43 Single-Component Tools Here are some useful tools to test the performance of MySQL and the system on which it runs. We show example benchs with some of these tools in the next section: mysqlslap mysqlslap (http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html) simulates load on the server and reports timing information. It is part of the MySQL 5.1 server distribution, but it should be possible to run it against MySQL 4.1 and newer servers. You can specify how many concurrent connections it should use, and you can give it either a SQL statement on the command line or a file containing SQL statements to run. If you don’t give it statements, it can also autogenerate SELECT statements by examining the server’s schema. sysbench sysbench (http://sysbench.sourceforge.net) is a multithreaded system benching tool. Its goal is to get a sense of system performance, in terms of the factors important for running a database server. For example, you can measure the performance of file I/O, the OS scheduler, memory allocation and transfer speed, POSIX threads, and the database server itself. sysbench supports scripting in the Lua language (http://www.lua.org), which makes it very flexible for testing a variety of scenarios. Database Test Suite The Database Test Suite, designed by The Open-Source Development Labs (OSDL) and hosted on SourceForge at http://sourceforge.net/projects/osdldbt/, is a test kit for running benchs similar to some industry-standard benchs, such as those published by the Transaction Processing Performance Council (TPC). In particular, the dbt2 test tool is a free (but uncertified) implementation of the TPC-C OLTP test. It supports InnoDB and Falcon; at the time of this writing, the status of other transactional MySQL storage engines is unknown. MySQL Bench Suite (sql-bench) MySQL distributes its own bench suite with the MySQL server, and you can use it to bench several different database servers. It is single-threaded and measures how quickly the server executes queries. The results show which types of operations the server performs well. The main benefit of this bench suite is that it contains a lot of predefined tests that are easy to use, so it makes it easy to compare different storage engines or configurations. It’s useful as a high-level bench, to compare the overall performance of two servers. You can also run a subset of its tests (for example, just testing UPDATE performance). The tests are mostly CPU-bound, but there are short periods that demand a lot of disk I/O. 44 | Chapter 2: Finding Bottlenecks: Benching and Profiling The biggest disadvantages of this tool are that it’s single-user, it uses a very small dataset, you can’t test your site-specific data, and its results may vary between runs. Because it’s single-threaded and completely serial, it will not help you assess the benefits of multiple CPUs, but it can help you compare single-CPU servers. Perl and DBD drivers are required for the database server you wish to bench. Documentation is available at http://dev.mysql.com/doc/en/mysqlbenchs. html/. Super Smack Super Smack (http://vegan.net/tony/supersmack/) is a benching, stresstesting, and load-generating tool for MySQL and PostgreSQL. It is a complex, powerful tool that lets you simulate multiple users, load test data into the database, and populate tables with randomly generated data. Benchs are contained in “smack” files, which use a simple language to define clients, tables, queries, and so on.
http://wenku.baidu.com/view/74746d3e0912a21614792915.html
改掉mysql.ini或.cnf里面端口、数据文件位置信息,
手工运行
"D:\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="D:\MySQL\MySQL Server 5.1\my.ini" MySQL2
或者类似命令
第一个是mysqld.exe的路径,第二个,配置文件,第三个是实例名
不同的端口,不同的datadir目录。
windows和linux有所不同,windows上很简单,用 5楼的方法就可以了.
You don’t have to roll your own benching system, and in fact you shouldn’t
unless there’s a good reason why you can’t use one of the available ones. There are a
wide variety of tools ready for you to use. We show you some of them in the following
sections.
Full-Stack Tools
Recall that there are two types of benchs: full-stack and single-component. Not
surprisingly, there are tools to bench full applications, and there are tools to
stress-test MySQL and other components in isolation. Testing the full stack is usually
a better way to get a clear picture of your system’s performance. Existing fullstack
tools include:
ab
ab is a well-known Apache HTTP server benching tool. It shows how many
requests per second your HTTP server is capable of serving. If you are benching
a web application, this translates to how many requests per second the
entire application can satisfy. It’s a very simple tool, but its usefulness is also limited
because it just hammers one URL as fast as it can. More information on ab
is available at http://httpd.apache.org/docs/2.0/programs/ab.html.
http_load
This tool is similar in concept to ab; it is also designed to load a web server, but
it’s more flexible. You can create an input file with many different URLs, and
http_load will choose from among them at random. You can also instruct it to
issue requests at a timed rate, instead of just running them as fast as it can. See
http://www.acme.com/software/http_load/ for more information.
JMeter
JMeter is a Java application that can load another application and measure its
performance. It was designed for testing web applications, but you can also use
it to test FTP servers and issue queries to a database via JDBC.
JMeter is much more complex than ab and http_load. For example, it has features
that let you simulate real users more flexibly, by controlling such parameters
as ramp-up time. It has a graphical user interface with built-in result
graphing, and it offers the ability to record and replay results offline. For more
information, see http://jakarta.apache.org/jmeter/.
Benching Tools | 43
Single-Component Tools
Here are some useful tools to test the performance of MySQL and the system on
which it runs. We show example benchs with some of these tools in the next
section:
mysqlslap
mysqlslap (http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html) simulates
load on the server and reports timing information. It is part of the MySQL 5.1
server distribution, but it should be possible to run it against MySQL 4.1 and
newer servers. You can specify how many concurrent connections it should use,
and you can give it either a SQL statement on the command line or a file containing
SQL statements to run. If you don’t give it statements, it can also autogenerate
SELECT statements by examining the server’s schema.
sysbench
sysbench (http://sysbench.sourceforge.net) is a multithreaded system benching
tool. Its goal is to get a sense of system performance, in terms of the factors
important for running a database server. For example, you can measure the performance
of file I/O, the OS scheduler, memory allocation and transfer speed,
POSIX threads, and the database server itself. sysbench supports scripting in the
Lua language (http://www.lua.org), which makes it very flexible for testing a variety
of scenarios.
Database Test Suite
The Database Test Suite, designed by The Open-Source Development Labs
(OSDL) and hosted on SourceForge at http://sourceforge.net/projects/osdldbt/, is a
test kit for running benchs similar to some industry-standard benchs,
such as those published by the Transaction Processing Performance Council
(TPC). In particular, the dbt2 test tool is a free (but uncertified) implementation
of the TPC-C OLTP test. It supports InnoDB and Falcon; at the time of this writing,
the status of other transactional MySQL storage engines is unknown.
MySQL Bench Suite (sql-bench)
MySQL distributes its own bench suite with the MySQL server, and you
can use it to bench several different database servers. It is single-threaded
and measures how quickly the server executes queries. The results show which
types of operations the server performs well.
The main benefit of this bench suite is that it contains a lot of predefined
tests that are easy to use, so it makes it easy to compare different storage engines
or configurations. It’s useful as a high-level bench, to compare the overall
performance of two servers. You can also run a subset of its tests (for example,
just testing UPDATE performance). The tests are mostly CPU-bound, but there are
short periods that demand a lot of disk I/O.
44 | Chapter 2: Finding Bottlenecks: Benching and Profiling
The biggest disadvantages of this tool are that it’s single-user, it uses a very small
dataset, you can’t test your site-specific data, and its results may vary between
runs. Because it’s single-threaded and completely serial, it will not help you
assess the benefits of multiple CPUs, but it can help you compare single-CPU
servers.
Perl and DBD drivers are required for the database server you wish to bench.
Documentation is available at http://dev.mysql.com/doc/en/mysqlbenchs.
html/.
Super Smack
Super Smack (http://vegan.net/tony/supersmack/) is a benching, stresstesting,
and load-generating tool for MySQL and PostgreSQL. It is a complex,
powerful tool that lets you simulate multiple users, load test data into the database,
and populate tables with randomly generated data. Benchs are contained
in “smack” files, which use a simple language to define clients, tables,
queries, and so on.