Service Management

  • Service management is mainly used to effectively control and manage a large number of microservices in distributed systems. This guide will show you how to use the service management capabilities provided by mesher.

Before you start

Grayscale release

Configuration

  • 1 Change the version number to 1.1.1 and 1.1.2 respectively in conf microservice.yaml of two mesher_calculator instances. Restart the mesher service and you can see that the service version number has changed in servicecenter.

    mesher-ser-manage-ver

  • 2 Change weight options in configuration file router.yaml of mesher_webapp. Then restart service.

    routeRule:
      calculator:        #service name
        - precedence: 2    #precedence of route rule
          route:           #route rule list
          - tags:
              version: 1.1.1
            weight: 70     #weight of 20%
          - tags:
              version: 1.1.2
            weight: 30     #weight of 20%
    

Verification

  • Click the Submit button repeatedly and you can see that the BMI Instance ID keep changing according to the weight configuration.

Circuit breaker

Configuration

  • 1 Change the circuit breaker configuration in conf chassis.yaml of mesher_webapp.

    isolation:
      Consumer:
        timeout:
          enabled: true
        timeoutInMilliseconds: 1000            
        maxConcurrentRequests: 1
    circuitBreaker:
      Consumer:
        enabled: true
        forceOpen: false
        forceClosed: false
        sleepWindowInMilliseconds: 10000    
        requestVolumeThreshold: 1          
        errorThresholdPercentage: 1
    fallback:
      Consumer:
        enabled: true
        maxConcurrentRequests: 1
    fallbackpolicy:
      Consumer:
        policy: returnnull
    
  • 2 Stop the service instances in directory test_balance.

Verification

  • 1 The circuit breaker of mesher_webapp takes effect when a negative parameter is passed in. The first picture is the log of mesher_webapp. The second picture is the return value when inputing negative parameter. The third picture is the return value when the circuit breaker of mesher_webapp takes effect.

    mesher-circuitbreaker

    mesher-circuitbreaker-ret

    mesher-circuitbreaker-ret-nil

  • 2 The service is automatically restored after 10 seconds because of the conf parameter sleepWindowInMilliseconds.

What’s next