why MLC
影響程式性能的兩個重要因素:
①應用程式從處理器快取和從記憶體子系統獲取資料所消耗的時間,其中存在各種延遲;
②帶寬b/w(bandwidth 非Bilibili World)
mlc正是做這個的
測驗內容
Node訪問速度
在NUMA(Non-Uniform Memory Access 非一致性記憶體訪問)構架下,不同的記憶體器件和CPU核心從屬不同的 Node,每個 Node 都有自己的集成記憶體控制器(IMC,Integrated Memory Controller),解決了“每個處理器共享相同的地址空間問題”,避免總線帶寬,記憶體沖突問題,
(補充:core=物理cpu,獨立的物理執行單元;thread=邏輯cpu,執行緒
socket = node 相當于主板上的cpu插槽,node內部,不同核心間使用IMC Bus通信;不同node間通過QPI(Quick Path Interconnect)進行通信
同城速達的速度肯定與國際郵件不同,所以QPI(remote)延遲明顯高于IMC Bus(local)
測驗樣例:
查詢記憶體訪問延遲 指令
./mlc --latency_matrix
結果
Numa node
Numa node 0 1
0 82.2 129.6
1 131.1 81.6
表示node之間/內部的空閑記憶體訪問延遲矩陣,以ns為單位
帶寬
帶寬反映了單位時間的傳輸速率馬路越寬,就不會堵車了,帶寬反映了單位時間的傳輸速率
Measuring Peak Injection Memory Bandwidths for the system Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec) Using all the threads from each core if Hyper-threading is enabled Using traffic with the following read-write ratios ALL Reads : 69143.9 3:1 Reads-Writes : 61908.4 2:1 Reads-Writes : 60040.5 1:1 Reads-Writes : 54517.6 Stream-triad like: 57473.4
r:w 表示不同讀寫比下的記憶體帶寬
一般情況下,記憶體的寫速度慢于讀取速度(Talk is easy, show me the CODE)
所以當讀寫比下降時,帶寬會下降(路窄了,塞車了)
問題分析:如果帶寬急劇下降,可能是寫入程式增多;或者是寫入程式出問題,速度太慢了
測驗樣例
查詢存訪問帶寬 指令(單獨判斷numa節點間記憶體訪問是否正常還可以使用 )
./mlc --bandwidth_matrix
結果
Measuring Memory Bandwidths between nodes within system
Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec)
Using all the threads from each core if Hyper-threading is enabled
Using Read-only traffic type
Numa node
Numa node 0 1
0 35216.6 32537.9
1 31875.1 35048.5
問題分析:如果副對角線數值相差過大,表明兩個node相互訪問的帶寬差距較大
解決方法:出現不平衡的時候一般從記憶體插法、記憶體是否故障以及numa平衡等角度進行排查
記憶體訪問帶寬和記憶體延遲的關系(讀操作)
Measuring Loaded Latencies for the system Using all the threads from each core if Hyper-threading is enabled Using Read-only traffic type Inject Latency Bandwidth Delay (ns) MB/sec ========================== 00000 523.74 69057.4 00002 589.55 68668.7 00008 686.99 68571.4 00015 549.87 68873.6 00050 575.48 68673.0 00100 524.74 68877.5 00200 197.61 64225.8 00300 131.60 47141.0 00400 110.39 36803.0 00500 117.32 30135.2 00700 100.90 22179.1 01000 100.93 15762.8 01300 91.74 12351.6 01700 98.61 9475.2 02500 86.66 6927.8 03500 88.13 5132.6 05000 87.68 3818.6 09000 85.36 2473.5 20000 84.83 1538.7
可以觀察記憶體在負載壓力下的回應變化,以及是否在到達一定帶寬時,出現不可接受的記憶體回應時間
測量CPU cache到CPU cache之間的訪問延遲
Measuring cache-to-cache transfer latency (in ns)...
Local Socket L2->L2 HIT latency 38.6
Local Socket L2->L2 HITM latency 43.6
Remote Socket L2->L2 HITM latency (data address homed in writer socket)
Reader Socket
Writer Socket 0 1
0 - 133.4
1 133.7 -
Remote Socket L2->L2 HITM latency (data address homed in reader socket)
Reader Socket
Writer Socket 0 1
0 - 133.5
1 133.7 -
峰值帶寬
指令
mlc --peak_bandwidth
結果
Using buffer size of 100.000MB/thread for reads and an additional 100.000MB/thread for writes Measuring Peak Memory Bandwidths for the system Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec) Using all the threads from each core if Hyper-threading is enabled Using traffic with the following read-write ratios ALL Reads : 50035.2 3:1 Reads-Writes : 48119.3 2:1 Reads-Writes : 47434.3 1:1 Reads-Writes : 48325.5 Stream-triad like: 44029.0
空閑記憶體延遲
指令
mlc --idle_latency
結果
Using buffer size of 200.000MB Each iteration took 260.5 core clocks ( 113.3 ns)
有負載記憶體延時
指令
mlc --loaded_latency
結果
Using buffer size of 100.000MB/thread for reads and an additional 100.000MB/thread for writes Measuring Loaded Latencies for the system Using all the threads from each core if Hyper-threading is enabled Using Read-only traffic type Inject Latency Bandwidth Delay (ns) MB/sec ========================== 00000 217.32 49703.4 00002 258.98 49482.4 00008 217.48 49908.1 00015 220.12 49973.7 00050 206.33 49185.7 00100 174.02 43811.8 00200 141.63 27651.1 00300 130.65 19614.6 00400 126.05 15217.0 00500 122.70 12506.0 00700 121.46 9253.0 01000 120.55 6690.6 01300 118.75 5314.9 01700 120.18 4148.7 02500 119.53 3055.7 03500 119.60 2349.4 05000 116.60 1816.9 09000 116.17 1257.8 20000 116.87 867.6
其余操作(未完待續
-
測量指定node之間的訪問延遲
-
測量CPU cache的訪問延遲
-
測量cores/Socket的指定子集內的訪問帶寬
-
測量不同讀寫比下的帶寬
-
指定隨機的訪問模式以替換默認的順序模式進行測量
-
指定測驗時的步幅
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/356956.html
標籤:其他
上一篇:原生微信小程式開發
下一篇:Wireshark找不到網卡
