I am thinking about a question: how to downgrade the service?
for example, there was an interface before, and an average was determined through the other three interfaces. Hypothetically, it doesn"t necessarily make sense. To get the location of the user, first request Amap, then request Baidu Map, and then request Tencent Map. After comparing the last three data results, a comprehensive result is returned to the client.
then after downgrading, you only need to request an interface or simply do not request, and return the last cached data directly to the user.
but in general, for example, a request to check DB, how is it degraded?
it has been said in previous books that multiple interface weights are defined, such as the following:
- quite important
- important
- General
- Yes or no
in this way, when the server is under load, level 4-> level 3.
can be discarded first.but how can it be overloaded? at the same time, what should the rules of abandonment look like?
or the client is degraded, that is, the client counts the requests and normal responses of each interface. When a large number of 500 is returned, it means that the server load is high, and a large number of requests should be avoided. The client directly tells the user that it has failed without requesting the server
the rule seems to be: for a period of time:
canRequest = requestCount - N * responseCount > 0
that is, when requestCount is normally requested, but only responseCount succeeds, all others fail.
is there any way to play like this?
can anyone give a specific example of a production environment