Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From 'Legacy' to 'Edge' 2014 edition

From 'Legacy' to 'Edge' 2014 edition

Eabad423977cfc6873b8f5df62b848a6?s=128

SHIBATA Hiroshi

April 19, 2014
Tweet

Transcript

  1. ! From ‘Legacy' to ‘Edge' 2014 edition ! Hiroshi SHIBATA

    @hsbt OedoRubyKaigi04
  2. SHIBATA Hiroshi(@hsbt)

  3. asakusa.rb

  4. ruby-lang.org

  5. Rails Girls in Japan

  6. Ruby Committer

  7. None
  8. ϛυϧ΢ΣΞͷΞοϓάϨʔυ ࣾ಺։ൃج൫ͷߏங ౷ܭج൫ͷߏங +409ͷӡ༻੔උ HJUIVC ηΩϡϦςΟ؂ࠪ ίʔυϨϏϡʔ ςετج൫ͷߏங ΞΫηεղੳج൫ͷߏங ։ൃϓϩηε

    ৽ਓڭҭ ݪߘࣥච ΧϯϑΝϨϯεൃද 044։ൃ αʔόʔߏ੒؅ཧͷ࡮৽ ϦʔϯελʔτΞοϓ +FOLJOT 3VCZ3BJMT 3%#.4 ٕज़ج൫νʔϜ
  9. http://30d.jp

  10. from 2007/5

  11. 380,000 users 230,000,000 photos

  12. Our Rails app 46 models 5000 lines in controllers 400

    lines in routes.rb 1:1.3 code to test ratio
  13. system architecture

  14. application server

  15. storage server

  16. job server

  17. transaction server

  18. storage is over 450 TB

  19. database size is over 250 GB

  20. Development Culture

  21. จࣈ github workflow

  22. IRC github issue costomer’s contact nagios

  23. DevOps

  24. 4 deploy/day

  25. None
  26. How to migrate edge rails from legacy rails?

  27. Ruby 1.8.6 Rails 2.0.2

  28. Ruby 1.8.6 Rails 2.0.2 Ruby 2.1.1 Rails 4.1.0 new!

  29. Why?

  30. None
  31. Ruby on Rails

  32. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  33. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0 Slow Fast
  34. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  35. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  36. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  37. Rails 2.0 Rails 2.3

  38. Rails 2.0 Rails 2.3 hotfix A migration A

  39. Rails 2.0 Rails 2.3 hotfix A migration A

  40. Rails 2.0 Rails 2.3 hotfix A migration A

  41. จࣈ

  42. Zero Downtime Deploy

  43. cookpad/kage

  44. Kage (kah-geh) is an HTTP shadow proxy server that sits

    between clients and your server(s) to enable "shadow requests".
  45. the basic of kage real request

  46. None
  47. _ਓਓ ਓਓ__ਓਓ ਓਓ_! > ಥવͷαʔόʔ࠶ىಈ <! ʉY^Y^Y^YY^Y^Y^YY^Y

  48. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  49. rails 2.3 with bundler

  50. source 'https://rubygems.org'! ! gem 'rails', '~> 2.3.18'! gem 'rake', '~>

    0.9.2'! gem 'rdoc'! gem 'rake-confirm'! ! gem 'mysql'! gem "mysql_retry_lost_connection"! gem 'acts_as_paranoid', :github => 'paperboy-30days/acts_as_paranoid'! gem 'passenger', '~> 3.0'! gem 'memcache-client', :require => 'memcache'! gem 'system_timer'! gem 'yajl-ruby', :require => 'yajl'! gem 'will_paginate', '~> 2.3'! gem 'mail'! ! gem 'sass'! gem 'compass-rails'! ! gem 'osaipo_client', :git => 'git@github.com:paperboy-all/ osaipo_client.git', :branch => 'legacy'! gem 'jugem_client', :git => 'git@github.com:paperboy-all/ jugem_client.git'! gem 'ppb_footer', :github => 'paperboy-all/ppb_footer'!
  51. require "./config/environment"! ! use Rails::Rack::LogTailer! use Rails::Rack::Static! run ActionController::Dispatcher.new rack

    with rails 2.3
  52. 30days-front can’t use hyphen can’t use number can’t convert !

    application.rb...
  53. Reduce customer frustration.

  54. app1 app2 backgroundrb to dj

  55. จࣈ

  56. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  57. Use trunk everyday.

  58. จࣈ

  59. จࣈ

  60. Use modern architecture

  61. app1 app2

  62. kyoto tycoon is slower than mysql…

  63. None
  64. 1.8 to 2.0

  65. จࣈ

  66. 2.0 to 2.1

  67. CPU Usage(%) 0 25 50 75 100 49 69 2.0

    2.1
  68. Resp. time(ms) 0 50 100 150 200 250 189 221

    2.0 2.1
  69. memory usage(giga byte) 0 1 2 3 4 3.8 3.2

    2.0 2.1
  70. จࣈ https://www.ruby-lang.org/en/news/2014/03/10/regression-of-hash-reject-in-ruby-2-1-1/

  71. Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0

    3.2 4.0
  72. จࣈ

  73. Resp. time(ms) 0 60 120 180 240 300 287 189

    3.2 4.0
  74. Ruby 1.9.3 2.0.0 2.1 2.2 Rails 3.0 3.2 ? 4.0

    ? 4.1 ?
  75. Ruby 1.9.3 2.0.0 2.1 2.2 Rails 3.0 3.2 ? 4.0

    ? 4.1 ? New!!
  76. จࣈ

  77. 1. Flash structure changes 2. Mutator methods called on Relation

  78. จࣈ

  79. Resp. time(ms) 0 60 120 180 240 300 266 287

    4.0 4.1
  80. Ruby 1.9.3 2.0.0 2.1 2.2 Rails 3.0 3.2 ? 4.0

    ? 4.1 ?
  81. class Bar! def bar(foo = foo())! foo! end! ! def

    buzz(foo = foo)! foo! end! ! def foo! :buzz! end! end! ! p Bar.new.bar! p Bar.new.buzz
  82. % ruby -v r45272.rb! ruby 2.2.0dev (2014-04-13 trunk 45580) [x86_64-darwin13]!

    :buzz! nil! ! % ruby -v r45272.rb! ruby 2.1.2p80 (2014-03-01 revision 45231) [x86_64-darwin13.0]! :buzz! :buzz
  83. จࣈ

  84. conclusion

  85. 2. fix gem 4. fix Ruby 3. fix Rails 1.

    fix your code