Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Resilient and Adaptable Systems with Cloud Native APIs

Resilient and Adaptable Systems with Cloud Native APIs

You may have heard about cloud native applications and the patterns and infrastructure required to run them, but what about your APIs? What is a cloud native API?

As we move to cloud native systems, the APIs are the glue that binds them together. API clients can be very diverse, from the desktop to mobile to IoT.

In this talk, we describe what a cloud native API is and discuss some patterns and protocols that help connect clients and APIs. Some of the patterns we discuss include API gateways, API discoverability, distributed APIs, and adaptability. We demo some tools, protocols, and projects that you can use to implement Cloud Native APIs, such as RSocket.

2559c50bf24b65eaba52fd7c75260c93?s=128

Olga Maciaszek-Sharma

September 01, 2021
Tweet

Transcript

  1. Spencer Gibb @spencerbgibb Olga Maciaszek-Sharma @olga_maciaszek Resilient and Adaptable Systems

    with Cloud Native APIs Copyright © 2020 VMware, Inc. or its affiliates. 1
  2. Cover w/ Image Agenda • What is a Cloud-Native API?

    • Protocols • Gateways • Architecture • Demo • Q+A 2
  3. What is a Cloud-Native API? 3

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

  5. IoT devices API First: The API is the product WWW

    Mobile Apps Web apps 5
  6. API First: The API is the product 6

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

    7
  8. Systems Driven by the API 8

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

    Balancer 9
  10. Systems Driven by the API Resilience Fault Tolerance Rate Limiting

    10
  11. The API is greater than the sum of its parts

    11
  12. Serverless 12

  13. Server-side architecture run in stateless, event-triggered, ephemeral compute containers.* *

    https://martinfowler.com/articles/serverless.html 13
  14. Backend as a Service 14

  15. Function as a Service 15

  16. Event-Driven 16

  17. Infrastructure management handled by cloud providers 17

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

  19. Emphasis on short startup and low memory footprint 19

  20. Higher system complexity Complex monitoring and tracing Risk of vendor

    locks Last 10% trap 20
  21. Spring Cloud Function @SpringBootApplication public class Application { [...] @Bean

    public Function<String, String> uppercase() { return value -> value.toUpperCase(); }} 21
  22. Tanzu Application Platform 22

  23. Efficiency/Speed 23

  24. Responsiveness is important Optimize for availability and speed 24

  25. Protocols 25

  26. Infrastructure is Important. Scaling and Resiliency 26

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

    matters. 27
  28. Evolving 28

  29. Intra-service communication as part of functionalities’ implementation 29

  30. APIs within systems 30

  31. Backward compatibility Addition only Tolerant consumers Deferred updates 31

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

  33. ' 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
  34. Protocols 34

  35. HTTP 35

  36. Resource-oriented 36

  37. Simple and straightforward 37

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

  39. 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
  40. HTTP/2 Binary Multiplexed Headers compression Server Push 40

  41. Upcoming: HTTP/3 QUIC-based 41

  42. Messaging 42

  43. Rabbitmq & Kafka offer distributed message brokers and streaming semantics

    43
  44. Topics & Queues 44

  45. Durable or Ephemeral 45

  46. Messaging allows separation of concerns at the API level 46

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

  48. RSocket 48

  49. Reactive Streams semantics on protocol level 49

  50. Message-driven Asynchronous 50

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

  52. Flow Control Backpressure Leasing 52

  53. Binary 53

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

  55. Gateways 55

  56. Discoverability 56

  57. Changing topology 57

  58. 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
  59. Spring Cloud Gateway 59

  60. Spring Cloud Gateway Spring Cloud Gateway Service 1 Service 2

    Service 3 Service 4 Mobile App Web App 60
  61. Spring Cloud Gateway Load Balancing Fault Tolerance Rate Limiting Security

    61
  62. RSocket Broker 62

  63. RSocket Broker Load Balancing Fault Tolerance Security Service Discovery 63

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

    Service 3 RSocket Broker RSocket Broker Service 1 Service 2 64
  65. RSocket 💖 HTTP 65

  66. RSocketHttpBridge 66

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

  68. POST Service ID and RSocket endpoint from URI byte[] Tags

    passed as headers Interaction mode from URI or default WellKnownKey 68
  69. Architecture 69

  70. Greenfield 70

  71. Allows builders to choose the right tool for the job

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

  73. Freedom of choice 73

  74. Legacy/Heritage 74

  75. Modernising architecture by areas/ components 75

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

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

    RSocket Service RSocket Service RSocket Service RSocket Service HTTP RSocket Bridge 77
  78. Demo 78

  79. Demo Flow HTTP Loan Service RSocket Broker RSocket Verification Service

    Gateway HTTP RSocket Bridge Verification Request Verification Response 79
  80. 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
  81. Thank you @olga_maciaszek @spencerbgibb © 2020 Spring. A VMware-backed project.

    81