Building loosely coupled and scalable systems using Event-Driven Architecture. Jonas Bonér Patrik Nordwall Andreas Källberg

Similar documents
Data Acquisition. The reference Big Data stack

Data Acquisition. The reference Big Data stack

Create High Performance, Massively Scalable Messaging Solutions with Apache ActiveBlaze

BUILDING MICROSERVICES ON AZURE. ~ Vaibhav

MOM MESSAGE ORIENTED MIDDLEWARE OVERVIEW OF MESSAGE ORIENTED MIDDLEWARE TECHNOLOGIES AND CONCEPTS. MOM Message Oriented Middleware

DS 2009: middleware. David Evans

Time and Space. Indirect communication. Time and space uncoupling. indirect communication

Nirvana A Technical Introduction

Reactive Microservices Architecture on AWS

CQRS and Event Sourcing for Java Developers Markus Eisele

Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors. Jonas Bonér Viktor Klang

Event-sourced architectures with Luminis Technologies

A Distributed System Case Study: Apache Kafka. High throughput messaging for diverse consumers

Using the SDACK Architecture to Build a Big Data Product. Yu-hsin Yeh (Evans Ye) Apache Big Data NA 2016 Vancouver

Monitoring a spacecraft from your smartphone using MQTT with Joram

Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions

Enabling industry 4.0 Event-driven architectures and smart micro services

Indirect Communication

ØMQ and PyØMQ. Simple and Fast Messaging. Brian Granger SciPy 2010

Transitioning from C# to Scala Using Apache Thrift. Twitter Finagle

Purplefinder Enterprise Platform Messagng with ActiveMQ. Peter Potts 13 th October 2010

Ultra Messaging Technical Product Overview

Evolution of an Apache Spark Architecture for Processing Game Data

Microservices, Messaging and Science Gateways. Review microservices for science gateways and then discuss messaging systems.

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Distributed Systems. Edited by. Ghada Ahmed, PhD. Fall (3rd Edition) Maarten van Steen and Tanenbaum

Real World Messaging With Apache ActiveMQ. Bruce Snyder 7 Nov 2008 New Orleans, Louisiana

ebay Marketplace Architecture

IBM Lotus Expeditor 6.2 Server MQ Everyplace Overview

Event-sourced architectures with Luminis Technologies

An Overview of WebSphere MQ Telemetry and How to Utilize MQTT for Practical Solutions

Messaging. Low Latency, High Throughput, Durable, RESTful, Open, Standards,..

Cloud-Native Applications. Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0

ebay s Architectural Principles

Network Based Hard/Soft Information Fusion Network Architecture/SOA J. Rimland

Shackbus. interconnecting your Shack. Tobias

Notes. Submit homework on Blackboard The first homework deadline is the end of Sunday, Feb 11 th. Final slides have 'Spring 2018' in chapter title

Distributed Object-Based Systems The WWW Architecture Web Services Handout 11 Part(a) EECS 591 Farnam Jahanian University of Michigan.

Designing and debugging real-time distributed systems

Chapter 4 Communication

RED HAT JBOSS FUSE. A lightweight, flexible integration platform

10. Replication. CSEP 545 Transaction Processing Philip A. Bernstein. Copyright 2003 Philip A. Bernstein. Outline

Switch or Broker? A comparison of two models for Reliable Messaging. by Pieter Hintjens, imatix Corporation. January, 2006

Introduction in Eventing in SOA Suite 11g

MSG: An Overview of a Messaging System for the Grid

Scaling Slack. Bing Wei

Above the Clouds: Introducing Akka. Jonas Bonér Scalable Solutions

2779 : Implementing a Microsoft SQL Server 2005 Database

It also performs many parallelization operations like, data loading and query processing.

Design and Architecture. Derek Collison

Joram configuration from clustering to WAN distribution

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

Hi! NET Developer Group Braunschweig!

Distributed KIDS Labs 1

Building a Scalable Architecture for Web Apps - Part I (Lessons Directi)

