自己想做的,劉愛貴在2010年就做完了(⊙ω⊙)
http://blog.csdn.net/liuaigui/article/details/5521024
通過綜合使用多種標准文件系統Benchmarks對Ext3, Ext4, Reiserfs, XFS, JFS, Reiser4的性能測試對比,對不同應用選擇合適的文件系統給出以下方案,供大家參考。文件系統性能測試數據見附表。
1、大量小文件(LOSF, Lost of small files)I/O應用(如小圖片)
Reiserfs(首選), Ext4文件系統適合這類負載特征,IO調度算法選擇deadline,block size = 4096, ext4關閉日志功能。
reiserfs mount參數:-o defaults, async, noatime, nodiratime, notail, data=writeback
ext4 mount參數:-o defaults, async, noatime, nodiratime, data=writeback, barrier=0
關閉ext4日志:tune2fs -O^has_journal /dev/sdXX
2、大文件I/O應用(如視頻下載、流媒體)
EXT4文件系統適合此類負載特征,IO調度算法選擇anticipatory, block size = 4096, 關閉日志功能,啟用extent(default)。
mount參數:-o defaults, async, noatime, nodiratime, data=writeback, barrier=0
關閉ext4日志:tune2fs -O^has_journal /dev/sdXX
3、SSD文件系統選擇
EXT4/Reiserfs可以作為SSD文件系統,但未對SSD做優化,不能充分發揮SSD性能,並影響SSD使用時間。
Btrfs對SSD作了優化,mount通過參數啟用。但Btrfs仍處於實驗階段,生產環境謹慎使用。
JFFS2/Nilfs2/YAFFS是常用的flash file system,在嵌入式環境廣泛應用,建議使用。性能目前還未作測試評估。
簡單分析一下選擇Reiserfs和ext4文件系統的原因:
1、Reiserfs
大量小文件訪問,衡量指標是IOPS,文件系統性能瓶頸在於文件元數據操作、目錄操作、數據尋址。reiserfs對小文件作了優化,並使用B+ tree組織數據,加速了數據尋址,大大降低了open/create/delete/close等系統調用開銷。mount時指定noatime, nodiratime, notail,減少不必要的inode操作,notail關閉tail package功能,以空間換取更高性能。因此,對於隨機的小I/O讀寫,reiserfs是很好的選擇。
2、Ext4
大文件順序訪問,衡量指標是IO吞吐量,文件系統性能瓶頸在於數據塊布局(layout)、數據尋址。Ext4對ext3主要作了兩方面的優化:
一是inode預分配。這使得inode具有很好的局部性特征,同一目錄文件inode盡量放在一起,加速了目錄尋址與操作性能。因此在小文件應用方面也具有很好的性能表現。
二是extent/delay/multi的數據塊分配策略。這些策略使得大文件的數據塊保持連續存儲在磁盤上,數據尋址次數大大減少,顯著提高I/O吞吐量。
因此,對於順序大I/O讀寫,EXT4是很好的選擇。另外,XFS性能在大文件方面也相當不錯。
附表:文件系統性能測試數據
| Testing Host: | ||||||||
| CPU | Genuine Intel(R) 2.13GHz 4 cores | |||||||
| MEM | 4GB | |||||||
| DISK | SAS 146.8GB * 4 | |||||||
| /dev/sdb | Ext3 | disable journal | defaults,async,noatime,nodiratime | |||||
| /dev/sdc | Ext4 | disable journal | defaults,async,noatime,nodiratime,data=writeback,barrier=0 | |||||
| /dev/sdd | XFS | has_journal | defaults,async,noatime,nodiratime,barrier=0 | |||||
| /dev/sde | Reiser4 | has_journal | defaults,async,noatime,nodiratime | |||||
| /dev/sde | reiserfs | has_journal | defaults,async,noatime,nodiratime,notail,data=writeback | |||||
| /dev/sde | JFS | has_journal | defaults,async,noatime,nodiratime | |||||
| /dev/sde | btrfs | has_journal | defaults.async.noatime,nodiratime,data=writeback | |||||
| NO. | Test Points | Ext3 | Ext4 | Reiserfs | XFS | JFS | Reiser4 | Btrfs |
| 1 | filesystem creation s | 37.381 | 22.333 | 3.744 | 1.786 | 1.858 | 2.758 | |
| 2 | filesystem mounting s | 0.024 | 0.039 | 0.299 | 0.079 | 0.068 | 3.524 | |
| 3 | filesystem unmounting s | 0.011 | 0.02 | 0.074 | 0.025 | 0.048 | 0.037 | |
| 4 | copy a large file (4GB) s | 35.486 | 37.227 | 30.605 | 43.547 | 30.32 | 42.17 | |
| 5 | recopy the large file s | 56.919 | 57.526 | 59.893 | 59.315 | 55.654 | 57.925 | |
| 6 | remove the large file s | 3.126 | 0.295 | 2.178 | 0.016 | 0.018 | 4.137 | |
| 7 | copy linux kernel archive.tar s | 0.103 | 0.143 | 0.574 | 0.094 | 0.552 | 0.564 | |
| 8 | extract files from kernel.tar s | 42.678 | 44 | 39.681 | 57.374 | 70.993 | 47.538 | |
| 9 | create kernel.tar from linux source s | 32.733 | 39.145 | 39.305 | 39.167 | 37.92 | 43.828 | |
| 10 | compile linux kernel s | 561.834 | 566.474 | 557.429 | 571.355 | 1773.143 | 828.028 | |
| 11 | copy kernel file tree s | 190.701 | 197.191 | 194.864 | 217.355 | 255.777 | 185.406 | |
| 12 | recopy kernel file tree s | 66.272 | 170.643 | 100.67 | 143.517 | 194.898 | 79.247 | |
| 13 | remove kernel file tree s | 13.719 | 3.783 | 3.661 | 50.072 | 92.068 | 33.2 | |
| 14 | list all files for kernel source(tree) s | 15.961 | 15.539 | 20.717 | 15.818 | 29.139 | 15.611 | |
| 15 | file search in kernel source (find) s | 0.119 | 0.9 | 0.331 | 2.515 | 0.791 | 5.913 | |
| 16 | create 1 million files s | 1000.969 | 986.712 | 940.201 | 1128.244 | 1111.509 | 2462.65 | |
| 17 | recopy the 1 million files s | 4783.069 | 595.828 | 59.252 | 972.671 | 1005.057 | 1734.48 | |
| 18 | remove the 1 million files s | 3257.384 | 396.32 | 74.917 | 735.048 | 2395.417 | 1165.314 | |
| 19 | dd read IOPS (bs=1KB,4GB) s | 26.795 | 27.257 | 26.036 | 26.158 | 25.948 | 26.485 | |
| 20 | dd write IOPS (bs=1KB,4GB) s | 27.006 | 26.461 | 32.577 | 26.164 | 29.203 | 126.906 | |
| 21 | dd read BW (bs=1MB,4GB) s | 26.784 | 23.552 | 25.999 | 26.233 | 28.635 | 26.541 | |
| 22 | dd write BW (bs=1MB,4GB) s | 29.429 | 26.123 | 30.64 | 24.683 | 31.446 | 31.925 | |
| Postmark (postmark.conf) | ||||||||
| 23 | transaction /s | 333 | 384 | 384 | 113 | 166 | 416 | |
| 24 | read MB/s | 27.98 | 20.42 | 24.37 | 9.69 | 10.64 | 30.22 | |
| 25 | write MB/s | 87.32 | 63.72 | 76.06 | 30.23 | 33.21 | 94.31 | |
| Randomio (randomio bigfile 10 .25 .01 2048 60 1) | (X表示Randomio不支持該文件系統) | |||||||
| 26 | create 4GB file MB/s | 167 | 166 | 164 | 168 | 156 | 51.3 | |
| 27 | random io/s | 372.1 | 382.3 | 378.8 | 521.5 | 382.7 | X | |
| 28 | random read latency ms | 26.9 | 26.2 | 26.6 | 13.2 | 26.3 | X | |
| 29 | random write latency ms | 26.5 | 26 | 25.9 | 37.1 | 25.6 | X | |
| 30 | random read latency std dev ms | 17.9 | 16.7 | 16.6 | 13.1 | 16.3 | X | |
| 31 | random write latency std dev ms | 15.8 | 14.9 | 14.5 | 38.8 | 14.3 | X | |
| Bonnie++ (-d /cacheX -s 7920 -x 1 -u root) | (+++++表示未獲得准確測試結果) | |||||||
| 32 | read KB/s | 155161 | 150029 | 160919 | 159242 | 155811 | 144079 | |
| 33 | write KB/s | 155150 | 150635 | 142801 | 159393 | 139770 | 107923 | |
| 34 | seek /s | 812.9 | 816.7 | 816 | 806.4 | 730.7 | 775.9 | |
| 35 | sequential create /s | 7374 | (+++++) | 29088 | 710 | 1366 | 10031 | |
| 36 | sequential delete /s | (+++++) | (+++++) | 25160 | 635 | 470 | 3123 | |
| 37 | random create /s | 7558 | (+++++) | 28178 | 745 | 509 | 5015 | |
| 38 | random delete /s | 25292 | (+++++) | 24723 | 559 | 287 | 3365 | |
| IOZone (-Razc -s 8192m -y 4k|1m -q 4k|1m -i 0 -i 1 -i 2 -b iozone.xls) | ||||||||
| 39 | sequential read with 4KB KB/s | |||||||
| 40 | sequential write with 4KB KB/s | (測試用時太長,暫未完成) | ||||||
| 41 | random read with 4KB KB/s | |||||||
| 42 | random write with 4KB KB/s | |||||||
| 43 | sequential read with 1MB KB/s | 156790 | 153432 | 160142 | 159591 | 161785 | 143197 | |
| 44 | sequential write with 1MB KB/s | 155928 | 156378 | 131246 | 162226 | 143348 | 138672 | |
| 45 | random read with 1MB KB/s | 101004 | 98060 | 102840 | 101225 | 101100 | 95864 | |
| 46 | random write with 1MB KB/s | 110537 | 102245 | 97924 | 107140 | 119733 | 97941 | |
| FileBench (load) | ||||||||
| 47 | randomread | |||||||
| 48 | randomwrite | |||||||
| 49 | varmail | |||||||
| 49 | iops /s | 1292.33 | 1921.658 | 1276.035 | 710.653 | 692.282 | 772.895 | |
| BW MB/s | 4.2 | 6.3 | 4.3 | 2.4 | 2.3 | 2.6 | ||
| webproxy | ||||||||
| 50 | iops /s | 14868.189 | 16379.942 | 14984.04 | 6156.159 | 2830.036 | 8705.437 | |
| 51 | BW MB/s | 55.5 | 60.8 | 56 | 25.1 | 12.3 | 34.7 | |
| videoserver | ||||||||
| iops /s | 395.147 | 392.849 | 391.85 | 391.65 | 391.74 | 391.048 | ||
| BW MB/s | 97.5 | 227.9 | 96.7 | 227.6 | 96.7 | 96.5 | ||
