日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

MySQL性能测试工具 mysqlslap

發布時間:2023/11/27 生活经验 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MySQL性能测试工具 mysqlslap 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

先看參數介紹

FormatOption FileDescriptionIntroduced
--auto-generate-sqlauto-generate-sqlGenerate SQL statements automatically when they are not supplied in files or using command options?
--auto-generate-sql-add-autoincrementauto-generate-sql-add-autoincrementAdd AUTO_INCREMENT column to automatically generated tables?
--auto-generate-sql-execute-number=#auto-generate-sql-execute-numberSpecify how many queries to generate automatically?
--auto-generate-sql-guid-primaryauto-generate-sql-guid-primaryAdd a GUID-based primary key to automatically generated tables?
--auto-generate-sql-load-type=typeauto-generate-sql-load-typeSpecify how many queries to generate automatically?
--auto-generate-sql-secondary-indexes=#auto-generate-sql-secondary-indexesSpecify how many secondary indexes to add to automatically generated tables?
--auto-generate-sql-unique-query-number=#auto-generate-sql-unique-query-numberHow many different queries to generate for automatic tests.?
--auto-generate-sql-unique-write-number=#auto-generate-sql-unique-write-numberHow many different queries to generate for --auto-generate-sql-write-number?
--auto-generate-sql-write-number=#auto-generate-sql-write-numberHow many row inserts to perform on each thread?
--commit=#commitHow many statements to execute before committing.?
--compresscompressCompress all information sent between the client and the server?
--concurrency=#concurrencyThe number of clients to simulate when issuing the SELECT statement?
--create=valuecreateThe file or string containing the statement to use for creating the table?
--create-and-drop-schema=valuecreate-and-drop-schemaThe schema in which to run the tests; dropped at the end of the test run5.5.12
--create-schema=valuecreate-schemaThe schema in which to run the tests?
--csv=[file]csvGenerate output in comma-separated values format?
--debug[=debug_options]debugWrite a debugging log?
--debug-checkdebug-checkPrint debugging information when the program exits?
--debug-infodebug-infoPrint debugging information, memory and CPU statistics when the program exits?
--default-auth=plugindefault-auth=pluginThe authentication plugin to use5.5.10
--delimiter=strdelimiterThe delimiter to use in SQL statements?
--detach=#detachDetach (close and reopen) each connection after each N statements?
--engine=engine_nameengineThe storage engine to use for creating the table?
--help?Display help message and exit?
--host=host_namehostConnect to the MySQL server on the given host?
--iterations=#iterationsThe number of times to run the tests?
--number-char-cols=#number-char-colsThe number of VARCHAR columns to use if --auto-generate-sql is specified?
--number-int-cols=#number-int-colsThe number of INT columns to use if --auto-generate-sql is specified?
--number-of-queries=#number-of-queriesLimit each client to approximately this number of queries?
--only-printonly-printDo not connect to databases. mysqlslap only prints what it would have done?
--password[=password]passwordThe password to use when connecting to the server?
--pipe?On Windows, connect to server using a named pipe?
--plugin-dir=pathplugin-dir=pathThe directory where plugins are located5.5.10
--port=port_numportThe TCP/IP port number to use for the connection?
--post-query=valuepost-queryThe file or string containing the statement to execute after the tests have completed?
--post-system=strpost-systemThe string to execute using system() after the tests have completed?
--pre-query=valuepre-queryThe file or string containing the statement to execute before running the tests?
--pre-system=strpre-systemThe string to execute using system() before running the tests?
--protocol=typeprotocolThe connection protocol to use?
--query=valuequeryThe file or string containing the SELECT statement to use for retrieving data?
--silentsilentSilent mode?
--socket=pathsocketFor connections to localhost?
--ssl-ca=file_namessl-caThe path to a file that contains a list of trusted SSL CAs?
--ssl-capath=dir_namessl-capathThe path to a directory that contains trusted SSL CA certificates in PEM format?
--ssl-cert=file_namessl-certThe name of the SSL certificate file to use for establishing a secure connection?
--ssl-cipher=cipher_listssl-cipherA list of allowable ciphers to use for SSL encryption?
--ssl-key=file_namessl-keyThe name of the SSL key file to use for establishing a secure connection?
--ssl-verify-server-certssl-verify-server-certThe server's Common Name value in its certificate is verified against the host name used when connecting to the server?
--user=user_name,userMySQL user name to use when connecting to server?
--verbose?Verbose mode?
--version?Display version information and exit?

?

1.使用自動生成腳本測試數據庫性能

mysqlslap?-uroot -p123?-a?--debug-info?--concurrency=50,100 ?--number-of-queries=200?--engine=myisam,innodb

參數介紹?

-u : 用戶名

-p : 密碼

-a (--auto-generate-sql) : 自動生成sql腳本測試數據庫

--debug-info : 輸出debug信息,包括內存,CPU等

--concurrency : 用戶并發數,可填寫多個

--number-of-queries : 每個用戶的查詢次數

--engine : 需要測試的數據庫引擎

輸出結果:

Benchmark
Running for engine myisam
Average number of seconds to run all queries: 2.092 seconds
Minimum number of seconds to run all queries: 2.092 seconds
Maximum number of seconds to run all queries: 2.092 seconds
Number of clients running queries: 50
Average number of queries per client: 4

Benchmark
Running for engine myisam
Average number of seconds to run all queries: 3.107 seconds
Minimum number of seconds to run all queries: 3.107 seconds
Maximum number of seconds to run all queries: 3.107 seconds
Number of clients running queries: 100
Average number of queries per client: 2

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 2.248 seconds
Minimum number of seconds to run all queries: 2.248 seconds
Maximum number of seconds to run all queries: 2.248 seconds
Number of clients running queries: 50
Average number of queries per client: 4

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 3.514 seconds
Minimum number of seconds to run all queries: 3.514 seconds
Maximum number of seconds to run all queries: 3.514 seconds
Number of clients running queries: 100
Average number of queries per client: 2

?

2.使用自定義SQL語句測試指定數據庫

mysqlslap -uroot -plewis0913 --create-schema="test"?--query="select * from?user;" --concurrency=50,100 --debug-info

參數介紹

--create-schema : 需要測試的數據庫

--query : 需要測試的sql語句

輸出結果:

Benchmark
Average number of seconds to run all queries: 2.029 seconds
Minimum number of seconds to run all queries: 2.029 seconds
Maximum number of seconds to run all queries: 2.029 seconds
Number of clients running queries: 50
Average number of queries per client: 1

Benchmark
Average number of seconds to run all queries: 2.544 seconds
Minimum number of seconds to run all queries: 2.544 seconds
Maximum number of seconds to run all queries: 2.544 seconds
Number of clients running queries: 100
Average number of queries per client: 1

轉載于:https://www.cnblogs.com/zemliu/archive/2012/08/13/2636905.html

總結

以上是生活随笔為你收集整理的MySQL性能测试工具 mysqlslap的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。