twitter: mariusbogoevici [email protected] principal specialist … · 2019-08-21 · event-driven...

33
Microservices Day NYC, August 2019 Marius Bogoevici Principal Specialist Solution Architect [email protected] twitter: mariusbogoevici 1 Event-driven Microservices in the Serverless Age

Upload: others

Post on 15-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Microservices Day NYC, August 2019

Marius BogoeviciPrincipal Specialist Solution [email protected]: mariusbogoevici

1

Event-driven Microservices in the Serverless Age

Page 2: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Marius Bogoevici

● Principal Specialist Solutions Architect at Red Hat○ Specialize in Integration/Messaging/Data Streaming

● OSS contributor since 2008○ Spring Integration○ JBoss ecosystem○ Spring XD, Spring Integration Kafka○ Former Spring Cloud Stream project lead

● Co-author “Spring Integration in Action”, Manning, 2012

2

Page 3: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

WHY MICROSERVICES? WHY SERVERLESS?

Monolith Microservices

Operational efficiency Fast value delivery

Page 4: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

INSERT DESIGNATOR, IF NEEDED4

Still, why fast value delivery?

Fast value delivery

New features

Experimentation

Increased confidence

Page 5: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Unfortunately, we cannot predict the future. As an organization, we must be able to observe and experiment in our environments and react accordingly.

We need to be agile.

Page 6: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

On the other hand we must be mindful of our resources;

We want to eliminate waste, reduce time to experiment, and make it cheap so we can increase

our returns.

Page 7: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

We cannot build complex systems from complex parts.

We must keep our components as simple and understandable as possible.

Page 8: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

As hardware evolves, we have more options

Page 9: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Request-reply vs. event-driven

Synchronous & ephemeralLow composabilitySimplified modelLow tolerance to failure Best practices evolved as REST

Asynchronous and persistent DecoupledHighly composableComplex modelHigh tolerance to failureBest practices are still evolving

9

Page 10: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

What is an event?

● Action or occurrence, something that happened in the past○ ‘Order created’, ‘user logged in’, ‘

● Event characteristics:○ Immutable○ Optionally persistent○ Shareable

● Event types: [1]○ Notification○ State Transfer (Command)○ Event-Sourcing/CQRS

[1] https://martinfowler.com/articles/201701-event-driven.html10

Page 11: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Designing systems with events● EDA: event-centric approach in system design

○ Treating events as part of your domain model○ Designing components as event handlers and

emitters● EDA is aligned with the goals of domain-driven design

○ Enforce isolation and decoupling between bounded contexts

○ Properly designed events can create an expressive ubiquitous language

● EDA creates highly observable and extensible systems● Event storming: events-first design

11

Page 12: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-driven microservices

Applications

MessagingMiddleware

12

Page 13: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

RETHINKING EVENT-DRIVEN ARCHITECTURE

EventsMicroservices Lines of Business

Apps

Regions

System and data-centric

Events are designed to respond to ad-hoc connectivity needs

Event-centric

Events are first class citizens that describe the interactions in the enterprise

Events

Events

EventsMicroservices

AppsLOBs

Regions

Page 14: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Microservices in containers:Increasing agility, isolation, utilization

14

Page 15: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

● Use a platform that makes running apps reliable, transparent and boring

● In-built resource management○ Memory, CPU, disk

● Elastic scaling● Monitoring and failover

○ Health, logging, metrics● Routing and load balancing● Rolling upgrades and CI/CD● Namespacing

Orchestrating containers on cloud native platforms

15

Page 16: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-driven microservices in the cloud native age:Elastic computing and utility messaging

16

Page 17: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Some challenges with microservices ...

● Utilization○ Idling under low traffic○ High resource consumption - memory, disk

● Connectivity ○ Must know broker location○ Integration with event sources

● Abstraction ○ Must know broker type○ Dependence on data/payload formats

● Observability● Security

Page 18: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Serverless model: event-based and elastic

Page 19: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Enriching microservice architecture with serverless facilities

● Elastic execution and avoidance of idling (autoscale)● Utility data and messaging infrastructure

○ Provided via platform services● Decoupling of business logic from messaging

infrastructure

Page 20: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Architectural risks with serverless: loss of domain perspective …

Page 21: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Architectural risks with serverless: … point-to-point integrations and sprawl

Page 22: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Recap: event hubs in microservice arhitecture

Page 23: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-centric microservice arhitectures...

Page 24: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

… can be easily adopted for serverless design

Page 25: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Microservices in Event-driven Architecture:Pros and cons

Page 26: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Functions in Event-driven Architecture:Pros and cons

Page 27: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-driven microservice use cases applied to serverlessEvent Sourcing/CQRS

Page 28: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-driven microservice use cases applied to serverlessStreaming ETL, CDC

Page 29: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Event-driven microservice use cases applied to serverlessLoad Balancing and High Scale Compute

Page 30: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Container-centric microservices and functions on Kubernetes

Page 31: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Optimizing utilization outside of autoscaling

● Impedance mismatch between runtimes optimized for physical/virtual environments and containerization○ Large footprint (low density)○ Long startup times - latency

● Recommendations:○ Favor technologies with small footprint and low latency, in particular for

serverless○ Favor technologies that allow for easy change of deployment model

(independent deployment vs on-demand/serverless) while preserving investment in business logic

Page 32: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Your technology radar● Service Mesh (e.g. Istio):

○ Provide microservice interconnectivity● Serverless platforms (e.g. Knative)

○ Container build and on-demand scheduling● Container-native frameworks (e.g. Quarkus)

○ Optimize Java workloads for containerized apps● Strimzi - Kafka operator for Kubernetes/OpenShift● EnMasse - Messaging-as-a-Service for Kubernetes/OpenShift● FaaS frameworks (e.g. Camel-K)

○ Schedule integration code directly on platform or via Knative

Page 33: twitter: mariusbogoevici mariusb@redhat.com Principal Specialist … · 2019-08-21 · Event-driven microservices are key for implementing highly distributed, extensible architectures

Conclusions

● Event-driven microservices are key for implementing highly distributed, extensible architectures

● Serverless platforms are a natural fit for several event-driven microservice use cases

● Serverless architectures should complement event-based execution with event-centric design

● Always consider tradeoffs:○ Serverless vs independent deployment (aka ‘traditional’

microservice)○ Optimizied runtime vs technical investment (can you have both?)