When server pressure increases, you can degrade certain non-essential services based on your business needs and traffic. Degrading a service means that you either do not process it or you process it in a simpler way. This frees up server resources to ensure that your core services operate normally.
How it works
Service degradation is implemented on the client side. When a client calls the server, the client immediately returns a degradation error code instead of sending a request to the server. You can degrade services at the service level or the method level. The process is as follows:
Configure a service degradation rule
Log on to the SOFAStack console.
In the navigation pane on the left, choose Middleware > Microservice Platform > Microservices > Service Administration, and then click the Service Degradation tab.
Click Add Degradation Rule, and then configure the following parameters:
Parameter
Description
Rule Name
Enter a name for the degradation rule.
Caller Application
Degradation takes effect on the client. Enter or select the client application.
Run Mode
Set the run mode for the degradation rule. Valid values:
Block Mode: The degradation rule takes effect.
Monitor Mode: The degradation rule does not take effect. It only enables log printing in MOSN.
Degraded Service
Select or enter the name of the server-side service that the client references. An asterisk (*) indicates all services.
Downgrade method
Enter the name of the method to degrade. An asterisk (*) indicates all methods.
Click Submit, and then click OK.
In the list of degradation rules, change the status of the rule that you just created to On.
Edit a service degradation rule
You can edit an existing service degradation rule at any time. Changes take effect in real time after you submit them.
On the Service Degradation tab, click the plus sign (+) to the left of the target application.
Click Edit to the right of the target service degradation rule.
Edit the service degradation rule as needed, and then click Submit.
Delete a service degradation rule
You can delete an existing service degradation rule. The deletion takes effect in real time. Proceed with caution.
On the Service Degradation tab, click the plus sign (+) to the left of the target application.
Click Delete to the right of the target service degradation rule.
Click OK.