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
Manage microservices like a Chef
Search
Mathieu Acthernoene
May 30, 2018
Technology
0
980
Manage microservices like a Chef
Mathieu Acthernoene
May 30, 2018
Tweet
Share
More Decks by Mathieu Acthernoene
See All by Mathieu Acthernoene
Advanced TypeScript: How we made our router typesafe
zoontek
3
1.2k
Designing and maintaining an open-source React Native library
zoontek
0
88
Des apps multiplateformes avec reason-react-native
zoontek
0
75
Other Decks in Technology
See All in Technology
Staff Engineer / 20240827 Yuichiro Masui
shift_evolve
0
150
【Λ(らむだ)最近のアプデ情報 / RPALT20240904
lambda
0
160
目標設定と習慣化で今よりも一歩生産性を上げる
sansantech
PRO
7
2.3k
Datadogの便利な使い方 - 意外と知らない?CoScreenとCloudcraft
taijihagino
PRO
1
600
APIのドキュメント化何使ってますか?
miu_crescent
2
160
New Relicで実践する外形監視
aeonpeople
1
120
React Aria で実現する次世代のアクセシビリティ
ryo_manba
4
580
Azure Cosmos DB での時系列ログの運用と改善
sansantech
PRO
0
190
FastlyとfalcoでNode.jsレスな Webサーバー構築 : IPTV版 ABEMAアプリインフラ刷新 / Building web server using Fastly and falco without Node.js for IPTV ABEMA app
nodaguti
0
240
リクルート新人研修2024 テキスト生成AI活用
recruitengineers
PRO
10
420
waitany と waitall を作った話
mrkn
0
110
技術ブログや登壇資料を秒で作るコツ伝授します
minorun365
PRO
18
4.5k
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
88
15k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.2k
A better future with KSS
kneath
235
17k
Making Projects Easy
brettharned
113
5.8k
How to Ace a Technical Interview
jacobian
275
23k
Visualization
eitanlees
142
15k
Music & Morning Musume
bryan
46
6k
The Art of Programming - Codeland 2020
erikaheidi
48
13k
Mobile First: as difficult as doing things right
swwweet
220
8.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
42
2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
Docker and Python
trallard
39
3k
Transcript
Manage microservices like a Chef
Mathieu Acthernoene @zoontek
Microservices are awesome ✨
Microservices are awesome ✨ Each service is an app implementing
its own business logic service database SaaS 1 SaaS 2
Microservices are awesome ✨ Separated by concern, easier to understand
what's going on auth email sms …
Microservices are awesome ✨ They can evolve apart, deploy at
different frequencies service 1 service 2 service 3 service 4 service 1 service 4 service 4
Microservices are awesome ✨ If one breaks, you don't have
to reboot everything service 1 service 3 service 4
Microservices are awesome ✨ Scales according to the service needs,
not globally CPU intensive service RAM intensive service GPU intensive service
Microservices are awesome ✨ Each service team is free to
use the right tools service using couchDB service using JavaScript service using Golang
But
But
Just as you think you're making microservices
You might just not
You are not building microservices when… #
You are not building microservices when… # Changes needs to
be synced service 1 service 1 change service 2
Deploys needs to be synced You are not building microservices
when… # service 1 service 1 deploy service 2
The same developers work across a large number of them
service 1 Kévin Sylvie Amine You are not building microservices when… # service 2 Kévin Luc Clarisse service 3 Kévin Zhang Nicolas
They share a datastore You are not building microservices when…
# service 1 database service 2
They share a lot of the same code / models
You are not building microservices when… # service 1 type User {} service 2 type User {} service 3 type User {}
You just created a distributed monolith crypto REST logging REST
email REST sms REST storage REST billing REST
None
Managing microservices is like managing a restaurant
waiter REST sous-chef REST pastry chef REST wine waiter REST
washer REST chef REST
None
How does a restaurant manage services?
None
The “simple” gateway solution crypto REST logging REST email REST
sms REST storage REST billing REST gateway REST
One interlocutor passing messages to the right services
The REST / JSON gateway issues ⚠ If a first
API is RESTful, the twelfth iteration is RESTish service API v1 ✨ service API v3 … service API v9 …
Latency caused by serialization / deserialization service 1 service 2
API gateway decode JSON understand message create message encode JSON The REST / JSON gateway issues ⚠
You embed your model schemas in every messages { "login":
"octocat", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", … The REST / JSON gateway issues ⚠
As a service owner, you have to wait for a
complete implementation of another one to start using it service 1 is finished & deployed the API gateway implements service 1 service 2 starts implementing its usage of service 1 The REST / JSON gateway issues ⚠
As JSON types are basic (JavaScript interop…), a documentation is
mandatory The REST / JSON gateway issues ⚠
How does a restaurant manage communication?
None
People working in the kitchen don't necessarily have the same
mother tongue
They don't force their coworkers to use their language
Protobuf ↔
Protobuf ↔ Created by, and for Google in 2001
A binary format for typed exchanges Protobuf ↔
Protobuf ↔ Generate clients for C++, Java, Python, Go, Ruby,
C#, JS, ObjC, PHP, Dart…
Offers backward compatibility for free Protobuf ↔
Offers a JSON mapping Protobuf ↔
Tooling and linters are available Protobuf ↔
Allows RPC methods definition Protobuf ↔
How to write a .proto file
syntax = "proto3";
package storage;
import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto";
option java_package = "com.scaleway.storage";
message Bucket { enum Attributes { LAZY = 0; DELUXE
= 1; } string id = 1; google.protobuf.Timestamp created_at = 2; repeated Attributes attributes = 3; int32 old_field = 4 [deprecated=true]; }
service Storage { rpc ListBuckets(ListBucketsRequest) returns (stream Bucket) { option
(google.api.http) = { get: "/buckets" }; } rpc GetBucket(GetBucketRequest) returns (Bucket) { option (google.api.http) = { get: "/buckets/{id}" }; } } message ListBucketsRequest { string user_id = 1; } message GetBucketRequest { string id = 1; }
syntax = "proto3"; package storage; option java_package = "com.scaleway.storage"; service
Storage { rpc ListBuckets(ListBucketsRequest) returns (stream Bucket) { option (google.api.http) = { get: "/buckets" }; } rpc GetBucket(GetBucketRequest) returns (Bucket) { option (google.api.http) = { get: "/buckets/{id}" }; } } message Bucket { enum Attributes { LAZY = 0; DELUXE = 1; } string id = 1; google.protobuf.Timestamp created_at = 2; repeated Attributes attributes = 3; int32 old_field = 4 [deprecated=true]; } message ListBucketsRequest { string user_id = 1; } message GetBucketRequest { string id = 1; }
None
I get Protobuf, but what is gRPC ? HTTP/2 clients
for Protobuf messages transport
Unaries, uni- and bi-directional streams I get Protobuf, but what
is gRPC ?
Blocking & Non-Blocking messages I get Protobuf, but what is
gRPC ?
Authentification (per call, and TLS for trusted services) I get
Protobuf, but what is gRPC ?
Cancellation and timeout handling I get Protobuf, but what is
gRPC ?
Smart retries with backoff I get Protobuf, but what is
gRPC ?
Error handling with standardized status codes I get Protobuf, but
what is gRPC ?
Lameducking for graceful shutdowns I get Protobuf, but what is
gRPC ?
A huge ecosystem
A huge ecosystem Used by Google, Lyft, Uber, Square, Netflix,
CoreOS, Docker, Cockroachdb, Cisco, Juniper Networks…
A huge ecosystem Supported by nginx, kubernetes, envoy, etcd, istio…
A huge ecosystem A lot of middlewares available
A huge ecosystem A HTTP+JSON interface available
A new service is created protos monorepo crypto gRPC logging
gRPC email gRPC sms gRPC storage gRPC billing gRPC service discovery ML gRPC
And for the front-end?
How does a restaurant expose services to a client?
None
GraphQL
A request example (developer.github.com/v4/explorer)
dashboard CLI API gateway mobile app GraphQL adapter protos monorepo
crypto gRPC gRPC logging gRPC email gRPC sms gRPC storage gRPC billing gRPC service discovery gRPC REST
None
Keep in mind that there's no silver bullet
This technologies allow you to create a factory of products
/ services
Thank you! Questions?