software development at scale bonus slides unseen gof
play

Software development at scale Bonus slides: Unseen GoF design - PowerPoint PPT Presentation

Principles of Software Construction: Objects, Design, and Concurrency Software development at scale Bonus slides: Unseen GoF design patterns (The end) Michael Hilton Bogdan Vasilescu School of Computer Science 17-214 1 Administrivia


  1. Principles of Software Construction: Objects, Design, and Concurrency Software development at scale Bonus slides: Unseen GoF design patterns (The end) Michael Hilton Bogdan Vasilescu School of Computer Science 17-214 1

  2. Administrivia • Final exam Monday May 6 th 5:30-8:30 GHC 4401 • Review session Saturday May 4 th 1pm NSH 3305 17-214 2

  3. Software GUIs UML Intro to Java Engineering More Git Static Analysis in Practice Streams Git, CI Design Part 1: Part 2: Part 3: Design at a Class Level Designing (Sub)systems Designing Concurrent Systems Design for Change: Understanding the Problem Information Hiding, Concurrency Primitives, Contracts, Unit Testing, Responsibility Assignment, Synchronization Design Patterns Design Patterns, GUI vs Core, Designing Abstractions for Design for Reuse: Design Case Studies Concurrency Inheritance, Delegation, Immutability, LSP, Design for Reuse at Scale: Design Patterns Frameworks and APIs 17-214 3

  4. SOFTWARE DEVELOPMENT AT SCALE 17-214 4

  5. Releasing at scale in industry • Facebook: https://atscaleconference.com/videos/rapid-release- at-massive-scale/ • Google: https://www.slideshare.net/JohnMicco1/2016-0425- continuous-integration-at-google-scale – https://testing.googleblog.com/2011/06/testing-at-speed-and-scale-of- google.html • Why Google Stores Billions of Lines of Code in a Single Repository: https://www.youtube.com/watch?v=W71BTkUbdqE • F8 2015 - Big Code: Developer Infrastructure at Facebook's Scale: https://www.youtube.com/watch?v=X0VH78ye4yY 17-214 5

  6. Pre-2017 release management model at Facebook 17-214 6

  7. Diff lifecycle: First, local testing 17-214 7

  8. Diff lifecycle: Next, CI testing (data center) 17-214 8

  9. Diff lifecycle: Then, diff ends up on master 17-214 9

  10. Release every two weeks 17-214 10

  11. Quasi-continuous push from master (1,000+ devs, 1,000 diffs/day); 10 pushes/day 17-214 11

  12. Aside: Key idea – fast to deploy, slow to release Dark launches at Instagram ● Early : Integrate as soon as possible. Find bugs early. Code can run in production about 6 months before being publicly announced (“dark launch”). ● Often : Reduce friction. Try things out. See what works. Push small changes just to gather metrics, feasibility testing. Large changes just slow down the team. Do dark launches, to see what performance is in production, can scale up and down. "Shadow infrastructure" is too expensive, just do in production. ● Incremental : Deploy in increments. Contain risk. Pinpoint issues. 17-214 12

  13. Aside: Feature Flags Typical way to implement a dark launch. http://swreflections.blogspot.com/2014/08/feature-toggles-are-one-of-worst-kinds.html http://martinfowler.com/bliki/FeatureToggle.html 17-214 13

  14. Issues with feature flags Feature flags are “technical debt” Example: financial services company with nearly $400 million in assets went bankrupt in 45 minutes. http://dougseven.com/2014/04/17/knightmare-a-devops- cautionary-tale/ 17-214 14

  15. Diff lifecycle: Finally, in production 17-214 15

  16. What’s in a weekly branch cut? (The limits of branches) 17-214 16

  17. Post-2017 release management model at Facebook 17-214 17

  18. Google: similar story. HUGE code base 17-214 18

  19. Exponential growth 17-214 19

  20. 2016 numbers Speed and Scale ● >30,000 developers in 40+ offices ● 13,000+ projects under active development ● 30k submissions per day (1 every 3 seconds) ● Single monolithic code tree with mixed language code ● Development on one branch - submissions at head ● All builds from source ● 30+ sustained code changes per minute with 90+ peaks ● 50% of code changes monthly ● 150+ million test cases / day, > 150 years of test / day ● Supports continuous deployment for all Google teams! Google Confidential and Proprietary 17-214 20

  21. Google code base vs Linux kernel code base 17-214 21

  22. How do they do it? 17-214 22

  23. 1. Lots of (automated) testing 17-214 23

  24. 2. Lots of automation 17-214 24

  25. 3. Smarter tooling • Build system • Version control • … 17-214 25

  26. 3a. Build system 17-214 26

  27. Standard Continuous Build System ● Triggers builds in continuous cycle ● Cycle time = longest build + test cycle ● Tests many changes together ● Which change broke the build? Google Confidential and Proprietary 17-214 27

  28. Google Continuous Build System ● Triggers tests on every change ● Uses fine-grained dependencies ● Change 2 broke test 1 Google Confidential and Proprietary 17-214 28

  29. Which tests to run? 17-214 31

  30. Scenario 1: a change modifies common_collections_util 17-214 32

  31. Scenario 1: a change modifies common_collections_util 17-214 33

  32. Scenario 1: a change modifies common_collections_util 17-214 34

  33. Scenario 1: a change modifies common_collections_util 17-214 35

  34. Scenario 2: a change modifies the youtube_client 17-214 36

  35. Scenario 2: a change modifies the youtube_client 17-214 37

  36. 3b. Version control • Problem: even git can get slow at Facebook-like scale – 1M+ source control commands run per day – 100K+ commits per week 17-214 38

  37. 3b. Version control • Solution: redesign version control 17-214 39

  38. 3b. Version control • Solution: redesign version control – Query build system's file monitor, Watchman, to see which files have changed 17-214 40

  39. 3b. Version control • Solution: redesign version control – Query build system's file monitor, Watchman, to see which files have changed à 5x faster “status” command 17-214 41

  40. 3b. Version control • Solution: redesign version control – Sparse checkouts??? (remember, git is a distributed VCS) 17-214 42

  41. 3b. Version control • Solution: redesign version control – Sparse checkouts: – Change the clone and pull commands to download only the commit metadata, while omitting all file changes (the bulk of the download) – When a user performs an operation that needs the contents of files (such as checkout), download the file contents on demand using existing memcache infrastructure 17-214 43

  42. 3b. Version control • Solution: redesign version control – Sparse checkouts à 10x faster clones and pulls – Change the clone and pull commands to download only the commit metadata, while omitting all file changes (the bulk of the download) – When a user performs an operation that needs the contents of files (such as checkout), download the file contents on demand using existing memcache infrastructure 17-214 44

  43. 4. Monolithic repository 17-214 45

  44. Monolithic repository – no major use of branches for development 17-214 46

  45. Did it work? Yes. Sustained productivity at Facebook Lines Committed Per Developer Per Day Growth of the size of the Android and iOS dev teams 17-214 47

  46. MONOREPO VS MANY REPOS 17-214 48

  47. A recent history of code organization • A single team with a monolithic application in a single repository … • Multiple teams with many separate applications in many separate repositories • Multiple teams with many separate applications microservices in many separate repositories • A single team with many microservices in many repositories … • Many teams with many applications in one big Monorepo 17-214 49

  48. What is a Monolithic Repository (monorepo)? A single version control repository containing multiple I projects I applications I libraries, often using a common build system. 2015 talk by Benjamin Eberlei 17-214 50

  49. Monorepos in industry Google (computer science version) 17-214 52

Recommend


More recommend