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.

Olga Maciaszek-Sharma

September 01, 2021
Tweet

More Decks by Olga Maciaszek-Sharma

Other Decks in Technology

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

    View Slide

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

    View Slide

  3. What is a Cloud-Native API?
    3

    View Slide

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

    View Slide

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

    View Slide

  6. API First: The API is the product
    6

    View Slide

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

    View Slide

  8. Systems Driven by the API
    8

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  12. Serverless
    12

    View Slide

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

    View Slide

  14. Backend as a Service
    14

    View Slide

  15. Function as a Service
    15

    View Slide

  16. Event-Driven
    16

    View Slide

  17. Infrastructure management handled by
    cloud providers
    17

    View Slide

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

    View Slide

  19. Emphasis on short startup and low
    memory footprint
    19

    View Slide

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

    View Slide

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

    View Slide

  22. Tanzu Application Platform
    22

    View Slide

  23. Efficiency/Speed
    23

    View Slide

  24. Responsiveness is important
    Optimize for availability and speed
    24

    View Slide

  25. Protocols
    25

    View Slide

  26. Infrastructure is Important.
    Scaling and Resiliency
    26

    View Slide

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

    View Slide

  28. Evolving
    28

    View Slide

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

    View Slide

  30. APIs within systems
    30

    View Slide

  31. Backward compatibility
    Addition only
    Tolerant consumers
    Deferred updates
    31

    View Slide

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

    View Slide

  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

    View Slide

  34. Protocols
    34

    View Slide

  35. HTTP
    35

    View Slide

  36. Resource-oriented
    36

    View Slide

  37. Simple and straightforward
    37

    View Slide

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

    View Slide

  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

    View Slide

  40. HTTP/2
    Binary
    Multiplexed
    Headers compression
    Server Push
    40

    View Slide

  41. Upcoming: HTTP/3
    QUIC-based
    41

    View Slide

  42. Messaging
    42

    View Slide

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

    View Slide

  44. Topics & Queues
    44

    View Slide

  45. Durable or Ephemeral
    45

    View Slide

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

    View Slide

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

    View Slide

  48. RSocket
    48

    View Slide

  49. Reactive Streams semantics on
    protocol level
    49

    View Slide

  50. Message-driven
    Asynchronous
    50

    View Slide

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

    View Slide

  52. Flow Control
    Backpressure
    Leasing
    52

    View Slide

  53. Binary
    53

    View Slide

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

    View Slide

  55. Gateways
    55

    View Slide

  56. Discoverability
    56

    View Slide

  57. Changing topology
    57

    View Slide

  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

    View Slide

  59. Spring Cloud Gateway
    59

    View Slide

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

    View Slide

  61. Spring Cloud Gateway
    Load Balancing
    Fault Tolerance
    Rate Limiting
    Security
    61

    View Slide

  62. RSocket Broker
    62

    View Slide

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

    View Slide

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

    View Slide

  65. RSocket 💖 HTTP
    65

    View Slide

  66. RSocketHttpBridge
    66

    View Slide

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

    View Slide

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

    View Slide

  69. Architecture
    69

    View Slide

  70. Greenfield
    70

    View Slide

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

    View Slide

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

    View Slide

  73. Freedom of choice
    73

    View Slide

  74. Legacy/Heritage
    74

    View Slide

  75. Modernising architecture by areas/
    components
    75

    View Slide

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

    View Slide

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

    View Slide

  78. Demo
    78

    View Slide

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

    View Slide

  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

    View Slide

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

    View Slide