Slide 1

Slide 1 text

Spencer Gibb @spencerbgibb Olga Maciaszek-Sharma @olga_maciaszek Resilient and Adaptable Systems with Cloud Native APIs Copyright © 2020 VMware, Inc. or its affiliates. 1

Slide 2

Slide 2 text

Cover w/ Image Agenda ● What is a Cloud-Native API? ● Protocols ● Gateways ● Architecture ● Demo ● Q+A 2

Slide 3

Slide 3 text

What is a Cloud-Native API? 3

Slide 4

Slide 4 text

The API is the product https://techcrunch.com/2019/09/06/apis-are-the-next-big-saas-wave/ API First 4

Slide 5

Slide 5 text

IoT devices API First: The API is the product WWW Mobile Apps Web apps 5

Slide 6

Slide 6 text

API First: The API is the product 6

Slide 7

Slide 7 text

API First: The API is the product Streaming Shopping Shipping 7

Slide 8

Slide 8 text

Systems Driven by the API 8

Slide 9

Slide 9 text

Systems Driven by the API Apps Instances & Networks Load Balancer 9

Slide 10

Slide 10 text

Systems Driven by the API Resilience Fault Tolerance Rate Limiting 10

Slide 11

Slide 11 text

The API is greater than the sum of its parts 11

Slide 12

Slide 12 text

Serverless 12

Slide 13

Slide 13 text

Server-side architecture run in stateless, event-triggered, ephemeral compute containers.* * https://martinfowler.com/articles/serverless.html 13

Slide 14

Slide 14 text

Backend as a Service 14

Slide 15

Slide 15 text

Function as a Service 15

Slide 16

Slide 16 text

Event-Driven 16

Slide 17

Slide 17 text

Infrastructure management handled by cloud providers 17

Slide 18

Slide 18 text

Automatic scaling Built-in high availability Pay-for-use billing model 18

Slide 19

Slide 19 text

Emphasis on short startup and low memory footprint 19

Slide 20

Slide 20 text

Higher system complexity Complex monitoring and tracing Risk of vendor locks Last 10% trap 20

Slide 21

Slide 21 text

Spring Cloud Function @SpringBootApplication public class Application { [...] @Bean public Function uppercase() { return value -> value.toUpperCase(); }} 21

Slide 22

Slide 22 text

Tanzu Application Platform 22

Slide 23

Slide 23 text

Efficiency/Speed 23

Slide 24

Slide 24 text

Responsiveness is important Optimize for availability and speed 24

Slide 25

Slide 25 text

Protocols 25

Slide 26

Slide 26 text

Infrastructure is Important. Scaling and Resiliency 26

Slide 27

Slide 27 text

Spring Ecosystem allows focus on core business. Speed to market matters. 27

Slide 28

Slide 28 text

Evolving 28

Slide 29

Slide 29 text

Intra-service communication as part of functionalities’ implementation 29

Slide 30

Slide 30 text

APIs within systems 30

Slide 31

Slide 31 text

Backward compatibility Addition only Tolerant consumers Deferred updates 31

Slide 32

Slide 32 text

Consumer-Driven Contracts Collaborative Scenario-based Integration testing Backwards compatibility testing 32

Slide 33

Slide 33 text

' Spring Cloud Contract request { method 'PUT' url '/fraudcheck' body([ "client.id": $(regex('[0-9]{10}')), loanAmount : 99999 ]) headers { contentType('application/json') } } response { status OK() body([ fraudCheckStatus : "FRAUD", "rejection.reason": "Amount too high" ]) headers { contentType('application/json') } } 33

Slide 34

Slide 34 text

Protocols 34

Slide 35

Slide 35 text

HTTP 35

Slide 36

Slide 36 text

Resource-oriented 36

Slide 37

Slide 37 text

Simple and straightforward 37

Slide 38

Slide 38 text

Client-Server/ Request-Response Synchronous Head-of-line blocking 38

Slide 39

Slide 39 text

Text-based The internet is running in debug mode* * http://java-is-the-new-c.blogspot.com/2014/10/why-protocols-are-messy-concept.html 39

Slide 40

Slide 40 text

HTTP/2 Binary Multiplexed Headers compression Server Push 40

Slide 41

Slide 41 text

Upcoming: HTTP/3 QUIC-based 41

Slide 42

Slide 42 text

