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

Principles Of Micoservices

Principles Of Micoservices

Bc7114ad3cf4d2d703dc71782e61ba43?s=128

Alper Hankendi

June 12, 2020
Tweet

Transcript

  1. Principles Of Microservices Alper Hankendi @alper_hankendi github.com/alperhankendi

  2. 20 2019 KrakenD API Gateway About Me Working as Product

    Engineering Director at Hepsiburada 20 Years Experience… approximately (professional) Ninja Developer, Servant Leader and Mentor Like to build useless stuff Drummer, Brewer and…. Father Golang and Linux Lover
  3. 33 2020 Authorization granularity • Definition of Microservices • How

    big is a Microservices • Scaling the organization • Principles Of Microservices ◦ Modelled Around business domain ◦ Culture Of Automation ◦ Hide Implementation Details ◦ Decentralise All The Things ◦ Deploy Independently ◦ Isolate Failure ◦ Consumer First ◦ Highly Observable AGENDA
  4. The microservice architectural style is an approach to developing a

    single application as a suite of small service, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different languages and use different data storage technologies. James Lewis@2014 Definition Of Microservices
  5. How Big is a Microservices

  6. Microservices Size Categories “Macro”services “Mini”services “Micro”services Ex: price,availability and shipping

    feature Ex: shopping cart domain calling the price, availability and shipping microservices Ex: ordering business capability using different miniservices, such as the shopping cart &&|| payment
  7. Scaling in Amazon & Netflix

  8. Starwars… Death Star ?

  9. 38 2019 KrakenD API Gateway Where to cut the services

    ?
  10. Where to cut the services? Social Tech

  11. Where to cut the services?

  12. 2 Recognize Conway’s Law 1 Right-size your teams 3 Enable

    unplanned innovation Scaling the Organization TL;DR Three Things You Can Do...
  13. Scaling the Organization 1- Right-sizing Teams Dunbar’s Number Aim for

    a team size of Dunbar Level 1 (5), Possibly Dunbar Level 2 (15) https://en.wikipedia.org/wiki/Dunbar's_number
  14. Scaling the Organization 2- Conway’s Law “A system’s design is

    a copy of the organization’s communication structure” Mel Conway@1967 Srv1 Index UI Srv2 Database UI Srv1 Srv2 Index Database UI https://www.melconway.com/Home/Committees_Paper.html
  15. Scaling the Organization 3- Unplanned Innovation If you want to

    achieve greatness, stop asking for permission
  16. Principles Of Microservices

  17. 20 2019 KrakenD API Gateway Principles Of Microservices TL;DR 2

    Culture Of Automation 1 Modelled Around Business Domain 3 Deploy Independently 4 Decentralise All The Things 5 Hide Implementation Details 6 Isolate Failure 7 Consumer First 8 Highly Observable
  18. 20 2019 KrakenD API Gateway Principles Of Microservices Modelled Around

    Business Domain Define Bounded Context Analyze your domain Define entities,aggregates, and services Identify microservices
  19. 20 2019 KrakenD API Gateway Principles Of Microservices Modelled Around

    Business Domain
  20. 20 2019 KrakenD API Gateway Principles Of Microservices Modelled Around

    Business Domain Checkout Search Payment Customer Content Campaign Shipping & Delivery Customer Service Fulfillment Customer Service Products not Projects per team per product Amazon’s notion of “you build, you run it”. This brings developers into contact with the day-to-day operation of their software. It also brings them into day-to-day contact with the customer. This customer feedback loop is essential for improving the quality of the service. https://queue.acm.org/detail.cfm?id=1142065
  21. 20 2019 KrakenD API Gateway Principles Of Microservices Culture Of

    Automation Infrastructure Automation (provision an isolated operation system or service, database, cache service, e.g) Automated Testing (sufficient testing in place that helps me understand whether I can release my software) Continuous Delivery (treating every check-in as a release candidates , building deployment pipelines , canary)
  22. 20 2019 KrakenD API Gateway Principles Of Microservices Culture Of

    Automation Canary Deployment https://docs.flagger.app/tutorials/istio-progressive-delivery
  23. 20 2019 KrakenD API Gateway Principles Of Microservices Culture Of

    Automation Canary Deployment Istio and Flagger to automate canary deployments https://docs.flagger.app/tutorials/istio-progressive-delivery
  24. 20 2019 KrakenD API Gateway Principles Of Microservices Deploy Independently

    Single Service Instance Per Host • Services are written using a variety of languages, frameworks, and framework versions • Each service consists of multiple service instances for throughput and availability • Service must be independently deployable and scalable • Service instances need to be isolated from one another • You need to be able to quickly build and deploy a service • You need to be able to constrain the resources (CPU and memory) consumed by a service • You need to monitor the behavior of each service instance • You want deployment to reliable • You must deploy the application as cost-effectively as possible https://microservices.io/patterns/deployment/single-service-per-host.html Inventory Promotions Basket Payments HOST Inventory HOST Payments Container
  25. 20 2019 KrakenD API Gateway Principles Of Microservices Deploy Independently

    CO-Exist Endpoints Basket Promotions V1 V2
  26. 20 2019 KrakenD API Gateway Principles Of Microservices Decentralise All

    The Things Make your teams more Autonomous What is autonomy ? Giving people as much freedom as possible to do the job at hand
  27. Hepsiburada Tech stack https://stackshare.io/hepsiburada/hepsiburada

  28. 20 2019 KrakenD API Gateway Principles Of Microservices Decentralise All

    The Things Dumb-Pipes… Smart Endpoints... Anti-pattern: Centralized Service Bus Source:: https://medium.com/@nathankpeck/microservice-principles-smart-endpoints-and-dumb-pipes-5691d410700f
  29. 20 2019 KrakenD API Gateway Principles Of Microservices Hide Implementation

    Details Database Per Service Service must be loosely coupled so that they can be developed, deployed and scaled independently. Different services have different data storage requirements. Keep each microservice’s persistent data private to that service and accessible only via its API. My List Service Catalog Service Projection Builder Reco Service
  30. 20 2019 KrakenD API Gateway Principles Of Microservices Hide Implementation

    Details Bounded Context Source : martinfowler.com/bliki/BoundedContext.html
  31. Search

  32. Product Detail

  33. My List

  34. Order Preview

  35. 20 2019 KrakenD API Gateway Principles Of Microservices Consumer First

    API Documentation
  36. Mesh: east-west traffic API GW: North-south traffic 20 2019 KrakenD

    API Gateway Principles Of Microservices Isolate Failure Microservice Microservice Monolith Microservice Microservice Microservice API GW Microservice Microservice Microservice Strategies to handle partial failure - Grained Timeout - Health Checks API - Caching
  37. 20 2019 KrakenD API Gateway Principles Of Microservices Isolate Failure

    Strategies to handle partial failure - Circuit Breakers (even on your database) - Bulkhead - Throttling ( Rate limiting, User Quota ) } } } CMS Service Catalog Service Recommendation Service Basket Recommendation Service API GW & Backend For Frontend
  38. 20 2019 KrakenD API Gateway Principles Of Microservices Back to

    Consumer First Question : Should I Provide a client library for access to my service... Well, It depends Client libraries can be useful for many reasons, one of which is isolating the specifics of communicating with a remote resource. For service registries, client libraries like those provided by Consul or Netflix Eureka handle service registration and heart beating. Other libraries, such as Netflix Ribbon, provide client-side load balancing. But not good in polyglot development ecosystem.
  39. 20 2019 KrakenD API Gateway Principles Of Microservices Isolate Failure

    Need more Resilience! Containerization - K8S, Istio (Service Mesh) , pod2pod communication thx to etcd
  40. 20 2019 KrakenD API Gateway Principles Of Microservices Observable Logging

    Splunk , ELK Metrics Prometheus , statsd , Grafana Distributed Tracing Jaeger, Zipkin , Kiali 3 Pillars of Observability
  41. Logging

  42. Logging

  43. Metrics

  44. Metrics

  45. Metrics

  46. Distributed Tracing

  47. Distributed Tracing

  48. Distributed Tracing

  49. Questions? @alper_hankendi github.com/alperhankendi