1.背景
創(chuàng)新互聯(lián)主要從事做網(wǎng)站、網(wǎng)站制作、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)舒城,十年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):13518219792sysbench是一款壓力測(cè)試工具,可以測(cè)試系統(tǒng)的硬件性能,也可以用來(lái)對(duì)數(shù)據(jù)庫(kù)進(jìn)行基準(zhǔn)測(cè)試。sysbench 支持的測(cè)試有CPU運(yùn)算性能測(cè)試、內(nèi)存分配及傳輸速度測(cè)試、磁盤IO性能測(cè)試、POSIX線程性能測(cè)試、互斥性測(cè)試測(cè)試、數(shù)據(jù)庫(kù)性能測(cè)試(OLTP基準(zhǔn)測(cè)試)。目前支持的數(shù)據(jù)庫(kù)主要是MySQL數(shù)據(jù)庫(kù)和PG數(shù)據(jù)庫(kù)。
在新服務(wù)器上線時(shí),建議對(duì)服務(wù)器的性能做一次測(cè)試,最好與既往的同類型的服務(wù)器的性能測(cè)試報(bào)表做一個(gè)橫線比較,發(fā)現(xiàn)潛在問(wèn)題。及新機(jī)器上線前,對(duì)服務(wù)器做一次體檢。
對(duì)數(shù)據(jù)庫(kù)而言,我們可以通過(guò)sysbench工具實(shí)現(xiàn)對(duì)數(shù)據(jù)庫(kù)的基準(zhǔn)測(cè)試。在現(xiàn)在的系統(tǒng)架構(gòu)中,前端都比較容易彈性水平拓展,數(shù)據(jù)庫(kù)相對(duì)較難,因此,基準(zhǔn)測(cè)試對(duì)數(shù)據(jù)庫(kù)具有很重要的作用。而對(duì)數(shù)據(jù)庫(kù)的基準(zhǔn)測(cè)試的作用,就是分析在當(dāng)前的配置下(包括硬件配置、OS、數(shù)據(jù)庫(kù)設(shè)置等),數(shù)據(jù)庫(kù)的性能表現(xiàn),從而找出MySQL的性能閾值,并根據(jù)實(shí)際系統(tǒng)的要求調(diào)整配置。
2.sysbench的安裝
1)安裝命令
yum -y install sysbench
2)查看安裝的版本
sysbench --version
3)查看已安裝軟件的信息(主要是通 rpm 命令)。
查詢sysbench的安裝信息,主要是測(cè)試mysql時(shí),需要使用sysbench自帶的lua腳本進(jìn)行測(cè)試。如果使用快速安裝的方式,默認(rèn)的腳本路徑為:/usr/share/sysbench
。
如果不在這個(gè)命令,我們我們執(zhí)行以下命令查看,查找已安裝在本機(jī)Linux系統(tǒng)上面的所有的sysbench軟件的程序:
rpm -qa sysbench
列出該軟件所有的文件與目錄所在完整文件名(list):
rpm -ql sysbench
3.sysbench 語(yǔ)法
sysbench --help Usage: sysbench [options]... [testname] [command] Commands implemented by most tests: prepare run cleanup help General options: --threads=N number of threads to use [1] --events=N limit for total number of events [0] --time=N limit for total execution time in seconds [10] --forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off] --thread-stack-size=SIZE size of stack per thread [64K] --rate=N average transactions rate. 0 for unlimited rate [0] --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0] --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. [] --debug[=on|off] print more debugging info [off] --validate[=on|off] perform validation checks where possible [off] --help[=on|off] print help and exit [off] --version[=on|off] print version and exit [off] --config-file=FILENAME File containing command line options --tx-rate=N deprecated alias for --rate [0] --max-requests=N deprecated alias for --events [0] --max-time=N deprecated alias for --time [0] --num-threads=N deprecated alias for --threads [1] Pseudo-Random Numbers Generator options: --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special] --rand-spec-iter=N number of iterations used for numbers generation [12] --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1] --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75] --rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0] --rand-pareto-h=N parameter h for pareto distribution [0.2] Log options: --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3] --percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95] --histogram[=on|off] print latency histogram in report [off] General database options: --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto] --db-debug[=on|off] print database-specific debug information [off] Compiled-in database drivers: mysql - MySQL driver pgsql - PostgreSQL driver mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=[LIST,...] MySQL server port [3306] --mysql-socket=[LIST,...] MySQL socket --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] --mysql-ssl[=on|off] use SSL connections, if available in the client library [off] --mysql-ssl-cipher=STRING use specific cipher for SSL connections [] --mysql-compression[=on|off] use compression, if available in the client library [off] --mysql-debug[=on|off] trace all client library calls [off] --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205] --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off] pgsql options: --pgsql-host=STRING PostgreSQL server host [localhost] --pgsql-port=N PostgreSQL server port [5432] --pgsql-user=STRING PostgreSQL user [sbtest] --pgsql-password=STRING PostgreSQL password [] --pgsql-db=STRING PostgreSQL database name [sbtest] 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
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。