MySQL基準(zhǔn)壓力測試工具M(jìn)ySQLSlap怎么用

小編給大家分享一下MySQL基準(zhǔn)壓力測試工具M(jìn)ySQLSlap怎么用,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、舟山網(wǎng)絡(luò)推廣、微信小程序、舟山網(wǎng)絡(luò)營銷、舟山企業(yè)策劃、舟山品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供舟山建站搭建服務(wù),24小時服務(wù)熱線:13518219792,官方網(wǎng)址:www.muchs.cn



常用的解釋:

  1. [root@zhanglin ~]# mysqlslap --help
    mysqlslap  Ver 1.0 Distrib 5.1.73, for redhat-linux-gnu (x86_64)
    Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.


    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    Run a query multiple times against the server.
    Usage: mysqlslap [OPTIONS]


    Default options are read from the following files in the given order:
    /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf 
    The following groups are read: mysqlslap client
    The following options may be given as the first argument:
    --print-defaults        Print the program argument list and exit.
    --no-defaults           Don't read default options from any option file.
    --defaults-file=#       Only read default options from the given file #.
    --defaults-extra-file=# Read this file after the global files are read.
      -?, --help          Display this help and exit.
      -a, --auto-generate-sql 
                          Generate SQL where not supplied by file or command line.     //系統(tǒng)自帶生成的SQL腳本來測試,非文件或命令行。
      --auto-generate-sql-add-autoincrement 
                          Add an AUTO_INCREMENT column to auto-generated tables.       //從5.1.18版本開始,?表示對生成的表自動添加auto_increment列。
      --auto-generate-sql-execute-number=# 
                          Set this number to generate a set number of queries to       //設(shè)置會話執(zhí)行SQL語句的次數(shù)
                          run.
      --auto-generate-sql-guid-primary 
                          Add GUID based primary keys to auto-generated tables.        //給測試表,根據(jù)主鍵添加GUID字段
      --auto-generate-sql-load-type=name 
                          Specify test load type: mixed, update, write, key, or        //代表要測試的是讀還是寫還是兩者混合的,嗎,默認(rèn)是混合模式。
                          read; default is mixed.
      --auto-generate-sql-secondary-indexes=# 
                          Number of secondary indexes to add to auto-generated         // 自動增長表除主鍵以外索引的個數(shù)。
                          tables.
      --auto-generate-sql-unique-query-number=# 
                          Number of unique queries to generate for automatic tests.    // 自動測試生成的不同查詢的個數(shù)。
      --auto-generate-sql-unique-write-number=# 
                          Number of unique queries to generate for                     // 自動測試生成的不同write SQL 語句的個數(shù)。
                          auto-generate-sql-write-number.
      --auto-generate-sql-write-number=# 
                          Number of row inserts to perform for each thread (default    //每個線程write SQL的數(shù)量。
                          is 100).
      --commit=#          Commit records every X number of statements.                 //多少條DML后提交一次。
      -C, --compress      Use compression in server/client protocol.                  // 使用壓縮。
      -c, --concurrency=name 
                          Number of clients to simulate for query to run.          //客戶端并發(fā)數(shù)量,多個可以用逗號隔開,例如:concurrency=100,500,1000, 并發(fā)連接線程數(shù)分別是100、500、1000個并發(fā)。
      --create=name       File or string to use create tables.                        //表名,可以直接指定名字也可指定到某個文件。
      --create-schema=name 
                          Schema to run tests in.                                     //用什么用戶測試。
      --csv[=name]        Generate CSV output to named file or to stdout if no file     //以CSV 文件輸出測試結(jié)果。
                          is named.
      -#, --debug[=#]     This is a non-debug version. Catch this and exit.
      --debug-check       Check memory and open file usage at exit.                   //檢查CPU以及內(nèi)存的相關(guān)信息。
      -T, --debug-info    Print some debug info at exit.                              //結(jié)束時 打印debug信息。
      -F, --delimiter=name 
                          Delimiter to use in SQL statements supplied in file or
                          command line.
      --detach=#          Detach (close and reopen) connections after X number of
                          requests.
      -e, --engine=name   Storage engine to use for creating the table.               //需要測試的存儲引擎。
      -h, --host=name     Connect to host.                                            //需要測試的數(shù)據(jù)庫主機(jī)。
      -i, --iterations=#  Number of times to run the tests.                           //-i N 測試執(zhí)行的次數(shù),代表要在不同并發(fā)環(huán)境下,各自運(yùn)行測試多少次。
      --no-drop           Do not drop the schema after the test.                      //測試結(jié)束,保留測試用戶數(shù)據(jù)。
      -x, --number-char-cols=name                                                     //創(chuàng)建測試表的 varchar 型字段數(shù)量,默認(rèn)是1。
                          Number of VARCHAR columns to create in table if
                          specifying --auto-generate-sql.
      -y, --number-int-cols=name                                                      //創(chuàng)建測試表的 int 型字段數(shù)量,默認(rèn)是1.
                          Number of INT columns to create in table if specifying
                          --auto-generate-sql.
      --number-of-queries=# 
                          Limit each client to this number of queries (this is not     //每個客戶端 總的執(zhí)行SQL次數(shù)(并發(fā)客戶數(shù)×每客戶查詢次數(shù))。
                          exact).
      --only-print        Do not connect to the databases, but instead print out       //只打印測試語句而不實(shí)際執(zhí)行。類似日常查看執(zhí)行計劃
                          what would have been done.
      -p, --password[=name] 
                          Password to use when connecting to server. If password is     //鏈接MySQL數(shù)據(jù)庫用戶的登錄密碼。
                          not given it's asked from the tty. 
      -P, --port=#        Port number to use for connection.                            //端口號。
      --post-query=name   Query to run or file containing query to execute after        //測試后  執(zhí)行的SQL語句
                          tests have completed.
      --post-system=name  system() string to execute after tests have completed.        //測試后  執(zhí)行的操作系統(tǒng)語句
      --pre-query=name    Query to run or file containing query to execute before       //測試前  執(zhí)行的SQL語句
                          running tests.
      --pre-system=name   system() string to execute before running tests.              //測試前  執(zhí)行的操作系統(tǒng)語句
      --protocol=name     The protocol to use for connection (tcp, socket, pipe,        // 鏈接服務(wù)器使用的 鏈接協(xié)議
                          memory).
      -q, --query=name    Query to run or file containing query to run.                 //測試的SQL語句 一般是自主設(shè)計的SQL
      -s, --silent        Run program in silent mode - no output.                       //不顯示測試
      -S, --socket=name   The socket file to use for connection.                        //連接服務(wù)器的socket通道文件
      --ssl               Enable SSL for connection (automatically enabled with
                          other flags).Disable with --skip-ssl.
      --ssl-ca=name       CA file in PEM format (check OpenSSL docs, implies
                          --ssl).
      --ssl-capath=name   CA directory (check OpenSSL docs, implies --ssl).
      --ssl-cert=name     X509 cert in PEM format (implies --ssl).
      --ssl-cipher=name   SSL cipher to use (implies --ssl).
      --ssl-key=name      X509 key in PEM format (implies --ssl).
      --ssl-verify-server-cert 
                          Verify server's "Common Name" in its cert against
                          hostname used when connecting. This option is disabled by
                          default.
      -u, --user=name     User for login if not current user.                           // 登錄MySQL用戶,
      -v, --verbose       More verbose output; you can use this multiple times to       //更詳細(xì)的輸出。
                          get even more verbose output.
      -V, --version       Output version information and exit.                          //版本信息



