Scalable Architecture of Cloud Application 
Based on CQRS and Event Sourcing

 


Andrzej Dębski,  Bartłomiej Szczepanik

project timeline

  • 11/2013 - Master thesis proposal
  • 02/2014 - Started working on application on-site in Berlin
  • 03/06/2014 - first presentation at AGH
  • 10/09/2014 - presentation for PaaSage technical board 
  • 01/10/2014 - abstract of the first whitepaper
  • 28/10/2014 - CGW'14 presentation
  • early 11/2014 - finished implementation
  • mid 11/2014 - first whitepaper finished
  • 11/2014-02/2015 - applying for various conferences
  • mid 11/2014 - start research on causal consistency
  • 12/2014 - assemble master thesis

THESIS

CQRS+ES-based applications are highly scalable.


THESIS goals

  • Build highly scalable and distributed application
  • Implement CQRS + ES architecture
  • Evaluate scalability




scalability

 

we need horizontal scalability




Reactive programming

  • react to events

    events are natural  for humans  and  simplify
     the architecture

  • react to load

    focus  on  scalability by avoiding  contention  on shared  resources


  • react to failure

    build  resilient  systems  
    with the  ability to  
    recover at  all levels

  • react to users

    honor response  
    time guarantees  
    regardless  of load

Reactive programming



www.reactivemanifesto.org



building blocks

Domain-driven design


  • Set of strategic and tactical patterns 
    in software engineering
  • More and more popular
  • Fits well with reactive programming - commands & events
  • All business logic resides in the "domain model"

Command-query responsibility segregation (CQRS)



event sourcing


on the bleeding edge

 

Application business requirements


  • Flight scheduling service
    • Legs and airplane rotations
    • Schedule validity checks
  • Simple domain 
  • Focus on architecture

CQRS+ES available solutions

  • Axon framework
  • akka-persistence
  • EventStore by Greg Young
  • Jdon frameworkj - dead?
  • Lokad.CQRS - already dead
  • ncqrs - already dead
  • handmade

technology stack

Application architecture

 

read model scalability


Write model scalability



TOOLS


  • Ansible
  • Kamon
  • Zipkin
  • Akka tracing
  • Gatling
  • Akka clustering JMX
  • Visual VM
  • SBT

MAIN CHALLENGES

  • Event sourcing
    • solution: akka-persistence
  • Replayable event bus
    • solution: own on top of Kafka and Cassandra
  • Load balancing
    • solution: akka-clustering routers
  • Write model distribution
    • solution: akka-cluster-sharding

current progress

  • CQRS + ES architecture
  • Neo4j read model
  • Most of business logic implemented
  • Tackled lots of technical problems
  • Read model scalability evaluation done
  • Write model distributed, not tested yet
  • CGW'14 presentation

FUTURE work


  • Full-fledged white paper
  • Causal consistency research
  • Integration with PaaSage
  • Detailed evaluation of the architecture

SCALABLE ARCHITECTURE OF CLOUD APPLICATION 

BASED ON CQRS AND EVENT SOURCING






Andrzej Dębski
andrzejdebski91 @ gmail.com

Bartłomiej Szczepanik
mequrel @ gmail.com
Made with Slides.com