Linux效能測試實踐

來源:互聯網
上載者:User

標籤:

前言

Linux效能測試、監控、最佳化是一個持續的過程,為LinuxCon上Brendan D. Gregg分享的 Linux benchmarking tools ,涵蓋面十分廣泛。我們可以通過成熟的監控方案如BMC Patrol,Zabbix來捕獲大部分資訊,在實際工作中我們會經常關注I/O效能,一般可以使用dd/ORION/IOzone做簡單的測試,如果需 要擷取更加全面詳細的報告可以使用nmon,本文將主要介紹Super PI /dd/nmon三種簡單而有效監測方法。

 

CPU | Memory | I/O | Network 一個都不能少

更新記錄

2015年03月06日 - 初稿

閱讀原文 - http://wsgzao.github.io/post/linux-performance/

擴充閱讀

  • Linux Performance - http://www.brendangregg.com/linuxperf.html
  • AIX 下磁碟 I/O 效能分析 - http://www.ibm.com/developerworks/cn/aix/library/1203_weixy_aixio/
  • nmon - http://nmon.sourceforge.net/pmwiki.php
CPU確認CPU型號cat /proc/cpuinfo |grep "model name" |uniq|cut -f 2 -d :Intel(R) Xeon(R) CPU E5- 2650 v2 @ 2.60 GHzSuper PI

 

計算時間越短越好

time echo "scale=500;4*a(1)" |bc -l -q3.141592653589793238462643383279502884197169399375105820974944592307 \81640628620899862803482534211706798214808651328230664709384460955058 \22317253594081284811174502841027019385211055596446229489549303819644 \28810975665933446128475648233786783165271201909145648566923460348610 \45432664821339360726024914127372458700660631558817488152092096282925 \40917153643678925903600113305305488204665213841469519415116094330572 \70365759591953092186117381932611793105118548074462379962749567351885 \75272489122793818301194912real 0 m0. 081 suser 0 m0. 076 ssys 0 m0. 000 sDisk清空緩衝

 

每次做讀寫測試前建議先清空緩衝

sync; echo 3 > /proc/sys/vm/drop_caches測試讀效能

 

選擇測試磁碟,建議做2-3組取平均值

hdparm -t /dev/sda/dev/sda:Timing buffered disk reads: 1074 MB in 3.00 seconds = 357.92 MB/sec測試寫入效能

 

根據業務選擇不同的BlockSize大小按需多次測試取平均值

time dd if =/dev/zero of=/tmp/speed bs= 1 M count= 2 K conv=fsync;rm /tmp/speed參考資料

 

以10,000 rpm 300 GB SAS硬碟為例,機型為IBM x3650 M4,Raid參數如下

1.Read Policy:Ahead (控制器緩衝讀策略:預讀)

2.Write Policy:Write Back with BBU(控制器緩衝寫策略:有電池備份時回寫)

3.IO Policy: Direct(IO策略:直接)

4.Drive Cache:disable (硬碟緩衝:禁用)

Raid Read(MB) Write(MB)
Raid 1 170 130
Raid 5 350 250
Raid 10 300 215
nmon

 

建議根據實際需求配置間隔時間和次數,配合 nmon Analyser 可以顯示直觀的圖表資料

#author: OX#function: monitor system information#time:2015/03/06#crontab -e#0 0 * * * sh /tmp/nmon/nmon.sh >/dev/null 2>&1npath=/tmp/nmon/log# monitoring per 120 senonds#nmon -s 120 -c 720 -f -m $npath# monitoring per 300 senonds/tmp/nmon/nmon_x86_sles11 -s 300 -c 288 -f -m $npath#delete file before 365 day#find /tmp -name *.nmon -mtime +365 -exec rm {} \;
  • 本文來自:Linux教程網

Linux效能測試實踐

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.