首頁 資料庫 mysql教程 Sysbench介绍与使用

Sysbench介绍与使用

Jun 07, 2016 pm 05:23 PM
資料庫

最近用sysbench进行了较多的性能测试,也总结一下它的特点和用法和需要注意的事项。sysbench是一个多线程性能测试工具,可以进行

最近用sysbench进行了较多的性能测试,也总结一下它的特点和用法和需要注意的事项。sysbench是一个多线程性能测试工具,可以进行CPU/内存/IO/数据库等性能测试。不过我绝大多数的时候都是用它来对数据库(MySQL)进行oltp测试。它能测哪些东西,怎么测让我从它的命令帮助来回答。

~/zbs$ sysbench --help 
Missing required command argument. 
Usage: 
  sysbench [general-options]... --test= [test-options]... command 

上面就大概的用法,--test=指定我们需要测什么类型,那么--test有哪几种类型呢?fileio/cpu/memory/threads/mutex,不好意思前面这几个我都没测过,我主要是用它来测数据库的性能,,但为什么没有数据库这个选项呢,这是我是用了最新的版本0.5,它与0.4的版本最大区别在于支持多表测试,执行实时打印统计信息,支持自定义lua脚本来设置测试行为。

Compiled-in tests: 
  fileio - File I/O test 
  cpu - CPU performance test 
  memory - Memory functions speed test 
  threads - Threads subsystem performance test 
  mutex - Mutex performance test 

如果你用sysbench0.4大概会看到如下,请注意oltp这个选项就是测数据库用的。

Compiled-in tests: 
  fileio - File I/O test 
  cpu - CPU performance test 
  memory - Memory functions speed test 
  threads - Threads subsystem performance test 
  mutex - Mutex performance test 
  oltp - OLTP test 

看完了测试模式之后,那么它有一些什么主要的其他控制参数呢?首先说这个每个测试模式自己特有的参数怎么擦看 sysbench --test= help,比如我这里(请注意,由于sysbench0.5的--test选项对数据库的测试不再使用oltp这个选项而是通过指定lua脚本,因此利用前面这个命令查看不到下面的结果,所以如果要查看还是通过0.4的吧,如果谁找到了方式在0.5版本里查看oltp的参数也请告诉一下。另外虽然0.5与0.4版本不同但是参数还是基本上保持兼容的):

~$ sysbench --test=oltp help 
sysbench 0.4.12:  multi-threaded system evaluation benchmark 
 
oltp options: 
  --oltp-test-mode=STRING        test type to use {simple,complex,nontrx,sp} [complex] 
  --oltp-reconnect-mode=STRING    reconnect mode {session,transaction,query,random} [session] 
  --oltp-sp-name=STRING          name of store procedure to call in SP test mode [] 
  --oltp-read-only=[on|off]      generate only 'read' queries (do not modify database) [off] 
  --oltp-skip-trx=[on|off]        skip BEGIN/COMMIT statements [off] 
  --oltp-range-size=N            range size for range queries [100] 
  --oltp-point-selects=N          number of point selects [10] 
  --oltp-simple-ranges=N          number of simple ranges [1] 
  --oltp-sum-ranges=N            number of sum ranges [1] 
  --oltp-order-ranges=N          number of ordered ranges [1] 
  --oltp-distinct-ranges=N        number of distinct ranges [1] 
  --oltp-index-updates=N          number of index update [1] 
  --oltp-non-index-updates=N      number of non-index updates [1] 
  --oltp-nontrx-mode=STRING      mode for non-transactional test {select, update_key, update_nokey, insert, delete} [select] 
  --oltp-auto-inc=[on|off]        whether AUTO_INCREMENT (or equivalent) should be used on id column [on] 
  --oltp-connect-delay=N          time in microseconds to sleep after connection to database [10000] 
  --oltp-user-delay-min=N        minimum time in microseconds to sleep after each request [0] 
  --oltp-user-delay-max=N        maximum time in microseconds to sleep after each request [0] 
  --oltp-table-name=STRING        name of test table [sbtest] 
  --oltp-table-size=N            number of records in test table [10000] 
  --oltp-dist-type=STRING        random numbers distribution {uniform,gaussian,special} [special] 
  --oltp-dist-iter=N              number of iterations used for numbers generation [12] 
  --oltp-dist-pct=N              percentage of values to be treated as 'special' (for special distribution) [1] 
  --oltp-dist-res=N              percentage of 'special' values to use (for special distribution) [75] 
 
General database options: 
 
  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers) 
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto] 
 
 
Compiled-in database drivers: 
  mysql - MySQL driver 
 