Send me up to 5 good questions in your opinion, I ll use top ones Via direct message at slack. Can be a group effort. Try to add some explanation.

Architekturen für die Cloud

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN. Chapter 1. Introduction

Java Enterprise Edition

IERG 4080 Building Scalable Internet-based Services

<Insert Picture Here> QCon: London 2009 Data Grid Design Patterns

Remote Procedure Call

Data Management in Application Servers. Dean Jacobs BEA Systems

Oracle 10g and IPv6 IPv6 Summit 11 December 2003

elasticsearch The Road to a Distributed, (Near) Real Time, Search Engine Shay Banon

STARCOUNTER. Technical Overview

Copyright 2013, Oracle and/or its affiliates. All rights reserved. CON-7777, JMS and WebSocket for Lightweight and Efficient Messaging

COMMUNICATION PROTOCOLS

Data Analytics at Logitech Snowflake + Tableau = #Winning

Broker Clusters. Cluster Models

Storm. Distributed and fault-tolerant realtime computation. Nathan Marz Twitter

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

May Gerd Liefländer System Architecture Group Universität Karlsruhe (TH), System Architecture Group

IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services

Oracle WebLogic Integration

ICALEPS 2013 Exploring No-SQL Alternatives for ALMA Monitoring System ADC

<Insert Picture Here> Future<JavaEE>

High Volume Messaging with IBM MessageSight for use in Mobile, Web and M2M solutions

Today: Distributed Objects. Distributed Objects

Polling Sucks. So what should we do instead?

Chapter 4 Communication

Lesson 14 SOA with REST (Part I)

Copyright 2016 Pivotal. All rights reserved. Cloud Native Design. Includes 12 Factor Apps

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Protocol Buffers, grpc

COMMUNICATION IN DISTRIBUTED SYSTEMS

Distributed systems. Lecture 6: distributed transactions, elections, consensus and replication. Malte Schwarzkopf

Tackling Application Integration Nightmares with WSO2 ESB. Hiranya Jayathilaka

The Data Access Layer:

Reactive Integrations - Caveats and bumps in the road explained

SHORT NOTES / INTEGRATION AND MESSAGING

9. Queued Transaction Processing

Using Messaging Protocols to Build Mobile and Web Applications. Jeff Mesnil

Distributed Systems 8. Remote Procedure Calls

CSCI-1680 RPC and Data Representation John Jannotti

CHAPTER - 4 REMOTE COMMUNICATION

Functionality, Challenges and Architecture of Social Networks

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

Data Centers. Tom Anderson

Transcription:

Building loosely coupled and scalable systems using Event-Driven Architecture Jonas Bonér Patrik Nordwall Andreas Källberg

Why is EDA Important for Scalability?

What building blocks does EDA consists of?

Outline Concepts Patterns Challenges Highly Scalable Web Sites

Concepts

Messaging Publish-Subscribe Point-to-Point Store-forward Request-Reply

Publish-Subscribe

Point-to-Point

Store-Forward

Request-Reply

Standards AMQP JMS

Some Products...

Domain Events It's really become clear to me in the last couple of years that we need a new building block and that is the Domain Events -- Eric Evans, 2009

Domain Events State transitions are an important part of our problem space and should be modeled within our domain. -- Greg Young, 2008

Domain Events Something that has happened in the past CustomerRelocated CargoShipped InventoryLossageRecorded

Domain Events Uniquely identifiable Self contained Observable Time relevant

Patterns

Event Stream Processing select * from Withdrawal (amount>=200).win:length(5)

Actors Share NOTHING Isolated lightweight processes Communicates through messages Asynchronous and non-blocking No shared state hence, nothing to synchronize. Each actor has a mailbox (message queue)

Actors Easier to reason about Raised abstraction level Easier to avoid Race conditions Deadlocks Starvation Live locks

Actors Transparent remoting Client-managed Server-managed Pub-Sub Redis ZeroMQ Guaranteed delivery Persistent mailbox File-based Network-based

