going reactive: building better microservices; rob harrop

Post on 07-Jan-2017

921 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Going ReactiveRob Harrop

Who am I?

▸ CEO @ Skipjaq▸ ML-driven performance optimisation

▸ Co-founder of SpringSource

▸ Once upon a time I…▸ Contributed to Spring Framework

▸ Wrote a book about Spring

▸ Talked a lot about Spring

Who am I?

▸ I’m on Twitter: ▸ @robertharrop

▸ I’m on Github/Gitlab: ▸ github.com/robharrop

▸ gitlab.com/rdh

▸ gitlab.com/skipjaq/hotspotmon

▸ I write about maths, modelling and performance ▸ https://robharrop.github.io

If you have questions after the session, {grab, tweet} me.

Agenda

Principles & Practice

Why Reactive?

Architecture is Fractal

Reactive Systems

ELKInflux Graphite

Publishers

Publish

Publishers

JVM JVM JVM

Systems as Streams

Hotspot MonSubscriber Publisher

Subscribe

Reactive Subsystems

JVM JVM

Subsystems as Streams

JVM Stat

Sampler

Clock

Repository

WebInflux

InfluxDB Browser

JVM

Reactive Objects

JVM

Total compiles

OSR compiles

100 83 62

12 8 5

Subscriber

Subscriber

Metrics as Streams

JVM as Streams

Host JVM1359

JVM459

JVM1976

Principles

Reactive Manifesto

▸ Resilient▸ Responsive▸ Elastic▸ Message-driven

Resilient

Back Pressure

Total Compiles

Influx Publisher

Influx HTTP Client

q n

∞ m

When n>m we have back pressure - an upstream publisher is too quick for a downstream publisher

Responsive

Asynchrony

Publisher Subscriber

Q

U

E

UE

1

2

3

1

2

Message-driven

Reactive Streams

public interface Publisher<T> {

public void subscribe(Subscriber<? super T> s);}

public interface Subscriber<T> { public void onSubscribe(Subscription s);

public void onNext(T t);

public void onError(Throwable t);

public void onComplete();}

public interface Subscription { public void request(long n);

public void cancel();}

public interface Processor<T, R> extends Subscriber<T>, Publisher<R> {

}

Project Reactor

▸ Reactive Streams defines a programming model

▸ Project Reactor provides an implementation of that model

▸ Flux<T> is a zero-to-many Publisher

▸ Mono<T> is a zero-or-one Publisher

▸ Reactor manages back pressure and asynch processing

Practice

Hotspotmon

Summary

▸ Reactive is a fractal model

▸ Publishers capture outputs from systems

▸ Subscribers capture interaction with those outputs

▸ Async, isolation and capacity management are built-in

▸ Reactive Streams captures the core contracts of a Reactive system

▸ Project Reactor provides a sophisticated implementation of Reactive Streams

Q&A

top related