Tworzenie wysokoskalowalnych systemów reaktywnych

Krzysztof Borowski

kborowski@agh.edu.pl

Trip plan

  • Domain Driven Design
  • Reactive Systems
  • Reactive Programming
  • ES and CQRS
  • System as a whole

PhotoTrip App

  • Mark on the map our trip
  • Add photos
  • Collaborate with others in real time
  • Add Comments

Domain Driven Design

Bounded Context

 

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.

Martin Fowler

Bounded Context

Aggregate

  • A cluster of domain objects that can be treated as a single unit.
  • Aggregates domain objects and theirs behaviour
  • Every change of the state within aggregate is transactional

Aggregates

Entity

  • Has unique identificator
  • Can mutate the state
  • Contains other entities or value objects
 case class Map(
    id: MapId, 
    creatorId: String,
    description: String
 ) 

Reactive Systems Space

Reactive System Definition

Systems spectrum

It is time to apply these design principles consciously from the start instead of rediscovering them each time.

Why should​ we care?

  • Our software operates 24/7 
  • Dealing with high load, responding in milliseconds
  • Solving more and more complicated domain problems
  • The codebase is growing, software is evolving quickly

Problems

  • Handling distributed architecture deployment
  • Defining proper service boundaries
  • Reliable messaging system
  • Data streams, asynchronous communication
  • Lack of well defined, tested in production frameworks
  • Domain Driven Design (~2003)
  • Persistent Messages Queues (Kafka (~2012))
  • Reactive Programming (~2007)
  • Lagom, Project Reactor (~2016)
  • Containers & Orchestration (~2013)

Problems

Solutions

Reactive Programming

Reactive Programming 

  • reacting to changes
  • often via data streams
  • program using and relying on events instead of the order of lines in the code

Using reactive programming tools does not imply having ​a Reactive System!

Reactive Programming Marketplace

concepts: ReactiveX, Reactive Streams

ready to use: RxJava, RxKotlin, RxSwift, RxJS, Monix,

akka-streams, vert.x, Ratpack

Functional Reactive Programming?

Event Sourcing

Command/Query Responsibility Segregation

with ES

External Communication

Inspiration

Short Trip into Reactive System space

By liosedhel

Short Trip into Reactive System space

  • 1,116