測試命令:
mysqlslap -uroot -pzhanglin --concurrency=1000 --iterations=10 --auto-generate-sql --auto-generate-sql-load-type=mixed --auto-generate-sql-add-autoincrement --engine=myisam --number-of-queries=10 --debug-info
  #備注本次測試以1000個并發(fā)線程、測試10次,自動生成SQL測試腳本、讀、寫、更新混合測試、自增長字段、測試引擎為myisam、共運(yùn)行10次查詢,輸出cpu資源信息

mysqlslap --concurrency=10,200,1000 --iterations=20 --number-int-cols=8 --number-char-cols=30 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read --engine=myisam,innodb --number-of-queries=5000 --verbose --socket=/tmp/mysql/mysql.sock -uroot -pzhanglin
   #系統(tǒng)腳本測試,增加int型 8列char 型30列,測試2種引擎myisam,innodb讀的性能,分別用10,200,1000個客戶端對服務(wù)器進(jìn)行測試總共5000個查詢語句 執(zhí)行20次查詢

以上是“MySQL基準(zhǔn)壓力測試工具M(jìn)ySQLSlap怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

文章題目:MySQL基準(zhǔn)壓力測試工具M(jìn)ySQLSlap怎么用
網(wǎng)站地址:http://www.muchs.cn/article26/ihpcjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、搜索引擎優(yōu)化、虛擬主機(jī)、網(wǎng)站改版、網(wǎng)站策劃、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名