CN112988405B - Automatic degradation method and device for micro-service and computing equipment - Google Patents

Automatic degradation method and device for micro-service and computing equipment Download PDF

Info

Publication number
CN112988405B
CN112988405B CN201911216283.2A CN201911216283A CN112988405B CN 112988405 B CN112988405 B CN 112988405B CN 201911216283 A CN201911216283 A CN 201911216283A CN 112988405 B CN112988405 B CN 112988405B
Authority
CN
China
Prior art keywords
service module
micro
call
instance
call 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.)
Active
Application number
CN201911216283.2A
Other languages
Chinese (zh)
Other versions
CN112988405A (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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the invention relates to the technical field of computers and discloses a method and a device for automatically degrading micro-services and computing equipment. Wherein the method comprises the following steps: receiving an external call request; generating a first call request carrying a call identifier according to the external call request; sending the first call request to a first micro-service module; generating a second call request carrying the call identifier according to the first call request; sending the second call request to a second micro-service module; determining a calling relation between the first micro-service module and the second micro-service module according to the calling identification; and if the second micro service module is abnormal, performing 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

Automatic degradation method and device for micro-service 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-services and computing equipment.
Background
With more and more scenes such as various high-concurrency accesses and big data processing of large websites, in order to achieve high availability, a distributed micro-service architecture is generally adopted. When an abnormality occurs in a certain service in the distributed micro-service architecture, in order to avoid an avalanche effect caused by the service abnormality, degradation processing is often required to be performed on the abnormal service so as to ensure normal operation of the core service.
Currently, the automatic service degradation method of the micro service generally configures the service degradation policy in the service development stage, and when the service is readjusted, the code needs to be modified and reissued for reconfiguration, so that the degree of automation is low.
Disclosure of Invention
In view of the above problems, the embodiments of the present invention provide a method, an apparatus, and a computing device for automatically degrading a micro service, which can achieve an effect with a higher degree of automation.
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 call request; generating a first call request carrying a call identifier according to the external call request; sending the first call request to a first micro-service module; generating a second call request carrying the call identifier according to the first call request; sending the second call request to a second micro-service module; determining a calling relation between the first micro-service module and the second micro-service module according to the calling identification; and if the second micro service module is abnormal, performing 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 alternative manner, the determining that the second micro service module is abnormal further includes: judging whether the second micro service module has an abnormal instance or not; if the abnormal instance exists in the second micro service module, after isolating the abnormal instance, calculating the maximum load of the second micro service module; determining the request load of the second micro service module according to the second call request; and if the request load of the second micro service module is larger than the maximum load of the second micro service module, determining that the second micro service module is abnormal.
In an alternative manner, the calculating the 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 instance according to the calling state of the normal instance; 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 the second micro service module has an abnormal instance further includes: determining a preset operation time length of the instance of the second micro service module according to the second call request; acquiring the current operation time length of the instance of the second micro service module; and if the current running time of the instance of the second micro service module is longer than the preset running time, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module.
In an alternative, the method further comprises: detecting the abnormal instance; judging whether the abnormal instance is recovered 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 notification to the first micro-service module.
In an optional manner, the degrading the second micro service module further includes: and enabling the second micro-service module to execute the calling task of one part of the second calling requests and reject the calling task of the other part of the second calling requests.
In an alternative, the method further comprises: and carrying out degradation processing on the first micro service module according to the degradation notification.
According to another aspect of the embodiment of the present invention, there is provided an automatic micro-service degradation apparatus, including: the interface module is used for receiving an external call request, generating a first call request carrying a call identifier according to the external call request, and sending the first call request; the first micro-service module is used for receiving the first call request, generating a second call request carrying the call identifier according to the first call request, and sending the second call request; the second micro service module is used for receiving the second call request; the call chain tracking module is used for determining a call relation between the first micro-service module and the second micro-service module according to the call 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; the call chain tracking module is further used for sending a degradation notification to the first micro-service module according to the call relation.
According to yet another aspect of an embodiment of the present invention, there is provided a computing device including: the device 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 to store at least one executable instruction that causes the processor to perform the operations of the micro-service auto-destaging method described above.
According to another aspect of embodiments of the present invention, there is provided a computer-readable storage medium having stored therein at least one executable instruction for causing a processor to perform the micro-service auto-destaging method as described above.
According to the embodiment of the invention, the external calling request is received, the first calling request carrying the calling identifier is generated according to the external calling request, the first calling request is sent to the first micro-service module, the second calling request carrying the calling identifier is generated according to the first calling request, the second calling request is sent to the second micro-service module, the calling relationship between the first micro-service module and the second micro-service module is determined according to the calling identifier, if the second micro-service module is determined to be abnormal, the second micro-service module is subjected to degradation processing, and a degradation notification is sent to the first micro-service module according to the calling relationship, the unique calling identifier of the calling request is generated each time, and the calling relationship of different calling requests is recorded, so that when the service is readjusted, the automatic service degradation and recovery operation can be realized, the problem of manual access processing is solved, the failure processing efficiency of the service is improved, and the effect of higher automation degree can be achieved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present invention can be more clearly understood, and the following specific embodiments of the present invention are given for clarity and understanding.
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 designate like parts throughout the figures. In the drawings:
fig. 1 shows a schematic structural diagram of an automatic micro-service degradation device according to an embodiment of the present invention;
FIG. 2 illustrates a schematic diagram of the invocation of a micro-service module of the micro-service auto-downgrade device;
FIG. 3 shows a schematic diagram of the first micro service module and the second micro service module of FIG. 1;
FIG. 4 is a flow chart illustrating a method for automatically degrading micro services provided by an embodiment of the present invention;
FIG. 5 illustrates a schematic 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 present invention are shown in the drawings, it should be understood that the present invention may 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 micro service automatic degradation method generally configures a service degradation policy in a service development stage, when the service is readjusted, a code needs to be modified and the service needs to be reissued for reconfiguration, and service interruption is caused in the reissuing process. Although the dynamic update can be realized based on the components such as the existing configuration center, the updating process needs manual adjustment and triggering, so that the real automatic operation can not be realized, and the degree of automation is low.
Based on the above, the embodiment of the invention provides a method, a device and a computing device for automatically degrading micro-services, which can still realize automatic service degradation when the services are readjusted, and can achieve the effect of higher automation degree.
In particular, embodiments of the present invention are further described below with reference to the accompanying drawings.
It should be understood, however, that the following examples provided herein may be combined with one another to form new embodiments, so long as they do not conflict.
Fig. 1 shows a schematic structural diagram of an automatic micro-service degradation device according to an embodiment of the present invention. The micro-service automatic downgrading apparatus 10 includes: 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, among other things, an application program interface (Application Programming Interface, API) gateway. The API gateway can be a server and is used for providing a unique access entry for the outside so as to realize the effects of high cohesion in the system and loose coupling between the systems through the gateway. 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 call request may be an external internet request or a request of an internal other system, for example, may be a request from a WEB side and an APP side.
The interface module 11 is further configured to generate a first call request carrying a call identifier according to the external call request, and send the first call request to the first micro service module 11. The call identifier is a globally unique identifier generated according to an external call request, and the identifier can be specifically a code. For example, if an external call request is received, the external call request is numbered according to a preset encoding mode, so as to obtain a call identifier. According to the external call request, a first call request carrying a call identifier is generated, which may specifically be: and generating a call identifier according to the external call request, generating a first call request according to service call information in the external call request, and binding the first call request with the call identifier. For example, according to the external call request, the call identifier 100xxxx is generated, and according to the service call information (specifying the call of the first micro service module 12) in the external call request, the 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, when 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 several distributed micro service modules. 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 a call identifier according to the first call request, and send the second call request to the second micro service module 13. The method comprises the steps of receiving a first call request, specifically: a first call request carrying a call identifier sent by the interface module 11 is received. According to the first call request, a second call request carrying a call identifier is generated, which may specifically be: and generating a second call request according to the call task information in the first call request, and acquiring a call identifier carried by the first call request to enable the second call request to be bound with the call identifier. For example, assuming that the call identifier carried by the first request is 100xxxx, according to the call task information (specifying to call the second micro service module 13) in the first call request, a second call request directed to the second micro service module 13 is generated, and the second call request is bound to the call identifier 100 xxxx.
The second micro service module 13 is one of several distributed micro service modules. The second micro-service module 13 may communicate with the interface module 11, and the second micro-service module 13 may also communicate 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. The second call request is received, specifically: a second call request carrying a call identifier sent by the first micro service module 12 is received.
The call chain tracking module 14 is respectively in communication connection with a plurality of micro-service modules in the distributed micro-service modules. 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 call request carrying a call identifier, the call chain tracking module 14 acquires the call identifier carried by the first call request from the first micro service module 12 and acquires the direction of the call identifier, if the call identifier is determined to be directed to the second micro service module 13, when the second micro service module 13 receives a second call request carrying the call identifier, the call chain tracking module 14 acquires the call identifier carried by the second call request from the second micro service module 13 and acquires the direction of the call identifier, the call chain tracking module 14 judges whether the call identifier carried by the first call request is identical to the call identifier carried by the second call request, and if so, the call relationship between the first micro service module 12 and the second micro service module 13 is determined to be that the first micro service module 12 calls the second micro service module 13. For example, as shown in fig. 2, assuming that the service a is a first micro-service module, the 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 is that the service a calls the service C; similarly, if the call identifier of the service C points to the service E and the service E also receives the call identifier 10aabb, it is determined that the call relationship calls the service E for the service C.
It should be noted that, the call chain tracking module 14 records the call relationship between each micro service module in real time. When the calling relation among the micro service modules is changed, the calling chain tracking module 14 updates the calling relation among the micro service modules, so that policy configuration is not required to be carried out again when the service is readjusted, and the degree of automation 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 micro service module 13 determines that the second micro service module is abnormal, the second micro service module 13 automatically degrades the service, and meanwhile, the second micro service module 13 sends an abnormal message to the call chain tracking module 14; after receiving the abnormal message sent by the second micro service module 13, the calling chain tracking module 14 calls the chain tracking module 14 to determine the micro service module (i.e. the first micro service module 11) related to the second micro service module 13 according to the calling relation, and then calls the chain tracking module 14 to generate a degradation notification and sends the degradation notification to the first micro service module 11; the first micro service module 12 receives the degradation notification and automatically degrades the service according to the degradation notification.
It should be noted that, the present embodiment is not limited to only the first micro-service module and the second micro-service module, but may include more micro-service modules, the call chain tracking module 14 is connected with each micro-service module and records the call relationship of each micro-service module, and when a certain micro-service module is abnormal, the call chain tracking module 14 determines other micro-service modules related to the abnormal micro-service module according to the call relationship and sends a degradation notification to other micro-service modules related to the abnormal micro-service module. The other micro service module related to the abnormal micro service module is generally an upstream module of the abnormal micro service module, and the upstream module refers to the micro service module that sends a call request to the abnormal micro service module. The micro service module can call a basic component, wherein the basic component can comprise message middleware, cache service, database service and the like.
The embodiment of the invention receives an external call request through an interface module 11, generates a first call request carrying a call identifier according to the external call request, sends the first call request to a first micro-service module 11, a first micro-service module 12 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 13, the second micro-service module 13 receives the second call request, and a call chain tracking module 14 determines the call relationship between the first micro-service module 12 and the second micro-service module 12 according to the call identifier; 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 unique call identifiers of call requests each time, and records the call relationship of different call requests, thereby realizing automatic service degradation when the service is readjusted, and achieving the effect of higher automation degree.
In some embodiments, to achieve high availability, the micro service module deploys several application instances. 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 may be deployed on a container platform or 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 also 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 a 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 traffic allocation between the instances based on the load balancing algorithm according to the first call request, record a call state of each instance, and upload call state information of each instance to the call chain tracking module 14.
The second service gateway 131 is respectively connected with the interface module 11 and the call chain tracking module 14, the second service gateway 131 is also connected with the first service gateway 121, and the second service gateway 131 is also connected with a plurality of instances of the second micro service module 13. The second service gateway 131 is configured to receive a second call request carrying a call 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 the load balancing algorithm according to the second call request, record a call state of each instance, and upload call state information of each instance to the call chain tracking module 14.
The second service gateway 131 is further configured to: judging whether the second micro service module 12 has an abnormal instance or not; if it is determined that the second micro service module 12 has an abnormal instance, after isolating the abnormal instance, calculating a maximum load of the second micro service module 12; determining a request load of the second micro service module 12 according to the second call 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 duration of the instance of the second micro service module 12; if the current running time of the instance of the second micro service module 12 is longer than the preset running time, determining that the instance is an abnormal instance, and determining that the second micro service module 12 has an abnormal instance.
The second call request may include call task information, where the call task information may be information of a task to be executed, and according to the information of the task to be executed, the number of required instances and the number of other micro-service modules to be called may be estimated. For example, assuming that the call task information is order settlement task information, the number of the required examples is estimated to be 2 according to the order settlement task information, and other micro-service modules do not need to be called. The preset operation time length is the operation time length of the obtained instance estimated according to the second call request. Then, according to the second call request, the predetermined operation duration of the instance of the second micro service module 12 may be determined as follows: the number of the required examples in the second micro service module 12 is estimated according to the calling task information of the second calling request, and the preset operation time length of each required example is calculated according to the historical operation speed of the required example. The current running time is the actual running time of the instance. Then, when the actual running time of a certain desired instance is longer than the preset running time, i.e. the instance call times out, the second service gateway 131 determines the instance as an abnormal instance. Different tasks can correspond to different numbers of examples, and preset running time lengths of the different tasks can be the same or different. Alternatively, the second micro service module 12 may also "determine whether an abnormal instance exists" in other manners, which is not limited by the embodiment of the present application.
The isolation exception example may specifically be: when the second service gateway 131 receives the next call request, the second service gateway 131 no longer sends the call request to the anomalous instance.
Wherein, after isolating the abnormal instance, calculating the maximum load of the second micro service module 12 further comprises: acquiring a calling state of a normal instance of the second micro service module 12; determining the residual load of the normal instance according to the calling state of the normal instance; from the remaining load of the normal instance, the maximum load of the second micro service module 12 is calculated. The call state refers to a use state of the instance, if all the instances are used, the use state of the instance is an idle-free state, and if the instances are partially used, the instance is a partial idle state. For example, assuming that the second micro service module 12 includes the unit instances a1, a2 and a3, a3 is determined to be an abnormal instance, a1 and a2 are determined to be normal instances, call states of a1 and a2 are obtained, and if it is determined that the residual loads of a1 and a2 are respectively 100% and 50%, the maximum load of the second micro service module 12 is 1.5 unit instances.
The determining, according to the second call request, the request load 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, so as to estimate the request load of the second micro service module 12.
When the second micro service module 13 determines that the second micro service module 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 call task of a part of the second call requests and reject the call task of another part of the second call requests, or transfers the call task of another part of the second call requests to a task queue. The calling task of a part of the second calling requests can be the calling task with the request load smaller than or equal to the maximum load, and the calling task of the other part of the second calling requests is the rest of the calling tasks except the calling task of a part of the second calling requests in the second calling requests. In such a manner that when the second micro service module 13 is abnormal, the request exceeding the load is transferred to a task queue or refused to be processed in such a manner that the second micro service module 13 is demoted.
Wherein the second service gateway 131 is further configured to: when it is determined that the second micro service module 13 is abnormal, the abnormal information is sent 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 relationship. 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, a degradation notification is sent 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 call 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 refers to a second call request having a request load less than or equal to the maximum load of the second micro service module. That is, when the degradation notification is received, the first service gateway 121 transmits the next second call request to the second service gateway 131, and the first service gateway 121 adjusts the task amount requested in the second call request so that the next second call 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 service gateway 131 is further configured to: detecting an abnormal instance; judging whether the abnormal instance is recovered 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 notification 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 abnormal instance is restored to normal, the second service gateway 131 may dispatch a portion of traffic to the abnormal instance for processing and monitoring to confirm whether the abnormal instance has been restored. If it is determined that the abnormal instance is recovered, the second service gateway 131 reassigns the call request to cancel the degradation 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 cancel degradation notification to other micro service modules related to the second micro service module 13 according to the call relationship. 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, a notification of canceling the degradation is sent to the first service gateway 121. The first service gateway 121 is further configured to receive a notification of cancellation of degradation, and perform cancellation of degradation on the first micro service module 12 according to the notification of cancellation of degradation.
According to the embodiment of the invention, an external call request is received through an interface module 11, a first call request carrying a call identifier is generated according to the external call request, the first call request is sent to a first service gateway 121, a second call request carrying the call identifier is generated by the first service gateway 121 according to the first call request, the second call request is sent 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 the first micro service module 12 and the 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 realizing automatic degradation and recovery operation of the service when the service is readjusted, solving the problem of needing manual access processing, improving the failure processing efficiency of the service, and achieving the effect of higher automation degree.
Fig. 4 shows a flowchart of a method for automatically degrading a micro service according to an embodiment of the present invention. The method is applied to the micro-service automatic downgrade apparatus 10 in the above-described embodiment. As shown in fig. 4, the method comprises the steps of:
step 210, receiving an external call request;
step 220, generating a first call request carrying a call identifier according to the external call request;
step 230, sending the first call request to a first micro service module;
step 240, generating a second call request carrying the call identifier according to the first call request;
step 250, sending the second call 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 step 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 calling relationship.
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 a 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 call 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 instance according to the calling state of the normal instance; 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 the instance of the second micro service module according to the second call request; acquiring the current operation time length of the instance of the second micro service module; and if the current running time of the instance of the second micro service module is longer than the preset running time, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module.
Wherein the method further comprises:
step 281, detecting the abnormal instance;
282, judging whether the abnormal instance is recovered according to the detection result;
And step 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:
step 275, making the second micro service module execute the call task of a part of the second call request, and rejecting another part of the call task of the second call request.
Wherein the method further 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 by the embodiment of the present invention is a method that can be executed by the foregoing apparatus for automatically degrading a micro service, and all embodiments of the foregoing apparatus for automatically degrading a micro service are applicable to the method, and the same or similar beneficial effects can be achieved.
It should be noted that, the method for automatically degrading the micro service provided by the embodiment of the invention can also be executed by other computing devices, and can achieve the same or similar beneficial effects.
According to the embodiment of the invention, the external calling request is received, the first calling request carrying the calling identifier is generated according to the external calling request, the first calling request is sent to the first micro-service module, the second calling request carrying the calling identifier is generated according to the first calling request, the second calling request is sent to the second micro-service module, the calling relationship between the first micro-service module and the second micro-service module is determined according to the calling identifier, if the second micro-service module is determined to be abnormal, the second micro-service module is subjected to degradation processing, and a degradation notification is sent to the first micro-service module according to the calling relationship, the unique calling identifier of the calling request is generated each time, and the calling relationship of different calling requests is recorded, so that when the service is readjusted, the automatic service degradation and recovery operation can be realized, the problem of manual access processing is solved, the failure processing efficiency of the service is improved, and the effect of higher 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, where the executable instruction causes a processor to execute a method for automatically degrading a micro service in any of the foregoing method embodiments.
According to the embodiment of the invention, the external calling request is received, the first calling request carrying the calling identifier is generated according to the external calling request, the first calling request is sent to the first micro-service module, the second calling request carrying the calling identifier is generated according to the first calling request, the second calling request is sent to the second micro-service module, the calling relationship between the first micro-service module and the second micro-service module is determined according to the calling identifier, if the second micro-service module is determined to be abnormal, the second micro-service module is subjected to degradation processing, and a degradation notification is sent to the first micro-service module according to the calling relationship, the unique calling identifier of the calling request is generated each time, and the calling relationship of different calling requests is recorded, so that when the service is readjusted, the automatic service degradation and recovery operation can be realized, the problem of manual access processing is solved, the failure processing efficiency of the service is improved, and the effect of higher automation degree can be achieved.
An embodiment of the present invention provides a computer program product comprising a computer program stored on a computer storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method for automatically degrading micro-services in any of the method embodiments described above.
According to the embodiment of the invention, the external calling request is received, the first calling request carrying the calling identifier is generated according to the external calling request, the first calling request is sent to the first micro-service module, the second calling request carrying the calling identifier is generated according to the first calling request, the second calling request is sent to the second micro-service module, the calling relationship between the first micro-service module and the second micro-service module is determined according to the calling identifier, if the second micro-service module is determined to be abnormal, the second micro-service module is subjected to degradation processing, and a degradation notification is sent to the first micro-service module according to the calling relationship, the unique calling identifier of the calling request is generated each time, and the calling relationship of different calling requests is recorded, so that when the service is readjusted, the automatic service degradation and recovery operation can be realized, the problem of manual access processing is solved, the failure processing efficiency of the service is improved, and the effect of higher automation degree can be achieved.
FIG. 5 illustrates a schematic diagram of a computing device according to an embodiment of the present invention, and the embodiment of the present invention is not limited to a specific implementation of the computing device.
As shown in fig. 5, the computing device may include: a processor (processor) 302, a communication interface (Communications Interface) 304, a memory (memory) 306, and a communication bus 308.
Wherein: processor 302, communication interface 304, and memory 306 perform communication with each other via communication bus 308. A communication interface 304 for communicating with network elements of other devices, such as clients or other servers. Processor 302 is configured to execute program 310, and may specifically perform the micro-service auto-downgrade method of any of the method embodiments described above.
In particular, program 310 may include program code including computer-operating instructions.
The processor 302 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included by the computing device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 306 for storing programs 310. Memory 306 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
According to the embodiment of the invention, the external calling request is received, the first calling request carrying the calling identifier is generated according to the external calling request, the first calling request is sent to the first micro-service module, the second calling request carrying the calling identifier is generated according to the first calling request, the second calling request is sent to the second micro-service module, the calling relationship between the first micro-service module and the second micro-service module is determined according to the calling identifier, if the second micro-service module is determined to be abnormal, the second micro-service module is subjected to degradation processing, and a degradation notification is sent to the first micro-service module according to the calling relationship, the unique calling identifier of the calling request is generated each time, and the calling relationship of different calling requests is recorded, so that when the service is readjusted, the automatic service degradation and recovery operation can be realized, the problem of manual access processing is solved, the failure processing efficiency of the service is improved, and the effect of higher 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 a construction of such a system is apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood 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 above 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 disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention 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 apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. 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. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units 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 but not others included in other embodiments, 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 can 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 use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (7)

1. A method for automatically degrading micro services, the method comprising:
receiving an external call request;
Generating a first call request carrying a call identifier according to the external call request;
sending the first call request to a first micro-service module;
generating a second call request carrying the call identifier according to the first call request;
sending the second call request to a second micro service module, including: judging whether the second micro service module has an abnormal instance or not; if the abnormal instance exists in the second micro service module, after isolating the abnormal instance, calculating the maximum load of the second micro service module; determining the request load of the second micro service module according to the second call request; if the request load of the second micro service module is larger than the maximum load of the second micro service module, determining that the second micro service module is abnormal; wherein the determining whether the second micro service module has an abnormal instance further includes: determining a preset operation time length of the instance of the second micro service module according to the second call request; acquiring the current operation time length of the instance of the second micro service module; if the current running time of the instance of the second micro service module is longer than the preset running time, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module;
Determining a calling relation between the first micro-service module and the second micro-service module according to the calling identification;
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 calling relation; the degrading the second micro service module further includes: and enabling the second micro-service module to execute the calling task of one part of the second calling requests and reject the calling task of the other part of the second calling requests.
2. The method of claim 1, wherein the calculating the maximum load of the second micro-service module further comprises:
acquiring a calling state of a normal instance of the second micro service module;
determining the residual load of the normal instance according to the calling state of the normal instance;
and calculating the maximum load of the second micro service module according to the residual load of the normal example.
3. The method according to claim 1, wherein the method further comprises:
detecting the abnormal instance;
judging whether the abnormal instance is recovered 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 notification to the first micro-service module.
4. A method according to any one of claims 1-3, wherein the method further comprises:
and carrying out degradation processing on the first micro service module according to the degradation notification.
5. An apparatus for automatically degrading micro-services, the apparatus comprising:
the interface module is used for receiving an external call request, generating a first call request carrying a call identifier according to the external call request, and sending the first call request;
the first micro-service module is used for receiving the first call request, generating a second call request carrying the call identifier according to the first call request, and sending the second call request;
a second micro-service module, configured to receive the second call request, including: judging whether the second micro service module has an abnormal instance or not; if the abnormal instance exists in the second micro service module, after isolating the abnormal instance, calculating the maximum load of the second micro service module; determining the request load of the second micro service module according to the second call request; if the request load of the second micro service module is larger than the maximum load of the second micro service module, determining that the second micro service module is abnormal; wherein the determining whether the second micro service module has an abnormal instance further includes: determining a preset operation time length of the instance of the second micro service module according to the second call request; acquiring the current operation time length of the instance of the second micro service module; if the current running time of the instance of the second micro service module is longer than the preset running time, determining that the instance is the abnormal instance, and determining that the abnormal instance exists in the second micro service module;
The call chain tracking module is used for determining a call relation between the first micro-service module and the second micro-service module according to the call 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;
the call chain tracking module is further used for sending a degradation notification to the first micro-service module according to the call relation; the degrading the second micro service module further includes: and enabling the second micro-service module to execute the calling task of one part of the second calling requests and reject the calling task of the other part of the second calling requests.
6. A computing device, comprising: the device 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 configured to store at least one executable instruction that causes the processor to perform the operations of the micro-service auto-destaging method according to any of claims 1-4.
7. A computer readable storage medium having stored therein at least one executable instruction for causing a processor to perform the method of automatically degrading micro-services of any one of claims 1-4.
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 CN112988405A (en) 2021-06-18
CN112988405B true 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)

