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

Migrating to Microservices

Yoshiyuki Komazaki
June 27, 2019
730

Migrating to Microservices

Yoshiyuki Komazaki

June 27, 2019
Tweet

Transcript

  1. Region #ECEFF1 Batch Layer Track Cloud Load Balancing Track Compute

    Engine Autoscaling Distributed Queue Cloud Pub/Sub End User Devices Redis Analyze Analyze Compute Engine Autoscaling Batch Cloud Bigtable Cloud Bigtable BigQuery Stride Compute Engine Cloud Storage Admin Admin Compute Engine Autoscaling Client Tracker.js Cloud CDN Realtime Layer or Cloud Front AWS JS/ SDK/ API Redislabs ... Stackdriver Stride 全体構成
  2. Region #ECEFF1 Batch Layer Track Cloud Load Balancing Track Compute

    Engine Autoscaling Distributed Queue Cloud Pub/Sub End User Devices Redis Analyze Analyze Compute Engine Autoscaling Batch Cloud Bigtable Cloud Bigtable BigQuery Stride Compute Engine Cloud Storage Admin Admin Compute Engine Autoscaling Client Tracker.js Cloud CDN Realtime Layer or Cloud Front AWS JS/ SDK/ API Redislabs ... Stackdriver Stride 行数 + Ops用リポジトリ + ライブラリ等 : 1 : 1 : ??? リポジトリ数 エントリーポイント + 起動オプション
  3. - 機能を把握するのが難しい - 依存関係、影響範囲が見づらい - 変更がしづらい - 問題の切り分けが難しい - 起動が遅い

    現状の問題点を把握する 適切な大きさに分ける 明確な境界を設ける プロセスを分離する
  4. マイクロサービス化あるある(?) 分割の境界を間違える • 複数サービスにまたがる開発が面倒 • 通信コスト ◦ Latency ◦ API定義だらけ

    元々がモノリス。うまく分割できることを期待しない。 まずはモノレポ。その下で大きくディレクトリを分けつつ進める。
  5. コードベースの構成 karte services ops lib service-a service-b service-c nodejs frontend

    manifests service-a Dockerイメージを作成 Service内の実装も通信も自由 大体Teamに紐づいている単位 同期すべき共有Library 同期しなくていいものは別 repo k8sのmanifests service-client Service間通信用Client API Specから自動生成する
  6. 開発環境 理想: • 開発環境は本番環境に近づけたい • できればk8s 現実: • k8sの場合はイメージのbuildが必要 •

    既存の開発より遅くなる • skaffoldのfilesyncはalpha機能 ローカルではdocker-compose。nginxでLBを代替 namespaceを分けて動作確認できる検証用クラスタも作っておく