Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
はてなリモートインターンシップ2022 マイクロサービス 講義資料
Search
Hatena
December 19, 2022
Programming
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
はてなリモートインターンシップ2022 マイクロサービス 講義資料
https://hatena.co.jp/recruit/intern/2022
Hatena
December 19, 2022
Transcript
88 slides
ϚΠΫϩαʔϏε #hatenaintern
☪仼סإ٭ٜ ˝ ם؆כםׂُؕؠٞئ٭لتֿלַֹֹס־־ ˝ ُؕؠٞئ٭لتס榫鏤סꦬ㍱妳־
☪仼ס⫂㳊 ˝ ُؕؠٞئ٭لتכע ˝ ٓؿٛت ˝ עיםמֽُׄؕؠٞئ٭لت ˝ ُؕؠٞئ٭لتס⮆Ⱏ亠嫎 ˝
ُؕؠٞئ٭لتסوٚؠطؔت ˝ ئ٭لتْشبٖ ˝ ױכ״
ֽ鎇םַ׆כ golang
ُؕؠٞئ٭لت ُؕؠٞئ٭لتכע
ُؕؠٞئ٭لت +
ُؕؠٞئ٭لت +
אאئ٭لتכע service a system that provides something that the public
needs, organized by the government or a private company Hatena REMOTE INTERNSHIP / ( ?)
ُؕؠٞئ٭لتכע + https://martinfowler.com/articles/microservices.html 2014 DDD( )
هٞءמכ׆סُؕؠٞئ٭لت 1 HTTP API - https://martinfowler.com/articles/microservices.html
ُؕؠٞئ٭لت REST API GraphQL gRPC... /
ةؘن٬يدتס䫍 2002 Amazon 1. ئ٭لتؕ٤ذ٭نؘ٭ت鵟י⪒יסظ٭ذכ嚀耆⪜ꝧ 2. אסؕ٤ذ٭نؘ٭ت鵟י鵟⟓םׄףםםַ 3. ؾشع٠٭ؠ飈סئ٭لتؕ٤ذ٭نؘ٭ت磬榺ג鵟⟓דֿׄ錉⺎ն 4.
✳榫䤗软עゖםַ HTTP Corba Pubsub ⛰ך荁ַ Bezos 5. Steve Yegge Google
ُؕؠٞئ٭لتס荁ַכ׆ API
ُؕؠٞئ٭لتס荁ַכ׆ ˝ 邾丗סؓوٛآ٭ب٘٤ך⺱⭚杼㲔逷䑒釐ֿםׂם ˝ ❆ֻף鵟湳ُؕؠٞئ٭لتכյ二ַؓوٛآ٭ب٘ ٤ךעאסُؕؠٞئ٭لتסٛؠؙتعדׄך鵟湳ֿך׀ ˝ ٚؕهٚٛך⺱׆כֿ⺎耆כַֻף⺎耆דֿյ銧鏤窜םל ֿ㰆㏇םַסֿَؕ٤ع ˝
ُؕؠٞئ٭لتׇכמز٭ّ⮉׆כֿך׀ ˝ 鵟湳םלْ٤طػ٤ت㓹泅ز٭ّםל
ُؕؠٞئ٭لتסחַכ׆ 1 web 2 20 ⾒ ⾒
ם僃鲣孱车זיַ־ ProtocolBu er gRPC GraphQL OpenAPI /
עיםכُؕؠٞئ٭لت ˝ עיםךُؕؠٞئ٭لت⮵榫יַױ ˝ 鐐ꄋئ٭لت ˝ هٞءذء ˝ 嚀危㰢綗 ˝
ز٭ّꝴךסظ٭ذס ˝ ؓوٛآ٭ب٘٤ُؕؠٞئ٭لتדׄך啶䡗יַכַֹյ釐碛釐碛ُ ؕؠٞئ٭لتיַ ˝ ؓوٛآ٭ب٘٤舅⛮עٓؿٛت┊㴩מ鷞榫יַ◄ֿ㛡ַ
ٓؿٛت ( ) 1 .... WAF(WebApplicationFramework)
ٓؿٛت 1 1 1 1 DB DB
ٓؿٛت 1 DB
vs CI/CD 2
1 1
ُؕؠٞئ٭لتס睦䈱 ? No /
㗞槡טׄגؤ٤ط؞تع DDD DB
磵⺬ꄆ邾 / ...
ُؕؠٞئ٭لتכظ٭ذ畘杼 ˝ ظ٭ذي٭ت┕סظ٭ذյُؕؠٞئ٭لتׇכמ斻玮י䧏ח׀ ˝ ظ٭ذي٭ت⪦僗כյ㗞槡טׄגؤ٤ط؞تعכַֹ䙫⽏ךֵױ荁ׂםַ ˝ ظ٭ذي٭ت邾丗סُؕؠٞئ٭لتך⪦僗כյظ٭ذي٭تֿ磵㷀ⶡ┉꤃㲹憠 מם ˝ ت؞٭ُ⪦僗יַג㕙⺬յֵئ٭لتך㚺催ⱶֻכ☽ئ٭لت㚺催מ鴑
䏼䑒釐ֵֿ ˝ ُؕؠٞئ٭لتׇכמ鸵⮉םظ٭ذي٭ت鹟䥃ך׀⮵憠ֵ ˝ ج؞ٖٛطؔ鈝憠鵭䈱鈝憠םלյ喋չ
ُؕؠٞئ٭لتכظ٭ذ畘杼
? No API GateWay API PC API API DB DB
1
ئ٭لتي٭تؓ٭؞طؠزٔ DB DB
ُؕؠٞئ٭لتס⮆Ⱏ
ُؕؠٞئ٭لتס⮆Ⱏ ˝ ُؕؠٞئ٭لت⛼זיַׂ꤀ע䑒յُؕؠٞئ٭لتס 鞊ⳉ婊㲊⛼哅ֿ䑒釐מם ˝ ُؕؠٞئ٭لتס⮆Ⱏ ˝ ⪮⛮氳ם⮆Ⱏ亠嫎釤⯥מյُؕؠٞئ٭لتס⯥䬠䤰ֻ יֽ׀ױֹ
ُؕؠٞئ٭لتס⯥䬠 DB
8 Fallacies of distributed computing ( 8 / ) -
1994 1. 2. 3. 4. 5. 6. 1 7. 8.
⺎鈝峮䓪 web / (Observability)
⺎鈝峮䓪 mackerel
ُؕؠٞئ٭لتס⮆Ⱏ ُؕؠٞئ٭لتס⮆Ⱏע荇չ孱孬ֿ㰆㏇ .... - - 僃鲣ךע⮆Ⱏ䣆Ⲃׄص٭ٜםלֿꝧ氦חחֵ
哅ⳉמ⮆Ⱏ ˝ 鏀錞 ˝ よ⿁辐炐٬吾碟 ˝ 鐐ꄋ ˝ ㏇䈻澬鏀 ˝
⭳蕔⛼哅 ˝ 鑁姲
哅ⳉמ⮆Ⱏ ˝ ٗ٭ا٭ֿאא樟ם㗞槡 ˝ ٗ٭ا٭ע⺱דֿյ姲״סֿ樟ם㗞槡
哅ⳉמ⮆Ⱏ /
㗞槡טׄגؤ٤ط؞تعמ⮆Ⱏ DDD DDD DDD
㗞槡טׄגؤ٤ط؞تعמ⮆Ⱏ (Entity Trap) - - - - DB ORM
ؕطٝ٭طؔهמ䷉ャ 1
攐䓪מ⮆Ⱏ / ( ) 1 (Availability) (Continuity) (Performance) / /
攐䓪מ⮆Ⱏ ײׂמُؕؠٞئ٭لت縒ֻ⯥מյױע㵚霄סئ٭لت⮆冪յלסֹםغْؕ ٤⣐ꪫֵֿ־釤哕״ױֹ /
❆ֻףج؞ٖٛطؔ ˝ ج؞ٖٛطؔמꄆ釐םظ٭ذ䣽ֹסעئ٭لتכי⮉ ⭳ױֹ ˝ 斻玮גظ٭ذي٭ت ˝ ❆ֻף鵟䅻סئ٭لتכ鐐ꄋئ٭لت⮆ꦕםל ˝ ⮯סئ٭لتכס鵟⟓ס倊⺘吾鋀ױֹ
❆ֻף⫋⮵榫䓪 ˝ ؓؗ٤ع㓹泅鵟湳յ婊岷嚀耆םל ˝ ⺱ؓؗ٤عך邾丗סئؕعמٞءؕ٤גַ ˝ 婊岷嚀耆ע䄄丗ֿ־־סךյُؕؠٞئ٭لتי⪦鵟 㓹泅מיֽ׀גַ ˝ 邾丗סئ٭لتך⮵榫ך׀־לֹ־
ُؕؠٞئ٭لتס⮆Ⱏ ˝ 釤י׀ג喋מُؕؠٞئ٭لتס⮆Ⱏ縒ֻכ׆ךע喋չ ם鈝憠ֵֿ ˝ 塜鉮ֿ扛ַ┩槡םסךյ喋չםססعٝ٭غ؛ن縒䜡ם ֿ錃銶ֹ ˝ 僃䖾ם錃銶ך扛ׄףؕطٝ٭طؔهמ䷉ャ◄ֿך׀ ˝
☽ס⣐ꪫכיظ٭ذס䣽ַמ浓泘׆כֵ
ُؕؠٞئ٭لتסوٚؠطؔت ˝ ُؕؠٞئ٭لتמֽׄظ٭ذס䣽ַ ˝ ئ٭لتꝴ鵟⟓ ˝ ئ٭لتْشبٖ ˝ ُؕؠٞئ٭لتסٛٛ٭تכٛنؒؠذٛ٤ء
ُؕؠٞئ٭لتמֽׄظ٭ذס䣽ַ
DB 1 1 DB to DB
CAP BASE 3 2 C: Consistency ( ) A: Availability
( P: Tolerance to network Partitions ( ) ( )CAP BASE Basically Available( ) Soft state( ) Eventually consistent( )
ُؕؠٞئ٭لتכ⮆丆عٚ٤اؠب٘٤ ! ئ٭لتױג׃عٚ٤اؠب٘٤עםַ 1
אך⮆丆عٚ٤اؠب٘٤גַ 2 Saga TCC
Saga T , T , T C , C ,
C :
Saga : AWS https://docs.aws.amazon.com/ja_jp/prescriptive-guidance/ latest/modernization-data-persistence/saga-pattern.html
TCC Try/Con rm/Cancel ײ؆ם荁ׄף⟊㰆յ鐍־ד״ם؞ٔ٤جٜ
TCC Try Cancel Try Con rm Con rm Cancel
TCC ˝ אבסئ٭لتמ◅㍑חٛؠؙتعֿ䑒釐 ˝ ع٭ذٜך侇ꝴֿ־־׆כֿؾشؠ
DB ? ... ADR
睦䈱縒ֻ泡גֹֿ荁ַ侇 1 1
ئ٭لتꝴ鵟⟓
ئ٭لتꝴ鵟⟓ schema rst
⫴璡䓪 1 1 1 /payment {"amount":300, "userAccount": "hoge"} /payment ID
/payment {"amount":300, "userAccount": "hoge","forPurchase": "abcd123"} forPurchase forPurchase
ئ٭لتْشبٖ
ُؕؠٞئ٭لتס畘杼 ˝ ؓوٛآ٭ب٘٤ע邾ꥭםئ٭لت紮סױ ˝ ؓوٛآ٭ب٘٤⟥渏י釤亠嫎ֿ培ַ ˝ ئ٭لتꝴס❣㰆꞊➟ ˝ 泃釱٬ٞءס⹜ ˝
ئؕغ٭قذ٭٤ֿ㛡ׂ⮵榫
ُؕؠٞئ٭لتס畘杼 ˝ ꤃㲹氦榟侇ס鐧削 ˝ ⠕չסئ٭لتꯂ樑מ釤יַׂכ侇ꝴֿ־־ ˝ ئ٭لتꝴס鵟⟓畘杼♓┕מ׆כֵֿאֹ
ئؕغ٭قذ٭٤ mackerel-container-agent
ئ٭لتْشبٖ proxy proxy ip
ئ٭لتْشبٖס䏔Ⱏ A B
ئ٭؞شعهٝ٭٭ Istio
ظ٭ذوٝ٭٤כؤ٤عٞ٭ٜوٝ٭٤ ˝ ظ٭ذوٝ٭٤ ˝ ⺨ئ٭لتמ㳝岣זיⳂׂوٞ؞ب ˝ 鵟⟓ס⯆䐒כ䗯㕔ס⹜ ˝ ىٜتزؘشؠ鏀錞٬鏀⺎םל车ֹ ˝
ْعٛشؠٞء⹜յؤ٤عٞ٭ٜوٝ٭٤峚
ظ٭ذوٝ٭٤כؤ٤عٞ٭ٜوٝ٭٤ ˝ ؤ٤عٞ٭ٜوٝ٭٤ ˝ ظ٭ذوٝ٭٤סؕ٤تذ٤تס畘杼 ˝ ⺨ئ٭لتסْعٛشؠٞء⹜ ˝ 啶䡗畘杼٬⺨牊رشبٍٖ٭غ
Envoy https://www.envoyproxy.io/ Lyft C++ L L HTTP HTTP, gRPC, WebSocket,
TCP ( )
Istio Istiod sidecar injection Envoy Envoy
ُؕؠٞئ٭لتסٛٛ٭ت亠嫎 API versioning / API
壿꣪氳מت؞٭ُסٛنؒؠذٛ٤ء GraphQL gRPC
催מ㰢שמע CloudNative CNCF Cloud Native Interactive Landscape The Amazon Builders'
Library microservice microservice - . oO( ( l _ l) ) Sam Newman 2016 Susan J. Fowler 2017 Neal Ford, Rebecca Parsons, Patrick Kua 2018 Sam Newman 2020 Microservice Architecture
ױכ״ ˝ ُؕؠٞئ٭لتע邾丗סئ٭لتֿ鵟⟓מזי鵽䯥י䡗 玮חؓ٭؞طؠزٔ ˝ ُؕؠٞئ٭لتס⮆Ⱏ亠嫎ע喋չם䣆嫎ֵֿ ˝ ُؕؠٞئ٭لتעؕطٝ٭طؔهמ䷉ャ禈ׄ׆כֿꄆ釐 ˝ ئ٭لتْشبٖםלסوٚؠطؔت⪌יַ׆ֹ
זיײֹסؤ٭ػ٭
: Istio istioctl install istioctl install !"set profile=demo !"context hatena-intern-2021
kubectl label namespace hatena-intern-2021 istio- injection=enabled kubectl get namespace hatena-intern-2021 -o yaml istio-injection enabled
: Istio kubectl apply -f https:!"raw.githubusercontent.com/istio/ istio/release-1.7/samples/addons/kiali.yaml Kiali kubectl apply
-f https:!"raw.githubusercontent.com/istio/ istio/release-1.7/samples/addons/prometheus.yaml Prometheus application istioctl dashboard kiali sign in admin:admin
Kiali
: fault injection 攐㲊ס嚀耆מ䙫㍲氳מ䷚꤃氦榟י䏅ꮶ疗㍱鐧ױ Injecting an HTTP abort fault renderer
service ( Service Temporarily Unavailable) fault %age Kiali application blog service error message istio-proxy log "authority": "renderer-go:50051" response_flags
: fault injection renderer service response 5 Kiali application istio-proxy
log response_flags kubectl delete virtualservices.networking.istio.io [໊લ] fault injection
More Decks by Hatena
See All by Hatena
Androiderを育成する「高速道路」と 実戦を経て辿り着いた現在地 / DroidKaigi 2026
hatena
0
320
60分で学ぶクラウドとSRE・サービス運用 / GeekCAMPAcademia 2026-05
hatena
1
150
エンジニアリング マネージャーの育成と評価軸の考え方
hatena
0
760
Perlブートキャンプ
hatena
0
6k
はてなサマーインターンシップ2025 Web API 講義資料
hatena
0
1.8k
はてなサマーインターンシップ2025 フロントエンド 講義資料
hatena
21
11k
はてなサマーインターンシップ2025 コンテナ + Kubernetesハンズオン 講義資料
hatena
0
880
はてなサマーインターンシップ2025 クラウドと運用 講義資料
hatena
0
920
はてなサマーインターンシップ2025 RDBMSの基礎 講義資料
hatena
0
1.1k
Other Decks in Programming
See All in Programming
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
140
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
320
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
620
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
270
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
530
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
270
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
120
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
240
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
Kiro Crewによる開発体験ーKiro CrewでStrands Decider 2B に関する技術検証をやってみた
satoshi256kbyte
1
240
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
760
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
970
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
890
The Language of Interfaces
destraynor
162
27k
Documentation Writing (for coders)
carmenintech
77
5.7k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
680
WENDY [Excerpt]
tessaabrams
15
41k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Evolving SEO for Evolving Search Engines
ryanjones
0
380
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
440