Get Reactive: Microservices, Programming, and Systems Jeremy Davis - - PowerPoint PPT Presentation

get reactive microservices programming and systems
SMART_READER_LITE
LIVE PREVIEW

Get Reactive: Microservices, Programming, and Systems Jeremy Davis - - PowerPoint PPT Presentation

Get Reactive: Microservices, Programming, and Systems Jeremy Davis Principal Solution Architect, App Dev @argntprgrmr Why Does Any of This Matter? Jakob Nielsen 46 years, 3 numbers 0.1 1 10 3 microservicesjourney.com 4


slide-1
SLIDE 1

Get Reactive: Microservices, Programming, and Systems

Jeremy Davis
 Principal Solution Architect, App Dev
 @argntprgrmr

slide-2
SLIDE 2

Why Does Any of This Matter?

slide-3
SLIDE 3

microservicesjourney.com 3

46 years, 3 numbers

0.1 1 10

Jakob Nielsen

slide-4
SLIDE 4

microservicesjourney.com 4

slide-5
SLIDE 5

Reactive is Responsive

slide-6
SLIDE 6

6

there are always tools

Also Tools!

slide-7
SLIDE 7

Reactive Systems/Reactive Programming

slide-8
SLIDE 8

8

Programming, Systems, Both

Observable.range(1, 100) .groupBy(n -> n % 2 == 0) .flatMap(g -> { return g.takeWhile(i -> i < 30).toList(); }).filter(l -> !l.isEmpty()).forEach(System.out::println);

slide-9
SLIDE 9

microservicesjourney.com 9

slide-10
SLIDE 10

imicroservicesjourney.com

Reactive Programming

10

Event Driven Message Driven Embraces realities of the network Embraces realities of data

Reactive Systems

slide-11
SLIDE 11

Reactive Systems

slide-12
SLIDE 12

12

Reactive Manifesto

slide-13
SLIDE 13

13

Responsive

  • dependability
  • maintained under failure (resilience)
  • maintained under load (elasticity)

because people get bored

slide-14
SLIDE 14

microservicesjourney.com 14

things fail

The system must be responsive in the face

  • f failure
  • must be designed for not added in
  • self-healing, full recovery
  • replication
  • isolation and containment
  • delegation

Resilient

slide-15
SLIDE 15

A System must stay responsive under various workloads

  • scales up and down
  • no contention points or bottlenecks
  • replicable/shardable components
  • provide relevant live performance measures

15

Elastic

everything changes

slide-16
SLIDE 16

16

asynchronous communication

  • asynchronous, non-blocking
  • location transparency
  • failures delegated as messages
  • back pressure

Message Driven

slide-17
SLIDE 17

Reactive Microservices

slide-18
SLIDE 18

18

the basics

“The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. “ — Martin Fowler http://martinfowler.com/articles/microservices.html

Why?

slide-19
SLIDE 19

Toolkits, Libraries, Frameworks

slide-20
SLIDE 20

microservicesjourney.com 20

slide-21
SLIDE 21

Reactive Programming

slide-22
SLIDE 22

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 22

An API for asynchronous programming with observable streams

ReactiveX

slide-23
SLIDE 23

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 23

as opposed to traditional programming

Traditional

  • Call a method
  • Store the return value in a variable
  • Do something useful with the variable

RxJava

RxJava

  • Create a method that does something useful

with the return values of an asynchronous call

  • Define the asynchronous call (Observable)
  • Attach an observer to the Observable by

subscribing

  • Do other stuff until the call returns and the

Observable begins to operate on the results

slide-24
SLIDE 24

24

rx.Observable()

Observable.range(1, 100) .groupBy(n -> n % 2 == 0) .flatMap(g -> { return g.toList(); }).forEach(System.out::println);

slide-25
SLIDE 25

microservicesjourney.com 25

like the Gang of Four pattern with onCompleted() and onError()

Observer Pattern

slide-26
SLIDE 26

26

rx.Observable()

