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

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

David Copeland

May 05, 2016
Tweet

More Decks by David Copeland

Other Decks in Programming

Transcript

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

    at once? NO, IT'S ACTUALLY… ▸ Growing Team ▸ Growing Business ▸ Changing Business
  2. FIRST, SOME ASSUMPTIONS ▸ Over time, more people will work

    on the code ▸ Over time, different people will work on the code
  3. 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
  4. FAILURE: BUSINESS/PRODUCT NOT MEETING USER NEEDS ▸ Simple changes difficult

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

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

    a larger company ▸ New longer-term consulting gig GROWTH & CHANGE
  7. 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.
  8. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

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

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  10. BEFORE EVEN STARTING… ▸ Deploy lots of apps ▸ Authentication

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

    ▸ Versioning ▸ JSON format ▸ Which HTTP library? ▸ Argue about REST and status codes
  12. THREE MONTHS LATER ▸ React front-end ▸ Hits the Backend-for-frontends

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

    (BFF) ▸ BFF talks to the underlying auth service ▸ Then hits the role service
  14. 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
  15. 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}!”
  16. 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
  17. WHAT HAPPENED? ▸ Money has been spent ▸ Blog posts

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

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

    all over Hacker News ▸ Meetups have been attended ▸ No actual business value ▸ Nothing to show
  20. 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?
  21. REMEMBER WHAT FAILURE LOOKS LIKE? ▸ Simple changes difficult ▸

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

    Difficult changes impossible ▸ Low morale ▸ Brain drain
  23. AS LONG AS WE _NOTICE_ THE MESS, WE CAN CLEAN

    IT UP —Pat Agîlecønßultånt
  24. CLEANING THE AIRPORT BATHROOM ▸ Requires top engineers ▸ Grueling

    ▸ Small changes difficult ▸ Bigger changes become delayed
  25. WHILE IT'S IMPOSSIBLE TO PREDICT THE FUTURE, WE DON'T NEED

    TO ACT BLIND TO IT. Chris Reasonable
  26. 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
  27. 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.
  28. 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
  29. 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
  30. WWW CUSTOMER SERVICE MARKETING SHARED DATABASE SHARED MODELS SHARED MODELS

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

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

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

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

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

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

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

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

    MODELS SHARED MODELS ANALYTICS PROMO CODES HTTP PRIVATE DATABASE PRIVATE DATABASE CACHE
  39. 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
  40. 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