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
580
Ruby应用性能调优实践
了解Ruby的性能调优关键,以及都有哪些工具可以利用
Li Zhe
October 12, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
Netty Chicago Java User Group 2024-04-17
sullis
0
180
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
雑に思考を整理する技術と効能
konifar
60
29k
使ってみよう Azure AI Document Intelligence
kosmosebi
2
320
Fast JSX: Don't clone props object #28768
yossydev
1
120
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
810
Node.js v22 で変わること
yosuke_furukawa
PRO
9
3.5k
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
27
8.3k
Git Lint
bkuhlmann
4
750
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.1k
Goのmultiple errorsについて (2024年4月版)
syumai
4
910
Featured
See All Featured
The Brand Is Dead. Long Live the Brand.
mthomps
49
29k
What's in a price? How to price your products and services
michaelherold
237
11k
The Cult of Friendly URLs
andyhume
74
5.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Unsuck your backbone
ammeep
663
57k
[RailsConf 2023] Rails as a piece of cake
palkan
23
4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
The Pragmatic Product Professional
lauravandoore
25
5.8k
Fireside Chat
paigeccino
21
2.6k
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