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

Microservices Architecture in the Real World - ...

Microservices Architecture in the Real World - RedisConf2019

Once you decide to adopt a microservices architecture, you’ll face many more decisions and questions. Among them are some core areas that this session will cover, based on our experiences making this shift at Credit Karma. Over the past three years, Credit Karma has gone from zero to over 100 microservices, supporting over 400 engineers while serving our more than 90 million members. The talk will dive into detail about Routing (how does service A find and call service B?), Management (how do you handle hundreds of containers?), Observability (how do you know what’s going on out there?), and developer Experience (how do your developers deal with this shift?).

Avatar for Mason Jones

Mason Jones

April 02, 2019

Other Decks in Technology

Transcript

  1. PRESENTED BY Microservices Architecture in the Real World Mason Jones

    @masonoise Senior Staff Infrastructure Engineer
  2. 3 900+ employees, 50% Engineering Over 90 million members Over

    100 microservices now, from zero in 2016
  3. 5

  4. 6

  5. 7 Introduction Routing Management Observability 01 02 03 04 User

    Experience 05 Now you need to think about...
  6. 12 How does service A make a request to service

    B? Seems like a simple question, right? Service Routing ROUTING
  7. 13 Where are (healthy) instances running? How does service A

    find them? Define "healthy"? Service A calling Service B ROUTING
  8. 14 Service Registry (Consul, Zookeeper…) DNS (but no port #

    w/o SRV record) Compute instances behind load-balancer Service A calling Service B ROUTING
  9. 15 Service Registry using Redis: Hydra NodeJS package with service

    discovery, route discovery, pub/sub messaging, load balancing, health monitoring and more. Uses Redis to store service and route information, and for core pub/sub functionality. https://www.hydramicroservice.com/ Service A calling Service B ROUTING
  10. 17 Example: Rate Limiting with Redis Can use INCR on

    a key with EXPIRE Key can be per-user or per-service Quick overview: https://redislabs.com/redis-best-practices/basic-rate-limiting/ Sending Requests ROUTING
  11. 21 Service Routing No libraries to maintain; automatic observability and

    security. Easier to span large systems. It's another critical piece of infrastructure to manage. Service Mesh Easy to understand, potentially easier to debug. But managing client libraries can be difficult, especially across polyglot systems. Client-Side Management ROUTING
  12. 24 Running many services on many servers? Trying to manage

    resources more efficiently? Dealing with dynamic cloud instances / auto-scaling? Service Management Are you... MANAGEMENT
  13. 25 If not: Don't worry about new tools yet. Use

    the tools you know. Service Management MANAGEMENT
  14. 26 Automate first. Think and plan ahead. Maintenance overhead will

    grow exponentially. Service Management But beware: MANAGEMENT
  15. 27 So Many Services! Suddenly you have lots of services

    on lots of servers. Orchestration frameworks to the rescue. MANAGEMENT
  16. 28 Kubernetes Docker Swarm Nomad Mesos + Marathon Amazon ECS

    / Fargate Orchestration Lots of options MANAGEMENT
  17. 29 Kubernetes Docker Swarm Nomad Mesos + Marathon Amazon ECS

    / Fargate Orchestration Today's best option MANAGEMENT
  18. 30 Primitives like Services, Deployments Pods with Sidecars (service mesh,

    Redis cache) Namespaces, Node Pools, access control (RBAC) Tools like Helm Orchestration Kubernetes MANAGEMENT
  19. 33 What's healthy or not? My service is slow? Slow

    for some customers...? Requests sometimes timing out? Services spiking the CPU? And so on... So many questions... OBSERVABILITY
  20. 35 Metrics? OBSERVABILITY Metrics might not help With even 20

    or 30 services, how much data can you watch? It's unrealistic to expect actionable data out of the box
  21. 36 Alert on container CPU or memory? and host CPU

    or memory and disk & network usage and request latency (for every service???) and service metrics (for every service???) and... Metrics Which? OBSERVABILITY
  22. 38 Ask: Why do you care? OBSERVABILITY If your customers

    are happy, does a CPU spike matter? Make sure you can answer questions when something critical happens.
  23. 39 Tools OBSERVABILITY Logs: ELK, Splunk, Sumo Logic, cloud offerings

    Metrics: Prometheus, InfluxDB, Datadog, Wavefront Tracing: Zipkin, Opentracing, Jaeger, Stackdriver
  24. 43 Your users == developers You want to give them

    a good experience How do they currently work? What does it mean to break it apart? USER EXPERIENCE
  25. 44 Environment Parity Everyone always wants dev, test, and production

    to be identical. Docker for Mac? Use docker-compose? Kubernetes? What about logging? Metrics? Configuration settings? Service discovery? Do we add Consul or our service mesh? Now what if our system has 50, 100, 200 services? USER EXPERIENCE
  26. 45 Environment Parity Nobody has solved this perfectly...? Shared cloud

    environments? Mock services? Map dependencies to load them automatically? USER EXPERIENCE
  27. 46 Tools Integration is hard. This is very different when

    you move to containers. Building and testing a monolith is conceptually easier. Build/CI Process Deploying containers is completely different from deploying a monolith. It also varies between orchestration frameworks. Deployment Integrating with whatever tools you already have for log management and monitoring is a lot of work. Logging/Monitoring Using IDEs with containers is tricky, especially debugging and integration with orchestration. Development tools USER EXPERIENCE And there's more...
  28. USER EXPERIENCE 48 Be prepared for an unexpectedly large amount

    of change. But enabling development teams to be independent is a huge benefit.