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 Slide

  2. Kauche


    Architect
    Yuki Ito


    @mrno110

    View Slide

  3. View Slide

  4. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View Slide

  5. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View Slide

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

    View Slide

  7. 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 Slide

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


    ɾEverything runs as a API (gRPC)

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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


    ✅ Reuse same implementation logic as APIs


    ✅ Use same Monitoring environments

    View Slide

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


    ✅ Reuse same implementation logic as APIs


    ✅ Use same Monitoring environments

    View Slide

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

    View Slide

  16. gRPC
    🧑💻

    View Slide

  17. Architecture: 2020 ~
    Run
    Customer App
    Customer gRPC

    View Slide

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

    View Slide

  19. 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 Slide

  20. Modular Monolith
    ✅ Pros


    - Single Deployment Unit


    - Simple Design


    ❌ Cons


    - Independence


    - Autonomy

    View Slide

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

    View Slide

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

    View Slide

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


    ✓ Transcoding


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


    ✓ ...

    View Slide

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

    View Slide

  25. 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 Slide

  26. Why Envoy?
    • Extensibility with WebAssembly


    • Dynamic Con
    fi
    gurations


    • Widely used in the Cloud Native World

    View Slide

  27. Why Envoy?
    • Extensibility with WebAssembly


    • Dynamic Con
    fi
    gurations


    • Widely used in the Cloud Native World

    View Slide

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

    View Slide

  29. HTTP Filters
    JWT Authentication
    RBAC
    Modify HTTP Headers
    Request

    View Slide

  30. HTTP Filters
    JWT Authentication
    RBAC
    Modify HTTP Headers
    Request

    View Slide

  31. Wasm Filter
    Compile

    View Slide

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

    View Slide

  33. 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 Slide

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

    View Slide

  35. from Single Service

    View Slide

  36. to Microservices

    View Slide

  37. Access Control

    View Slide

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


    • Restricting Ingress

    View Slide

  39. Access Control with IAM

    View Slide

  40. Ingress Setting
    • all


    • internal-and-cloud-load-balancing


    • internal

    View Slide

  41. Ingress Setting
    all

    View Slide

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

    View Slide

  43. Ingress Setting
    internal

    View Slide

  44. Network

    View Slide

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

    View Slide

  46. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View Slide

  47. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  53. Single Aggregation Layer
    ❌ Initiative


    ❌ Independence


    ❌ Autonomy

    View Slide

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

    View Slide

  55. GraphQL Federation
    Commerce GraphQL Social GraphQL
    +
    Customer GraphQL


    (Super Graph)
    (Rover CLI)

    View Slide

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

    View Slide

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

    View Slide

  58. GraphQL Federation
    ✅ Initiative


    ✅ Independence


    ✅ Autonomy

    View Slide

  59. Agenda
    • Past ~ Present


    • Architecture


    • Microservices


    • Future


    • API Federation

    View Slide