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

Evolution of Architecture @ Kauche

Yuki Ito
September 04, 2022

Evolution of Architecture @ Kauche

Yuki Ito

September 04, 2022
Tweet

More Decks by Yuki Ito

Other Decks in Technology

Transcript

  1. Evolution of Architecture @ Kauche
    Yuki Ito (@mrno110)

    View full-size slide

  2. Kauche


    Architect
    Yuki Ito


    @mrno110

    View full-size slide

  3. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View full-size slide

  4. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View full-size slide

  5. Architecture
    Run
    Tasks
    Pub/Sub
    Mobile App External Service
    Mobile API Web Hook API Job API
    Scheduler

    View full-size slide

  6. What is Cloud Run
    Cloud Run is a managed compute
    platform that enables you to run
    containers that are invocable via
    requests or events.


    Cloud Run is serverless: it abstracts
    away all infrastructure management...
    https://cloud.google.com/run/docs

    View full-size slide

  7. Architecture - Key Concepts -
    ɾEverything runs on Cloud Run


    ɾEverything runs as a API (gRPC)

    View full-size slide

  8. Architecture
    Run
    Tasks
    Pub/Sub
    Mobile App External Service
    Mobile API Web Hook API Job API
    Scheduler

    View full-size slide

  9. Architecture
    Run
    Tasks
    Pub/Sub
    Mobile App External Service
    Mobile API Web Hook API Job API
    Scheduler

    View full-size slide

  10. Architecture - Key Concepts -
    e.g.) VS. Cloud Functions Trigger
    Run Pub/Sub Functions
    Run Firestore Functions

    View full-size slide

  11. Architecture
    Run
    Tasks
    Pub/Sub
    Mobile App External Service
    Mobile API Web Hook API Job API
    Scheduler

    View full-size slide

  12. Architecture
    ✅ Everything is Managed as API De
    fi
    nitions


    ✅ Reuse same implementation logic as APIs


    ✅ Use same Monitoring environments

    View full-size slide

  13. Architecture
    ✅ Everything is Managed as API De
    fi
    nitions


    ✅ Reuse same implementation logic as APIs


    ✅ Use same Monitoring environments

    View full-size slide

  14. gRPC
    gRPC is a modern open source
    high performance Remote
    Procedure Call (RPC)
    framework that can run in
    any environment.
    https://grpc.io/

    View full-size slide

  15. gRPC
    🧑💻

    View full-size slide

  16. Architecture: 2020 ~
    Run
    Customer App
    Customer gRPC

    View full-size slide

  17. Architecture: 2021 ~
    Run
    Customer App
    Customer gRPC / Partner gRPC
    Partner App

    View full-size slide

  18. Modular Monolith
    Almost all the cases where I've heard of a system that was built
    as a microservice system from scratch, it has ended up in serious
    trouble. ...


    you shouldn't start a new project with microservices, even if
    you're sure your application will be big enough to make it
    worthwhile.
    MonolithFirst
    Martin Fowler
    https://martinfowler.com/bliki/MonolithFirst.html

    View full-size slide

  19. Modular Monolith
    ✅ Pros


    - Single Deployment Unit


    - Simple Design


    ❌ Cons


    - Independence


    - Autonomy

    View full-size slide

  20. Architecture: 2022 ~
    Run
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC

    View full-size slide

  21. API Gateway Pattern
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC
    API Gateway

    View full-size slide

  22. O
    ffl
    oading Cross-Cutting Concerns to the API Gateway
    ✓ Authentication / Authorization


    ✓ Transcoding


    ✓ Being Internet facing (TLS / Domain / CDN / IP ...)


    ✓ ...

    View full-size slide

  23. API Gateway Pattern
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC
    Envoy (API Gateway)

    View full-size slide

  24. Envoy
    https://www.envoyproxy.io/docs/envoy/v1.23.0/intro/what_is_envoy
    Envoy is an L7 proxy and communication bus
    designed for large modern service oriented
    architectures. The project was born out of the
    belief that:ɹ


    The network should be transparent to
    applications. When network and application
    problems do occur it should be easy to
    determine the source of the problem.

    View full-size slide

  25. Why Envoy?
    • Extensibility with WebAssembly


    • Dynamic Con
    fi
    gurations


    • Widely used in the Cloud Native World

    View full-size slide

  26. Why Envoy?
    • Extensibility with WebAssembly


    • Dynamic Con
    fi
    gurations


    • Widely used in the Cloud Native World

    View full-size slide

  27. Envoy Architecture
    https://www.envoyproxy.io/docs/envoy/latest/intro/life_of_a_request#http-
    fi
    lter-chain-processing

    View full-size slide

  28. HTTP Filters
    JWT Authentication
    RBAC
    Modify HTTP Headers
    Request

    View full-size slide

  29. HTTP Filters
    JWT Authentication
    RBAC
    Modify HTTP Headers
    Request

    View full-size slide

  30. Wasm Filter
    Compile

    View full-size slide

  31. proxy-wasm
    https://github.com/proxy-wasm/spec/blob/c8
    ff
    5a8ac7b18a65360fe8ab843a6291b8947682/docs/WebAssembly-in-Envoy.md

    View full-size slide

  32. e.g. Fetching access tokens from Google Cloud Metadata Server
    API Gateway
    Upstream Microservice
    Metadata Server
    Access Token Access Token
    Get Access Token
    Request

    View full-size slide

  33. Microserivces
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC
    API Gateway

    View full-size slide

  34. from Single Service

    View full-size slide

  35. to Microservices

    View full-size slide

  36. Access Control

    View full-size slide

  37. Access Control - Cloud Run -
    • Access Control with IAM


    • Restricting Ingress

    View full-size slide

  38. Access Control with IAM

    View full-size slide

  39. Ingress Setting
    • all


    • internal-and-cloud-load-balancing


    • internal

    View full-size slide

  40. Ingress Setting
    all

    View full-size slide

  41. Ingress Setting
    internal-and-cloud-load-balancing

    View full-size slide

  42. Ingress Setting
    internal

    View full-size slide

  43. Network
    https://kauche.connpass.com/event/252043/

    View full-size slide

  44. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View full-size slide

  45. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View full-size slide

  46. Architecture: 2022 ~
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC
    API Gateway

    View full-size slide

  47. Architecture: 2022 ~
    Customer App
    Customer gRPC
    Partner App
    Partner gRPC
    API Gateway

    View full-size slide

  48. Architecture: 2022 ~
    Customer App
    Customer gRPC
    API Gateway

    View full-size slide

  49. Architecture: 2022 ~
    Commerce gRPC Social gRPC
    API Gateway
    Customer App

    View full-size slide

  50. Single Aggregation Layer
    Commerce gRPC
    API Gateway
    Aggregation Layer
    Social gRPC

    View full-size slide

  51. Single Aggregation Layer
    ❌ Initiative


    ❌ Independence


    ❌ Autonomy

    View full-size slide

  52. GraphQL Federation
    Commerce gRPC
    API Gateway
    Social GraphQL
    Customer GraphQL Federation (Apollo Router)
    Commerce GraphQL
    Social gRPC

    View full-size slide

  53. GraphQL Federation
    Commerce GraphQL Social GraphQL
    +
    Customer GraphQL


    (Super Graph)
    (Rover CLI)

    View full-size slide

  54. GraphQL Federation
    Commerce gRPC
    API Gateway
    Social GraphQL
    Customer GraphQL Federation (Apollo Router)
    Commerce GraphQL
    Social gRPC

    View full-size slide

  55. GraphQL Federation
    Commerce gRPC
    API Gateway
    Social GraphQL
    Customer GraphQL Federation (Apollo Router)
    Commerce GraphQL
    Social gRPC
    Platfrom
    Business

    View full-size slide

  56. GraphQL Federation
    ✅ Initiative


    ✅ Independence


    ✅ Autonomy

    View full-size slide

  57. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View full-size slide