Spencer Gibb @spencerbgibb
Olga Maciaszek-Sharma @olga_maciaszek
Resilient and Adaptable Systems
with Cloud Native APIs
Copyright © 2020 VMware, Inc. or its affiliates.
1
Cover w/ Image
Agenda
● What is a Cloud-Native API?
● Protocols
● Gateways
● Architecture
● Demo
● Q+A
2
What is a Cloud-Native API?
3
The API is the product
https://techcrunch.com/2019/09/06/apis-are-the-next-big-saas-wave/
API First
4
IoT devices
API First: The API is the product
WWW
Mobile Apps Web apps
5
API First: The API is the product
6
API First: The API is the product
Streaming Shopping Shipping
7
Systems Driven by the API
8
Systems Driven by the API
Apps Instances &
Networks
Load
Balancer
9
Systems Driven by the API
Resilience Fault
Tolerance
Rate
Limiting
10
The API is greater than the sum of its parts
11
Serverless
12
Server-side architecture run in
stateless, event-triggered, ephemeral
compute containers.*
* https://martinfowler.com/articles/serverless.html
13
Backend as a Service
14
Function as a Service
15
Event-Driven
16
Infrastructure management handled by
cloud providers
17
Automatic scaling
Built-in high availability
Pay-for-use billing model
18
Emphasis on short startup and low
memory footprint
19
Higher system complexity
Complex monitoring and tracing
Risk of vendor locks
Last 10% trap
20
Spring Cloud Function
@SpringBootApplication
public class Application {
[...]
@Bean
public Function<String, String> uppercase() {
return value -> value.toUpperCase();
}}
21
Tanzu Application Platform
22
Efficiency/Speed
23
Responsiveness is important
Optimize for availability and speed
24
Protocols
25
Infrastructure is Important.
Scaling and Resiliency
26
Spring Ecosystem
allows focus on core business.
Speed to market matters.
27
Evolving
28
Intra-service communication as part of
functionalities’ implementation
29
APIs within systems
30
Backward compatibility
Addition only
Tolerant consumers
Deferred updates
31
Consumer-Driven Contracts
Collaborative
Scenario-based
Integration testing
Backwards compatibility testing
32
'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
Protocols
34
HTTP
35
Resource-oriented
36
Simple and straightforward
37
Client-Server/ Request-Response
Synchronous
Head-of-line blocking
38
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
HTTP/2
Binary
Multiplexed
Headers compression
Server Push
40
Upcoming: HTTP/3
QUIC-based
41
Messaging
42
Rabbitmq & Kafka
offer distributed message brokers
and streaming semantics
43
Topics & Queues
44
Durable or Ephemeral
45
Messaging allows separation of
concerns at the API level
46
Event Sourcing
Command Query Responsibility
Segregation (CQRS)
https://martinfowler.com/eaaDev/EventSourcing.html
https://martinfowler.com/bliki/CQRS.html
47
RSocket
48
Reactive Streams semantics on
protocol level
49
Message-driven
Asynchronous
50
Fire-and-Forget
Request/Response
Request/Stream
Channel
51
Flow Control
Backpressure
Leasing
52
Binary
53
TCP
WebSockets
Aeron
Upcoming: HTTP/3 (QUIC)
54
Gateways
55
Discoverability
56
Changing topology
57
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
Spring Cloud Gateway
59
Spring Cloud Gateway
Spring Cloud
Gateway
Service 1
Service 2
Service 3
Service 4
Mobile App
Web App
60
Spring Cloud Gateway
Load Balancing
Fault Tolerance
Rate Limiting
Security
61
RSocket Broker
62
RSocket Broker
Load Balancing
Fault Tolerance
Security
Service Discovery
63
RSocket Broker
RSocket
Broker
Service 1
Service 3
Service 2
Service 3
RSocket
Broker
RSocket
Broker
Service 1
Service 2
64
RSocket 💖 HTTP
65
RSocketHttpBridge
66
http POST
host:port/serviceId/rsocketEndpointId
< valid.json
67
POST
Service ID and RSocket endpoint from URI
byte[]
Tags passed as headers
Interaction mode from URI or default
WellKnownKey
68
Architecture
69
Greenfield
70
Allows builders to choose
the right tool for the job
71
Constraints are:
budget, personnel, time to market,
functional requirements.
72
Freedom of choice
73
Legacy/Heritage
74
Modernising architecture by areas/
components
75
Legacy Service + RSocket ecosystem
Legacy HTTP
Service
RSocket
Broker
RSocket Service
RSocket Service
RSocket Service
RSocket Service
76
Legacy Service + RSocket ecosystem
Legacy HTTP
Service
RSocket
Broker
RSocket Service
RSocket Service
RSocket Service
RSocket Service
HTTP RSocket
Bridge
77
Demo
78
Demo Flow
HTTP Loan Service RSocket Broker
RSocket
Verification
Service
Gateway
HTTP RSocket
Bridge
Verification Request
Verification Response
79
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
Thank you
@olga_maciaszek
@spencerbgibb
© 2020 Spring. A VMware-backed project.
81

Resilient and Adaptable Systems with Cloud Native APIs