Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CPUの基本的な性能指標
Search
Satoru Takeuchi
PRO
August 15, 2020
Technology
330
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CPUの基本的な性能指標
以下動画のテキストです
https://youtu.be/1pyzZQLxzv8
Satoru Takeuchi
PRO
August 15, 2020
Transcript
10 slides
CPUの基本的な性能指標 Aug 15th, 2020 Satoru Takeuchi Twitter: satoru_takeuchi, EnSatoru 1
性能指標を計るコマンド • sarコマンド ◦ Sysstatパッケージに入っている • 使い方 ◦ sar 1:
一秒ごとにCPUが何をしているのかを表示。全 CPUの平均値を出す ◦ sar -P ALL 1: 一秒ごとに全CPUの平均値、および各 CPUの値を出す ◦ sar -P 0 1: 一秒ごとにCPU0が何をしているのかを表示 • オプションを付けると別種のメトリクスも得られる ◦ メモリ ◦ ストレージI/O ◦ ネットワークI/O 2
数値の意味がわからん! $ sar -P 0 1 ... 06:13:58 AM CPU
%user %nice %system %iowait %steal %idle 06:13:59 AM 0 0.00 0.00 0.00 0.00 0.00 100.00 こいつらの意味は何 ? 順番に説明します %stealは今回は省略 3
%idle • 単純に何もしてない ◦ どんなプロセスも動いていないしカーネルも仕事していないし I/Oもしてない 06:13:58 AM CPU %user
%nice %system %iowait %steal %idle 06:13:59 AM 0 0.00 0.00 0.00 0.00 0.00 100.00 4
%user • プロセスが動いている • 演習: 無限ループプログラムを動かす ◦ taskset -c 0
./loop 06:20:34 AM CPU %user %nice %system %iowait %steal %idle 06:20:35 AM 0 100.00 0.00 0.00 0.00 0.00 0.00 5
%nice • syscallやnice/reniceコマンドで優先度を下げたプロセスが動作中 ◦ 優先度を上げたプログラムは %userにカウントされる • 演習: nice値を正の数にして(優先度を下げて)無限ループプログラムを実行 ◦
sudo taskset -c 0 nice -n 1 ./loop 06:27:23 AM CPU %user %nice %system %iowait %steal %idle 06:27:24 AM 0 0.00 100.00 0.00 0.00 0.00 0.00 6
%system • カーネルが動作中 • 演習: 無限ループ中にgetppid() syscallを呼び続けるプログラムを動かす ◦ taskset -c
0 ./ppidloop 06:29:42 AM CPU %user %nice %system %iowait %steal %idle 06:29:43 AM 0 62.63 0.00 37.37 0.00 0.00 0.00 getppid()を囲むループ処理 getppid()処理 7
%iowait • CPUはidle、かつ、CPU上のプロセスが依頼したストレージI/O実行中 • 演習: idleのCPU上でI/Oをし続ける ◦ for ((;;)) ;
do taskset -c 0 dd if=/dev/zero of=test.img bs=1M count=1K oflag=direct; done 06:37:52 AM CPU %user %nice %system %iowait %steal %idle 06:37:53 AM 0 0.00 0.00 20.75 24.53 0.00 54.72 I/O処理を囲むループ処理 カーネルのI/O処理 CPUは何もせずI/O待ち 8
%iowaitの罠 • CPUが何かしてる時にI/O中でも%iowaitにならない ◦ 〇: %iowaitが0ではない⇒I/Oが発生している ◦ ×: %iowaitが0⇒I/Oが発生していない •
演習: ./loopを実行しているCPU上で前述のI/Oを出すプログラムを動かす 06:43:01 AM CPU %user %nice %system %iowait %steal %idle 06:43:02 AM 0 80.81 0.00 19.19 0.00 0.00 0.00 ./loopの処理など カーネルのI/O処理 I/O中でもCPUが仕事してるので0.00 9
まとめ • sarコマンドが出すCPUについてのメトリクスについて学んだ • %iowaitは罠 10
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
Btrfsのsnapshotとランダム書き込み
sat
PRO
0
51
ファイルシステムのデフラグ
sat
PRO
1
58
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
130
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
90
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
120
あなたの知らないバージョン命名規則
sat
PRO
3
940
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
87
Machine Check Exception
sat
PRO
2
78
バイナリダンプの模様を読む
sat
PRO
0
120
Other Decks in Technology
See All in Technology
共通基盤の実装に Kotlin - Quarkus を選定した理由と採用したアーキテクチャ
nealle
1
150
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
240
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
7
5.9k
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
440
Terraform 0 to 100:100個以上のリポジトリを常に最新にし続けるための自動化
sue445
2
1.2k
AI×アジャイルで、石橋を高速で叩きながら渡る~電力会社がゼロから築いた会員サイト改善プロセス~ / 20261112 Ayami Kanazawa & Shigeru Hirai
shift_evolve
PRO
1
100
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
1.2k
E2E Test というハーネス — AI時代の自動テスト民主化
daishukojima
10
5.9k
WasmをRustにする技術
sansantech
PRO
1
130
メルカリの小規模チーム「Pod」で、 エンジニアがデータアナリストなしで、 AIを使ってデータ分析の自走を目指す取り組み
jackojacko_
0
280
2026-11-16 JAWS-UG コンテナ支部 #31 ゆるLT大会 ECR のライフサイクルポリシーを いい感じに設定したい / ECR Lifecycle policy
masasuzu
3
580
cdkdがどんだけ早いか、実際に動かして見てみよう
smt7174
1
130
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
The Language of Interfaces
destraynor
162
27k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Scaling GitHub
holman
464
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Paper Plane (Part 1)
katiecoart
PRO
3
12k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
Thoughts on Productivity
jonyablonski
76
5.5k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Paper Plane
katiecoart
PRO
6
55k