kvm磁盤io優化以及性能測試以及與物理機對比


ubuntu下kvm的磁盤io性能優化步驟

1、virsh shutdown wcltest2

2、virsh edit wcltest2

<driver name='qemu' type='qcow2'/>
      <source file='/kvm-data/kvm/wcltest2_os_disk.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>

 磁盤優化:

<driver name='qemu' type='qcow2' cache='none' io='native'/>
<target dev='vda' bus='virtio'/>
 同時刪除
<address type='drive' controller='0' bus='0' target='0' unit='0'/>

3、ubuntu下安裝sysbench1.0

wget https://github.com/akopytov/sysbench/archive/1.0.zip -O "sysbench-1.0.zip"
unzip sysbench-1.0.zip
apt-get install automake -y
apt-get install libtool -y
./autogen.sh
./configure --without-mysql
備注( --without-mysql 不編譯測試mysql的相關環境)
make
make install

4、io測試隨機讀寫

sysbench --test=fileio --num-threads=50 --file-total-size=2G --file-test-mode=rndrw prepare  准備測試
sysbench --test=fileio --num-threads=50 --file-total-size=2G --file-test-mode=rndrw run      開始測試
sysbench --test=fileio --num-threads=50 --file-total-size=2G --file-test-mode=rndrw cleanup  清除測試文件

 物理機執行結果:

File operations:
    reads/s:                      469.90
    writes/s:                     312.81
    fsyncs/s:                     1000.35

Throughput:
    read, MiB/s:                  7.34
    written, MiB/s:               4.89

General statistics:
    total time:                          10.1041s
    total number of events:              18024

Latency (ms):
         min:                                    0.00
         avg:                                   27.86
         max:                                 1047.11
         95th percentile:                      153.02
         sum:                               502103.21

Threads fairness:
    events (avg/stddev):           360.4800/49.51
    execution time (avg/stddev):   10.0421/0.03

 kvm優化前執行結果:File operations:

    reads/s:                      243.34
    writes/s:                     162.23
    fsyncs/s:                     513.40

Throughput:
    read, MiB/s:                  3.80
    written, MiB/s:               2.53

General statistics:
    total time:                          10.1048s
    total number of events:              9290

Latency (ms):
         min:                                    0.00
         avg:                                   54.13
         max:                                  769.09
         95th percentile:                      297.92
         sum:                               502877.36

Threads fairness:
    events (avg/stddev):           185.8000/65.60
    execution time (avg/stddev):   10.0575/0.02

 kvm優化后結果:

File operations:
    reads/s:                      438.57
    writes/s:                     289.51
    fsyncs/s:                     911.55

Throughput:
    read, MiB/s:                  6.85
    written, MiB/s:               4.52

General statistics:
    total time:                          10.1056s
    total number of events:              16577

Latency (ms):
         min:                                    0.01
         avg:                                   30.30
         max:                                  311.64
         95th percentile:                      123.28
         sum:                               502289.90

Threads fairness:
    events (avg/stddev):           331.5400/28.37
    execution time (avg/stddev):   10.0458/0.02

 結論:

kvm優化的io隨機讀寫性能達到接近物理機的磁盤io性能


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM