Mysqlslap performs a benchmark test and mysqlslap performs a benchmark test.
View the main parameter configurations and descriptions supported by mysqlslap as follows:
-A, -- auto-generate-SQL: the system automatically generates an SQL script to test Generate SQL where not supplied by file or command line. -- auto-generate-SQL-add-autoincrement: Add an AUTO_INCREMENT column to auto-generated tables in the table generated by auto-generate-SQL-add-autoincrement. -- auto-generate-SQL-load-type = name indicates the query type Specify test load type: mixed, update, write, key, or read used during the test. default is mixed. -- auto-generate-SQL-write-number = # specify the Number of lines of the generated initialization data number of row inserts to perform for each thread (default is 100 ). -c, -- concurrency = name specifies the Number of concurrent threads Number of clients to simulate for query to run. -- create = name File or string to use create tables. -- create-schema = name create a schema name for the test database Schema to run tests in. -T, -- debug-info This is a non-debug version. catch this and exit. specify the output of additional memory and CPU statistics-e, -- engine = name Storage engine to use for creating the table. specify the storage engine to be tested. You can use commas (,) to separate multiple storage engines for testing-h, -- host = name Connect to host. link the remote host's IP-I, -- iterations = # Number of times to run the tests. specify the number of times to run this test -- no-drop Do not drop the schema after the test. after the test is completed, the process data-x is not cleared, -- number-char-cols = name indicates the Number of varchar data types generated in the test table. number of VARCHAR columns to create in table if specifying -- auto-generate-SQL. -y, -- number-int-cols = name indicates the Number of int data types generated in the test table. number of INT columns to create in table if specifying -- auto-generate-SQL. -- number-of-queries = # specify the number of queries executed by each thread. Limit each client to this number of queries (this is not exact ). -- only-print Do not connect to the databases, but instead print out does not run the test script, but prints the generated script out. -p, -- password [= name] specifies the Password used to connect to the database used for the test to use when connecting to server. if password is not given it's asked from the tty. -q, -- query = name Query to run or file containing query to run. SQL-u for custom testing, -- user = name User for login if not current user. user Name of the connected database used for the test
The complete running script is as follows:
mysqlslap -S /tmp/mysql3306.sock --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=10 --create-schema=test -uroot -p
After the password is entered, the test information is as follows:
Enter password: Benchmark Running for engine innodb Average number of seconds to run all queries: 0.097 seconds Minimum number of seconds to run all queries: 0.093 seconds Maximum number of seconds to run all queries: 0.107 seconds Number of clients running queries: 1 Average number of queries per client: 10Benchmark Running for engine innodb Average number of seconds to run all queries: 0.506 seconds Minimum number of seconds to run all queries: 0.447 seconds Maximum number of seconds to run all queries: 0.570 seconds Number of clients running queries: 50 Average number of queries per client: 0Benchmark Running for engine innodb Average number of seconds to run all queries: 2.204 seconds Minimum number of seconds to run all queries: 1.595 seconds Maximum number of seconds to run all queries: 3.257 seconds Number of clients running queries: 100 Average number of queries per client: 0mysqlslap: Error when connecting to server: 1040 Too many connectionsmysqlslap: Error when connecting to server: 1040 Too many connectionsmysqlslap: Error when connecting to server: 1040 Too many connectionsmysqlslap: Error when connecting to server: 1040 Too many connections
At this point, we can see that, when the development reaches 200, the Too connector connections exception occurs. This is because the maximum number of connections configured by mysql by default is 100, so we need. modify cnf as follows:
Add max_connections = 1024 and then run normally
Benchmark Running for engine innodb Average number of seconds to run all queries: 0.093 seconds Minimum number of seconds to run all queries: 0.087 seconds Maximum number of seconds to run all queries: 0.098 seconds Number of clients running queries: 1 Average number of queries per client: 10Benchmark Running for engine innodb Average number of seconds to run all queries: 0.514 seconds Minimum number of seconds to run all queries: 0.462 seconds Maximum number of seconds to run all queries: 0.545 seconds Number of clients running queries: 50 Average number of queries per client: 0Benchmark Running for engine innodb Average number of seconds to run all queries: 1.209 seconds Minimum number of seconds to run all queries: 1.173 seconds Maximum number of seconds to run all queries: 1.241 seconds Number of clients running queries: 100 Average number of queries per client: 0Benchmark Running for engine innodb Average number of seconds to run all queries: 2.174 seconds Minimum number of seconds to run all queries: 1.978 seconds Maximum number of seconds to run all queries: 2.402 seconds Number of clients running queries: 200 Average number of queries per client: 0