日B视频 亚洲,啪啪啪网站一区二区,91色情精品久久,日日噜狠狠色综合久,超碰人妻少妇97在线,999青青视频,亚洲一区二卡,让本一区二区视频,日韩网站推荐

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

如何使用OFF-CPU火焰圖調(diào)查分析Linux性能問題概述

Linux閱碼場 ? 來源:未知 ? 2018-12-23 13:47 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

本文用off-cpu火焰圖分析一個程序的延遲(主要在拿鎖上),找出來瓶頸,并消除的故事。本文非常值得一讀,但是閱碼場沒有足夠的時間將其翻譯為中文,希望童鞋們直接讀英文。

The Setup

As a performance engineer at MemSQL, one of my primary responsibilities is to ensure that customer Proof of Concepts (POCs) run smoothly. I was recently asked to assist with a big POC, where I was surprised to encounter an uncommon Linux performance issue. I was running a synthetic workload of 16 threads (one for each CPU core). Each one simultaneously executed a very simple query (select count(*) from t where i > 5) against a columnstore table.

In theory, this ought to be a CPU bound operation since it would be reading from a file that was already in disk buffer cache. In practice, our cores were spending about 50% of their time idle

In this post, I’ll walk through some of the debugging techniques and reveal exactly how we reached resolution.

What were our threads doing?

After confirming that our workload was indeed using 16 threads, I looked at the state of our various threads. In every refresh of myhtopwindow, I saw that a handful of threads were in theDstate corresponding to “Uninterruptible sleep”:

Why were we going off CPU?

At this point, I generated anoff-cpu flamegraphusing Linuxperf_eventsto see why we entered this state.Off-CPUmeans that instead of looking at what is keeping the CPU busy, you look at what is preventing it from being busy by things happening elsewhere (e.g. waiting for IO or a lock). The normal way to generate these visualizations is to useperf inject -s, but the machine I tested on did not have a new enough version ofperf. Instead I had to use anawkscriptI had previously written:

$ sudoperfrecord --call-graph=fp -e 'sched:sched_switch' -e 'sched:sched_stat_sleep' -e 'sched:sched_stat_blocked' --pid $(pgrep memsqld | head -n 1) -- sleep 1

[ perf record: Woken up 1 times to write data ]

[ perf record: Captured and wrote 1.343 MB perf.data (~58684 samples) ]

$ sudoperfscript -f time,comm,pid,tid,event,ip,sym,dso,trace -i sched.data | ~/FlameGraph/stackcollapse-perf-sched.awk | ~/FlameGraph/flamegraph.pl --color=io --countname=us >off-cpu.svg

Note: recording scheduler events viaperf recordcan have a very large overhead and should be used cautiously in production environments. This is why I wrap theperf recordaround asleep 1to limit the duration.

In an off-cpu flamegraph, the width of a bar is proportional to the total time spent off cpu. Here we see a lot of time is spent inrwsem_down_write_failed.

From the repeated calls torwsem_down_read_failedandrwsem_down_write_failed, we see that culprit wasmmapcontending in the kernel on themm->mmap_semlock:

down_write(&mm->mmap_sem);

ret = do_mmap_pgoff(file, addr, len, prot, flag, pgoff,&populate);

up_write(&mm->mmap_sem);

This was causing everymmapsyscall to take 10-20ms (almost half the latency of the query itself). MemSQL was so fast that that we had inadvertently written a benchmark for Linuxmmap!

The fix was simple — we switched from usingmmapto using the traditional filereadinterface. After this change, we nearly doubled our throughput and became CPU bound as we expected:

For more information and discussion around Linux performance,check out the original post on my personal blog.

Download MemSQL Community Edition to run your own performance tests for free today:memsql.com/download

Alex Reece is a systems and performance engineer. He believes in active benchmarking, root cause analysis, and fast code.

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • cpu
    cpu
    +關(guān)注

    關(guān)注

    68

    文章

    11332

    瀏覽量

    225992
  • Linux
    +關(guān)注

    關(guān)注

    88

    文章

    11822

    瀏覽量

    219602
  • SQL
    SQL
    +關(guān)注

    關(guān)注

    1

    文章

    807

    瀏覽量

    46964

原文標題:用off-cpu火焰圖調(diào)查Linux性能問題