Command and Query Responsibility Segregation A single model cannot be appropriate for reporting, searching and transactional behavior. -- Greg Young, 2008

CQRS Aggregate roots receive Commands and publish Events All state changes are represented by Domain Events Reporting module is updated as a result of the published Events All Queries go directly to the Reporting, the Domain is not involved

The traditional way... DB Data access Domain Service Update DTO Query DTO Client

The CQRS way... DB Data access Domain publish subscribe DB Data access Service Service Command Query DTO Client

The CQRS way... DB DB Data access Data access publish Service DB Data access Domain Service DB Service Data access Service Client

CQRS Benefits Separation of concern Fully encapsulated domain that only exposes behavior Queries do not use the domain model Easy integration with external systems Performance and scalability Testability

Event Sourcing Every state change is materialized in an Event All events are stored in an Event Log System can be reset and Event Log replayed Many different Listeners can be added

Storing Structure Purchase Order * Line Item Shipping Information

Event Sourcing - Storing Deltas Cart Created Added 2 Socks Added 2 Shirts Shipping Info Added

Aggregates are tracking events as to what has changed within them Current state is constructed by replaying all events Data is not persisted in a structure but as a series of transactions No ORM is needed

Event Sourcing - Replaying Events 1 2 3 4 5 6 7

Event Sourcing - Rolling Snapshot Snapshot 1 2... 100 101 102 103 104

Event Sourcing - Benefits No object-relational impedance mismatch Bullet-proof auditing and historical tracing Support future ways of looking at data Performance and scalability Testability Reconstruct production scenarios

Simple CQRS Sample http://github.com/patriknw/ sculptor-simplecqrs/

Challenges

Clustering of Brokers ActiveMQ Master-Slave Store and Forward Network of Brokers RabbitMQ Cluster of Erlang nodes ZeroMQ Brokerless - point-to-point or pub-sub

ZeroMQ Network protocol - thin layer above TCP/IP Transports Text INPROC IPC MULTICAST TCP

ZeroMQ Forwarding devices QUEUE FORWARDER STREAMER

ZeroMQ Patterns REQUEST/REPLY (load-balanced) PUB/SUB UPSTREAM/DOWNSTREAM (pipelining) PAIR (exclusive)

Wire Formats Java serialization (binary, schema, runtime) Protobuf (binary, schema, compiled) Avro (binary, schema, compiled & runtime) Thrift (binary, schema, compiled) Text MsgPack (binary, schema, compiled) Protostuff (binary, schema, compiled) Kryo (binary, schema-less, runtime) BERT (binary, schema-less, runtime) Hessian (binary, schema-less, compiled) XML (text, schema) JSON (text, schema-less)

Guaranteed Delivery Do I really need it? Persistence increases reliability at the expense of performance

Competing Consumers Pattern for solving: Load balancing Concurrency Failover Only works with Point-to-Point Channel Challenge ordering duplicates (idempotent receiver)

Duplicate Messages What do I need? Once-and-only-once At-least-once At-most-once QOS keep history of processed ids Unique message identifier Business semantics

How to get back on track? Point-to-point: no problem, just make the queue persistent Pub/sub: well, not so straight forward Problem: only active subscribers Solution: durable subscriber Problem: failover and load balancing

Producer Flow Control What to do when producers flood you with messages? Running low on broker resources, slow consumers Graceful degradation caller run (in process only) block abort discard

Behind the Scenes of Highly Scalable Web Sites

caching is important, but also...

Minimize latency Flickr: Do The Essential Work Up- Front And Queue The Rest Amazon: ~99% of content is static Reddit: Precompute everything and cache it

Changes - pull or push Facebook: Pull on Demand Digg: Push on Change Twitter: Push tweets

Truly event-driven web clients Request-response doesn't fit collaborative systems WebSockets enable real eventdriven web

Why is EDA Important for Scalability? Scale out and up Load balance Parallel execution Non-blocking Loosely coupled components can scale more independent of each other

?

thanks for listening