slide-27
SLIDE 27

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 27

Insert copy

Operators (marbles)

slide-28
SLIDE 28

28

slide-29
SLIDE 29

29

all about the Observables

  • Observable
  • Operators
  • Marbles
  • Learning curve

Summary: rxJava

slide-30
SLIDE 30

One Rule: “Don’t mutate state outside of the function”

slide-31
SLIDE 31

Reactive Streams

slide-32
SLIDE 32

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 32

a standard for asynchronous stream processing that isn’t for end users

  • Standard
  • Interoperability layer
  • no operators
  • java.util.concurrent.Flow
  • Github
  • JavaScript
  • Lightbend, Netflix, Pivotal, Red Hat

Reactive Streams

slide-33
SLIDE 33

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 33

Actor Mailbox Actor Mailbox Actor Mailbox Actor Mailbox Actor Mailbox

slide-34
SLIDE 34

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 34

Actor Mailbox Actor Mailbox akka://default/user/$a#114635109 akka://default/user/$a#114635173

slide-35
SLIDE 35

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 35

slide-36
SLIDE 36

36

its all about the actor model

  • Actor Model
  • Messaging
  • Addressing
  • Steams, Web, others
  • Reactive end to end

Summary: akka

slide-37
SLIDE 37

INSERT DESIGNATOR, IF NEEDED (EDIT ON MASTER SLIDE) 37

a toolkit for building reactive applications on the JVM

Event Loop COLUMN HEADING ALL CAPS Vertices Event Bus

slide-38
SLIDE 38

38

single threaded event loop

slide-39
SLIDE 39

Cardinal Rule: “Don’t Block the Event Loop”

slide-40
SLIDE 40

40

its all about verticles

slide-41
SLIDE 41

41

messages

slide-42
SLIDE 42

42

JsonObject

slide-43
SLIDE 43

43

its all about reactive

  • Reactive from end to end
  • Json
  • Event Loop
  • Messaging
  • rxJava built in
  • Polyglot

Summary: Eclipse Vert.x

slide-44
SLIDE 44

44

Project Reactor and WebFlux

slide-45
SLIDE 45

45

slide-46
SLIDE 46

46

its hidden

  • Flux
  • Mono
  • WebFlux
  • Reactive Streams

Summary: Spring Reactor

slide-47
SLIDE 47

47

General

Books: https://info.lightbend.com/COLL-20XX-Designing-Reactive-Systems_RES-LP.html Webinars : https://www.lightbend.com/blog/akka-revealed-jvm-architects-journey-from-resilient-actors- to-scalable-clusters https://www.lightbend.com/blog/using-the-actor-model-with-domain-driven-design-ddd-in- reactive-systems-with-vaughn-vernon Blogs: https://developer.lightbend.com/blog/2017-08-10-atotm-akka-messaging-part-1/index.html https://developer.lightbend.com/blog/2017-11-01-atotm-akka-messaging-part-2/index.html

Links

slide-48
SLIDE 48

48

Vert.x

Tutorials: http://vertx.io/blog/posts/introduction-to-vertx.html http://escoffier.me/vertx-hol/ Books: http://vertx.io/docs/guide-for-java-devs/ https://developers.redhat.com/promotions/building-reactive-microservices-in-java/ Presentations: https://www.youtube.com/channel/UCGN6L3tRhs92Uer3c6VxOSA

Links

slide-49
SLIDE 49

49

RxJava

Books: http://shop.oreilly.com/product/0636920042228.do Code: https://github.com/ReactiveX/RxJava https://github.com/jhusain/learnrxjava Presentations: GOTO 2013 • Functional Reactive Programming with RxJava • Ben Christensen

Links

slide-50
SLIDE 50

50

Spring Reactor/WebFlux

Blogs: https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive- landscape Presentations: https://www.youtube.com/watch?v=zVNIZXf4BG8

Links

slide-51
SLIDE 51

plus.google.com/+RedHat linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHatNews

Thank You!