CN112988405A - Micro-service automatic degradation method and device and computing equipment - Google Patents

Micro-service automatic degradation method and device and computing equipment Download PDF

Info

Publication number
CN112988405A
CN112988405A CN201911216283.2A CN201911216283A CN112988405A CN 112988405 A CN112988405 A CN 112988405A CN 201911216283 A CN201911216283 A CN 201911216283A CN 112988405 A CN112988405 A CN 112988405A
Authority
CN
China
Prior art keywords
service module
micro
calling
micro service
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911216283.2A
Other languages
Chinese (zh)
Other versions
CN112988405B (en
Inventor
韩梁
李海传
郑海朋
罗琼
穆铁马
马恺琳
刘兆祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911216283.2A priority Critical patent/CN112988405B/en
Publication of CN112988405A publication Critical patent/CN112988405A/en
Application granted granted Critical
Publication of CN112988405B publication Critical patent/CN112988405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Abstract

The embodiment of the invention relates to the technical field of computers, and discloses a method and a device for automatically degrading micro-service and computing equipment. Wherein, the method comprises the following steps: receiving an external calling request; generating a first calling request carrying a calling identifier according to the external calling request; sending the first calling request to a first micro service module; generating a second calling request carrying the calling identifier according to the first calling request; sending the second calling request to a second micro service module; determining a calling relationship between the first micro service module and the second micro service module according to the calling identifier; and if the second micro service module is determined to be abnormal, carrying out degradation processing on the second micro service module, and sending a degradation notification to the first micro service module according to the calling relation. Through the mode, the embodiment of the invention can achieve the effect of higher automation degree.

Description

Micro-service automatic degradation method and device and computing equipment
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a method and a device for automatically degrading micro-service and computing equipment.
Background
With various scenes of high concurrent access, big data processing and the like of a large website increasing, in order to achieve high availability, a distributed micro-service architecture is generally adopted. When a certain service in the distributed micro-service architecture is abnormal, in order to avoid an avalanche effect caused by the abnormal service, the abnormal service often needs to be degraded to ensure that the core service normally operates.
Currently, the method for automatically degrading micro-services generally configures a service degradation policy in a service development stage, and when the service is readjusted, a code needs to be modified and reissued for reconfiguration, so that the degree of automation is low.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present invention provide a method, an apparatus, and a computing device for automatically degrading a microservice, which can achieve an effect of high automation degree.
According to an aspect of an embodiment of the present invention, there is provided a method for automatically degrading a micro service, the method including: receiving an external calling request; generating a first calling request carrying a calling identifier according to the external calling request; sending the first calling request to a first micro service module; generating a second calling request carrying the calling identifier according to the first calling request; sending the second calling request to a second micro service module; determining a calling relationship between the first micro service module and the second micro service module according to the calling identifier; and if the second micro service module is determined to be abnormal, carrying out degradation processing on the second micro service module, and sending a degradation notification to the first micro service module according to the calling relation.
In an optional manner, the determining that the second micro service module is abnormal further includes: judging whether the second micro service module has an abnormal example or not; if the second micro service module is determined to have the abnormal example, calculating the maximum load of the second micro service module after isolating the abnormal example; determining the request load of the second micro-service module according to the second calling request; and if the request load of the second micro service module is greater than the maximum load of the second micro service module, determining that the second micro service module is abnormal.
In an optional manner, the calculating a maximum load of the second micro service module further includes: acquiring a calling state of a normal instance of the second micro-service module; determining the residual load of the normal example according to the calling state of the normal example; and calculating the maximum load of the second micro-service module according to the residual load of the normal example.
In an optional manner, the determining whether there is an abnormal instance in the second microservice module further includes: determining a preset operation time length of an instance of the second micro service module according to the second calling request; acquiring the current operation time length of the instance of the second micro-service module; if the current operation time length of the instance of the second micro service module is longer than the preset operation time length, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module.
In an optional manner, the method further comprises: detecting the abnormal instance; judging whether the abnormal example is recovered or not according to the detection result; and if the abnormal instance is determined to be recovered, performing degradation cancellation processing on the second micro service module, and sending a degradation cancellation notice to the first micro service module.
In an optional manner, the performing degradation processing on the second micro service module further includes: and enabling the second micro-service module to execute a part of the calling tasks of the second calling request and reject another part of the calling tasks of the second calling request.
In an optional manner, the method further comprises: and performing degradation processing on the first micro service module according to the degradation notification.
According to another aspect of the embodiments of the present invention, there is provided a micro-service automatic degradation apparatus, the apparatus including: the interface module is used for receiving an external calling request, generating a first calling request carrying a calling identifier according to the external calling request, and sending the first calling request; the first micro-service module is used for receiving the first calling request, generating a second calling request carrying the calling identifier according to the first calling request, and sending the second calling request; the second micro service module is used for receiving the second calling request; the calling chain tracking module is used for determining a calling relation between the first micro service module and the second micro service module according to the calling identifier; the second micro service module is further used for performing degradation processing on the second micro service module if the second micro service module is determined to be abnormal; and the calling chain tracking module is also used for sending a degradation notification to the first micro-service module according to the calling relation.
According to still another aspect of an embodiment of the present invention, there is provided a computing device including: a processor, a memory, and a communication interface, the processor, the memory, and the communication interface in communication with each other; the memory is used for storing at least one executable instruction which causes the processor to execute the operation of the micro-service automatic degradation method.
According to another aspect of the embodiments of the present invention, there is provided a computer-readable storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to execute the micro-service automatic degradation method as described above.
The embodiment of the invention generates a first call request carrying a call identifier according to the external call request by receiving the external call request, sends the first call request to a first micro-service module, generates a second call request carrying the call identifier according to the first call request, sends the second call request to a second micro-service module, determines the call relation between the first micro-service module and the second micro-service module according to the call identifier, if the second micro-service module is determined to be abnormal, carries out degradation processing on the second micro-service module, sends a degradation notice to the first micro-service module according to the call relation, generates a unique call identifier of the call request every time, records the call relation of different call requests, thereby still realizing the full-automatic operation of automatic degradation and recovery of the service when the service is readjusted, and solving the problem of manual access processing, the service fault processing efficiency is improved, and the effect of high automation degree can be achieved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic structural diagram illustrating an apparatus for automatically degrading microservice provided by an embodiment of the present invention;
FIG. 2 is a diagram illustrating the call relationship of the microservice module of the microservice automatic degradation apparatus;
FIG. 3 shows a schematic structural diagram of the first micro-service module and the second micro-service module of FIG. 1;
FIG. 4 is a flow chart of a method for automatically degrading microservice provided by an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computing device provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Currently, the method for automatically degrading micro-services generally configures a service degradation policy in a service development stage, when the service is readjusted, a code needs to be modified and reissued for reconfiguration, and a service interruption may be caused in the reissuing process. Although dynamic updating can be realized based on components such as the existing configuration center, the updating process needs manual adjustment and triggering, real automatic operation cannot be realized, and the automation degree is low.
Based on this, the embodiment of the present invention provides a method, an apparatus, and a computing device for automatically degrading a micro service, which can still achieve automatic degradation of the service when the service is readjusted, and can achieve an effect of higher automation degree.
Specifically, the embodiments of the present invention will be further explained below with reference to the drawings.
It should be understood that the following examples are provided by way of illustration and are not intended to limit the invention in any way to the particular embodiment disclosed.
Fig. 1 shows a schematic structural diagram of a microservice automatic degradation apparatus provided by an embodiment of the present invention. The microservice automatic degradation device 10 comprises: an interface module 11, a first micro-service module 12, a second micro-service module 13 and a call chain tracking module 14.
The Interface module 11 may include an Application Programming Interface (API) gateway. The API gateway can be a server and is used for providing a unique access entrance to the outside so as to achieve the effect of loose coupling between systems through the gateway with high cohesion in the system. The API gateway may provide different API gateways for different clients.
In this embodiment, the interface module 11 is configured to receive an external call request. The external invocation request may be an external internet request or a request from another internal system, for example, may be a request from a WEB end and an APP end.
The interface module 11 is further configured to generate a first call request carrying the call identifier according to the external call request, and send the first call request to the first micro service module 11. The calling identifier is a globally unique identifier generated according to an external calling request, and the identifier may be a code. For example, if an external call request is received, the external call request is numbered according to a preset encoding mode to obtain a call identifier. According to the external call request, generating a first call request carrying a call identifier, which may specifically be: and generating a calling identifier according to the external calling request, then generating a first calling request according to service calling information in the external calling request, and binding the first calling request with the calling identifier. For example, according to the external call request, the call identifier 100xxxx is generated, and according to the service call information in the external call request (specifying that the first micro service module 12 is called), a first call request directed to the first micro service module 12 is generated, and the first call request is bound to the call identifier 100 xxxx.
It should be noted that, each time the interface module 11 receives a new external call request, the interface module 11 generates a new call identifier according to the new external call request.
The first micro service module 12 is one of a plurality of micro service modules in a distributed micro service module. The first micro service module 12 communicates with the interface module 11, and the first micro service module 12 also communicates with the second micro service module 13 and the call chain tracking module 14.
In this embodiment, the first micro service module 12 is configured to receive the first call request, generate a second call request carrying the call identifier according to the first call request, and send the second call request to the second micro service module 13. The receiving of the first call request specifically includes: receiving a first call request carrying a call identifier sent by the interface module 11. Generating a second call request carrying the call identifier according to the first call request, which may specifically be: and generating a second call request according to the call task information in the first call request, acquiring the call identifier carried by the first call request, and binding the second call request with the call identifier. For example, assuming that the calling identifier carried by the first request is 100xxxx, according to the calling task information in the first calling request (specifying to call the second micro service module 13), a second calling request directed to the second micro service module 13 is generated, and the second calling request is bound to the calling identifier 100 xxxx.
The second micro service module 13 is one of a plurality of micro service modules in the distributed micro service module. The second micro service module 13 may be in communication with the interface module 11, and the second micro service module 13 may also be in communication with the first micro service module 12 and the call chain tracking module 14.
In this embodiment, the second micro service module 13 is configured to receive a second call request. Receiving a second call request, specifically: and receiving a second call request carrying a call identifier sent by the first micro service module 12.
The calling chain tracking module 14 is in communication connection with a plurality of micro service modules in the distributed micro service module respectively. In this embodiment, the call chain tracking module 14 is configured to determine a call relationship between the first micro service module and the second micro service module according to the call identifier. The method specifically comprises the following steps: when the first micro service module 12 receives a first calling request carrying a calling identifier, the calling chain tracking module 14 obtains the calling identifier carried by the first calling request from the first micro service module 12 and obtains the direction of the calling identifier, if it is determined that the calling identifier points to the second micro service module 13, when the second micro service module 13 receives a second calling request carrying a calling identifier, the calling chain tracking module 14 obtains the calling identifier carried by the second calling request from the second micro service module 13 and obtains the direction of the calling identifier, the calling chain tracking module 14 judges whether the calling identifier carried by the first calling request is the same as the calling identifier carried by the second calling request, if so, it is determined that a calling relationship between the first micro service module 12 and the second micro service module 13 calls the second micro service module 13 for the first micro service module 12. For example, as shown in fig. 2, assuming that a service a is a first micro service module and a service C is a second micro service module, when the service a receives a first call request carrying a call identifier 10aabb, the call chain tracking module 14 obtains the call identifier 10aabb from the service a and obtains the direction of the call identifier, if it is determined that the call identifier points to the service C, when the service C receives a second call request carrying the call identifier 10aabb, the call identifier 10aabb is obtained from the service C, and after comparison, it is determined that the call identifier carried by the first call request is the same as the call identifier carried by the second call request, it is determined that the call relationship calls the service C for the service a; similarly, if the calling identifier of service C points to service E, and service E also receives calling identifier 10aabb, it is determined that the calling relationship called service E for service C.
It should be noted that the call chain tracking module 14 records the call relationship between the micro service modules in real time. When the call relationship between the micro service modules changes, the call chain tracking module 14 updates the call relationship between the micro service modules, so that when the service is readjusted, policy configuration does not need to be performed again, and the automation degree is improved.
The second micro service module 13 is further configured to perform degradation processing on the second micro service module if it is determined that the second micro service module is abnormal; the call chain tracking module 14 is further configured to send a degradation notification to the first micro service module 12 according to the call relationship; the first micro service module 12 is further configured to perform degradation processing on the first micro service module according to the degradation notification. The specific implementation mode can be as follows: when the second microservice module 13 determines that the microservice module is abnormal, the second microservice module 13 performs automatic degradation processing on the service, and meanwhile, the second microservice module 13 sends an abnormal message to the call chain tracking module 14; after receiving the abnormal message sent by the second microservice module 13, the call chain tracking module 14 determines the microservice module (i.e. the first microservice module 11) related to the second microservice module 13 according to the call relation, and then the call chain tracking module 14 generates a degradation notification and sends the degradation notification to the first microservice module 11; the first micro-service module 12 receives the degradation notification, and performs automatic degradation processing on the service according to the degradation notification.
It should be noted that, this embodiment is not limited to only two modules, namely, the first micro service module and the second micro service module, and may further include more micro service modules, the call chain tracking module 14 is connected to each micro service module, and records the call relationship of each micro service module, when a certain micro service module is abnormal, the call chain tracking module 14 determines, according to the call relationship, other micro service modules related to the abnormal micro service module, and sends a degradation notification to other micro service modules related to the abnormal micro service module. The other micro service modules related to the abnormal micro service module are generally upstream modules of the abnormal micro service module, and the upstream modules refer to the micro service modules which send call requests to the abnormal micro service module. The micro service module can call basic components, and the basic components can include message middleware, cache services, database services and the like.
The embodiment of the invention receives an external calling request through an interface module 11, generates a first calling request carrying a calling identifier according to the external calling request, sends the first calling request to a first micro-service module 11, generates a second calling request carrying the calling identifier according to the first calling request by a first micro-service module 12, sends the second calling request to a second micro-service module 13, receives the second calling request by the second micro-service module 13, and determines the calling relationship between the first micro-service module 12 and the second micro-service module 12 according to the calling identifier by a calling chain tracking module 14; if the second micro service module 13 is determined to be abnormal, the second micro service module 13 performs degradation processing; the call chain tracking module 14 sends a degradation notification to the second micro service module 13 according to the call relationship, so that the first micro service module 12 performs degradation processing, generates a unique call identifier of the call request each time, and records the call relationship of different call requests, thereby still realizing automatic degradation of the service when the service is readjusted, and achieving the effect of higher automation degree.
In some embodiments, to achieve high availability, the microservice module may deploy several instances of the application. As shown in fig. 3, the first micro service module 12 includes a first service gateway 121 and several instances, and the second micro service module 13 also includes a second service gateway 131 and several instances. Wherein, the instance can be deployed in a container platform or a virtual machine, etc.
The first service gateway 121 is connected to the interface module 11 and the call chain tracking module 14, and the first service gateway 121 is further connected to a plurality of instances of the first micro service module 12. The first service gateway 121 is configured to receive a first call request carrying a call identifier sent by the interface module 11, generate a second call request carrying the call identifier according to the first call request, and send the second call request to the second service gateway 131. The first service gateway 121 is further configured to implement, according to the first invocation request, traffic allocation between the instances based on a load balancing algorithm, record the invocation state of each instance, and upload the invocation state information of each instance to the invocation chain tracking module 14.
The second service gateway 131 is connected to the interface module 11 and the call chain tracking module 14, the second service gateway 131 is further connected to the first service gateway 121, and the second service gateway 131 is further connected to a plurality of instances of the second micro service module 13. The second service gateway 131 is configured to receive the second invocation request carrying the invocation identifier sent by the first service gateway 121. The second service gateway 131 is further configured to implement traffic allocation between the instances based on a load balancing algorithm according to the second invocation request, record the invocation state of each instance, and upload the invocation state information of each instance to the invocation chain tracking module 14.
The second service gateway 131 is also configured to: judging whether the second micro-service module 12 has an abnormal instance; if it is determined that the second micro service module 12 has an abnormal instance, calculating the maximum load of the second micro service module 12 after isolating the abnormal instance; determining the request load of the second micro-service module 12 according to the second calling request; if the request load of the second micro service module 12 is greater than the maximum load of the second micro service module 12, it is determined that the second micro service module 12 is abnormal.
The determining whether the second micro service module 12 has an abnormal instance may specifically be: the second service gateway 131 determines a preset operation duration of the instance of the second micro service module 12 according to the second call request; the second service gateway 131 obtains the current running time of the instance of the second micro service module 12; if the current operation time length of the instance of the second micro service module 12 is greater than the preset operation time length, determining that the instance is an abnormal instance, and determining that the abnormal instance exists in the second micro service module 12.
The second call request may include call task information, where the call task information may be information of a task to be executed, and the number of required instances and the number of other micro service modules to be called may be estimated according to the information of the task to be executed. For example, assume that the calling task information is order settlement task information, and the number of the estimated required instances is 2 according to the order settlement task information, without calling other micro-service modules. The preset operation time length is the operation time length of the example estimated according to the second calling request. Then, according to the second invocation request, determining a preset operation duration of the instance of the second micro service module 12 may be: and estimating the number of the required examples in the second micro-service module 12 according to the calling task information of the second calling request, and calculating the preset running time of each required example according to the historical running speed of the required example. The current operation duration is the actual operation duration of the instance. Then, when the actual running time of a certain required instance is longer than the preset running time, that is, the instance is overtime when the instance is called, the second service gateway 131 determines that the instance is an abnormal instance. Different tasks can correspond to different numbers of instances, and the preset running time lengths of the different tasks can be the same or different. Optionally, it may also be determined whether there is an abnormal instance in the second micro service module 12 in another manner, "which is not limited in this application embodiment.
The isolation exception instance may specifically be: when the second service gateway 131 receives the next invocation request, the second service gateway 131 no longer sends the invocation request to the exception instance.
Wherein, after isolating the abnormal instance, calculating the maximum load of the second micro service module 12 further comprises: acquiring the calling state of the normal instance of the second micro-service module 12; determining the residual load of the normal example according to the calling state of the normal example; the maximum load of the second micro service module 12 is calculated from the remaining load of the normal instance. The calling state refers to the use state of the instance, if the instance is used completely, the use state of the instance is a no-idle state, and if the instance is used partially, the instance is a partial-idle state. For example, assuming that the second micro service module 12 includes unit instances a1, a2 and a3, determining that a3 is an abnormal instance, then a1 and a2 are normal instances, obtaining the calling states of a1 and a2, and if the remaining loads of a1 and a2 are 100% and 50%, respectively, then the maximum load of the second micro service module 12 is 1.5 unit instances.
Wherein, according to the second invocation request, determining the request load of the second micro service module 12 may be: and predicting the number of required examples in the second micro service module 12 according to the calling task information of the second calling request, thereby predicting the request load of the second micro service module 12.
When the second micro service module 13 determines that it is abnormal, the second micro service module 13 performs automatic degradation processing on the service, which may specifically be: when the second service gateway 131 determines that the second micro service module 13 is abnormal, the second service gateway 131 makes the second micro service module execute the calling task of one part of the second calling requests, and rejects the calling task of the other part of the second calling requests, or transfers the calling task of the other part of the second calling requests to the task queue. The calling tasks of one part of the second calling requests can be calling tasks with the request load smaller than or equal to the maximum load, and the calling tasks of the other part of the second calling requests are the other calling tasks except the calling tasks of one part of the second calling requests in the second calling requests. In this way, when the second microservice module 13 is abnormal, requests exceeding the load are transferred to the task queue or are rejected, so as to downgrade the second microservice module 13.
Wherein the second service gateway 131 is further configured to: when it is determined that the second micro service module 13 is abnormal, sending abnormal information to the call chain tracking module 14, so that the call chain tracking module 14 sends a degradation notification to other micro service modules related to the second micro service module 13 according to the call relation. If the call chain tracking module 14 determines that the other micro service module related to the second micro service module 13 is the first micro service module 12 according to the call relationship, it sends a degradation notification to the first service gateway 121. The first service gateway 121 is further configured to receive the degradation notification, and perform degradation processing on the first micro service module 12 according to the degradation notification. The first service gateway 121 performs degradation processing on the first micro service module 12, which may specifically be: and regenerating a second calling request matched with the maximum load of the second micro-service module according to the maximum load of the second micro-service module. The second call request matching the maximum load of the second micro service module is a second call request whose request load is less than or equal to the maximum load of the second micro service module. That is, when receiving the degradation notification and the first service gateway 121 sends the next second invocation request to the second service gateway 131, the first service gateway 121 adjusts the task amount requested in the second invocation request so that the next second invocation request does not exceed the maximum load of the second micro service module 12, thereby completing the degradation processing of the first micro service module 12.
In some embodiments, the second serving gateway 131 is further configured to: detecting an abnormal instance; judging whether the abnormal instance recovers or not according to the detection result; and if the abnormal instance is determined to be recovered, performing degradation cancellation processing on the second micro service module, and sending a degradation cancellation notice to the first micro service module. Wherein the second service gateway 131 may detect the abnormal instance by sending a timed heartbeat mechanism. When the exception instance returns to normal, the second service gateway 131 may dispatch part of the traffic to the exception instance for processing and monitoring to confirm whether the exception instance has returned. If the abnormal instance is determined to be recovered, the second service gateway 131 reassigns the call request to perform degradation cancellation processing on the second micro service module, and sends a recovery message to the call chain tracking module 14, so that the call chain tracking module 14 sends a degradation cancellation notification to other micro service modules related to the second micro service module 13 according to the call relation. If the call chain tracking module 14 determines that other micro service modules related to the second micro service module 13 are the first micro service module 12 according to the call relationship, it sends a notification of canceling degradation to the first service gateway 121. The first service gateway 121 is further configured to receive a notification of canceling degradation, and perform, according to the notification of canceling degradation, a process of canceling degradation on the first microservice module 12.
In the embodiment of the present invention, an interface module 11 receives an external call request, generates a first call request carrying a call identifier according to the external call request, and sends the first call request to a first service gateway 121, the first service gateway 121 generates a second call request carrying the call identifier according to the first call request, and sends the second call request to a second service gateway 131, the second service gateway 131 receives the second call request, and a call chain tracking module 14 determines a call relationship between a first micro service module 12 and a second micro service module 12 according to the call identifier; if the second micro service module 13 is determined to be abnormal, the second service gateway 131 performs degradation processing on the second micro service module 13; the call chain tracking module 14 sends a degradation notification to the first service gateway 121 according to the call relationship, so that the first service gateway 121 performs degradation processing on the first micro service module 12, generates a unique call identifier of a call request each time, and records the call relationship of different call requests, thereby still realizing full-automatic operation of automatic degradation and recovery of a service when the service is readjusted, solving the problem of requiring manual access processing, improving the fault processing efficiency of the service, and achieving the effect of higher automation degree.
Fig. 4 shows a flowchart of a method for automatically degrading microservice provided by an embodiment of the present invention. The method is applied to the micro-service automatic degradation device 10 in the above embodiment. As shown in fig. 4, the method comprises the steps of:
step 210, receiving an external call request;
step 220, generating a first calling request carrying a calling identifier according to the external calling request;
step 230, sending the first call request to a first micro service module;
step 240, generating a second calling request carrying the calling identifier according to the first calling request;
step 250, sending the second calling request to a second micro service module;
step 260, determining a calling relationship between the first micro service module and the second micro service module according to the calling identifier;
and 270, if the second micro service module is determined to be abnormal, performing degradation processing on the second micro service module, and sending a degradation notification to the first micro service module according to the call relation.
Wherein step 270 further comprises:
step 271, judging whether the second micro service module has an abnormal instance;
step 272, if it is determined that the second micro service module has the abnormal instance, calculating the maximum load of the second micro service module after isolating the abnormal instance;
step 273, determining a request load of the second micro service module according to the second calling request;
step 274, if the request load of the second micro service module is greater than the maximum load of the second micro service module, determining that the second micro service module is abnormal.
Wherein, step 272 further comprises: acquiring a calling state of a normal instance of the second micro-service module; determining the residual load of the normal example according to the calling state of the normal example; and calculating the maximum load of the second micro-service module according to the residual load of the normal example.
Wherein step 271 further comprises: determining a preset operation time length of an instance of the second micro service module according to the second calling request; acquiring the current operation time length of the instance of the second micro-service module; if the current operation time length of the instance of the second micro service module is longer than the preset operation time length, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module.
Wherein, the method also comprises:
step 281, detecting the abnormal example;
282, judging whether the abnormal instance is recovered or not according to the detection result;
and 283, if the abnormal instance is determined to be recovered, performing degradation cancellation processing on the second micro service module, and sending a degradation cancellation notification to the first micro service module.
Wherein step 270 further comprises:
and 275, enabling the second microservice module to execute a part of the calling tasks of the second calling request and reject another part of the calling tasks of the second calling request.
Wherein, the method also comprises: and 290, performing degradation processing on the first micro service module according to the degradation notification.
It should be noted that the method for automatically degrading a micro service provided in the embodiment of the present invention is a method that can be executed by the apparatus for automatically degrading a micro service, and all embodiments of the apparatus for automatically degrading a micro service are applicable to the method and can achieve the same or similar beneficial effects.
It should be noted that the method for automatically degrading microservice provided by the embodiment of the present invention can also be executed by other computing devices, and can achieve the same or similar beneficial effects.
The embodiment of the invention generates a first call request carrying a call identifier according to the external call request by receiving the external call request, sends the first call request to a first micro-service module, generates a second call request carrying the call identifier according to the first call request, sends the second call request to a second micro-service module, determines the call relation between the first micro-service module and the second micro-service module according to the call identifier, if the second micro-service module is determined to be abnormal, carries out degradation processing on the second micro-service module, sends a degradation notice to the first micro-service module according to the call relation, generates a unique call identifier of the call request every time, records the call relation of different call requests, thereby still realizing the full-automatic operation of automatic degradation and recovery of the service when the service is readjusted, and solving the problem of manual access processing, the service fault processing efficiency is improved, and the effect of high automation degree can be achieved.
An embodiment of the present invention provides a computer-readable storage medium, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to execute the method for automatically degrading the micro service in any method embodiment described above.
The embodiment of the invention generates a first call request carrying a call identifier according to the external call request by receiving the external call request, sends the first call request to a first micro-service module, generates a second call request carrying the call identifier according to the first call request, sends the second call request to a second micro-service module, determines the call relation between the first micro-service module and the second micro-service module according to the call identifier, if the second micro-service module is determined to be abnormal, carries out degradation processing on the second micro-service module, sends a degradation notice to the first micro-service module according to the call relation, generates a unique call identifier of the call request every time, records the call relation of different call requests, thereby still realizing the full-automatic operation of automatic degradation and recovery of the service when the service is readjusted, and solving the problem of manual access processing, the service fault processing efficiency is improved, and the effect of high automation degree can be achieved.
Embodiments of the present invention provide a computer program product comprising a computer program stored on a computer storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the method for automatically degrading a microservice in any of the above-described method embodiments.
The embodiment of the invention generates a first call request carrying a call identifier according to the external call request by receiving the external call request, sends the first call request to a first micro-service module, generates a second call request carrying the call identifier according to the first call request, sends the second call request to a second micro-service module, determines the call relation between the first micro-service module and the second micro-service module according to the call identifier, if the second micro-service module is determined to be abnormal, carries out degradation processing on the second micro-service module, sends a degradation notice to the first micro-service module according to the call relation, generates a unique call identifier of the call request every time, records the call relation of different call requests, thereby still realizing the full-automatic operation of automatic degradation and recovery of the service when the service is readjusted, and solving the problem of manual access processing, the service fault processing efficiency is improved, and the effect of high automation degree can be achieved.
Fig. 5 is a schematic structural diagram of a computing device according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the computing device.
As shown in fig. 5, the computing device may include: a processor (processor)302, a communication Interface 304, a memory 306, and a communication bus 308.
Wherein: the processor 302, communication interface 304, and memory 306 communicate with each other via a communication bus 308. A communication interface 304 for communicating with network elements of other devices, such as clients or other servers. The processor 302 is configured to execute the program 310, and may specifically execute the method for automatically degrading the micro service in any of the method embodiments described above.
In particular, program 310 may include program code comprising computer operating instructions.
The processor 302 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computing device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 306 for storing a program 310. Memory 306 may comprise high-speed RAM memory and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The embodiment of the invention generates a first call request carrying a call identifier according to the external call request by receiving the external call request, sends the first call request to a first micro-service module, generates a second call request carrying the call identifier according to the first call request, sends the second call request to a second micro-service module, determines the call relation between the first micro-service module and the second micro-service module according to the call identifier, if the second micro-service module is determined to be abnormal, carries out degradation processing on the second micro-service module, sends a degradation notice to the first micro-service module according to the call relation, generates a unique call identifier of the call request every time, records the call relation of different call requests, thereby still realizing the full-automatic operation of automatic degradation and recovery of the service when the service is readjusted, and solving the problem of manual access processing, the service fault processing efficiency is improved, and the effect of high automation degree can be achieved.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specified otherwise.

Claims (10)

1. A method for micro-service auto-downgrading, the method comprising:
receiving an external calling request;
generating a first calling request carrying a calling identifier according to the external calling request;
sending the first calling request to a first micro service module;
generating a second calling request carrying the calling identifier according to the first calling request;
sending the second calling request to a second micro service module;
determining a calling relationship between the first micro service module and the second micro service module according to the calling identifier;
and if the second micro service module is determined to be abnormal, carrying out degradation processing on the second micro service module, and sending a degradation notification to the first micro service module according to the calling relation.
2. The method of claim 1, wherein the determining that the second micro-service module is abnormal further comprises:
judging whether the second micro service module has an abnormal example or not;
if the second micro service module is determined to have the abnormal example, calculating the maximum load of the second micro service module after isolating the abnormal example;
determining the request load of the second micro-service module according to the second calling request;
and if the request load of the second micro service module is greater than the maximum load of the second micro service module, determining that the second micro service module is abnormal.
3. The method of claim 2, wherein the calculating the maximum load of the second microservice module further comprises:
acquiring a calling state of a normal instance of the second micro-service module;
determining the residual load of the normal example according to the calling state of the normal example;
and calculating the maximum load of the second micro-service module according to the residual load of the normal example.
4. The method of claim 2, wherein the determining whether the second microservice module has an abnormal instance further comprises:
determining a preset operation time length of an instance of the second micro service module according to the second calling request;
acquiring the current operation time length of the instance of the second micro-service module;
if the current operation time length of the instance of the second micro service module is longer than the preset operation time length, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module.
5. The method of claim 2, further comprising:
detecting the abnormal instance;
judging whether the abnormal example is recovered or not according to the detection result;
and if the abnormal instance is determined to be recovered, performing degradation cancellation processing on the second micro service module, and sending a degradation cancellation notice to the first micro service module.
6. The method of claim 1, wherein the downgrading the second microservice module further comprises:
and enabling the second micro-service module to execute a part of the calling tasks of the second calling request and reject another part of the calling tasks of the second calling request.
7. The method according to any one of claims 1-6, further comprising:
and performing degradation processing on the first micro service module according to the degradation notification.
8. An apparatus for microservice automatic degradation, the apparatus comprising:
the interface module is used for receiving an external calling request, generating a first calling request carrying a calling identifier according to the external calling request, and sending the first calling request;
the first micro-service module is used for receiving the first calling request, generating a second calling request carrying the calling identifier according to the first calling request, and sending the second calling request;
the second micro service module is used for receiving the second calling request;
the calling chain tracking module is used for determining a calling relation between the first micro service module and the second micro service module according to the calling identifier;
the second micro service module is further used for performing degradation processing on the second micro service module if the second micro service module is determined to be abnormal;
and the calling chain tracking module is also used for sending a degradation notification to the first micro-service module according to the calling relation.
9. A computing device, comprising: the system comprises a processor, a memory and a communication interface, wherein the processor, the memory and the communication interface are communicated with each other;
the memory is used for storing at least one executable instruction which causes the processor to execute the operation of the micro-service automatic degradation method according to any one of claims 1-7.
10. A computer-readable storage medium having stored therein at least one executable instruction for causing a processor to perform the method of automatically downgrading microservice of any of claims 1-7.
CN201911216283.2A 2019-12-02 2019-12-02 Automatic degradation method and device for micro-service and computing equipment Active CN112988405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911216283.2A CN112988405B (en) 2019-12-02 2019-12-02 Automatic degradation method and device for micro-service and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911216283.2A CN112988405B (en) 2019-12-02 2019-12-02 Automatic degradation method and device for micro-service and computing equipment

Publications (2)

Publication Number Publication Date
CN112988405A true CN112988405A (en) 2021-06-18
CN112988405B CN112988405B (en) 2023-12-26

Family

ID=76331460

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911216283.2A Active CN112988405B (en) 2019-12-02 2019-12-02 Automatic degradation method and device for micro-service and computing equipment

Country Status (1)

Country Link
CN (1) CN112988405B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113645152A (en) * 2021-06-29 2021-11-12 福建天泉教育科技有限公司 Service degradation method and terminal

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170046146A1 (en) * 2015-08-11 2017-02-16 International Business Machines Corporation Autonomously healing microservice-based applications
CN109104491A (en) * 2018-08-30 2018-12-28 郑州云海信息技术有限公司 A kind of micro services call method, device, server and storage medium
CN109582472A (en) * 2018-10-19 2019-04-05 华为技术有限公司 A kind of micro services processing method and equipment
CN109714319A (en) * 2018-12-06 2019-05-03 深圳市中农网有限公司 Management system, method, apparatus, computer equipment and the storage medium of micro services
CN109840752A (en) * 2018-12-29 2019-06-04 航天信息股份有限公司 Administrative permission operation system based on micro services
CN109873736A (en) * 2019-01-18 2019-06-11 苏宁易购集团股份有限公司 A kind of micro services monitoring method and system
CN110149364A (en) * 2019-04-15 2019-08-20 厦门市美亚柏科信息股份有限公司 Method, apparatus, the storage medium of micro services are provided based on data service platform
CN110262889A (en) * 2019-06-27 2019-09-20 深圳前海微众银行股份有限公司 A kind of link tracing method and device
US10430238B1 (en) * 2019-05-30 2019-10-01 Capital One Services, Llc Programmatically applying labels to nodes in cluster orchestration platforms
CN110377437A (en) * 2019-07-19 2019-10-25 深圳前海微众银行股份有限公司 Communication means, computer equipment and storage medium between a kind of micro services
CN110445643A (en) * 2019-07-25 2019-11-12 泰康保险集团股份有限公司 Asynchronous micro services call link tracking, device, medium and electronic equipment
CN110474863A (en) * 2018-05-10 2019-11-19 中国移动通信集团浙江有限公司 Micro services safety certifying method and device
CN110489215A (en) * 2019-06-29 2019-11-22 华为技术有限公司 The treating method and apparatus of scene is waited in a kind of application program

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170046146A1 (en) * 2015-08-11 2017-02-16 International Business Machines Corporation Autonomously healing microservice-based applications
CN110474863A (en) * 2018-05-10 2019-11-19 中国移动通信集团浙江有限公司 Micro services safety certifying method and device
CN109104491A (en) * 2018-08-30 2018-12-28 郑州云海信息技术有限公司 A kind of micro services call method, device, server and storage medium
CN109582472A (en) * 2018-10-19 2019-04-05 华为技术有限公司 A kind of micro services processing method and equipment
CN109714319A (en) * 2018-12-06 2019-05-03 深圳市中农网有限公司 Management system, method, apparatus, computer equipment and the storage medium of micro services
CN109840752A (en) * 2018-12-29 2019-06-04 航天信息股份有限公司 Administrative permission operation system based on micro services
CN109873736A (en) * 2019-01-18 2019-06-11 苏宁易购集团股份有限公司 A kind of micro services monitoring method and system
CN110149364A (en) * 2019-04-15 2019-08-20 厦门市美亚柏科信息股份有限公司 Method, apparatus, the storage medium of micro services are provided based on data service platform
US10430238B1 (en) * 2019-05-30 2019-10-01 Capital One Services, Llc Programmatically applying labels to nodes in cluster orchestration platforms
CN110262889A (en) * 2019-06-27 2019-09-20 深圳前海微众银行股份有限公司 A kind of link tracing method and device
CN110489215A (en) * 2019-06-29 2019-11-22 华为技术有限公司 The treating method and apparatus of scene is waited in a kind of application program
CN110377437A (en) * 2019-07-19 2019-10-25 深圳前海微众银行股份有限公司 Communication means, computer equipment and storage medium between a kind of micro services
CN110445643A (en) * 2019-07-25 2019-11-12 泰康保险集团股份有限公司 Asynchronous micro services call link tracking, device, medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
FLORIAN RADEMACHER 等: "Challenges of Domain-Driven Microservice Design: A Model-Driven Perspective", 《IEEE SOFTWARE》, pages 36 - 43 *
梁安健 等: "基于Spring Cloud的微服务构建及软件云化应用研究", 《电子产品可靠性与环境试验》, pages 105 - 109 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113645152A (en) * 2021-06-29 2021-11-12 福建天泉教育科技有限公司 Service degradation method and terminal
CN113645152B (en) * 2021-06-29 2023-09-26 福建天泉教育科技有限公司 Service degradation method and terminal

Also Published As

Publication number Publication date
CN112988405B (en) 2023-12-26

Similar Documents

Publication Publication Date Title
US11159411B2 (en) Distributed testing service
CN108400904B (en) Health examination method and device based on micro-service architecture
CN111913818A (en) Method for determining dependency relationship between services and related device
CN109995842B (en) Grouping method and device for distributed server cluster
CN111930493B (en) NodeManager state management method and device in cluster and computing equipment
CN113067875B (en) Access method, device and equipment based on dynamic flow control of micro-service gateway
CN112241350B (en) Micro-service evaluation method and device, computing device and micro-service detection system
CN110399178B (en) Third-party service calling method and device, electronic equipment and storage medium
CN112433863A (en) Micro-service calling method and device, terminal equipment and storage medium
CN112988405B (en) Automatic degradation method and device for micro-service and computing equipment
CN106612263B (en) Method and equipment for processing application access request
CN112437155B (en) Service data processing method and device and server device
CN111385328A (en) Service request processing method and system and electronic equipment
US20060248531A1 (en) Information processing device, information processing method and computer-readable medium having information processing program
CN111447273A (en) Cloud processing system and data processing method based on cloud processing system
CN113055199B (en) Gateway access method and device and gateway equipment
CN112132583A (en) Transaction processing method and device of block chain, electronic equipment and readable storage medium
CN111913815A (en) Call request processing method and device, electronic equipment and readable storage medium
CN113055892A (en) Carrier scheduling method and device, computing equipment and computer storage medium
CN114942797B (en) System configuration method, device, equipment and storage medium based on side car mode
CN112019359B (en) Service processing method and system based on IMS network
CN113612846B (en) Service online processing method, computing device and computer storage medium
CN114900860B (en) Edge computing method and device for mobile terminal, edge computing server and medium
CN117149396B (en) Cluster fault transfer method and device, equipment and storage medium
CN111932235B (en) Service processing method, data accessor, state manager and computing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant