Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
單體式服務邁向微服務 @ MOPCON 2019
Search
Hash Lin
October 19, 2019
Technology
3
1.8k
單體式服務邁向微服務 @ MOPCON 2019
微服務的興起,透過微服務可以改善現有系統架構上的問題,是什麼原因讓 KKBOX 開始使用微服務?又是如何透過容器達到快速部屬與管理的,讓我們一探究竟。
Hash Lin
October 19, 2019
Tweet
Share
More Decks by Hash Lin
See All by Hash Lin
如何在微服務系統架構上導入 CI/CD
hashman
1
110
MOPCON 2019 資訊組工作方法
hashman
0
370
看 KKBOX 怎麼走通知這條路 @ COSCUP 2018
hashman
2
640
Other Decks in Technology
See All in Technology
テスト”ケース”駆動開発 で手戻りをなくそう
ryohma0510
0
320
フルカイテン株式会社 採用資料
fullkaiten
0
32k
DroidKaigi 2024 たすけて!ViewModel
mhidaka
5
940
開発者の定量・定性データを組み合わせて開発者体験を把握するための取り組み
ham0215
1
130
事前準備が肝!AI活用のための業務改革
layerx
PRO
1
380
【株式会社ELYZA】|GENIAC成果報告会 自社開発モデルプレゼンテーション
elyza
1
280
AIを活用した柔軟かつ効率的な社内リソース検索への取り組み
cygames
0
180
Functional TypeScript
naoya
11
4.8k
Swift Testingのconfirmationを コードリーディング/Dive into Swift Testing confirmation
laprasdrum
2
260
Mocking in Rust Applications
taiki45
2
410
不動産売買取引におけるAIの可能性とプロダクトでのAI活用
zabio3
0
270
サーバー管理しないサーバーサービスManaged DevOps Pool
kkamegawa
0
130
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
Ruby is Unlike a Banana
tanoku
96
11k
How to train your dragon (web standard)
notwaldorf
85
5.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
36
1.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
354
29k
What the flash - Photography Introduction
edds
67
11k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Code Review Best Practice
trishagee
62
16k
Faster Mobile Websites
deanohume
304
30k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
Code Reviewing Like a Champion
maltzj
517
39k
Why You Should Never Use an ORM
jnunemaker
PRO
53
8.9k
Transcript
KKBOX 後端工程師 Hash@MOPCON 單體式系統邁向微服務
單體式系統 邁向微服務 單體式系統 Monolithic 02 01 03 04 微服務系統 Microservices
部署 Deployment 案例分享 Case Study
小故事
KKBOX 誒誒,可以幫我升級一下 kkbox-search 套件 嗎? Channels Direct Message 主管 +
+ 好啊~ 感謝幫忙 hash rainycheng hash Monday, September 23th rainycheng 9+ 1
None
KKBOX Channels Direct Message 主管 + + 誒誒,這個套件是不是要安裝 opencc 在主機上面?
rainycheng Friday, September 27nd rainycheng 9+ 9+ ... 你又沒有說... 系統噴 Error 才發現 rainycheng 對啊,機器沒有裝唷? hash 喔喔拍謝忘了說,麻煩你請處理一下 hash … rainycheng
None
KKBOX Channels Direct Message 主管 大人 + + Friday, October
3nd 主管 Q 9+ 9+ 安安,我想要升級 CMS 主機 PHP 版本到 7.2 hash 好的,知道了 hash Hmm… 這個主機上面有不少服務運作,需要跟其他 Project owner 確認完才可以動手唷 主管 Q 天真可愛 / CQD / wesleyliao
KKBOX Channels Direct Message 主管 + + Friday, October 3nd
rainycheng 9+ 9+ 這很麻煩耶,需要花不少時間,你很急嗎? rainycheng 不好意思想問一下 xxx 專案是否可以升級上 PHP 7.2 呢? hash 是不會但是希望可以盡快升級(汗... hash 我抽空處理,不保證什麼時候可以完成唷 rainycheng
有沒有很眼熟呢?
單體式系統 (Monolithic) 01
None
None
None
單體式系統缺點 異動套件 / 設定檔 不得隨意異動系統伺服器 上的套件或是設定檔 注意相依性 任何套件的升級,都需要 特別注意這個套件所帶來 的相依性
建置成本高 須顧及應用程式所有 相依性進行建置
微服務 02
去耦合 將服務切分成獨立的 個體,服務獨立運作 微服務 將單體式系統拆成多個小服務 這些服務都會透過定義好的介面 進行溝通 介面 服務與服務間僅有 介面相依
降低發佈風險 一次發佈一個服務
None
舒服 乾淨 清楚 明瞭
微服務真美好
注意 Latency 上升
None
注意 Latency 上升 Debug 困難
None
注意 Latency 上升 傳輸不可靠 Debug 困難 主機數成長
None
▪ 重複的程式碼 ▪ 相依性過高 ▪ 效能瓶頸 界定服務邊界
部署 03
Gitlab Open Source CI Third Party Github * V Gitlab
V V V BitBucket V V
1. 自動化檢查 2. 透過 Docker 進行不同版本的測試 3. 確保每次的 Merge 都是綠燈
Gitlab CI Installation Check Testing Deploy CI / CD
.gitlab-ci.yml Gitlab CI
Sending Merge Request Develop Continuous Integration Review & Merge Request
Continuous Deployment Run CI Pipeline 1. Install Project 2. Unit Test Build Docker Image Docker Hub / Private Docker Registry
Live Demo
案例分析 04
去耦合
None
Project 1 kkbox-search v1.x v1.x Project 2 kkbox-search v1.x Project
3 kkbox-search v1.x
Project 1 kkbox-search v1.x Project 2 kkbox-search v1.x Project 3
kkbox-search v1.x v1.x v2.x
Project 1 kkbox-search v2.x Project 2 kkbox-search v2.x Project 3
kkbox-search v2.x v1.x v2.x
Project 1 Project 2 Project 3 API Search kkbox-search v1.x
v1.x v2.x
Project 1 Project 2 Project 3 API Search kkbox-search v2.x
v1.x v2.x
Docker 與微服務帶來的方便
Server A Ubuntu 16.04 + PHP 5.6 Project A Project
A Project A Project A Project A Project A Server B Ubuntu 16.04 + PHP 5.6 Server C Ubuntu 16.04 + PHP 5.6 Server D Ubuntu 16.04 + PHP 7.2 Server E Ubuntu 16.04 + PHP 7.2 Server F Ubuntu 16.04 + PHP 7.2 Project B Project B Project B
HA Proxy Ubuntu 16.04 + PHP 5.6 Project A Cloud
Ubuntu 16.04 + PHP 5.6 Project A Ubuntu 16.04 + PHP 5.6 Project A Ubuntu 16.04 + PHP 5.6 Project B Ubuntu 16.04 + PHP 5.6 Project B Ubuntu 16.04 + PHP 5.6 Project B
HA Proxy Ubuntu 16.04 + PHP 7.2 Project A Cloud
Ubuntu 16.04 + PHP 7.2 Project A Ubuntu 16.04 + PHP 7.2 Project A Ubuntu 16.04 + PHP 5.6 Project B Ubuntu 16.04 + PHP 5.6 Project B Ubuntu 16.04 + PHP 5.6 Project B
單體式系統 邁向微服務 單體式系統 Monolithic 02 01 03 04 微服務系統 Microservices
部署 Deployment 案例分享 Case Study
你們也有這些問題嗎?
Does anyone have any questions?
[email protected]
Thank you!