Mersher 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 mersher.
Before you start
- Walk through mersher-quick-start, mersher-load-balance and have mersher display programs running.
Grayscale release
Configuration
-
1 Change the version number to 1.1.1 and 1.1.2 respectively in conf microservice.yaml of two mersher_calculator instances. Restart the mersher service and you can see that the service version number has changed in servicecenter.
-
2 Change weight options in configuration file router.yaml of mersher_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 mersher_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 mersher_webapp takes effect when a negative parameter is passed in. The first picture is the log of mersher_webapp. The second picture is the return value when inputing negative parameter. The third picture is the return value when the circuit breaker of mersher_webapp takes effect.
-
2 The service is automatically restored after 10 seconds because of the conf parameter sleepWindowInMilliseconds.
What’s next
-
More about service management