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

Manage microservices like a Chef

Manage microservices like a Chef

Mathieu Acthernoene

May 30, 2018
Tweet

More Decks by Mathieu Acthernoene

Other Decks in Technology

Transcript

  1. Microservices are awesome ✨ Each service is an app implementing

    its own business logic service database SaaS 1 SaaS 2
  2. 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
  3. Microservices are awesome ✨ If one breaks, you don't have

    to reboot everything service 1 service 3 service 4
  4. Microservices are awesome ✨ Scales according to the service needs,

    not globally CPU intensive service RAM intensive service GPU intensive service
  5. Microservices are awesome ✨ Each service team is free to

    use the right tools service using couchDB service using JavaScript service using Golang
  6. But

  7. But

  8. You are not building microservices when… # Changes needs to

    be synced service 1 service 1 change service 2
  9. Deploys needs to be synced You are not building microservices

    when… # service 1 service 1 deploy service 2
  10. 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
  11. 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 {}
  12. You just created a distributed monolith crypto REST logging REST

    email REST sms REST storage REST billing REST
  13. The “simple” gateway solution crypto REST logging REST email REST

    sms REST storage REST billing REST gateway REST
  14. 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 …
  15. Latency caused by serialization / deserialization service 1 service 2

    API gateway decode JSON understand message create message encode JSON The REST / JSON gateway issues ⚠
  16. 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 ⚠
  17. 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 ⚠
  18. As JSON types are basic (JavaScript interop…), a documentation is

    mandatory The REST / JSON gateway issues ⚠
  19. 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]; }
  20. 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; }
  21. 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; }
  22. I get Protobuf, but what is gRPC ? HTTP/2 clients

    for Protobuf messages transport
  23. A huge ecosystem Used by Google, Lyft, Uber, Square, Netflix,

    CoreOS, Docker, Cockroachdb, Cisco, Juniper Networks…
  24. A new service is created protos monorepo crypto gRPC logging

    gRPC email gRPC sms gRPC storage gRPC billing gRPC service discovery ML gRPC
  25. 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