Can Time-Travel Keep You From Blowing Up The Enterprise?

Can Time-Travel Keep You From Blowing Up The Enterprise?

My talk from RailsConf 2016 on scaling rails

F74253f4a099258870157426b4cdb2dc?s=128

David Copeland

May 05, 2016
Tweet

Transcript

  1. CAN TIME-TRAVEL KEEP YOU FROM BLOWING UP THE ENTERPRISE? @DAVETRON5000

  2. SCALING RAILS

  3. SCALING RAILS ▸ Do stuff Faster? ▸ Do more stuff

    at once?
  4. SCALING RAILS ▸ Do stuff Faster? ▸ Do more stuff

    at once? NO, IT'S ACTUALLY… ▸ Growing Team ▸ Growing Business ▸ Changing Business
  5. MONOLITH? OR MICROSERVICES?

  6. A FRAMING DEVICE CAUSE & EFFECT

  7. DON'T BLOW UP THE ENTERPRISE

  8. DON'T BLOW UP THE ENTERPRISE

  9. DON'T BLOW UP THE ENTERPRISE

  10. DON'T BLOW UP THE ENTERPRISE

  11. DON'T BLOW UP THE ENTERPRISE

  12. FIRST, SOME ASSUMPTIONS

  13. FIRST, SOME ASSUMPTIONS ▸ Over time, more people will work

    on the code
  14. FIRST, SOME ASSUMPTIONS ▸ Over time, more people will work

    on the code ▸ Over time, different people will work on the code
  15. FIRST, SOME ASSUMPTIONS ▸ Over time, more people will work

    on the code ▸ Over time, different people will work on the code ▸ There will be increasing demands on the code
  16. FAILURE: BUSINESS/PRODUCT NOT MEETING USER NEEDS ▸ Simple changes difficult

    ▸ Difficult changes impossible ▸ Low morale ▸ Brain drain
  17. COMMON, BUT NOT UNIVERSAL ▸ Start-up ▸ New project on

    a larger company ▸ New longer-term consulting gig
  18. COMMON, BUT NOT UNIVERSAL ▸ Start-up ▸ New project on

    a larger company ▸ New longer-term consulting gig GROWTH & CHANGE
  19. NOTHIN' BEATS MONOLITH! GOOD 'OLE MONOLITH

  20. SHIP EARLY, SHIP OFTEN INTEGRATED SYSTEM

  21. MORE DEVELOPERS!

  22. MORE DEVELOPERS!

  23. MORE DEVELOPERS!

  24. MORE HIDDEN COMPLEXITY HOMEPAGE ADMIN PURCHASING SEARCH REFERRALS

  25. MORE HIDDEN COMPLEXITY ADMIN.CSS HOMEPAGE ADMIN PURCHASING SEARCH REFERRALS

  26. MORE HIDDEN COMPLEXITY ADMIN.CSS HOMEPAGE ADMIN SEARCH REFERRALS

  27. MORE HIDDEN COMPLEXITY ADMIN.CSS HOMEPAGE ADMIN SEARCH CACHE REFERRALS

  28. MORE HIDDEN COMPLEXITY ADMIN.CSS HOMEPAGE ADMIN CACHE REFERRALS

  29. ENTANGLEMENTS

  30. ENTANGLEMENTS user.signed_up.chronologically.approved. active_orders.in_zip(:east_cost). unshipped.first.try(:first_name)

  31. ENTANGLEMENTS

  32. ENTANGLEMENTS after_create do |user| end

  33. ENTANGLEMENTS after_create do |user| end UserMailer.send_welcome(user.id)

  34. ENTANGLEMENTS after_create do |user| end UserMailer.send_welcome(user.id) PaymentProcessor.add_customer(user.id)

  35. ENTANGLEMENTS after_create do |user| end UserMailer.send_welcome(user.id) PaymentProcessor.add_customer(user.id) MarketingTrackingSite.event!(user.id)

  36. ENTANGLEMENTS after_create do |user| end UserMailer.send_welcome(user.id) PaymentProcessor.add_customer(user.id) MarketingTrackingSite.event!(user.id) OtherTrackingSite.event!(user.id)

  37. OH, AND… ▸ Test suite is glacial ▸ Don't even

    think about looking in app/assets/javascripts ▸ /admin starts acting up -> www is dead, too ▸ Etc.
  38. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  39. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  40. MICROSERVICES FROM DAY 1 NEVER AGAIN

  41. BEFORE EVEN STARTING…

  42. BEFORE EVEN STARTING… ▸ Deploy lots of apps

  43. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

  44. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

    ▸ Versioning
  45. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

    ▸ Versioning ▸ JSON format
  46. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

    ▸ Versioning ▸ JSON format ▸ Which HTTP library?
  47. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

    ▸ Versioning ▸ JSON format ▸ Which HTTP library? ▸ Argue about REST and status codes
  48. OH, AND WHAT SERVICES DO WE ACTUALLY NEED?

  49. THREE MONTHS LATER

  50. THREE MONTHS LATER ▸ React front-end

  51. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF)
  52. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF) ▸ BFF talks to the underlying auth service
  53. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF) ▸ BFF talks to the underlying auth service ▸ Then hits the role service
  54. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF) ▸ BFF talks to the underlying auth service ▸ Then hits the role service ▸ Then decorates with the consumer data
  55. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF) ▸ BFF talks to the underlying auth service ▸ Then hits the role service ▸ Then decorates with the consumer data ▸ To render “Hello, #{first_name}!”
  56. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

    (BFF) ▸ BFF talks to the underlying auth service ▸ Then hits the role service ▸ Then decorates with the consumer data ▸ To render “Hello, #{first_name}!” ▸ Managed by Docker, Ansible, AWS, Terraform, Vault, Bash, and, of course, some Go
  57. WHAT HAPPENED?

  58. WHAT HAPPENED? ▸ Money has been spent

  59. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

    all over Hacker News
  60. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

    all over Hacker News ▸ Meetups have been attended
  61. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

    all over Hacker News ▸ Meetups have been attended ▸ No actual business value
  62. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

    all over Hacker News ▸ Meetups have been attended ▸ No actual business value ▸ Nothing to show
  63. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

    all over Hacker News ▸ Meetups have been attended ▸ No actual business value ▸ Nothing to show ▸ Is there any money left?
  64. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  65. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  66. LET'S DO THIS OK MONOLITH

  67. AS LONG AS WE _NOTICE_ THE MESS, WE CAN CLEAN

    IT UP —Pat Agîlecønßultånt
  68. MORE DEVELOPERS!

  69. MORE DEVELOPERS!

  70. MORE HIDDEN COMPLEXITY HOMEPAGE ADMIN PURCHASING SEARCH REFERRALS

  71. MORE HIDDEN COMPLEXITY ADMIN.CSS HOMEPAGE ADMIN CACHE REFERRALS NOW, IT’S

    TOO MESSY!
  72. None
  73. MORE HIDDEN COMPLEXITY HOMEPAGE ADMIN PURCHASING SEARCH REFERRALS

  74. MORE HIDDEN COMPLEXITY HOMEPAGE ADMIN PURCHASING REFERRALS PROMO CODES

  75. CLEANING THE AIRPORT BATHROOM ▸ Requires top engineers ▸ Grueling

    ▸ Small changes difficult ▸ Bigger changes become delayed
  76. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Low morale ▸ Brain

    drain
  77. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Low morale ▸ Brain

    drain
  78. THERE _IS_ ANOTHER WAY NO BLUR,

  79. WHILE IT'S IMPOSSIBLE TO PREDICT THE FUTURE, WE DON'T NEED

    TO ACT BLIND TO IT. Chris Reasonable
  80. DON'T BE BLIND TO THE FUTURE ▸ More developers, more

    features, more code, more changes ▸ You'll want things decoupled; but not exactly what. ▸ Don't make a mess in the first place
  81. ENABLE DECOUPLING ▸ One rails app per business function ▸

    No business logic in Active Record models ▸ Use the Rule of Three to guide decisions around abstraction, tooling, de- coupling, and general pattern identification.
  82. RULE OF THREE ▸ 1st and 2nd times aren't a

    pattern. ▸ 3rd time is - use that to create needed tooling or process changes ▸ This is engineering culture ▸ Mature teams can graduate to the Rule of Two :) Effort 1ST 2ND 3RD 4TH 5TH 6TH
  83. EXAMPLES ▸ Third Rails app - create it with a

    re-usable generator ▸ Third Ruby Gem - create it with a re-usable gem scaffold ▸ Third mess you make with jQuery - consider a front-end framework ▸ Third time customers report an outage - improve monitoring
  84. WWW SHARED DATABASE

  85. WWW CUSTOMER SERVICE SHARED DATABASE

  86. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE

  87. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

    SHARED MODELS
  88. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

    SHARED MODELS PROMO CODE LOGIC PROMO CODE LOGIC
  89. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

    SHARED MODELS PROMO CODE LOGIC PROMO CODE LOGIC CACHE
  90. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

    SHARED MODELS PROMO CODE LOGIC PROMO CODE LOGIC CACHE
  91. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

    SHARED MODELS ANALYTICS PROMO CODE LOGIC PROMO CODE LOGIC CACHE
  92. WWW CUSTOMER SERVICE MARKETING FINANCE SHARED DATABASE SHARED MODELS SHARED

    MODELS SHARED MODELS ANALYTICS PROMO CODE LOGIC PROMO CODE LOGIC CACHE
  93. WWW CUSTOMER SERVICE MARKETING FINANCE SHARED DATABASE SHARED MODELS SHARED

    MODELS SHARED MODELS ANALYTICS PROMO CODES HTTP CACHE
  94. WWW CUSTOMER SERVICE MARKETING FINANCE SHARED DATABASE SHARED MODELS SHARED

    MODELS SHARED MODELS ANALYTICS PROMO CODES HTTP CACHE
  95. WWW CUSTOMER SERVICE MARKETING FINANCE SHARED DATABASE SHARED MODELS SHARED

    MODELS SHARED MODELS ANALYTICS PROMO CODES HTTP PRIVATE DATABASE CACHE
  96. WWW CUSTOMER SERVICE MARKETING FINANCE SHARED DATABASE SHARED MODELS SHARED

    MODELS SHARED MODELS ANALYTICS PROMO CODES HTTP PRIVATE DATABASE PRIVATE DATABASE CACHE
  97. YOUR ARCHITECTURE ISN'T EVER "DONE"

  98. YOUR ARCHITECTURE PLANS SHOULD BE HOW IT CHANGES NOT WHAT

    IT SHOULD BE
  99. ENTERPRISE BEGINS

  100. WHAT DID WE LEARN EXACTLY? ▸ Don't be blind to

    the future (this is different than predicting it!) ▸ Write code to enable change ▸ Create a culture of change, based on the Rule of Three ▸ Your architecture must evolve and is never "done" ▸ Don't make a mess
  101. 25% off CODE RailsConf16 FULL-STACK-RAILS.COM SWENG.ME NEED RANTS ABOUT BAD

    UX AND JAVASCRIPT? @DAVETRON5000 WANT TO WORK THIS WAY? TECH.STITCHFIX.COM/CAREERS/ FINAL SLIDE OF SELF-PROMOTION