AirJD 焦点
AirJD

没有录音文件
00:00/00:00
加收藏

Ruby应用性能调优实践 by 李哲

发布者 ruby
发布于 1447808783462  浏览 5875 关键词 Ruby, 性能 
分享到

第1页

Ruby



- OneAPM 2015.10.10



第3页

: :



第5页

{}



第8页





第9页





第10页

• OneAPM







• 2015



C



• 350



• 200



• IT



?



第11页



• Java 2007 ~ 2010 • Ruby 2011 ~ Now • OneAPM - RubyAgent, Cloud

Insight • github.com/markgeek • douban.com/people/markgeek/



第12页

Rails



第13页

Rack



第14页

Ruby



第15页

Ruby



第16页

30%



第17页











第18页

Ruby

• 2000 • 300ms • < 150ms • 4 / 8core,8G • nginx, goliath, grape, redis



第21页

Ruby



第22页

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



第23页

http://tmm1.net/ruby21-rgengc



第24页

Ruby



第25页

• Benchmark • Profiling • Tracing • Debugging



第26页

Benchmark



第27页

benchmark, benchmark-ips



第28页

Profiling



第30页

RubyProf,StackProf



第31页

Tracing



第32页

rbtrace,allocation_tracer



第33页

benchmark



第34页

Ruby Performance



第35页

1.98 / 1.14 = 1.7368…



第37页

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



第42页

StackProf

• CPU



• middleware



第46页

rbtrace

• rbtrace -p <PID> —firehose • rbtrace -p <PID> —slow=<N> • rbtrace -p <PID> --methods "Kernel#sleep" “Proc#call" • rbtrace -p <PID> --gc



第47页

• fast-ruby • fasterer



第52页

http://rbkit.codemancers.com/



第53页

https://github.com/peek/peek-rblineprof



第54页

https://github.com/MiniProfiler/rack-mini-profiler



第55页

Dtrace / SystemTap



第57页

Ruby



第58页

“Super Dry Ruby”

– Yukihiro 'Matz' Matsumoto



第59页

https://www.youtube.com/watch?v=bqWBB8-iEac&list=PLE7tQUdRKcyZdMYKatu_nics8Pkjxl3-F



第61页

Application Performance Monitor or

Application Performance Management



第67页

• 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



第68页

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



第69页

2

• http://www.theirishpenguin.com/2009/10/29/understanding-how-ruby-storesobjects-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.1garbage-collector/



第70页

https://github.com/mattbaker/ruby-heap-viz



第71页

Q&A



支持文件格式:*.pdf
上传最后阶段需要进行在线转换,可能需要1~2分钟,请耐心等待。