Distributed Systems with Microservices

Going to microservices checklist ✅

  • Volume: the volume of activities outgrow the current technology stack

  • New features: better new technologies for certain new features (Using python for example for a report/analytics microservice)

  • Engineering team growth: lines of communication increased, the source code is becoming bigger, the cognitive load of an engineer is increasing which slows down the process of developing and maintaining source code (more on that later)

  • Technical debt: debt from previous build decision, now it's becoming difficult to make changes

  • Distributed system for distributed team: promoting end-to-end ownership for small set of teams with different responsibilities where each team is responsible for it own development and deployment line (frequent small releases by each team rather than a 1 big deployment release), and they communicate through defined contracts and documentation

Challenges of microservices that you should consider

  • Domain knowledge

  • Maintaining contracts

  • Distributed system challenges

  • Operational challenges

  • Observability

  • Increase points of failure

Designing phase 🎨

  1. Implement most meaningful separation using bounded context

  2. Design functions inside capability

  3. Implement service contracts

  4. Standardize the development, automate, and deployment processes

Implementing a microservice

Communication

  • Asynchronous communication

    • Multiple receivers / Fun-out / Pub-Sub (NATS, Kafka, Kinesis)

    • Single Receiver (using NATS broker or without broker)

      • Point to point (subject-based using NATS for example)

      • HTTP pooling

  • Synchronous communication

    • Single Receiver

      • HTTP REST

      • gRPC

    • Multiple Receivers

      • Web-hooks

API Gateway

Use cases

  • Authentication and authorization

  • Service discovery integration

  • Response caching

  • Retry policies, circuit breaker, and QoS

  • Rate limiting and throttling

  • Load balancing

  • Logging, tracing, correlation

  • Headers, query strings, and claims transformation

  • IP allow listing

Refs

Last updated