[Linux] 使用noatime属性优化文件系统读取性能
生活随笔
收集整理的這篇文章主要介紹了
[Linux] 使用noatime属性优化文件系统读取性能
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
博客原文:
**hackershell**
當文件被創建,修改和訪問時,Linux系統會記錄這些時間信息,當訪問足夠頻繁將會是很大的開銷,因為每次訪問都會記錄時間,所以 我們今天使用bonnie++來簡單測試我們修改noatime給我們帶來的性能提升有多少,我們先下載最新版本的bonnie++
# tar xf bonnie++-1.97.tgz # cd bonnie++-1.97.1 # make編譯好之后就可以使用了
注:測試數據最好為內存的2倍
所以在沒修改noatime之前,我們先測試文件系統的性能
./bonnie++ -s 31896 -d /export/ -u root -q >> file.csv運行結果如下:
Version 1.97 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 31896M 458 99 189663 52 82909 21 2487 98 214994 26 823.4 56 Latency 32591us 566ms 705ms 11924us 252ms 122ms Version 1.97 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP16 16300 79 +++++ +++ +++++ +++ 14745 74 +++++ +++ 18007 32 Latency 10929us 478us 521us 493us 134us 374us接下來我們修改掛載的/export,重新測試一遍
# vim /etc/fstab UUID=d41182b5-5092-4f2f-88a3-be619feef512 /export ext4 defaults,noatime 1 2設置立即生效
mount -o remount /export執行命令:
./bonnie++ -s 31896 -d /export/ -u root -q >> file.csv運行結果為:
Version 1.97 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 31896M 497 99 171760 35 93152 21 2276 97 240294 28 755.6 45 Latency 18716us 661ms 539ms 29368us 263ms 79468us Version 1.97 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP16 18605 93 +++++ +++ +++++ +++ 20520 96 +++++ +++ +++++ +++ Latency 1186us 379us 1297us 1288us 127us 1443us可能這樣的結果不直觀,我們可以
cat file.csv | ./bon_csv2html > result.html網頁打開為:
<img src="http://hackershell.cn/image/noatime2.png" alt="noatime_test1" align=center />
可以看出214MBps提升到了240MBps,雖然這只是一次測試,但是理論上來說還是會有性能上的提升,在整體的集群環境下,還是有益提升集群性能的。
參考資料:
測試工具Bonnie++的使用
總結
以上是生活随笔為你收集整理的[Linux] 使用noatime属性优化文件系统读取性能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 分布式中Redis实现Session终结
- 下一篇: QTP自动化测试自学手册V2.0版本