Microservice Patterns - 3.2.4 Interprocess communication in a microservice architecture - Using Service Discovery


Reference


in order for one service to invoke another service using RPI, it needs to know the network location of a service instance. => Service Discovery

Using service discovery
Instance IP may change, then Service client need a way to find instance

OVERVIEW OF SERVICE DISCOVERY
  • Its key component is a service registry, which is a database of the network locations of an application’s service instances
  • The service discovery mechanism updates the service registry when service instances start and stop.
  • When a client invokes a service, the service discovery mechanism queries the service registry to obtain a list of available service instances and routes the request to one of them.

APPLYING THE APPLICATION-LEVEL SERVICE DISCOVERY PATTERNS
  1. Service register when start (Self registration pattern, instance information may contain health check URL)
    (Pattern: Self registration A service instance registers itself with the service registry. See http://microservices.io/patterns/self-registration.html.)
  2. Client query service and send request with cache mechanism and load balance strategy such as round-robin or random 
    ( Pattern: Client-side discovery A service client retrieves the list of available service instances from the service registry and load balances across them. See http://microservices.io/patterns/clientside-discovery.html.)

Good and Bad
Good: Handle the scenarios, including legacy system can support this way
Bad: When using some tool such as supported by JVM or Spring, can't be supported in non-JVM environment

it’s usually better to use a service discovery mechanism that’s provided by the deployment infrastructure because of application later implementation limitation.

APPLYING THE PLATFORM-PROVIDED SERVICE DISCOVERY PATTERNS
Platform such as Docker and Kubernetes have a built-in service registry and service discovery mechanism. Ex. DNS, VIP

Good and bad
Good: No application code needed
Bad: Need deployed to Docker or Kubernates


沒有留言:

張貼留言

Lessons Learned While Benchmarking vLLM with GPU

Recently, I benchmarked vLLM on a GPU to better understand how much throughput can realistically be expected in an LLM serving setup. One ...