Messaging 42

Slide 43

Slide 43 text

Rabbitmq & Kafka offer distributed message brokers and streaming semantics 43

Slide 44

Slide 44 text

Topics & Queues 44

Slide 45

Slide 45 text

Durable or Ephemeral 45

Slide 46

Slide 46 text

Messaging allows separation of concerns at the API level 46

Slide 47

Slide 47 text

Event Sourcing Command Query Responsibility Segregation (CQRS) https://martinfowler.com/eaaDev/EventSourcing.html https://martinfowler.com/bliki/CQRS.html 47

Slide 48

Slide 48 text

RSocket 48

Slide 49

Slide 49 text

Reactive Streams semantics on protocol level 49

Slide 50

Slide 50 text

Message-driven Asynchronous 50

Slide 51

Slide 51 text

Fire-and-Forget Request/Response Request/Stream Channel 51

Slide 52

Slide 52 text

Flow Control Backpressure Leasing 52

Slide 53

Slide 53 text

Binary 53

Slide 54

Slide 54 text

TCP WebSockets Aeron Upcoming: HTTP/3 (QUIC) 54

Slide 55

Slide 55 text

Gateways 55

Slide 56

Slide 56 text

Discoverability 56

Slide 57

Slide 57 text

Changing topology 57

Slide 58

Slide 58 text

Service Registration and Discovery Service A Service Registry Service A Service A 1. Register Service B 2. Query for service A instances 3. Connect 58

Slide 59

Slide 59 text

Spring Cloud Gateway 59

Slide 60

Slide 60 text

Spring Cloud Gateway Spring Cloud Gateway Service 1 Service 2 Service 3 Service 4 Mobile App Web App 60

Slide 61

Slide 61 text

Spring Cloud Gateway Load Balancing Fault Tolerance Rate Limiting Security 61

Slide 62

Slide 62 text

RSocket Broker 62

Slide 63

Slide 63 text

RSocket Broker Load Balancing Fault Tolerance Security Service Discovery 63

Slide 64

Slide 64 text

RSocket Broker RSocket Broker Service 1 Service 3 Service 2 Service 3 RSocket Broker RSocket Broker Service 1 Service 2 64

Slide 65

Slide 65 text

RSocket 💖 HTTP 65

Slide 66

Slide 66 text

RSocketHttpBridge 66

Slide 67

Slide 67 text

http POST host:port/serviceId/rsocketEndpointId < valid.json 67

Slide 68

Slide 68 text

POST Service ID and RSocket endpoint from URI byte[] Tags passed as headers Interaction mode from URI or default WellKnownKey 68

Slide 69

Slide 69 text

Architecture 69

Slide 70

Slide 70 text

Greenfield 70

Slide 71

Slide 71 text

Allows builders to choose the right tool for the job 71

Slide 72

Slide 72 text

Constraints are: budget, personnel, time to market, functional requirements. 72

Slide 73

Slide 73 text

Freedom of choice 73

Slide 74

Slide 74 text

Legacy/Heritage 74

Slide 75

Slide 75 text

Modernising architecture by areas/ components 75

Slide 76

Slide 76 text

Legacy Service + RSocket ecosystem Legacy HTTP Service RSocket Broker RSocket Service RSocket Service RSocket Service RSocket Service 76

Slide 77

Slide 77 text

Legacy Service + RSocket ecosystem Legacy HTTP Service RSocket Broker RSocket Service RSocket Service RSocket Service RSocket Service HTTP RSocket Bridge 77

Slide 78

Slide 78 text

Demo 78

Slide 79

Slide 79 text

Demo Flow HTTP Loan Service RSocket Broker RSocket Verification Service Gateway HTTP RSocket Bridge Verification Request Verification Response 79

Slide 80

Slide 80 text

Resources ● https://github.com/OlgaMaciaszek/spring-one-2021-rsocket-http-sample ● https://github.com/rsocket-routing/rsocket-routing-broker ● https://github.com/spring-projects-experimental/spring-native ● https://spring.io/projects/spring-cloud-function ● https://spring.io/projects/spring-cloud-contract ● https://spring.io/projects/spring-cloud-gateway ● https://rsocket.io/ 80

Slide 81

Slide 81 text

Thank you @olga_maciaszek @spencerbgibb © 2020 Spring. A VMware-backed project. 81