mysql options: 
  --mysql-host=[LIST,...]      MySQL server host [localhost] 
  --mysql-port=N                MySQL server port [3306] 
  --mysql-socket=STRING        MySQL socket 
  --mysql-user=STRING          MySQL user [sbtest] 
  --mysql-password=STRING      MySQL password [] 
  --mysql-db=STRING            MySQL database name [sbtest] 
  --mysql-table-engine=STRING  storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb] 
  --mysql-engine-trx=STRING    whether storage engine used is transactional or not {yes,no,auto} [auto] 
  --mysql-ssl=[on|off]          use SSL connections, if available in the client library [off] 
  --myisam-max-rows=N          max-rows parameter for MyISAM tables [1000000] 
  --mysql-create-options=STRING additional options passed to CREATE TABLE [] 

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1665
14
CakePHP 教程
1424
52
Laravel 教程
1321
25
PHP教程
1269
29
C# 教程
1249
24
iOS 18 新增「已復原」相簿功能 可找回遺失或損壞的照片 iOS 18 新增「已復原」相簿功能 可找回遺失或損壞的照片 Jul 18, 2024 am 05:48 AM

蘋果公司最新發布的iOS18、iPadOS18以及macOSSequoia系統為Photos應用程式增添了一項重要功能,旨在幫助用戶輕鬆恢復因各種原因遺失或損壞的照片和影片。這項新功能在Photos應用的"工具"部分引入了一個名為"已恢復"的相冊,當用戶設備中存在未納入其照片庫的圖片或影片時,該相冊將自動顯示。 "已恢復"相簿的出現為因資料庫損壞、相機應用未正確保存至照片庫或第三方應用管理照片庫時照片和視頻丟失提供了解決方案。使用者只需簡單幾步

Hibernate 如何實作多型映射? Hibernate 如何實作多型映射? Apr 17, 2024 pm 12:09 PM

Hibernate多態映射可映射繼承類別到資料庫,提供以下映射類型:joined-subclass:為子類別建立單獨表,包含父類別所有欄位。 table-per-class:為子類別建立單獨資料表,僅包含子類別特有列。 union-subclass:類似joined-subclass,但父類別表聯合所有子類別列。

如何在PHP中處理資料庫連線錯誤 如何在PHP中處理資料庫連線錯誤 Jun 05, 2024 pm 02:16 PM

PHP處理資料庫連線報錯,可以使用下列步驟:使用mysqli_connect_errno()取得錯誤代碼。使用mysqli_connect_error()取得錯誤訊息。透過擷取並記錄這些錯誤訊息,可以輕鬆識別並解決資料庫連接問題,確保應用程式的順暢運作。

在PHP中使用MySQLi建立資料庫連線的詳盡教學 在PHP中使用MySQLi建立資料庫連線的詳盡教學 Jun 04, 2024 pm 01:42 PM

如何在PHP中使用MySQLi建立資料庫連線:包含MySQLi擴充(require_once)建立連線函數(functionconnect_to_db)呼叫連線函數($conn=connect_to_db())執行查詢($result=$conn->query())關閉連線( $conn->close())

如何在 Golang 中將 JSON 資料保存到資料庫中? 如何在 Golang 中將 JSON 資料保存到資料庫中? Jun 06, 2024 am 11:24 AM

可以透過使用gjson函式庫或json.Unmarshal函數將JSON資料儲存到MySQL資料庫中。 gjson函式庫提供了方便的方法來解析JSON字段,而json.Unmarshal函數需要一個目標類型指標來解組JSON資料。這兩種方法都需要準備SQL語句和執行插入操作來將資料持久化到資料庫中。

如何在 Golang 中使用資料庫回呼函數? 如何在 Golang 中使用資料庫回呼函數? Jun 03, 2024 pm 02:20 PM

在Golang中使用資料庫回呼函數可以實現:在指定資料庫操作完成後執行自訂程式碼。透過單獨的函數新增自訂行為,無需編寫額外程式碼。回調函數可用於插入、更新、刪除和查詢操作。必須使用sql.Exec、sql.QueryRow或sql.Query函數才能使用回呼函數。

PHP與不同資料庫的連接:MySQL、PostgreSQL、Oracle和更多 PHP與不同資料庫的連接:MySQL、PostgreSQL、Oracle和更多 Jun 01, 2024 pm 03:02 PM

PHP連接資料庫指南:MySQL:安裝MySQLi擴展,建立連線(servername、username、password、dbname)。 PostgreSQL:安裝PgSQL擴展,建立連線(host、dbname、user、password)。 Oracle:安裝OracleOCI8擴展,建立連線(servername、username、password)。實戰案例:取得MySQL資料、PostgreSQL查詢、OracleOCI8更新記錄。

如何使用C++處理資料庫連線和操作? 如何使用C++處理資料庫連線和操作? Jun 01, 2024 pm 07:24 PM

在C++中使用DataAccessObjects(DAO)函式庫連接和操作資料庫,包括建立資料庫連線、執行SQL查詢、插入新記錄和更新現有記錄。具體步驟為:1.包含必要的函式庫語句;2.開啟資料庫檔案;3.建立Recordset物件執行SQL查詢或操作資料;4.遍歷結果或依照特定需求更新記錄。

See all articles