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 full-size slide

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

    View full-size slide

  3. What is a Cloud-Native API?
    3

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  6. API First: The API is the product
    6

    View full-size slide

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

    View full-size slide

  8. Systems Driven by the API
    8

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  12. Serverless
    12

    View full-size slide

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

    View full-size slide

  14. Backend as a Service
    14

    View full-size slide

  15. Function as a Service
    15

    View full-size slide

  16. Event-Driven
    16

    View full-size slide

  17. Infrastructure management handled by
    cloud providers
    17

    View full-size slide

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

    View full-size slide

  19. Emphasis on short startup and low
    memory footprint
    19

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  22. Tanzu Application Platform
    22

    View full-size slide

  23. Efficiency/Speed
    23

    View full-size slide

  24. Responsiveness is important
    Optimize for availability and speed
    24

    View full-size slide

  25. Infrastructure is Important.
    Scaling and Resiliency
    26

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  28. APIs within systems
    30

    View full-size slide

  29. Backward compatibility
    Addition only
    Tolerant consumers
    Deferred updates
    31

    View full-size slide

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

    View full-size slide

  31. '
    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 full-size slide

  32. Resource-oriented
    36

    View full-size slide

  33. Simple and straightforward
    37

    View full-size slide

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

    View full-size slide

  35. 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 full-size slide

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

    View full-size slide

  37. Upcoming: HTTP/3
    QUIC-based
    41

    View full-size slide

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

    View full-size slide

  39. Topics & Queues
    44

    View full-size slide

  40. Durable or Ephemeral
    45

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  43. Reactive Streams semantics on
    protocol level
    49

    View full-size slide

  44. Message-driven
    Asynchronous
    50

    View full-size slide

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

    View full-size slide

  46. Flow Control
    Backpressure
    Leasing
    52

    View full-size slide

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

    View full-size slide

  48. Discoverability
    56

    View full-size slide

  49. Changing topology
    57

    View full-size slide

  50. 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 full-size slide

  51. Spring Cloud Gateway
    59

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  54. RSocket Broker
    62

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  57. RSocket 💖 HTTP
    65

    View full-size slide

  58. RSocketHttpBridge
    66

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  61. Architecture
    69

    View full-size slide

  62. Greenfield
    70

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  65. Freedom of choice
    73

    View full-size slide

  66. Legacy/Heritage
    74

    View full-size slide

  67. Modernising architecture by areas/
    components
    75

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  71. 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 full-size slide

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

    View full-size slide