Families Citing this family (1)

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

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10656929B2 (en) * 2015-08-11 2020-05-19 International Business Machines Corporation Autonomously healing microservice-based applications

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
Challenges of Domain-Driven Microservice Design: A Model-Driven Perspective;Florian Rademacher 等;《IEEE Software》;第36-43页 *
基于Spring Cloud的微服务构建及软件云化应用研究;梁安健 等;《电子产品可靠性与环境试验》;第105-109页 *

Also Published As

Publication number Publication date
CN112988405A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
US11159411B2 (en) Distributed testing service
US10257135B2 (en) Intelligent electronic mail server manager, and system and method for coordinating operation of multiple electronic mail servers
CN106533805B (en) Micro-service request processing method, micro-service controller and micro-service architecture
CN109995842B (en) Grouping method and device for distributed server cluster
CN105939201A (en) Method and device for checking state of server
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
CN107682172A (en) Control centre's device, the method and medium of operation system processing
CN112433863A (en) Micro-service calling method and device, terminal equipment and storage medium
US20230046979A1 (en) Microservice call method and apparatus, device, and medium
CN110838987B (en) Queue current limiting method 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
CN105635231A (en) Calling method and apparatus of distributed system
CN111385328B (en) Service request processing method, system and electronic equipment
CN108664343B (en) State calling method and device for micro-service
CN108235800B (en) Network fault detection method, control center equipment and computer storage medium
CN112437155B (en) Service data processing method and device and server device
CN109460215B (en) Application control method and device
CN114979286B (en) Access control method, device, equipment and computer storage medium for container service
CN113055199B (en) Gateway access method and device and gateway equipment
CN112019359B (en) Service processing method and system based on IMS network
CN114942797B (en) System configuration method, device, equipment and storage medium based on side car mode
CN110177077A (en) System of account processed offline method, apparatus, equipment and storage medium
CN117149396B (en) Cluster fault transfer method and device, equipment and storage medium

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