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
Ruby应用性能调优实践
Search
Li Zhe
October 12, 2015
Programming
10
590
Ruby应用性能调优实践
了解Ruby的性能调优关键,以及都有哪些工具可以利用
Li Zhe
October 12, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
CSC307 Lecture 12
javiergs
PRO
0
220
OpenAI/Gemini APIを使って EPUBを翻訳するCLIツールをつくってみた
tomiyan
0
790
Android開発者のための Kotlin Multiplatform入門
ntaro
0
190
初心者がおさえておきたいAWS CDKのベストプラクティス 2024
konokenj
15
7.3k
AHC035解説
terryu16
0
710
Exploring the Gradually Lost Technical Skills in the Cloud Native Era
hwchiu
2
3.9k
TiDB Serverless ~理想のServerless DBを考える~
soso_15315
1
160
日付と正規化
megmogmog1965
0
140
Activities at Cairo Library
cairolibrary720
0
1.2k
CSC307 Lecture 06
javiergs
PRO
0
360
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
220
さきがけから振り返るアーキテクチャ刷新 / Reflecting on the Architectural Renewal from the Vanguard
nrslib
2
770
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
18
1.2k
What the flash - Photography Introduction
edds
65
11k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
How To Stay Up To Date on Web Technology
chriscoyier
784
250k
Music & Morning Musume
bryan
43
5.9k
Design by the Numbers
sachag
277
18k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Leading Effective Engineering Teams 2024
addyosmani
3
300
Fashionably flexible responsive web design (full day workshop)
malarkey
399
65k
Automating Front-end Workflow
addyosmani
1362
200k
WebSockets: Embracing the real-time Web
robhawkes
59
7.2k
Transcript
Rubyଫአᚆ᧣սਫ᪢ ߽ - OneAPM 2015.10.10
ञฎՋԍҘ
ञ: ݰԧ੪ : ݰԧ੪ݺ
֦మݰᗤᶟҘ ඓԀஞހҘ ౯݄ԧᬟѺ
ڹݶԪ { ڹݶԪ }
ӳ۹Ոࣁଠ
ৼ֯Ո
۹Ղཛྷୗސ …
ํᅩᔲୟ …
౯ժฎଗՋԍጱ? • OneAPM • ᚆፊഴଘݣ • 2015ଙڡਠ౮Cᣟᩒ • 350Ո •
ᬪ200ՈฎᎸݎ • قࢵԆᥝITउ૱᮷ํړلݪېԪ॒
౯ฎ᧡Ҙ • ߽ • Java 2007 ~ 2010 • Ruby
2011 ~ Now • ፓڹ੪ᘳOneAPM - RubyAgent, Cloud Insight • github.com/markgeek • douban.com/people/markgeek/
౯ժᘱᘱRails ౌ ᬯկԪ
ᘏฎRack ౌ ᬯկԪ
ٌਫฎRuby ౌ ᬯկԪ
֦ᦊԅRubyౌހҘ ౌጱᤒሿฎՋԍҘ ፥ጱฎ᭜౮ጱހҘ ᦶ፳አૡٍ༄ၥᬦހҘ
30%զӤጱౌฎຝӤ᧣սጱ
– ӧᎣ᭲ฎ᧡᧔ጱ “ᑕଧާ᮷ฎࡅෛܵ෯ጱਹվ̶”
ӞӻRubyଫአ • 2000ଚݎ • क़᮱ߥଫᳵ300ms • ଫአߥଫᳵ < 150ms •
4ݣԆ / 8core,8G • nginx, goliath, grape, redis
None
None
፡፡RubyጱचᏐܲݥ
RubyVMጱݎܲݥ • 1.9 Koichi Sasada : YARV • 1.9 Narihiro
Nakamura ғLazySweep • 2.0 Narihiro Nakamura ғBitmap Marking GC • 2.1 Koichi Sasada ғGenerational Collector • 2.2 Koichi Sasada ғIncremental Generational Collector
http://tmm1.net/ruby21-rgengc
Rubyጱᬩᤈ᭛ଶӞፗࣁ܋
ӞԶच༷ஷ • Benchmark • Profiling • Tracing • Debugging
Benchmarkғ᪒ړ
benchmark, benchmark-ips
Profilingғᦕ୯ᬩᤈמ௳
None
RubyProf,StackProf
Tracingғᦕ୯ොဩ᧣አמ௳
rbtrace,allocation_tracer
Ӟӻੜጱbenchmark
Ruby Performance
1.98 / 1.14 = 1.7368…
None
RubyProf • flat - Prints a flat profile as text
(default). • dot - Prints a graph profile as a dot file • call_stack - prints a HTML visualization of the call tree • call_tree - format for KCacheGrind
None
None
None
None
StackProf • CPUཛྷୗ • ړᯈཛྷୗ • middlewareཛྷୗ
None
None
None
rbtrace • rbtrace -p <PID> —firehose • rbtrace -p <PID>
—slow=<N> • rbtrace -p <PID> --methods "Kernel#sleep" “Proc#call" • rbtrace -p <PID> --gc
Ꮯਧኒ᷀ԏݸ • fast-ruby • fasterer
Ӟӻਫᴬጱֺৼ
None
None
ݚक़ጱӞԶૡٍ
http://rbkit.codemancers.com/
https://github.com/peek/peek-rblineprof
https://github.com/MiniProfiler/rack-mini-profiler
ইຎ֦ବ੶உఽي᪁ Dtrace / SystemTap
ݳᭇጱૡٍ؉ݳᭇጱૡ֢
Rubyਖ਼տᬩᤈጱๅள
– Yukihiro 'Matz' Matsumoto “Super Dry Ruby”
https://www.youtube.com/watch?v=bqWBB8-iEac&list=PLE7tQUdRKcyZdMYKatu_nics8Pkjxl3-F
ই֜೮ᖅጱፊഴଫአ ጱᚆᳯ᷌
Application Performance Monitor or Application Performance Management
None
None
ӧՐՐฎᬯԶ
None
None
რᩒრ • https://github.com/JuanitoFatas/fast-ruby • https://github.com/DamirSvrtan/fasterer • https://github.com/schneems/derailed_benchmarks • https://github.com/change/method_profiler •
https://github.com/schneems/heapy • https://github.com/peek/peek-rblineprof • https://github.com/tmm1/rblineprof
݇ᘍᩒා1 • https://engineering.heroku.com/blogs/2015-02-04-incremental-gc/ • http://tmm1.net/ruby21-rgengc/ • https://www.youtube.com/watch?v=nRehkd22j78&spfreload=10 • https://avsej.net/2012/systemtap-and-ruby-20/ •
https://www.shopify.com/technology/16777156-tuning-rubys-global-method-cache • https://www.youtube.com/watch?v=pZ_BcEcFGj0 • http://www.atdot.net/~ko1/activities/2015_railsconf.pdf • http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc
݇ᘍᩒා2 • http://www.theirishpenguin.com/2009/10/29/understanding-how-ruby-stores- objects-in-memory-the-ruby-heap.html • http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc • http://thorstenball.com/blog/2014/03/12/watching-understanding-ruby-2.1- garbage-collector/
https://github.com/mattbaker/ruby-heap-viz
ᨀᨀ Q&A