Service oriented architecture

Monolith

Multiple responsibilities (UI, API, Logic, Authorization, Authentication) within a single application.

Pro:

  • One source
  • Little overhead
  • Easy testing

Cons:

  • Hard to scale independently
  • Big applications can suffer from to frequent code changes from different teams

Microservices

The big monolith is split up into smaller applications with a separation of concerns.

Pro:

  • Scalability (If the services are set up the correct way)
  • Flexibility in terms of programming language, framework, deployment
  • Easier separation into work teams

Cons:

  • More complex network setup
  • Higher administrative effort to provide micro services
  • Strongly depend on contracts between services which can only be tested during integration

Contracts

Contracts are the promises between microservices on what happens if an RPC is sent from one service to another. They can be seen as the definition of a functions arguments and return value.

So calling a service that does not stick to the before agreed contract, is like calling a function with the wrong arguments, which typically leads to failure.

See: https://docs.pact.io/

Communication

Monolith: Inter-process communication

Micro services: Network/RPC

Service to Service access (East-West Traffic).

Mitigation for microservices:

  • Software defined Network: Automate all VLANS/Firewall rules.
  • Service Mesh: Flat Network, Sidecar pattern mit mTLS certificates.
  • Auto scheduling:
    • Results in unknown IPs and Ports
      • Service Discovery