cd /usr/local/src yum -y install make automake libtool pkgconfig libaio-devel git clone https://github.com/akopytov/sysbench.git cd sysbench ./autogen.sh ./configure make -j 4 make install ldconfig /usr/local/mysql/lib [root@VM_42_63_centos sysbench]# sysbench --version; sysbench 1.1.0-50966c8
sysbench fileio --file-num=4 --file-block-size=16384 --file-total-size=110G prepare
[root@VM_42_63_centos data]# sysbench fileio help sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3) fileio options: --file-num=N number of files to create [128] --file-block-size=N block size to use in all IO operations [16384] --file-total-size=SIZE total size of files to create [2G] --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw} --file-io-mode=STRING file operations mode {sync,async,mmap} [sync] --file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} [] --file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100] --file-fsync-all[=on|off] do fsync() after each write operation [off] --file-fsync-end[=on|off] do fsync() at the end of test [on] --file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync] --file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0] --file-rw-ratio=N reads/writes ratio for combined test [1.5]
[root@VM_42_63_centos sysdata]# sysbench fileio \ > --time=180 \ > --threads=24 \ > --file-total-size=110G \ > --file-test-mode=rndrd \ > --file-num=4 \ > --file-extra-flags=direct \ > --file-fsync-freq=0 \ > --file-block-size=16384 \ > run sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 24 Initializing random number generator from current time Extra file open flags: directio 4 files, 2.5GiB each 10GiB total file size Block size 16KiB Number of IO requests: 0 Read/Write ratio for combined random IO test: 1.50 Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random read test Initializing worker threads... Threads started! Throughput: read: IOPS=1752.15 27.38 MiB/s (28.71 MB/s) write: IOPS=0.00 0.00 MiB/s (0.00 MB/s) fsync: IOPS=0.00 Latency (ms): min: 0.07 avg: 13.70 max: 687.59 95th percentile: 36.89 sum: 4319633.88
[root@VM_42_63_centos sysdata]# sysbench fileio \ > --time=180 \ > --threads=24 \ > --file-total-size=110G \ > --file-test-mode=rndwr \ > --file-num=4 \ > --file-extra-flags=direct \ > --file-fsync-freq=0 \ > --file-block-size=16384 \ > run sysbench 1.1.0-50966c8 (using bundled LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 24 Initializing random number generator from current time Extra file open flags: directio 4 files, 2.5GiB each 10GiB total file size Block size 16KiB Number of IO requests: 0 Read/Write ratio for combined random IO test: 1.50 Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random write test Initializing worker threads... Threads started! Throughput: read: IOPS=0.00 0.00 MiB/s (0.00 MB/s) write: IOPS=1094.75 17.11 MiB/s (17.94 MB/s) fsync: IOPS=0.53 Latency (ms): min: 0.09 avg: 21.92 max: 3376.77 95th percentile: 94.10 sum: 4319984.68
隨機讀的iops爲1752,隨機寫的iops爲1094,讀寫非對稱mysql
清理測試文件用cleanup選項便可git
咱們主要看隨機寫的性能哦github