文章出處:【微信號:LinuxDev,微信公眾號:Linux閱碼場】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    Linux性能分析工具大全

    今天浩道跟大家分享關(guān)于linux性能分析過程中常用到的分析工具!
    發(fā)表于 01-05 09:52 ?1050次閱讀

    中國鋰離子電池原材料市場調(diào)查分析報告2008-2009版

    中國鋰離子電池原材料市場調(diào)查分析報告2008-2009版 詳細內(nèi)容請見:http://www.boomingfield.com/Html/yjxxcl/2008-9/18
    發(fā)表于 12-29 15:12

    _首屆中國嵌入式應用狀況_調(diào)查分析報告

    _首屆中國嵌入式應用狀況_調(diào)查分析報告
    發(fā)表于 08-20 14:48

    全志Tina中使用perf分析CPU使用率

    perf簡介Perf是是內(nèi)置于Linux內(nèi)核源碼樹中的性能剖析(profiling)工具。不僅可以用于應用程序的性能統(tǒng)計分析,還可以用于內(nèi)核的性能
    發(fā)表于 05-20 14:25

    火焰識別

    本人長期從事Linux系統(tǒng)的圖像處理產(chǎn)品研發(fā),近期在做火焰識別,火爐溫度控制,智能精準滅火,最近在用樹莓派,期待本產(chǎn)品有更好的性能,我希望可以有機會試用該開發(fā)版,體驗新產(chǎn)品的強大功能,同時及時反饋自己的用戶體驗,使雙方共贏。
    發(fā)表于 07-23 10:18

    Linux CPU性能應該如何優(yōu)化

    Linux系統(tǒng)中,由于成本的限制,往往會存在資源上的不足,例如 CPU、內(nèi)存、網(wǎng)絡、IO 性能。本文,就對 Linux 進程和 CPU
    的頭像 發(fā)表于 01-18 08:52 ?4343次閱讀

    疫情之下,中國LED顯示屏市場活力調(diào)查分析

    疫情之下,中國LED顯示屏市場活力調(diào)查分析 眾所周知市場活躍是行業(yè)發(fā)展的主要動力,而2020年初突如其來的疫情,給中國市場帶來了巨大的沖擊,LED顯示屏市場也不例外。而我們收到了行業(yè)多方面的市場反饋
    發(fā)表于 04-02 11:23 ?2173次閱讀

    火焰系列之使用火焰隱藏功能提高繪制精度

    我們可以看到,火焰顯示, func程序占用了近四分之一的CPU時間。但是由于我們把 func綁定在CPU0和1上執(zhí)行,根據(jù)小學數(shù)學我們應該可以計算出來 func最多占用 2/32=6
    的頭像 發(fā)表于 06-23 10:15 ?2596次閱讀
    <b class='flag-5'>火焰</b><b class='flag-5'>圖</b>系列之使用<b class='flag-5'>火焰</b><b class='flag-5'>圖</b>隱藏功能提高繪制精度

    火焰:全局視野的Linux性能剖析

    CPU火焰圖中的每一個方框是一個函數(shù),方框的長度,代表了它的執(zhí)行時間,所以越寬的函數(shù),執(zhí)行越久。火焰的樓層每高一層,就是更深一級的函數(shù)被調(diào)用,最頂層的函數(shù),是葉子函數(shù)。
    的頭像 發(fā)表于 06-28 09:44 ?2742次閱讀

    殺手級分析——bootchart

    之前小弟一直在宣傳推廣火焰,結(jié)果是很多童鞋凡事都用火焰。說實話,火焰特別適合
    的頭像 發(fā)表于 09-08 09:13 ?8750次閱讀
    殺手級<b class='flag-5'>分析</b>——bootchart

    基于linux eBPF的進程off-cpu的方法

    的swap等。如下圖所示,紅色部分屬于on-cpu部分,藍色部分屬于off-cpu。 一般我們用的perf命令等都是采樣on-cpu的指令進行CPU的消耗
    的頭像 發(fā)表于 09-25 15:41 ?4024次閱讀
    基于<b class='flag-5'>linux</b> eBPF的進程<b class='flag-5'>off-cpu</b>的方法

    Linux問題分析性能優(yōu)化

    文章來源于:https://mp.weixin.qq.com/s/d1NLXGp7teOgskussBXNMQ作者:alex目錄排查順序方法論性能分析工具CPU分析思路內(nèi)存
    的頭像 發(fā)表于 09-06 19:01 ?1655次閱讀
    <b class='flag-5'>Linux</b>問題<b class='flag-5'>分析</b>與<b class='flag-5'>性能</b>優(yōu)化

    Linux問題故障定位的小技巧

    a. on-CPU:執(zhí)行中,執(zhí)行中的時間通常又分為用戶態(tài)時間user和系統(tǒng)態(tài)時間sys。 b. off-CPU:等待下一輪上CPU,或者等待I/O、鎖、換頁等等,其狀態(tài)可以細分為可執(zhí)行、匿名換頁、睡眠、鎖、空閑等狀態(tài)。
    的頭像 發(fā)表于 07-09 16:30 ?930次閱讀
    <b class='flag-5'>Linux</b>問題故障定位的小技巧

    使用Arthas火焰工具的Java應用性能分析和優(yōu)化經(jīng)驗

    分享作者在使用Arthas火焰工具進行Java應用性能分析和優(yōu)化的經(jīng)驗。
    的頭像 發(fā)表于 10-28 09:27 ?2413次閱讀
    使用Arthas<b class='flag-5'>火焰</b><b class='flag-5'>圖</b>工具的Java應用<b class='flag-5'>性能</b><b class='flag-5'>分析</b>和優(yōu)化經(jīng)驗

    Linux性能分析實戰(zhàn):用trace揪出卡頓、高CPU的“真兇”

    Linux 開發(fā)或運維的你,是否常被這些問題困擾:服務突然卡頓卻找不到根源,CPU 占用率飆升但查不到 “罪魁禍首”,系統(tǒng)響應變慢卻摸不清瓶頸?其實,Linux 內(nèi)核早已為我們準備了 “透視鏡”——trace 跟蹤技術(shù),今天
    的頭像 發(fā)表于 02-03 15:24 ?646次閱讀
    <b class='flag-5'>Linux</b><b class='flag-5'>性能</b><b class='flag-5'>分析</b>實戰(zhàn):用trace揪出卡頓、高<b class='flag-5'>CPU</b>的“真兇”
    池州市| 祁阳县| 蒙山县| 隆子县| 云林县| 漾濞| 明星| 环江| 潞西市| 皋兰县| 社会| 普宁市| 田东县| 准格尔旗| 侯马市| 巴楚县| 洛阳市| 格尔木市| 宁国市| 恭城| 营口市| 仙居县| 民权县| 阳东县| 射洪县| 墨脱县| 铜川市| 沙湾县| 南投县| 噶尔县| 房产| 仲巴县| 宜昌市| 赣榆县| 化州市| 平阳县| 乌海市| 富民县| 河池市| 绥阳县| 天长市|