• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Rails Hardware (no conclusions!)
 

Rails Hardware (no conclusions!)

on

  • 265 views

 

Statistics

Views

Total Views
265
Views on SlideShare
265
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • simplest of all, but it does not tell the whole story\n
  • This is where cloud infrastructure may seem inferior.\n
  • \n
  • you should benchmark representative code to be relevant, not calculating Pi\n
  • \n
  • (and less frequently too)\n
  • What’s the word on tweaking GC in ruby 1.9?\n
  • free + lots of promo codes\nyou want to track queueing time as well \nUse REE to get GC info\nOutlier requests analysis is not so useful, to me it always happens during the times of I/O shortage, not CPU shortage\nAn opportunity to create a more focused service\nRecall cloud hosting\n\nIn real application, there may be no single point responsible for the slowdown\n"Death by a thousand cuts" is the toughest one to combat\nExcept we can jump to the latests CPUs\nTurbo boost, eh? Perhaps underutilized Xeons are the way to go to get the absolute max\nA particular problem with Rails 3 where middleware is slightly slower, activerecord is slightly slower, who knows what else slightly slower\nThis is what the adoption rate slow\nView helpers are slow when there are many of them\nSerialization is slow\nHappens when loading structured data from memcached\nLoad strings?\n
  • \n
  • Why Basecamp feels sluggish\nWhy Rails 3 is adopted slowly\nWhy streaming in Rails 3.1 may change the game\n
  • \n
  • Chances are, you will be loading a single core\nYou need fastest startup time - running rake tasks, tests, generators, console, restarting the server\nThe way rubygems are written, every 'require' inspects LOADPATH\nRuby 1.9.2 is not that good for fast startups\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Rails Hardware (no conclusions!) Rails Hardware (no conclusions!) Presentation Transcript

  • You need differentkinds of performance
  • You need differentkinds of performanceProduction
  • You need different kinds of performanceProductionDevelopment
  • Production
  • core 1core 2core 3core 4 … timecore time
  • core 1core 2core 3core 4 … timecore time
  • core 1core 2core 3 8core 4 … timecore 5 time
  • Great max RPM == high performance?
  • 100 ppl x 60 km/hEconomical and efficient
  • User cares about performance of HIS request only 1 x 300 km/h
  • …especially in ruby Time, s C GNU gcc 1.07 Java 6 -server 1.55 Haskell GHC 2.16 Scala 2.22 Lisp SBCL 2.67 C# Mono 2.95 OCaml 3.35 Clojure 5.32 Erlang HiPE 13.17 Python 3 28.07 Ruby 1.9 65.14by http://shootout.alioth.debian.org Computer Language Benchmarks Game  
  • Garbage collection (GC)core 1core 2core 3core 4 … time Actual productive work
  • Ideally, GC should occur between requests (during idle time)core 1core 2core 3core 4 … time what USER cares about
  • Tweaking GC results in… 30%–50% better throughput AND response timeshttp://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning
  • http://rpm.newrelic.com
  • Roundtrip to Moscow 50ms… Europe +100ms… US +100ms
  • In development
  • In developmentYou reinitialize Rails stack frequentlyYou use a single CPU core most of the time
  • In developmentYou reinitialize Rails stack frequently(unless using Spork etc)You use a single CPU core most of the time
  • In developmentYou reinitialize Rails stack frequently(unless using Spork etc)You use a single CPU core most of the time(unless using parallel_specs, hydra etc)
  • Rails’ own test suite
  • Rails’ own test suite~% git clone git://github.com/rails/rails.gitCloning into rails...~% cd rails~/rails[master]% git checkout v3.0.7Note: checking out v3.0.7.…HEAD is now at 2c32601... bumping version for release~/tmp/rails[tag: v3.0.7]% bundle installFetching source index for http://rubygems.org/…Your bundle is complete! Use `bundle show [gemname]` to see where abundled gem is installed.~/tmp/rails[tag: v3.0.7]% time bundle exec rake test | tee out.txt 2>&1
  • MySQL 5.5 PostgreSQL 9 SQLite 3.6.16+ memcachedmysql2 gem 0.2.x (not 0.3.x) …
  • ~/rails[tag: v3.0.7]% cat out.txt| grep errors2294 tests, 9629 assertions, 0 failures, 0 errors419 tests, 1171 assertions, 0 failures, 0 errors2981 tests, 12075 assertions, 0 failures, 0 errors72 tests, 142 assertions, 0 failures, 0 errors200 tests, 515 assertions, 0 failures, 0 errors273 tests, 773 assertions, 0 failures, 0 errors2483 tests, 7646 assertions, 0 failures, 0 errors2471 tests, 7634 assertions, 0 failures, 0 errors2443 tests, 7555 assertions, 0 failures, 0 errors2522 tests, 7865 assertions, 0 failures, 0 errors28 tests, 33 assertions, 0 failures, 0 errors6 tests, 15 assertions, 0 failures, 0 errors7 tests, 14 assertions, 0 failures, 0 errors1 tests, 0 assertions, 0 failures, 0 errors1 tests, 1 assertions, 0 failures, 0 errors10 tests, 12 assertions, 0 failures, 0 errors6 tests, 7 assertions, 0 failures, 0 errors13 tests, 18 assertions, 0 failures, 0 errors5 tests, 9 assertions, 0 failures, 0 errors1 tests, 2 assertions, 0 failures, 0 errors3 tests, 6 assertions, 0 failures, 0 errors21 tests, 22 assertions, 0 failures, 0 errors4 tests, 28 assertions, 0 failures, 0 errors5 tests, 7 assertions, 0 failures, 0 errors4 tests, 4 assertions, 0 failures, 0 errors13 tests, 18 assertions, 0 failures, 0 errors5 tests, 5 assertions, 0 failures, 0 errors3 tests, 3 assertions, 0 failures, 0 errors1 tests, 1 assertions, 0 failures, 0 errors4 tests, 4 assertions, 0 failures, 0 errors37 tests, 69 assertions, 0 failures, 0 errors35 tests, 305 assertions, 0 failures, 0 errors … (continues)
  • ~/rails[tag: v3.0.7]% cat out2.txt | ruby -ne next unless$_ =~ /^((d+) (tests|assertions|failures|errors)(?:, )?){4}$/; $_.split(", ").each { |pair| count, name =*pair.split(" "); @totals ||= {}; @totals[name] ||= 0;@totals[name] += count.to_i }; print "r"+@totals.map { |key, val| "#{key} #{val}"}.join(", "); STDOUT.flush; END{puts}failures 0, tests 16658, errors 0, assertions 56316
  • ## ruby -ne ...next unless $_ =~ /^((d+) (tests|assertions|failures|errors)(?:, )?){4}$/$_.split(", ").each do |pair| count, name = *pair.split(" ") @totals ||= {} @totals[name] ||= 0 @totals[name] += count.to_iendprint "r"+@totals.map { |key, val| "#{key} #{val}"}.join(", "); STDOUT.flush;END {puts}
  • CC (attribution) photosbus http://www.flickr.com/photos/futurepastnow/2972823328ferrari http://www.flickr.com/photos/dontthinkfeel/200793214/obie http://www.flickr.com/photos/seanosh/2544491971earth NASArope walking http://www.flickr.com/photos/envizion/470658414