reactive systems why now electronic commerce era
play

Reactive Systems Why now? Electronic Commerce Era Multicore Era - PowerPoint PPT Presentation

Reactive Systems Why now? Electronic Commerce Era Multicore Era Cloud Era Backlash to the BOFH Era Rails, JEE, or X are just not good enough! Rails, JEE, or X are just not good enough! Simultaneous Invention/Evolution Successful systems


  1. Reactive Systems

  2. Why now?

  3. Electronic Commerce Era

  4. Multicore Era

  5. Cloud Era

  6. Backlash to the BOFH Era

  7. Rails, JEE, or X are just not good enough!

  8. Rails, JEE, or X are just not good enough!

  9. Simultaneous Invention/Evolution Successful systems patterns are being “discovered”

  10. Desirable System Properties Responsive Resilient Elastic - Message-Driven

  11. What’s in a name?

  12. re • act • ive 
 adjective \r ē - ˈ ak-tiv\ � : done in response to a problem or situation � : reacting to problems when they occur instead of doing something to prevent them Source: http://www.merriam-webster.com/

  13. http://www.reactivemanifesto.org/

  14. Responsive

  15. re • spons • ive 
 adjective \ri- ˈ spän(t)-siv\ � : reacting in a desired or positive way � : quick to react or respond Source: http://www.merriam-webster.com/

  16. How to be Responsive? 1. Be Deterministic � 2. Offer good Service Times � 3. Go Parallel to divide work

  17. 1. Deterministic => Order of Algorithms

  18. Order of Algorithms

  19. Latency Histograms

  20. Latency Histograms Mode

  21. Latency Histograms Mode Median

  22. Latency Histograms Mode Mean Median

  23. Don’t be a Resource Hog

  24. 2. Service Time => Utilisation

  25. Queuing Theory 11 8 Response Time 6 3 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Utilisation

  26. Limit queue lengths 
 to control response times

  27. 3. Parallel => Contention & Coherence

  28. Universal Scalability Law 20 15 Speedup 10 5 Amdahl USL 0 1 2 4 8 16 32 64 128 256 512 1024 Processors

  29. Shared mutable state is the 
 crystal meth 
 of concurrent systems

  30. Break work into batches and pipelines with no contention

  31. Are you a Hipster or a Geek?

  32. Learn to Measure & Apply Science

  33. “Synchronous RPC is the 
 crack cocaine of 
 distributed programming” � - @mjpt777

  34. Resilient

  35. re·sil·ient adjective \ri- ˈ zil-y ə nt\ : able to become strong, healthy, or successful again after something bad happens : able to return to an original shape after being pulled, stretched, pressed, bent, etc. @drkrab [Merriam-Webster online Dictionary]

  36. Bad things that happen “Unforeseen” “Broken” “Stretched” • Input Validation • Computers • Memory • Configuration • Memory • Compute • Inconsistency • Disks • I/O Load • Hackers • Networks • Storage � capacity • Routers • Just plain BUGS • Congestion • Cables “Anything that can possibly go wrong, eventually does.”

  37. Bulkheads In essence: contain faults

  38. The 3 rules of resilience 1. Isolate , 2. Isolate , and 3. Isolate. 


  39. “ You need at least two [computers] to make a reliable system” observe A B observe Joe Armstrong

  40. Joe’s version 
 of Titanic T HE U NSINKABLE 2 T HE U NSINKABLE 1

  41. The 3 rules of resilience 1. Isolate , 2. Isolate , and 3. Make faults 
 observable.

  42. Units of Isolation 1. Data Center 2. Rack / Cluster 3. Machine 4. Operating System Process 5. Software Component

  43. Most software 
 faults are transient When Microsoft Word hangs, 
 you restart it, and move on with life. … this is where the Titanic analogy ends.

  44. The 3 rules of resilience 1. Isolate , 2. Make faults 
 observable, 3. Restart

  45. Units of Isolation 1. Data Center 2. Rack / Cluster 3. Machine 4. Operating System Process 5. Software Component

  46. Actors: Isolated Components 1. Encapsulated 2. Faults are handled outside 
 – by another actor 3. Patterns for fault handlers 
 are called Supervisors

  47. Toolbox Heartbeats / alive monitors • Transactions • Append-only file formats • Actors / Micro-processes • Component-local resources • Supervisors (Erlang, Akka) • Circuit Breaker Patterns • and many more … •

  48. … because you know it’s 
 ISOLATED @drkrab

  49. Elastic

  50. elas • tic 
 adjective /i- ˈ las-tik/ � : capable of ready change or easy expansion or contraction � : able to be changed Source: http://www.merriam-webster.com/

  51. Outline 1. Scaling 2. Elastic 3. Profit! 52

  52. Why do we need to be Elastic?

  53. The rules of the game have changed

  54. Apps in the 60s-90s Apps today were written for are written for Single machines Clusters of machines Single core processors Multicore processors Expensive RAM Cheap RAM Expensive disk Cheap disk Slow networks Fast networks Few concurrent users Lots of concurrent users Small data sets Large data sets Latency in seconds Latency in milliseconds 55

  55. Outline 1. Scaling 2. Elastic 3. Profit! 56

  56. WAIT! What is Scalability ?

  57. Scalability vs Performance

  58. Scale UP

  59. Scale OUT

  60. CPU CPU L1/L2 L1/L2 CPU CPU CPU CPU Cache Cache Core Core Socket Socket CPU CPU Thread Thread Node Node JVM JVM Machine Machine Cluster Data Cluster Data Center Center 61

  61. Thus Scaling Up & Out is practically the same thing 62

  62. $cale DOWN $cale IN

  63. be ASYNC 64

  64. don’t BLOCK 65

  65. divide CONQUER 66 66

  66. pipe LINE 67

  67. share NOTHING 68

  68. location TRANSPARENCY 69

  69. obtain METRICS 70

  70. Outline 1. Scaling 2. Elastic 3. Profit! 71

  71. reactive ELASTICITY 72

  72. predictive ELASTICITY 73

  73. become ELASTIC

  74. Outline 1. Scaling 2. Elastic 3. Profit! 75

  75. Message Driven

  76. It’s not what Message Passing provides. � It’s what it makes harder or even impossible.

  77. pro·to·col noun \ ˈ pr ō -t ə - ˌ k o ̇ l, - ˌ k ō l, - ˌ käl, -k ə l\ � ... � : a set of conventions governing the treatment and especially the formatting of data in an electronic communications system <network protocols > ... : a code prescribing strict adherence to correct etiquette and precedence (as in diplomatic exchange and in the military services) <a breach of protocol > � @toddlmontgomery

  78. Boundaries are Good!

  79. Binary Asynchronous Boundary Boundary Forced Decoupling & Separation of Concerns Event Ordering Errors are Implied Correlation Messages

  80. Message Driven facilitates other traits

  81. Asynchrony Contention Built-in is Evil Responsive Amdahl’s Law Decoupling Forces & USL Responsive Design

  82. Supervisors & Boundaries Hierarchies enforce bulkheads Resilient Live Piecemeal Localized Errors Upgrade

  83. Decoupling key to Contention Scale is Evil Elastic Amdahl’s Law Spin Up, Down, & USL In, & Out

  84. Even traditional blocking operations can be decoupled

  85. REST is Reactive!

  86. HTTP “Message” Request “Message” Can do LOTS of Processing stuff while waiting “Message” Response “Message” But what about correlating responses with requests?! Don’t I need to wait? @toddlmontgomery

  87. Web Services http://en.wikipedia.org/wiki/List_of_web_service_specifications Request No, seriously , lots of these!! Message Sync Request ACK … Response Sync Message Response ACK But… Async Request/Response… kinda @toddlmontgomery

  88. Errors are Messages

  89. Got an error, so let’s send a new error message back… Mistakes & BCP TCP RST behavior…

  90. Reactive Streams

Recommend


More recommend