Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Linuxコマンドでボトルネックを調べる
Search
Kazuhiko Yamashita
March 20, 2018
Technology
17
8.9k
Linuxコマンドでボトルネックを調べる
俺の話を聞け!!LT大会 #8でトークした資料です
Kazuhiko Yamashita
March 20, 2018
Tweet
Share
More Decks by Kazuhiko Yamashita
See All by Kazuhiko Yamashita
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.4k
Tuning GraphQL on Rails
pyama86
2
1.5k
ttlcacheのここがスゴい
pyama86
1
91
クラウドサービスの 利用コストを削減する技術 - 円安の真南風を感じて -
pyama86
3
510
実践ARMアーキテクチャ移行
pyama86
2
2.3k
リモートワーク時代の守護神 PHP開発者のためのセキュリティ強化術
pyama86
3
1.1k
実践DevSecOps~クラウドネイティブとオンプレミスの間から~
pyama86
1
78
ペパボOpenTelemetry革命
pyama86
2
2.1k
Site Reliability Engineering for GMO
pyama86
10
1.3k
Other Decks in Technology
See All in Technology
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
1
4.8k
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
5
320
ガバナンスを支える新サービス / New Services to Support Governance
sejima1105
1
600
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
260
20240513 - 框裡框外_文學院學生如何在AI世代安身立命 @ 淡江大學
dpys
0
450
TypeScript開発にモジュラーモノリスを持ち込む
sansantech
PRO
3
780
Web APIをなぜつくるのか
mikanichinose
0
950
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
190
AWS re:Invent 2024 recap
hkoketsu
0
610
Wantedly での Datadog 活用事例
bgpat
2
920
Working as a Server-side Engineer at LY Corporation
lycorp_recruit_jp
0
460
Google Cloud で始める Cloud Run 〜AWSとの比較と実例デモで解説〜
risatube
PRO
0
120
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
The Language of Interfaces
destraynor
155
24k
Making the Leap to Tech Lead
cromwellryan
133
9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
How to Ace a Technical Interview
jacobian
276
23k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
BBQ
matthewcrist
85
9.4k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Why Our Code Smells
bkeepers
PRO
335
57k
Writing Fast Ruby
sferik
628
61k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
97
17k
Transcript
ʙय़ͩʂՖคͩʂ-5େձͩ͊͊͊͋͋͋͋ʂʂʂ̍ʙ !QZBNB(.01FQBCP *OD ԶͷΛฉ͚ʂʂ-5େձ -JOVYίϚϯυͰϘτϧωοΫ ΛௐΔ
ϗεςΟϯάࣄۀ෦νʔϑςΫχΧϧϦʔυ ࢁԼ!QZBNB
ϖύϘԬ
αʔόαΠυɺϑϩϯτΤϯυɺ ΠϯϑϥΤϯδχΞશһདྷͯ͘Εʂʂʂʂ̍ ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU
Ϙτϧωο Ϋௐࠪ
ʮͳΜ͔Θ͔ΒΜ͚Ͳɺ Կ͔͕ͯ͘ ॲཧ͕ॏ͍ʯ
಄ѱͦ͏
ύϑΥʔϚϯεղੳʹ ͍͔ͭ͘ͷखஈ͕͋Δ
ͳΜ͔͍͍ͩͨͲͷձࣾʹ͍Δ͍͢͝ਓʹฉ͘ w͍͢͝ਓʹฉ͘ͱɺ͍͍ͩͨղܾͯ͘͠ΕΔ w͍͢͝ਓ͍͢͝ͷͰɺͦͷͰΘ͔Βͳͯ͘ɺ͍͍ͩͨ࣍ͷʹ ʮࡢͷ͋ΕΘ͔ͬͨΑʂʂʂʯͱ͔ௐ͖ͯͯ͘ΕΔ w͍͢͝ਓʹฉ͘ͱɺ͍͢͝ਓ͕ؤுΔ͚ͩͰɺ͕ࣗؤுΒͳ͍͔Β ͕ࣗ͠ͳ͍
ϓϩϑΝΠϦϯά wIUUQTHJUIVCDPNUNNTUBDLQSPG ݴޠ໊ϓϩϑΝΠϥ<ݕࡧ>
-JOVYͷίϚϯυͰௐΔ wHEC5IF(/6%FCVHHFS wTUSBDF5SBDFTZTUFNDBMMTBOETJHOBMT wQFSG1FSGPSNBODFBOBMZTJTUPPMTGPS-JOVY wWBMHSJOEBTVJUFPGUPPMTGPSEFCVHHJOHBOEQSPpMJOHQSPHSBNT
ࣄྫ
NSVCZͷ"1*ΞΫηε͕ NSVCZ DMJFOU "1*4FSWFS SFTPVSDFFYBNQMF NSVCZͷ$MJFOU͔Β͋Δ"1*Λ࣮ߦͯ͠ .#ͷϨεϙϯεΛऔಘ͢Δ߹ +40/
ࣄྫ ॠؒతʹ(CZUF͘Β͍ ϝϞϦ͏
WBMHSJOEͰϝϞϦͷΞϩέʔγϣϯΛݟΔ # valgrind curl http://localhost/resource/example > /dev/null … ==18619== HEAP
SUMMARY: ==18619== in use at exit: 0 bytes in 0 blocks ==18619== total heap usage: 1,863 allocs, 1,863 frees, 211,125 bytes allocated # valgrind /home/pyama/mruby test.rb … ==12811== HEAP SUMMARY: ==12811== in use at exit: 0 bytes in 0 blocks ==12811== total heap usage: 51,721 allocs, 51,721 frees, 12,028,345,116 bytes allocated
ʗ ?P? ʘ(
TUSBDFͰγεςϜίʔϧͷ౷ܭΛऔΔ # strace -fc /home/pyama/mruby test.rb % time seconds usecs/call
calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 73.00 0.006317 2 3361 munmap 23.27 0.002014 11 183 brk 2.62 0.000227 0 1734 read 1.11 0.000096 0 3380 mmap 0.00 0.000000 0 3 write 0.00 0.000000 0 16 open 0.00 0.000000 0 23 close NVONBQ͕ࢧత IUUQTMJOVYKNPTEOKQIUNM-%1@NBOQBHFTNBONNBQIUNM
QFSGΛར༻ͯ͠ίʔϧάϥϑΛऔಘ͢Δ IUUQNSVCZPSHEPDTBQJIFBEFSTNSVCZ@'TUSJOHIIUNMNSC@TUS@QMVTGVODUJPO # perf record --call-graph dwarf -- /home/pyama/mruby test.rb
# perf report -g -G —stdio 94.35% 0.03% mruby mruby [.] mrb_str_plus | ---mrb_str_plus | --20.06%-- mrb_vm_exec mrb_vm_run … NSC@TUS@QMVT͕ࢧత
ใ͔ΒԾઆΛཱͯΔ wॲཧ)551ϦΫΤετͰϨεϙϯεϘσΟαΠζ͕େ͖͍ wϝϞϦ(#ͬͯΔΦϫλ wNVONBQ͕ࢧతͰճଟ͍͜ͱ͔ΒɺϝϞϦͷ֬อɺղ์͕ଟ ͍ͷͰͳ͍͔ʁ wNSC@TUS@QMVT͕ࢧతͰ͋Δ͜ͱ͔Βɺจࣈྻ݁߹͕ଟ͍͜ͱ͕ݪ ҼͬΆ͍ͳʁ NSC@TUS@QMVTSVCZFbDlBz lCz`
ΧΫΧΫ γΧδΧ
ݪҼ)551ϦΫΤετͷόοϑΝαΠζ IUUQTHJUIVCDPNNBUTVNPUPSZNSVCZTJNQMFIUUQQVMM NSVCZ DMJFOU "1*4FSWFS SFTPVSDFFYBNQMF +40/ ιέοτ͔Β+40/Λड͚औΔࡍͷόοϑΝαΠζ͕CZUFͰ͋ͬͨ͜ͱ͔Βɺ ಡࠐͷϧʔϓճ͕ଟ͘ͳ͍ͬͯͨɻόοϑΝͷαΠζΛCZUFมߋ͢Δ͜ͱͰ ݁Ռͱͯ͠ϧʔϓճΛݮΒͯ͠จࣈྻ݁߹ͷճΛݮΒͨ͠
NSVCZTJNQMFIUUQ while (t = socket.read(1024)) if block_given? yield t next
end ɹ #όοϑΝ͕গͳ͍ͱϧʔϓճ͕૿͑ͯɺ݁߹ճ͕૿͑ͯແବʹϝϞϦ֬อ response_text += t end ͔͠ɺ($͕Δ·Ͱ։์͞Εͳ͍
͏Ұา ౿ΈࠐΉ
NSC@TUS@QMVT NSVCZͰจࣈྻ݁߹ͷࡍʹ݁߹݁Ռจࣈྻͷ ϝϞϦΛ֬อ͢Δ
NSVCZTJNQMFIUUQ while (t = socket.read(1024)) if block_given? yield t next
end response_text << t end ͞ΒʹDPODBUʹ͢Δ͜ͱͰɺແବͳྖҬ֬อΛΊΔ
NSC@TUS@QMVT74NSC@TUS@DBU TUSJOHlBCz TUSJOHlBz TUSJOHlCz TUSJOHlBz TUSJOHlCz TUSJOHlBz TUSJOHlCz
TUSJOHlBCz
IUUQTUFOTOBQPODPNBSDIJWFT
·ͱΊ wϓϩϑΝΠϥίϚϯυΛར༻ͯ͠ใΛूΊΑ͏ wूΊͨใ͔ΒԾઆΛཱͯΑ͏ wԾઆΛݕূ͠Α͏ wσόοάίʔυͰ͋Ε͜Εࢼ͢ wਂ͘ίʔυΛಡΉɺ࣮ʹഭΔ
5IBOLZPV ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU