背景: Linux是NFS的Server端,AIX是NFS的Client端(此外,有一個Linux也作為Client端對比測試)。
- 1.NFS對應的底層設備是閃存卡,本地測試I/O寫性能可達2GB/s;
- 2.服務器是千兆網卡,FTP測試傳輸可達到100MB/s;
- 3.AIX成功掛載NFS,dd測試寫入速度只有10MB/s;
- 4.Linux成功掛載NFS,同樣dd測試寫入速度可達到100MB/s;
說明:以上速度主要是體現數量級的差異,實際測試會有少許偏差。
具體環境:
NFS Server:RHEL 6.8
NFS Client:AIX 6.1、RHEL 6.8
掛載參數均依據MOS文檔配置:
- Mount Options for Oracle files for RAC databases and Clusterware when used with NFS on NAS devices (文檔 ID 359515.1)
根據本次實際需求,提煉一下需要配置的參數:
--MOS建議(AIX):
cio,rw,bg,hard,nointr,rsize=32768,
wsize=32768,proto=tcp,noac,
vers=3,timeo=600--MOS建議(Linux):
rw,bg,hard,nointr,rsize=32768,
wsize=32768,tcp,actimeo=0,
vers=3,timeo=600
AIX NFS的掛載參數:
mount -o cio,rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,vers=3,timeo=600 10.xx.xx.212:/xtts /xtts
直接掛載提示如下錯誤:
# mount -o cio,rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,vers=3,timeo=600 10.xx.xx.212:/xtts /xtts
mount: 1831-008 giving up on:
10.xx.xx.212:/xtts
vmount: Operation not permitted.
查資料確認AIX需要額外設置網絡參數:
# nfso -p -o nfs_use_reserved_ports=1
再次嘗試掛載成功:
mount -o cio,rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,vers=3,timeo=600 10.xx.xx.212:/xtts /xtts
可dd測試的速度非常不理想,只有10MB/s:
--test performance; AIX NFS
# time dd if=/dev/zero of=/xtts/test-write bs=8192 count=102400
102400+0 records in.
102400+0 records out.
real 0m43.20s
user 0m0.79s
sys 0m5.28s
# time dd if=/xtts/test-write of=/dev/null bs=8192 count=102400
102400+0 records in.
102400+0 records out.
real 0m30.86s
user 0m0.84s
sys 0m5.88s
所有參數都是根據實際需求,按照MOS的建議設置的。有什么問題嗎?
- 嘗試去掉cio參數測試,發現結果幾乎沒變化;
- 嘗試去掉hard參數測試,發現結果幾乎沒變化;
- 嘗試協議從tcp改為udp測試,發現結果幾乎沒變化;
幾乎能試的參數都試了,結果都不理想,馬上都准備協調資源找主機工程師定位了。
此時,靈感乍現,突然想到一個可能性。有沒有可能AIX上的NFS限制了單個進程的I/O吞吐能力?帶着這個猜測,進行並行測試:
開5個窗口同時開始dd:
time dd if=/dev/zero of=/xtts/test-write1 bs=8192 count=102400
time dd if=/dev/zero of=/xtts/test-write2 bs=8192 count=102400
time dd if=/dev/zero of=/xtts/test-write3 bs=8192 count=102400
time dd if=/dev/zero of=/xtts/test-write4 bs=8192 count=102400
time dd if=/dev/zero of=/xtts/test-write5 bs=8192 count=102400
驚喜的發現5個窗口都在55s同時完成,這相當於800M*5=4000M,都在55s完成,每秒達到72MB/s,通過這種並行的方式已滿足提升效率的需求。
而且看起來只要繼續嘗試多開窗口測試,基本也能達到網絡上限100MB/s(千兆網卡限制)。
附:測試同樣的NFS掛載到另一台Linux服務器上,無需並行,dd寫入速度就可達100MB/s,這也是之前影響自己思考的因素。
Linux NFS的掛載參數:
# mount -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600 10.xx.xx.212:/xtts /xtts
Linux NFS的測試結果:
--test performance; Linux NFS
# dd if=/dev/zero of=/xtts/test-write bs=8192 count=102400
102400+0 records in
102400+0 records out
838860800 bytes (839 MB) copied, 6.02451 s, 139 MB/s
# dd if=/xtts/test-write of=/dev/null bs=8192 count=102400
102400+0 records in
102400+0 records out
838860800 bytes (839 MB) copied, 8.55925 s, 98.0 MB/s
對AIX不熟悉,沒有進一步深究底層原理。開始解決問題過程中的主要困惑在於,為何Linux作為client時,無需並行就可以dd測試達到100MB/s的速度,使自己陷入了固有思維中。從這件事情得到的思考是:有些時候,要跳出常規思維去思考方可有所突破。
最后把NFS Server端本地測試的結果也貼出來,感嘆下閃存卡的I/O能力:
# dd if=/dev/zero of=/dev/test-write2 bs=8192 count=1024000
1024000+0 records in
1024000+0 records out
8388608000 bytes (8.4 GB) copied, 4.19912 s, 2.0 GB/s