Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tableapp architecture migration story for GCPUG.TW

389 views

Published on

Tableapp architecture migration story for GCPUG.TW

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Tableapp architecture migration story for GCPUG.TW

  1. 1. About me ● 陳彥文 / wenchen ● 自由開發者 ● AWS五年經驗 / GCP一年經驗 ● 過去在新創圈打滾
  2. 2. Migrate From AWS to GCP TABLEAPP Architecture Story Yen-Wen Chen 5 July 2017 GCPUG.TW
  3. 3. 緣由
  4. 4. 找出問題 TABLEAPP Cloudfront CDN Assets / Images S3 DNS Route53 Mail Server SES Notification SNS Clusters EC2 Database RDS / HA 1. 展開完整架構 2. 列出遭遇到的狀況 3. 盡可能開啟所有Log 4. 分析狀況來源
  5. 5. 選定改善目標 改善反應速率 資料庫效能 Log整合 降低部署時間 支撐更多的流量 降低成本 跨區負載
  6. 6. 選定改善目標及檢驗標準 改善反應速率 資料庫效能 Log整合 降低部署時間 支撐更多的流量 降低成本 跨區負載 ● 資源使用效率 ● 減緩月支出成長速度
  7. 7. 實驗
  8. 8. TABLEAPP AWS Architecture TABLEAPP Cloudfront CDN Assets / Images S3 DNS Route53 Mail Server SES Notification SNS Load Balancer Application Clusters EC2 / AutoScale Database RDS / HA
  9. 9. AWS Architecture Resource Problem Scaling!! ● Auto Scaling Benefit ○ Maintain availability ○ Maintain performance ○ Decrease capacity during lulls to reduce costs ● Monthly avg CPU usage under 5% ● EC2 requiring is slow ○ about 1~2min to activate a ec2 ○ about 1~2min to update latest source code ○ about 30s to run health check
  10. 10. Our solution is Container
  11. 11. Virturalized Infrastructure Infrastructure Host OS Docker Engine BINS/LIBS APP Container BINS/LIBS APP Container BINS/LIBS APP Container We can ignore resource problem
  12. 12. Container Auto Scaling Container A Container B Container C Container A Container B Container C Container A Container C Machine 1 Machine 2 Machine 3 If Container C causes CPU overload Then put a new C into Machine 3
  13. 13. Service Auto Discovery Container A Container B Container C Container A Container B Container C Container A Container C Machine 1 Machine 2 Machine 3 Service A Service B Service C Service auto discovery / configuration / load balance
  14. 14. Other Benefits of Docker Moby ● Version Control ○ push code and build ○ every commit has its own images ● Lightweight ○ fast activation (~ 10s) and rollback ○ small image ● Isolation ○ applications and resources are isolated and segregated ● Protable ○ Multi-cloud platform support ○ BOSS asked that
  15. 15. We want to run moby on …?
  16. 16. Kubernetes vs EC2 Container Service Kubernetes EC2 Container Service Open Source NO PaaS Google Compute Engine, Rackspace, Microsoft Azure, vSphere, ... AWS Community x Management Kubectl / API AWS CLI / API Protable Run anywhere AWS only Service / Discovery built-in Elastic Load Balance
  17. 17. How about K8s on AWS?
  18. 18. Deploy Kubernetes on EC2 ● Maintain Kubernetes yourself ○ Install ○ Testing ○ Update ○ and …. ● Handle auto-scale manually ○ remove pods before remove ec2 ● Using CI to deploy image ● Set up logging and monitoring policy ● Integrate AWS resource and Kubernetes manually ○ It must be scalable No, it sucks ...
  19. 19. Kubernetes on Google Cloud is awesome
  20. 20. Google Container Engine (GKE) ● Easy ● Full managed ○ even update kubernetes ● Logging and Monitoring support (stackdrive) ● Automatic and configurable cluster scaling ● Google Cloud Platform resource integration
  21. 21. Design new Architecture
  22. 22. TABLEAPP GCP Architecture Cloud Load Balancing Database Cloud SQL EastAsia Cluster Container Engine TABLEAPP Cloud CDN TABLEAPP Cloudfront CDN Assets / Images S3 DNS Route53 Mail Server SES Notification SNS
  23. 23. Architecture inside kubernetes TABLEAPP Kubernetes Cluster Front Service API Service Manage Service Front Front Manage Manage API CloudSQL Proxy API CloudSQL Proxy API Cloud Load Balancing Manage Cloud Load Balancing WWW Cloud Load Balancing Database Cloud SQL Logger Service Logger Logging
  24. 24. Deployment EastAsia Cluster Container Engine BitBucket Build Trigger Container Registry Build Images Container Registry Base Images Code Repository ImageUpdate Pub/Sub Pods Update Cloud Functions Config Files Cloud Storage 2 1 Base Images Dockerfile Updated 2 Web Source Code Updated 3 Build Images Process 4 Pull Latest Config File 5 Trigger Image Update 6 Notified Image Update 7 Pull Latest Docker Image 8 Pull Latest Config File From Pods startup script 9 Migrate Database From Pods startup script Database Cloud SQL 1 3 4 7 8 5 6 9
  25. 25. Log Collection EastAsia Cluster Container Engine BitBucket Build Trigger Container Registry Build Images Container Registry Code Repository Base Images ImageUpdate Pub/Sub Pods Update Cloud Functions Config Files Cloud Storage Database Cloud SQL Cloud Load Balancing Tableapp Cloud CDN Logging Build Log Log Files Cloud StorageBackup
  26. 26. Cost and Usage
  27. 27. Request History Requests has grown 5 times in past year5x
  28. 28. Payment History ● cost increased almost 2 times in six month ● We start optimize AWS architecture at 2016-11 Start Optimize 2x
  29. 29. Payment History ● After reduce cost ● We start maintain architecture in Google at 2017-02 Start Test Google
  30. 30. Payment History Now We redece cost successful We can afford more request
  31. 31. Conclusion ● We still remain some service in AWS ○ SES ○ SNS ○ S3 ○ Read replica Database ● CloudCDN is really fast ○ very low latency ○ optimize network ○ POP is stable ● Lower price ○ based on new arch, we save 40% cost
  32. 32. QA

×