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
610
Ruby应用性能调优实践
了解Ruby的性能调优关键,以及都有哪些工具可以利用
Li Zhe
October 12, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
Result型で“失敗”を型にするPHPコードの書き方
kajitack
5
590
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
620
Goで作る、開発・CI環境
sin392
0
200
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
1
9.2k
RailsGirls IZUMO スポンサーLT
16bitidol
0
160
プロダクト志向なエンジニアがもう一歩先の価値を目指すために意識したこと
nealle
0
120
ニーリーにおけるプロダクトエンジニア
nealle
0
760
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
540
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
190
Team operations that are not burdened by SRE
kazatohiei
1
300
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
130
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
150
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
Site-Speed That Sticks
csswizardry
10
680
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.4k
Why Our Code Smells
bkeepers
PRO
337
57k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
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