2016年1月7日 星期四

Windows上不同Block Size的效能測試 - 以AWS EC2為例

在我之前的文章中有特別介紹到透過SQLIO來進行磁碟機在不同Block Size的存取效能,但很可惜的是,此軟體目前已無法使用,但取而帶之的是另一個新的軟體,名稱為DiskSpd,但其實二者在使用上的方法非常的接近,我在下列整理使用的方法。

測試環境:
Amazon EC2
Instance Types - m4.xlarge

參考連結:
DiskSpd: http://aka.ms/diskspd
EC2 Instance Types: https://aws.amazon.com/tw/ec2/instance-types/

先前文章介紹:
SQL Server IO 測試工具 - SQLIO的使用與不同Block Size下的效能測試


參數說明:
-b  -> Block Size
-d  -> 測試時間(秒)
-t   -> 模擬的執行緒數量
-o  -> overlapped IOs
-L -> 關閉所有硬體或軟體式快取
-c  -> 產生檔案

執行範例:
diskspd.exe -b4k -d60 -t4 -o8 -L -r -w40 -c100m test_io_4k.dat

下列我分別針對4、16、32、64、128、256等不同的Block Size進行測試,數據如下,可以看出其實在Block Size越高的情況,其實是會有助於IO的傳輸。


另外一提在SQL Server上,由於Data File與Log File的磁碟在建議上也是擺放在較大的Block Size上也會有較佳的效能,但文中有提到,在許多的情況可能32K會是較佳的選擇,建議大家可以在設計規劃前可以再進行測試,藉以確認情況。

截取文字:
An appropriate value for most installations should be 65,536 bytes (that is, 64 KB) for partitions on which SQL Server data or log files reside. In many cases, this is the same size for Analysis Services data or log files, but there are times where 32 KB provides better performance. To determine the right size, you will need to do performance testing with your workload comparing the two different block sizes.

Disk Partition Alignment Best Practices for SQL ServerDisk Partition Alignment Best Practices for SQL Server
https://technet.microsoft.com/en-us/library/dd758814(v=sql.100).aspx


輸出範例:
Command Line: diskspd -b64k -d60 -t4 -o8 -L -r -w40 -c100m -c100m test_io_64k.dat

Input parameters:

timespan:   1
-------------
duration: 60s
warm up time: 5s
cool down time: 0s
measuring latency
random seed: 0
path: 'test_io_64k.dat'
think time: 0ms
burst size: 0
using software and hardware write cache
performing mix test (write/read ratio: 40/100)
block size: 65536
using random I/O (alignment: 65536)
number of outstanding I/O operations: 8
thread stride size: 0
threads per file: 4
using I/O Completion Ports
IO priority: normal

Results for timespan 1:
*******************************************************************************

actual test time: 60.00s
thread count: 4
proc count: 4

CPU |  Usage |  User  |  Kernel |  Idle
-------------------------------------------
   0|  97.84%|   2.66%|   95.18%|   2.16%
   1|  98.10%|   5.34%|   92.76%|   1.90%
   2|  97.42%|   3.93%|   93.49%|   2.58%
   3|  98.23%|   5.13%|   93.10%|   1.77%
-------------------------------------------
avg.|  97.90%|   4.26%|   93.63%|   2.10%

Total IO
thread |       bytes     |     I/Os     |     MB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |     56763678720 |       866145 |     902.23 |   14435.69 |    0.484 |     0.983 | test_io_64k.dat (100MB)
     1 |     60673949696 |       925811 |     964.38 |   15430.12 |    0.453 |     0.988 | test_io_64k.dat (100MB)
     2 |     60541894656 |       923796 |     962.28 |   15396.54 |    0.454 |     0.937 | test_io_64k.dat (100MB)
     3 |     61227008000 |       934250 |     973.17 |   15570.77 |    0.449 |     0.952 | test_io_64k.dat (100MB)
-----------------------------------------------------------------------------------------------------
total:      239206531072 |      3650002 |    3802.07 |   60833.13 |    0.459 |     0.965

Read IO
thread |       bytes     |     I/Os     |     MB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |     34065874944 |       519804 |     541.46 |    8663.37 |    0.469 |     1.076 | test_io_64k.dat (100MB)
     1 |     36373069824 |       555009 |     578.13 |    9250.11 |    0.438 |     0.995 | test_io_64k.dat (100MB)
     2 |     36226596864 |       552774 |     575.80 |    9212.86 |    0.439 |     0.993 | test_io_64k.dat (100MB)
     3 |     36731944960 |       560485 |     583.84 |    9341.38 |    0.434 |     0.958 | test_io_64k.dat (100MB)
-----------------------------------------------------------------------------------------------------
total:      143397486592 |      2188072 |    2279.23 |   36467.72 |    0.445 |     1.005

Write IO
thread |       bytes     |     I/Os     |     MB/s   |  I/O per s |  AvgLat  | LatStdDev |  file
-----------------------------------------------------------------------------------------------------
     0 |     22697803776 |       346341 |     360.77 |    5772.33 |    0.507 |     0.823 | test_io_64k.dat (100MB)
     1 |     24300879872 |       370802 |     386.25 |    6180.01 |    0.475 |     0.977 | test_io_64k.dat (100MB)
     2 |     24315297792 |       371022 |     386.48 |    6183.68 |    0.475 |     0.845 | test_io_64k.dat (100MB)
     3 |     24495063040 |       373765 |     389.34 |    6229.39 |    0.470 |     0.942 | test_io_64k.dat (100MB)
-----------------------------------------------------------------------------------------------------
total:       95809044480 |      1461930 |    1522.84 |   24365.40 |    0.481 |     0.901


  %-ile |  Read (ms) | Write (ms) | Total (ms)
----------------------------------------------
    min |      0.129 |      0.131 |      0.129
   25th |      0.326 |      0.358 |      0.338
   50th |      0.395 |      0.431 |      0.409
   75th |      0.482 |      0.522 |      0.499
   90th |      0.587 |      0.632 |      0.607
   95th |      0.676 |      0.728 |      0.699
   99th |      1.114 |      1.211 |      1.155
3-nines |      5.509 |      5.694 |      5.579
4-nines |     21.156 |     21.259 |     21.195
5-nines |    165.139 |    165.020 |    165.061
6-nines |    268.805 |    259.394 |    259.702
7-nines |    271.001 |    259.702 |    271.001
8-nines |    271.001 |    259.702 |    271.001
    max |    271.001 |    259.702 |    271.001


關鍵字:DiskSpdBlock SizeIOPS

沒有留言:

張貼留言