Save 37% off PRO during our Black Friday Sale! »

Rethinking Reactive Architectures

Rethinking Reactive Architectures

thecloudfirst.io

E6c61f085d7aceaf97b7bd00e9195514?s=128

SQUER Solutions

March 11, 2021
Tweet

Transcript

  1. Rethinking Reactive Architectures The Cloud First Paris / Remote, March

    2021
  2. @duffleit @duffleit david.leitner@squer.at David Leitner Coding Architect

  3. Reactive? Programming with, or designing upon, asynchronous data streams.

  4. asynchronous data streams. Space Time Collections Iterator Generator Value Getter

    Setter Promise Deferred Resolver Stream Reader Emitter
  5. The relationship between them is implicit, an idea that only

    exists in the mind of the programmers. It should be explicit, a part of the language, and existing for all time. Counter and doubled should be bound.
  6. The relationship between them is implicit, an idea that only

    exists in the mind of the programmers. It should be explicit, a part of the language, and existing for all time. Counter and Double should be bound. = the Destiny Operator
  7. The relationship between them is implicit, an idea that only

    exists in the mind of the programmers. It should be explicit, a part of the language, and existing for all time. Counter and Double should be bound. = the Destiny Operator 1 map(x => x*2) 2 3 6
  8. The relationship between them is implicit, an idea that only

    exists in the mind of the programmers. It should be explicit, a part of the language, and existing for all time. Counter and Double should be bound. = the Destiny Operator
  9. The relationship between them is implicit, an idea that only

    exists in the mind of the programmers. It should be explicit, a part of the language, and existing for all time. Counter and Double should be bound. = the Destiny Operator
  10. Stream Caller Receiver Caller Receiver propagate change observe change trigger

    change directly The reactive programming paradigm is based on asynchronous streams which propagate change. This differs from imperative programming, where statements are used to change a program’s state.
  11. YAMS — Yet Another Mail Service NEW 2021-04-11 — An

    important Email 2021-04-09 — Another important Email 2021-04-08 — Do you want to join my network? 2021-04-05 — Nigerian prince wants to send you money X your inbox contains 4 mails 1 NEW Mail Reload Controller Rest Client update UI Element update UI update UI
  12. YAMS — Yet Another Mail Service NEW 2021-04-11 — An

    important Email 2021-04-09 — Another important Email 2021-04-08 — Do you want to join my network? 2021-04-05 — Nigerian prince wants to send you money X your inbox contains 4 mails 1 NEW Mail Reload Websocket Client Email Email count() count() collect() filter() subscribe Email map()
  13. YAMS — Yet Another Mail Service NEW 2021-04-11 — Hello

    TheCloudFirst.io! 👋 2021-04-09 — Another important Email 2021-04-08 — Do you want to join my network? 2021-04-05 — Nigerian prince wants to send you money X your inbox contains 5 mails 2 NEW Mail Websocket Client Email Email count() count() collect() filter() subscribe Email NEW 2021-04-11 — An important Email map()
  14. We move from a pull-based design, to an asynchronous push-based

    design.
  15. Reactive Programming ✅ Reactive Architectures 🥺 We take the same

    concepts from reactive programming and move them up to the system architecture. 🤞
  16. None
  17. Let’s talk about architecture first, What does this term even

    mean? The main subsystems in a systems and how they are connected together. Perry and Wolf The shared understanding of the senior people within a project. Ralph Johnson The things that are hard to change. Martin Fowler
  18. What is good Architecture And how find define it. PunchCard

    Talk Non Functional Requirements Those requirements which make your software non-functional if you do not consider them.
  19. What is good Architecture And how find define it. PunchCard

    Talk ILITIES of Software
  20. What is good Architecture And how find define it. PunchCard

    Talk Security Usability Consistency Availability This is your architecture. A tradeoff. Business Requirements
  21. Internet has 4.7 Billion users. Facbook has 2.8 Billion users.

    Youtube has 2.1 Billion users. 2010 2020 The Internet has 1.4 Billion users. A single website may now handle twice as much traffic as the entire internet did a decade ago.
  22. The Reactive Manifesto Message Driven Responsive Elastic Resilient NFR Supported

    by Enabled by Scalability Extendibility
  23. Microservice A Microservice B Message Driven Responsive Elastic Resilient Value

    Form Means
  24. Microservice A Microservice B Message Driven Responsive Elastic Resilient Value

    Form Means Microservice B
  25. Microservice A Microservice B Message Driven Responsive Elastic Resilient Value

    Form Means Microservice B Stream
  26. Microservice A Microservice B Message Driven Responsive Elastic Resilient Value

    Form Means
  27. Message Driven Responsive Elastic Resilient Value Form Means Microservice A

    Stream Microservice B
  28. We support Back-Pressure Stream Provider Consumer events are stored until

    consumed Stream Provider Consumer A Consumer C Consumer B scaling out consumers We can scale-out by Location Transparency
  29. We move from a synchronous pull-based architecture, to an asynchronous

    push-based architecture.
  30. Microservice A Microservice B Microservice C Web Application Microservice C

    with high latency First Generation MicroServices Synchronous and without Backpressure Support
  31. Microservice A Microservice B Microservice C Web Application Microservice C

    with high latency Second Generation MicroServices Partially asynchronous with Queues Queue isolates bottleneck Queue
  32. Web Application Stream Microservice usually Backend-For-Frontend (BFF) Microservice A Microservice

    B Microservice C Third Generation MicroServices Fully asynchronous & stream-centric
  33. Events as the System State Stream of Transactions Max sent

    David 100€ Max sent Maria 70€ David sent Maria 25€ User Balance David + 75 € Max - 170 € Maria + 95 € ➡ Event Sourcing 100% reliable audit log.
  34. Web Application Stream Microservice usually Backend-For-Frontend (BFF) Microservice A Microservice

    B Microservice C
  35. Web Application Eventstore Microservice usually Backend-For-Frontend (BFF) Microservice A Microservice

    B Microservice C
  36. Web Application Eventstore Microservice usually Backend-For-Frontend (BFF) Lambda A Lambda

    B Lambda C Forth Generation MicroServices EventSourced with FaaS
  37. Microservice A Web Application Microservice B Microservice C Stream Microservice

    often Backend-For-Frontend (BFF) HTTP Streaming Request/Response
  38. Lambda A Web Application Lambda B Lambda C Eventstore Microservice

    often Backend-For-Frontend (BFF) HTTP Streaming Request/Response
  39. GraphQL ✅ Consumer Driven APIs ✅ Native Schema Support ✅

    Streaming Support
  40. Streaming with GraphQL ➡

  41. Lambda A Web Application Lambda B Lambda C Eventstore Microservice

    often Backend-For-Frontend (BFF) HTTP Streaming Request/Response
  42. Lambda A Web Application Lambda B Lambda C Eventstore GraphQL

    Streaming Request/Response
  43. Lambda A Web Application Lambda B Lambda C Eventstore GraphQL

    Microservice A Microservice B Microservice C Web Application ➡ pull-based push-based
  44. Realtime Insurance Calculation Real World Example

  45. GraphQL Step 1 Step 2 Step 2 Car Brand Build

    Year Car Model Insurance Agent Customer ✅ This Is Correct Alfra Romeo Giulia, 2020 110PS, Diesel Step 1 Step 2 Step 2 Coverage 200 € 🏁 Sign Digital Do you accept 70% coverage for 200€? Lambda A Lambda B Lambda C Eventstore GraphQL Customers expect realtime syncronisation between channels.
  46. GraphQL Step 1 Step 2 Step 2 Car Brand Build

    Year Car Model Lambda A Insurance Agent Lambda B Lambda C Eventstore GraphQL Customer ✅ This Is Correct Alfra Romeo Giulia, 2020 110PS, Diesel Step 1 Step 2 Step 2 Coverage 250 € 🏁 Sign Digital Do you accept full coverage for 250€?
  47. Resilient Banking with Projections Real World Example

  48. Mobile Banking Usage Show balance & last transactions: 93% Initiate

    new payment: 3% Any other functionality: 4%
  49. Microservice A Web Banking Microservice B Microservice C Stream GraphQL

    Projection Projections 1⃣ Projections act as read-models for a specific client. 2⃣ They subscribe to events & hydrate the projection. 3⃣ The client only reads from the projection.
  50. There are only two core issues in Computer Science: •

    cache invalidation, • and naming things.
  51. There are only two core issues in Computer Science: •

    unused potential of reactive systems, • and naming things.
  52. Microservice A Web Banking Microservice B Microservice C Stream GraphQL

    Projection Projections 1⃣ Projections act as read-models for a specific client. 2⃣ They subscribe to events & hydrate the projection. 3⃣ The client only reads from the projection.
  53. There are only two core issues in Computer Science: •

    unused potential of reactive systems, • and naming things. • and off-by-one-errors.
  54. GraphQL Mobile Client Projection Microservice A Web Banking Microservice B

    Microservice C Eventstore GraphQL Projection Projections 1⃣ Projections act as read-models for a specific client. 2⃣ They subscribe to events & hydrate the projection. 3⃣ The client only reads from the projection. Show balance & last transactions: 93%
  55. The Reactive Manifesto Message Driven Responsive Elastic Resilient NFR Supported

    by Enabled by Scalability Extendibility
  56. This stuff is cool, but think twice, & ensure that

    reactive architectures really fit your problem at hand (aka. NFRs).
  57. Architectural Styles buy you options Reactive Architectures buy you mainly

    Resilience, Realtime Capabilities, Elasticity, & Extendibility. you pay by complexity. 💵
  58. Maybe start small, and shift to reactive systems once needed.

  59. None
  60. @duffleit @duffleit david.leitner@squer.at David Leitner Coding Architect

  61. squer.link/kafka