CN117955836A - Configuration method and device of fuse in micro-service system and micro-service system - Google Patents

Configuration method and device of fuse in micro-service system and micro-service system Download PDF

Info

Publication number
CN117955836A
CN117955836A CN202211274048.2A CN202211274048A CN117955836A CN 117955836 A CN117955836 A CN 117955836A CN 202211274048 A CN202211274048 A CN 202211274048A CN 117955836 A CN117955836 A CN 117955836A
Authority
CN
China
Prior art keywords
fuse
degradation
configuration
target
micro
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.)
Pending
Application number
CN202211274048.2A
Other languages
Chinese (zh)
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.)
Mashang Consumer Finance Co Ltd
Original Assignee
Mashang Consumer Finance 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 Mashang Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN202211274048.2A priority Critical patent/CN117955836A/en
Publication of CN117955836A publication Critical patent/CN117955836A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/0816Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application provides a configuration method and device of a fuse in a micro-service system and the micro-service system, which solve the problem of poor expandability of degradation strategy codes of micro-services in the prior art. The micro-service system comprises a configuration center server, wherein a plurality of fusing and degrading strategies are stored in the configuration center server, and the corresponding relation between each fusing and degrading strategy and the identity of the micro-service is respectively shown, the fusing and degrading strategies comprise fusing and degrading logic, and at least part of fusing and degrading logic of different fusing and degrading strategies are the same; the configuration method is performed by a configuration center server. The configuration method comprises the following steps: acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service; searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity; when the target fuse degradation policy is found, the target fuse degradation policy is sent to the fuse for fuse degradation function configuration of the fuse.

Description

Configuration method and device of fuse in micro-service system and micro-service system
Technical Field
The application relates to the technical field of micro services, in particular to a method and a device for configuring fuses in a micro service system, the micro service system, computer equipment and a storage medium.
Background
In the related art, micro services often contain a large number of downgraded strategies to avoid avalanche effects, ensuring that micro service systems are highly available. The degradation policy codes are usually inserted into the service codes of the micro-service in a hard coding mode, so that the invasiveness to the service codes is high, and the expansibility is poor.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a method and an apparatus for configuring fuses in a micro service system, a computer device, and a storage medium, so as to solve the problem in the prior art that the degrading policy code of the micro service is poor in expansibility.
The first aspect of the present application provides a method for configuring a fuse in a micro-service system. The micro-service system comprises a configuration center server, the configuration center server comprises a configuration file, a plurality of fusing and degrading strategies are stored in the configuration file, and each fusing and degrading strategy is corresponding to an identity mark of the micro-service, the fusing and degrading strategies comprise fusing and degrading logic, and at least part of fusing and degrading logic of different fusing and degrading strategies is the same. The configuration method is executed by a configuration center server and comprises the following steps: acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service; searching a fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity; when the fusing degradation strategy corresponding to the target identity is found, the fusing degradation strategy corresponding to the target identity is sent to the fuse for performing fusing degradation function configuration on the fuse.
The second aspect of the present application provides a device for configuring a fuse in a micro-service system. The micro-service system comprises a configuration center server, the configuration center server comprises a configuration file, a plurality of fusing and degrading strategies are stored in the configuration file, and the corresponding relation between each fusing and degrading strategy and the identity of the micro-service is respectively achieved, the fusing and degrading strategies comprise fusing and degrading logic, and at least part of fusing and degrading logic of different fusing and degrading strategies are identical; the configuration device is installed in the configuration center server, and the configuration device comprises: the acquisition module is used for acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service; the searching module is used for searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity; and the sending module is used for sending the target fuse degradation strategy to the fuse when the target fuse degradation strategy is found, so as to be used for carrying out fuse degradation function configuration on the fuse.
A third aspect of the present application provides a micro-service system comprising: the micro server is configured with a target micro service and a fuse, and the target micro service is in communication connection with the fuse; the configuration center server pre-stores a plurality of fusing and degrading strategies, and the corresponding relation between each fusing and degrading strategy and the identity of the micro service, wherein the fusing and degrading strategies comprise fusing and degrading logic, and at least part of fusing and degrading logic of different fusing and degrading strategies are the same; the configuration center server is used for acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service; searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity; when the target fuse degradation policy is found, the target fuse degradation policy is sent to the fuse for fuse degradation function configuration of the fuse.
A fourth aspect of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executed by the processor, where the processor implements the steps of the method for configuring fuses in a micro service system provided in any of the foregoing embodiments when executing the computer program.
A fifth aspect of the present application provides a computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the method for configuring fuses in a micro-service system provided by any of the embodiments described above.
According to the configuration method and device for the fuse in the micro-service system, the computer equipment and the storage medium, provided by the embodiment of the application, the configuration center server is arranged in the micro-service system, the fuse degradation strategies of a plurality of micro-services are stored in the configuration center server, and the degradation logic of the fuse degradation strategies of the plurality of micro-services is at least partially the same. The fuses acquire their corresponding fuse degradation policies by sending configuration requests to the configuration center server. In this case, modifying the fuse degradation logic in the configuration hub server may synchronously modify a plurality of fuse degradation policies that contain the fuse degradation logic. In the prior art, a hard coding mode is adopted to insert the fusing degradation strategy into the service code, and the fusing degradation strategy of each fuse needs to be modified respectively. In comparison, the configuration method of the fuse in the micro-service system provided by the embodiment of the application is convenient for changing the fusing degradation policy code, and improves the expansibility of the fusing degradation policy code.
Drawings
Fig. 1 is a schematic diagram of a related art micro service system architecture.
Fig. 2 is a schematic diagram of a micro service system according to an embodiment of the application.
Fig. 3 is a flowchart of a method for configuring fuses in a micro service system according to a first embodiment of the present application.
Fig. 4 is a flowchart illustrating a method for configuring fuses in a micro service system according to a second embodiment of the present application.
Fig. 5 is a flowchart illustrating a method for configuring fuses in a micro service system according to a third embodiment of the present application.
Fig. 6 is a block diagram of a configuration device of a fuse according to a first embodiment of the present application.
Fig. 7 is a block diagram of a configuration device of a fuse according to a second embodiment of the present application.
Fig. 8 is a flowchart of a fuse degradation method according to an embodiment of the present application.
Fig. 9 is a block diagram of a fuse degradation device according to an embodiment of the present application.
Fig. 10 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
Fig. 1 is a schematic diagram of a related art micro service system architecture. As shown in fig. 1, the micro service system 10 includes a service requester 11, a fuse 12, and a service provider 13, which are communicatively connected in order.
The service requester 11 is an initiator of a service request, and may be an entity physical device, or may be a certain entity part of the physical device, or may be a software function module of the physical device, for implementing a specific function. The service provider 13 is a responder to the service request for providing a service, and may provide a data processing service, a transaction processing service, or the like, for example. The fuse 12 and the service requester 11 may be located in the same physical device, so as to be different functional units of the physical device, or may be separately used as a physical device. The fuse 12 is configured with a fuse degradation policy. Before the service requester 11 initiates a service request to the service provider 13, a call request needs to be sent to the fuse 12, and the fuse 12 determines whether to allow the service requester 11 to send the service request to the service provider 13 according to a pre-configured fuse degradation policy.
As shown in fig. 1, in the micro service system 10, the fuse degradation policy is inserted into the service code of the service provider 11 by adopting a java hard coding mode, so that the invasiveness to the service code is high, and the expansibility is poor, i.e. the service code is not easy to change.
In view of this, the embodiment of the present application provides a micro service system, in which a configuration center server is set in the micro service system, all the fuse degradation policies of a plurality of micro services are stored in the configuration center server, and the degradation logic of the fuse degradation policies of the plurality of micro services is at least partially the same. The fuses acquire their corresponding fuse degradation policies by sending configuration requests to the configuration center server. In this case, the degradation logic is modified in the configuration center server, and a plurality of fuse degradation policies including the fuse degradation logic may be synchronously modified. In the related art, a hard coding mode is adopted to insert the fuse degradation policy into the service code, and even if a plurality of fuse degradation policies contain the same fuse degradation logic, the fuse degradation policies of each fuse need to be modified respectively. In comparison, the configuration method of the fuse in the micro-service system provided by the embodiment of the application is convenient for changing the fusing degradation policy code, and improves the expansibility of the fusing degradation policy code.
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Fig. 2 is a schematic diagram of a micro service system according to an embodiment of the application. The micro service system 20 includes a configuration center server 21. The configuration center server 21 includes a configuration file, in which a plurality of fuse degradation policies are stored, and a corresponding relationship between each fuse degradation policy and an identity of the micro service. The fusing degradation policy may correspond to an identity of one micro-service, or may correspond to identities of multiple micro-services. The fuse degradation policies include fuse degradation logic, at least portions of which are identical for different fuse degradation policies, that is, the fuse degradation logic for different fuse degradation policies includes identical portions.
As shown in fig. 2, the micro-server system 20 further includes a micro-server 22, and the micro-server 22 is configured with a target micro-service 221 and a fuse 222, and the target micro-service 221 and the fuse 222 are communicatively connected. When the target micro service 221 is used as a service requester, the configuration center server 21 may send the fuse degradation policy corresponding to the target micro service 221 to the fuse 222 by executing the method for configuring fuses provided in the embodiment of the present application, so as to configure the fuse 222 with a fuse degradation function. In this case, the modification of the fuse degradation logic in the configuration center server 21 may synchronously modify a plurality of fuse degradation policies containing the fuse degradation logic. In the related art, a hard coding mode is adopted to insert the fusing degradation strategy into the service code, and the fusing degradation strategy of each fuse needs to be modified respectively. In comparison, the configuration method of the fuse in the micro-service system provided by the embodiment of the application is convenient for changing the fusing degradation policy code, and improves the expansibility of the fusing degradation policy code.
In one embodiment, the fuse 222 determines whether to allow the targeted micro-service 221 to initiate a service request to the service provider 23 based on the fuse degradation policy in combination with its state and statistics in that state. The states of the fuse 222 may include an open state, a closed state, and a half open state. The statistical information includes the response of the service provider 23 to the service request issued by the service requester 221. The response conditions referred to herein may include half-on timing, etc. The half-on timing refers to the time that the fuse 222 is in the half-on state, and the on timing refers to the time that the fuse 222 is in the on state.
The fuse degradation policy is, for example, when the target micro service 221 issues a service request to the fuse 222, if the fuse 222 is in a closed state, that is, a state where the resource of the service provider 23 can be invoked by the target micro service 221, the fuse 222 returns a result of passing the request to the target micro service 221. If the fuse 222 is in the half-open state, the fuse 222 determines whether to allow the service request based on whether the half-open time exceeds a first time threshold. Specifically, if the half-open timer does not exceed the first time threshold, the fuse 222 grants the service request at a first probability; if the half-on timer exceeds the first time threshold, the fuse 222 allows the service request. If the fuse 222 is in the on state, the fuse 222 determines whether to allow the service request based on whether the on timer exceeds a second time threshold. Specifically, if the on-time does not exceed the second time threshold, the fuse 222 allows the service request with a second probability; if the on-time exceeds the second time threshold, the fuse 222 allows the service request.
The first probability and the second probability mentioned above are the duty cycle of the normal response of the target micro service 221 to the service request issued by the service provider 23. The values of the first probability and the second probability can be equal or unequal, and the values are reasonably set according to actual conditions.
The statistics may also include a proportion of unresponsiveness to service requests, a proportion of timeout responses to service requests, an average response time, a count of normal responses to service requests, and so forth. In this case, the fuse 222 may also switch its state in accordance with the fuse degradation policy in combination with the statistical information. Accordingly, the fuse degradation policy further includes: and when the proportion of unresponsive service requests reaches a first threshold value, the proportion of overtime response to the service requests reaches a second threshold value, and the average response time to the service requests reaches a third threshold value in the first period, updating the state of the fuse from the closed state to the open state. When the on-time exceeds a third time threshold, the state of the fuse is updated from an on-state to a half-on-state when the count of normal responses to service requests reaches a first number threshold. When the count of normal responses to the service requests reaches a second number threshold, the state of the fuse is updated from a half-open state to a closed state.
In one embodiment, preset fuse degradation logic is also stored in the configuration file of the configuration center server 21. The fuse degradation policy stored in the configuration file may include an entirety of the preset fuse degradation logic, or may include a portion of the preset fuse degradation logic. In particular, the preset fuse degradation logic includes at least one fuse degradation sub-logic, each of which may be a separate module, and the fuse degradation policy may invoke all or part of the fuse degradation sub-logic of the preset fuse degradation logic.
The fuse degradation sub-logic includes at least one fuse degradation parameter. The fuse degradation parameters include statistical information, such as, for example, a fuse degradation policy in the micro-service system 10 shown in fig. 1, the fuse degradation parameters include a half-on timer, an on timer, a proportion of unresponsiveness to service requests, a proportion of timeout responses to service requests, an average response time, and a count of normal responses to service requests.
A user configuration interface is developed through the target micro-service 221 for configuring the values of the fuse degradation parameters and the target identity in the fuse degradation logic. The values of the configured fuse degradation parameters and the target identity are synchronized to the configuration center server 21. The configuration center server 21 acquires the value of the fuse degradation parameter and the target identity contained in the at least one fuse degradation sub-logic, generates a target fuse degradation policy based on the acquired value of the fuse degradation parameter and the target identity, and a correspondence between the target fuse degradation policy and the target identity. In this case, the developer of the target micro service 221 may use preset fuse degradation logic stored in the configuration center server 21 to obtain a target fuse degradation policy that meets its own needs through the values of the fuse degradation parameters configured at the user configuration interface. Thus, the user can directly utilize the preset fusing degradation logic stored in the configuration center server 21 without developing the preset fusing degradation logic, and the production cost is reduced. It should be appreciated that pre-written fuse degradation policies may also be stored in a configuration file without configuration using a user configuration interface.
As shown in fig. 2, the micro-server system 20 further includes a service provider 23, and the service provider 23 may be provided in another micro-server. The fuse 222 determines whether to allow the target micro-service 221 to issue a service request to the service requester 23 according to the configured fuse degradation policy.
The following describes in detail the execution process of the method for configuring the fuse in the micro service system according to the embodiment of the present application with reference to the accompanying drawings.
Fig. 3 is a flowchart of a method for configuring fuses in a micro service system according to a first embodiment of the present application. Referring to fig. 2, the configuration method 300 is performed by the configuration center server 21. As shown in fig. 3, the configuration method 300 includes:
In step S310, a configuration request of the fuse 222 is obtained, where the configuration request includes the target identity of the target micro service 221.
When the micro server 22 where the target micro service 221 is located is started up, the target micro service 221 sends a start signal to the fuse 222. After receiving the activation signal, the fuse 222 forms a configuration request based on the activation signal, where the configuration request includes an identity of the target micro-service 221, for example, a service name of the target micro-service 221.
Step S320, searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity. That is, the fuse 222 transmits the configuration request to the configuration center server 21, and after the configuration center server 21 receives the configuration request, the fuse degradation policy of the target micro service 221 is searched from its configuration file.
In the present embodiment, the configuration file of the configuration center server 21 includes a plurality of fuse demotion policies, and the correspondence between each of the plurality of fuse demotion policies and the service name of the micro service. In this case, the configuration center server 21 performs traversal search on the configuration file according to the service name of the target micro service 221 included in the configuration request, so as to match the fuse degradation policy corresponding to the service name of the target micro service 221, that is, the target fuse degradation policy. The target fuse degradation policy may be a fuse degradation policy in the related art, for example, the fuse degradation policy mentioned in the micro service system 10 shown in fig. 1, which is not limited in this embodiment.
In step S330, when the target fuse degradation policy is found, the target fuse degradation policy is sent to the fuse 222 for fuse degradation function configuration of the fuse 222. The configured fuses 222 may determine whether to allow the target micro service 221 to issue a call request to the service provider according to the fuse degradation policy in combination with the state of the fuses 222 and statistical information in the recorded state thereof. The specific implementation of the fuse 222 refers to the description of the fuse 222 in the micro service system 10 shown in fig. 1, and will not be repeated here.
According to the method for configuring fuses provided in the present embodiment, by setting the configuration center server 21 in the micro service system 20, the fuse degradation policies of a plurality of micro services are all stored in the configuration center server 21, and the degradation logic of the fuse degradation policies of the plurality of micro services is at least partially the same. The fuse 222 obtains its corresponding fuse degradation policy by sending a configuration request to the configuration hub server 21. In this case, the modification of the fuse degradation logic in the configuration center server 21 may synchronously modify a plurality of fuse degradation policies containing the fuse degradation logic. In the prior art, the fusing degradation policy is inserted into the service code by hard coding, and needs to be modified for each fuse 222 separately. In comparison, the configuration method of the fuse 222 in the micro service system provided by the embodiment of the application is convenient for changing the fusing degradation policy code, and improves the expansibility of the fusing degradation policy code.
Fig. 4 is a flowchart illustrating a method for configuring fuses in a micro service system according to a second embodiment of the present application. The configuration method 400 shown in fig. 4 differs from the configuration method 300 shown in fig. 3 in that in this embodiment, the configuration file of the configuration center server 21 also stores a preset fuse degradation policy. The preset fuse degradation policy belongs to one of the fuse degradation policies, which is not set separately for a specific micro service, and may be sent to a fuse connected to the micro service when the fuse degradation policy is not stored in the configuration center server 21 by a developer of the micro service.
Specifically, the configuration method 400 further includes, based on the configuration method 300 shown in fig. 3:
in step S410, when the target fuse degradation policy is not found, the preset fuse degradation policy is sent to the fuse 222 for performing fuse degradation function configuration on the fuse 222.
Specifically, traversal search is performed in the configuration file based on the service name of the target micro service 221, and if a fuse degradation policy corresponding to the service name is found, the fuse degradation policy is determined as the target fuse degradation policy of the target micro service 221. If the fuse degradation policy corresponding to the service name is not found, determining the preset fuse degradation policy as the target fuse degradation policy of the target micro service 221. By setting the preset fuse degradation policy, it can be ensured that any one of the micro services in the micro service system 20 has a corresponding fuse degradation policy available, and that the whole micro service system is highly available.
Fig. 5 is a flowchart illustrating a method for configuring fuses in a micro service system according to a third embodiment of the present application. In this embodiment, the configuration file further includes preset fuse degradation logic including a plurality of fuse degradation sub-logics including at least one fuse degradation parameter. As shown in fig. 5, the configuration method 500 further includes, based on the configuration method (taking the configuration method 300 shown in fig. 3 as an example) provided in any one of the foregoing embodiments:
step S510, obtaining a value of a fuse degradation parameter and a target identity contained in at least one fuse degradation sub-logic.
The preset fuse degradation logic includes a fuse degradation parameter. The fuse degradation parameters include statistical information, such as, for example, a fuse degradation policy in the micro-service system 10 shown in fig. 1, the fuse degradation parameters include a half-on timer, an on timer, a proportion of unresponsiveness to service requests, a proportion of timeout responses to service requests, an average response time, and a count of normal responses to service requests. The value of the fuse degradation parameter and the fuse degradation logic together comprise a degradation policy. Configuration hub server 22 stores preset fuse degradation logic that includes a plurality of fuse degradation sub-logic. The target micro service provides a user configuration interface, and a user can select a fusing degradation sub-logic in the user configuration interface according to own requirements, set values of fusing degradation parameters contained in the selected fusing degradation sub-logic and a target identity, and then synchronize the configuration parameters to the configuration center server 21.
Step S520, a target fuse degradation strategy is generated based on the value of the fuse degradation parameter and the target identity, and a corresponding relation between the target fuse degradation strategy and the target identity is established. After the configuration central server 21 obtains the value of the fusing degradation parameter, a fusing degradation policy is formed based on the fusing degradation parameter, and a corresponding relation between the fusing degradation policy and the target identity is established, so that the target fusing degradation policy is obtained.
According to the method for configuring fuses provided in this embodiment, preset fuse degradation logic is stored in the configuration center server 21 in advance, and the preset fuse degradation logic includes a plurality of fuse degradation sub-logics, and each fuse degradation sub-logic is an independent module. The fusing degradation parameters contained in the fusing degradation sub-logic can be set or modified through a user configuration interface provided by the target micro-service 221 to obtain a fusing degradation strategy meeting the self requirements of the target micro-service 221, so that the privately customized fusing degradation strategy is realized, the operation process is simple, the implementation is easy, and the modification is convenient. At the same time, different micro-services 221 may share the same fuse downgrade sub-logic, that is, a set of fuse downgrade sub-logic may be stored in the configuration center server 21, which may be invoked by multiple fuse downgrade policies, reducing code redundancy compared to storing the same set of fuse downgrade sub-logic for each fuse downgrade policy.
The application also provides a configuration device of the fuse in the micro-service system, which can be used as a functional unit of the configuration center server for executing the steps of the configuration method provided by any embodiment. Fig. 6 is a block diagram of a configuration device 60 of a fuse according to a first embodiment of the present application. As shown in fig. 6, the configuration device 60 includes an acquisition module 61, a search module 62, and a transmission module 63. The obtaining module 61 is configured to obtain a configuration request of the fuse, where the configuration request includes a target identity of a target micro-service. The searching module 62 is configured to search the configuration file for a target fuse degradation policy corresponding to the target identity based on the target identity. The sending module 63 is configured to send the target fuse degradation policy to the fuse when the target fuse degradation policy is found, so as to configure the fuse with a fuse degradation function.
According to the configuration device of the fuse provided by the embodiment, the fuse degradation policies of a plurality of micro services are stored in the configuration center server, and the degradation logic of the fuse degradation policies of the plurality of micro services is at least partially identical. The fuses acquire their corresponding fuse degradation policies by sending configuration requests to the configuration center server. In this case, modifying the fuse degradation logic in the configuration hub server may synchronously modify a plurality of fuse degradation policies that contain the fuse degradation logic. In the prior art, a hard coding mode is adopted to insert the fusing degradation strategy into the service code, and the fusing degradation strategy of each fuse needs to be modified respectively. In comparison, the configuration method of the fuse in the micro-service system provided by the embodiment of the application is convenient for changing the fusing degradation policy code, and improves the expansibility of the fusing degradation policy code.
In one embodiment, the sending module 63 is further configured to send the preset fuse degradation policy to the fuse for performing fuse degradation function configuration on the fuse when the target fuse degradation policy is not found.
According to the configuration device of the fuse provided in this embodiment, it may be determined whether a target fuse degradation policy of the target micro service 221 exists in a configuration file of the configuration center server, if so, the target fuse degradation policy is sent to the fuse 222, and if not, a preset fuse degradation policy is sent to the fuse 222. In this way, it can be ensured that any one of the micro services in the micro service system 20 has a corresponding fuse degradation policy available, ensuring that the entire micro service system is highly available.
Fig. 7 is a block diagram of a configuration device of a fuse according to a second embodiment of the present application. As shown in fig. 7, the configuration file further includes preset fuse degradation logic including a plurality of fuse degradation sub-logics, each including at least one fuse degradation parameter. In this case, the obtaining module 61 is further configured to obtain the value of the fuse degradation parameter and the target identity, which are included in at least one fuse degradation sub-logic. Configuration device 70 further comprises a generation module 71 for generating the target fuse degradation policy based on the obtained value of the fuse degradation parameter, and a correspondence between the target fuse degradation policy and the target identity.
In one embodiment, the obtaining module 61 is specifically configured to obtain the value of the fuse degradation parameter and the target identity through a user configuration interface provided by the target micro service.
According to the configuration device of the fuse provided in this embodiment, the preset fuse degradation logic is pre-stored in the configuration center server 21, the preset fuse degradation logic includes at least one fuse degradation sub-logic, and the fuse degradation parameters included in the fuse degradation sub-logic can be set or modified through the user interface configuration interface provided by the target micro-service to obtain the fuse degradation policy meeting the self-requirement of the target micro-service 221, so that the privately customized fuse degradation policy is realized, the operation process is simple, the implementation is easy, and the modification is convenient. At the same time, different micro-services may share the same fuse degradation sub-logic, thereby reducing code redundancy.
The application also provides a fusing degradation method which is suitable for the micro-service system 20 shown in fig. 2. Fig. 8 is a flowchart of a fuse degradation method according to an embodiment of the present application. The fuse degradation method is performed by the fuse 22. As shown in fig. 8, the fuse degradation method 800 includes:
Step S810 (not shown in the figure) issues a configuration request to the configuration center server 21 based on the start signal of the target micro service 221.
After the micro server where the target micro service 221 is located is started, a start signal is sent to the fuse 222. Based on the activation signal, the fuse 222 forms a configuration request that includes an identification of the target micro-service 221, such as a service name of the target micro-service 221. The fuse 222 sends a configuration request to the configuration center server 22.
In step S820, the fuse degradation policy returned by the configuration center server 21 is received to perform the fuse degradation function configuration.
After receiving the configuration request sent by the fuse 222, the configuration center server 21 executes the steps of the method for configuring a fuse provided in any of the embodiments above, so as to send the fuse degradation policy of the target micro service 221 to the fuse 222. After receiving the fuse degradation policy, the fuse 222 loads the fuse degradation policy to implement the fuse degradation function configuration.
In step S830, in response to the call request issued by the target micro service 221, it is determined whether to allow the target micro service 221 to transmit a service request to the service provider 23 based on the self state of the fuse 222. If not, go to step S840 and step S850; if so, step S860 and step S860 are performed.
For example, in the present embodiment, the states of the fuse 222 include an off state and an on state. When the fuse 222 is in the off state, i.e., the service provider 23 is in the unavailable state, the fuse 222 returns the disallowed call information. When the fuse 222 is in an on state, i.e., the service provider 23 is in an available state, the fuse 222 returns permission-to-invoke information.
Step S840, returning a preset response result.
Specifically, when the fuse 222 is in the off state, i.e., the service provider 23 is in an unavailable state, the fusing callback function is triggered, and a preset response result is returned. The preset response result may be a history return result of the calling service provider 23 stored in the cache, or identification information for indicating that the service provider 23 is abnormal.
In step S850, it is determined whether to modify the state of the fuse 222 based on the statistical information recorded by the fuse 222.
For example, the statistics include a proportion of service requests not responded, a proportion of service request timeout responses, and an average response time to service requests. And when the proportion of unresponsive service requests reaches a first threshold value, the proportion of overtime response to the service requests reaches a second threshold value, and the average response time to the service requests reaches a third threshold value in the first period, updating the state of the fuse from the closed state to the open state.
In step S860, the service request of the target micro service 221 is forwarded to the service provider 23, and the response result of the service provider 23 to the service request is received.
The service request issued by the target micro service 221 reaches the fuse 222 through the gateway aggregation layer, and the fuse 222 forwards the service request to the service provider. Upon receiving the service request, the service provider 23 responds to the service request and returns the response result to the fuse 222.
In step S870, the response result is stored in the buffer of the fuse 222, so that when the service provider 23 is abnormal, the response result is returned to the target micro service 221 as the preset response result mentioned in step S840.
Returning to step S850. For example, the statistics also include a count of normal responses to the service request. When the count of normal responses to the service requests reaches a second number threshold, the state of the fuse is updated from an on state to an off state, and an alarm prompt is sent out.
In one embodiment, the fuse degradation method 800 further includes exposing at least some of the statistics, the state of the fuses, the setting of fuse degradation parameters, and/or the modification records in real time. The statistical information displayed in real time may include a maximum passing rate and a minimum passing rate for allowing the service request to send the service request to the service provider in a first predetermined time interval, a fusing rate of the fuse in a second predetermined time interval, that is, a ratio of the number of times the fuse is switched to the on state to the total number of times of state switching, and the like. The information display can facilitate the developer of the target micro-service to more intuitively view the data.
The application also provides a fusing degradation device. Fig. 9 is a block diagram of a fuse degradation device according to an embodiment of the present application. As shown in fig. 9, the fuse degrading device 90 includes: the device comprises a communication module 91, a configuration module 92, a determination module 93 and a state switching module 94. The communication module 91 is configured to send a configuration request to the configuration center server 21 based on the start signal of the target micro service 221, and receive a fuse degradation policy returned by the configuration center server 21. The configuration module 92 is configured to perform a fuse degradation function configuration based on a fuse degradation policy. The determining module 93 is configured to determine, in response to a call request issued by the target micro service 221, whether to allow the target micro service 2211 to transmit a service request to the service provider 23 based on the self state of the fuse 222. The communication module 91 is configured to return a preset response result to the target micro service 221 when the fuse 222 determines that the target micro service 221 is not allowed to send a service request to the service developer; when the fuse 222 determines that the target micro service 221 is allowed to send a service request to the service provider 23, the communication interface of the service provider 23 is invoked. The status switching module 94 is operable to determine whether to modify the status of the fuse 212 based on statistical information recorded by the fuse 222.
In one embodiment, the fuse degradation device 90 further includes an alarm module 95 for alerting when the state switching module 94 switches the state of the fuse to an on state.
In one embodiment, the fuse degradation device 90 further includes a presentation module 96 for presenting at least a portion of the statistical information, the status of the fuses, the setting of the fuse degradation parameters, and/or the modification records in real time. The statistical information presented in real time may include a maximum passing rate and a minimum passing rate for allowing the target micro service 221 to transmit the service request to the service provider in the first predetermined time interval, a fusing rate of the fuse in the second predetermined time interval, that is, a ratio of the number of times the fuse is switched to the on state to the total number of times of state switching, and the like. The information presentation may facilitate more intuitive viewing of data by the developer of the target micro-service 221.
The application also provides computer equipment. Fig. 10 is a block diagram of a computer device according to an embodiment of the present application. The computer device may be a configuration center server 21. As shown in fig. 10, the computer device 100 includes: memory 101, processor 102, and a computer program stored on memory 101 for execution by processor 102. The steps of the method for configuring a fuse provided in any of the embodiments and/or the steps of the method for degrading a fuse provided in any of the embodiments described above are implemented when the processor 102 executes a computer program.
Memory 101 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory includes Random Access Memory (RAM) and/or cache memory (cache), among others. Nonvolatile memory includes Read Only Memory (ROM), hard disk, flash memory, and the like. The memory 101 may also store therein a fuse demotion policy of the service requester, a default fuse demotion policy, and the like.
The processor 102 may be a processing unit, such as a Central Processing Unit (CPU), having data processing capabilities and/or instruction execution capabilities.
A computer program may be written in one or more programming languages. The programming languages include object-oriented programming languages such as Java, C++, and the like, and conventional procedural programming languages such as the "C" language. The computer program may execute entirely on the computer device 100, partly on the computer device 100 and partly on a server, as a stand-alone software package.
In one embodiment, the computer device 100 further comprises: input device 103 and output device 104, input device 103 and output device 104 are respectively connected to processor 102. The input device 103 may be a microphone or a microphone array for capturing sound signals. The input device 13 may also be a keyboard, a mouse, etc. The output device 104 may output various information to the outside. The output device 104 may be a display, speakers, printer, etc.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the fuse configuration method provided by any of the above embodiments and/or the steps of the fuse degradation method provided by any of the above embodiments.
A computer readable storage medium may employ any combination of one or more readable media. The readable storage medium may be in the form of any one of electronic, magnetic, optical, electromagnetic, infrared, semiconductor, or a combination of the foregoing. For example, the readable storage medium includes: hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, and the like.
The basic principles of the present application have been described above in connection with specific embodiments, but it should be noted that the advantages, benefits, effects, etc. mentioned in the present application are merely examples and not intended to be limiting, and these advantages, benefits, effects, etc. are not to be construed as necessarily possessed by the various embodiments of the application. Furthermore, the specific details disclosed herein are for purposes of illustration and understanding only, and are not intended to be limiting, as the application is not necessarily limited to practice with the above described specific details.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the application to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the application to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.

Claims (10)

1. The configuration method of the fuse in the micro-service system is characterized in that the micro-service system comprises a configuration center server, the configuration center server comprises a configuration file, a plurality of fuse degradation strategies are stored in the configuration file, and the corresponding relation between each fuse degradation strategy and the identity of the micro-service is respectively stored in the configuration file, the fuse degradation strategies comprise fuse degradation logic, and at least part of fuse degradation logic of different fuse degradation strategies is the same; the configuration method is executed by the configuration center server, and the configuration method comprises the following steps:
Acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service;
Searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity;
And when the target fusing degradation strategy is found, the target fusing degradation strategy is sent to the fuse for performing fusing degradation function configuration on the fuse.
2. The configuration method of claim 1, wherein the configuration file further comprises a preset fuse degradation policy; the configuration method further comprises the following steps:
and when the target fusing degradation strategy is not found, sending the preset fusing degradation strategy to the fuse for performing fusing degradation function configuration on the fuse.
3. The configuration method according to claim 1 or 2, wherein the configuration file further comprises preset fuse degradation logic comprising a plurality of fuse degradation sub-logics, each comprising at least one fuse degradation parameter; the configuration method further comprises the following steps:
Acquiring the value of the fusing degradation parameter and the target identity contained in at least one fusing degradation sub-logic;
And generating the target fuse degradation strategy based on the acquired value of the fuse degradation parameter, and the corresponding relation between the target fuse degradation strategy and the target identity.
4. The configuration method of claim 3, wherein the obtaining the value of the fuse degradation parameter and the target identity contained by at least one of the fuse degradation sub-logics comprises:
and acquiring the value of the fusing degradation parameter and the target identity through a user configuration interface provided by the target micro-service.
5. The configuration device of the fuse in the micro-service system is characterized in that the micro-service system comprises a configuration center server, the configuration center server comprises a configuration file, a plurality of fuse degradation strategies are stored in the configuration file, and each fuse degradation strategy is respectively corresponding to the identity of the micro-service, the fuse degradation strategies comprise fuse degradation logic, and at least part of fuse degradation logic of different fuse degradation strategies is the same; the configuration device is installed in the configuration center server, and the configuration device comprises:
The acquisition module is used for acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service;
The searching module is used for searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity;
and the sending module is used for sending the target fuse degradation strategy to the fuse when the target fuse degradation strategy is found, so as to be used for carrying out fuse degradation function configuration on the fuse.
6. A micro-service system, comprising:
The micro server is configured with a target micro service and a fuse, and the target micro service is in communication connection with the fuse; and
The configuration center server comprises a configuration file, wherein a plurality of fusing and degrading strategies are stored in the configuration file, and the corresponding relation between each fusing and degrading strategy and the identity of the micro service is respectively achieved, the fusing and degrading strategies comprise fusing and degrading logic, and at least part of fusing and degrading logic of different fusing and degrading strategies is the same;
The configuration center server is used for acquiring a configuration request of the fuse, wherein the configuration request comprises a target identity of a target micro-service; searching a target fusing degradation strategy corresponding to the target identity in the configuration file based on the target identity; and when the target fusing degradation strategy is found, the target fusing degradation strategy is sent to the fuse for performing fusing degradation function configuration on the fuse.
7. The micro-service system of claim 6, wherein the configuration file further comprises preset fuse degradation logic, the preset fuse degradation logic comprising a plurality of fuse degradation sub-logics, each fuse degradation sub-logic comprising at least one fuse degradation parameter;
The configuration center server is further configured to obtain a value of the fuse degradation parameter and the target identity, where the value of the fuse degradation parameter and the target identity are included in at least one fuse degradation sub-logic, and generate the target fuse degradation policy based on the obtained value of the fuse degradation parameter and the target identity.
8. The micro service system of claim 6, wherein the configuration center server is further configured to obtain the value of the fuse degradation parameter and the target identity contained in at least one fuse degradation sub-logic through a user configuration interface provided by the target micro service.
9. Computer device comprising a memory, a processor and a computer program stored on the memory for execution by the processor, characterized in that the processor, when executing the computer program, realizes the steps of the method for configuring fuses in a microservice system according to any one of claims 1 to 4.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of configuring a micro-service system according to any one of claims 1 to 4.
CN202211274048.2A 2022-10-18 2022-10-18 Configuration method and device of fuse in micro-service system and micro-service system Pending CN117955836A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211274048.2A CN117955836A (en) 2022-10-18 2022-10-18 Configuration method and device of fuse in micro-service system and micro-service system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211274048.2A CN117955836A (en) 2022-10-18 2022-10-18 Configuration method and device of fuse in micro-service system and micro-service system

Publications (1)

Publication Number Publication Date
CN117955836A true CN117955836A (en) 2024-04-30

Family

ID=90796693

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211274048.2A Pending CN117955836A (en) 2022-10-18 2022-10-18 Configuration method and device of fuse in micro-service system and micro-service system

Country Status (1)

Country Link
CN (1) CN117955836A (en)

Similar Documents

Publication Publication Date Title
US11394625B2 (en) Service level agreement based storage access
KR102148064B1 (en) Voice displaying
US12015724B2 (en) Devices and methods for analytics exposure to application functions in 5G networks
US10848500B2 (en) Systems and methods for group-based mobile device management
CN110753131A (en) Microservice distributed current limiting method and device, storage medium and electronic equipment
EP3565219A1 (en) Service execution method and device
US11073970B2 (en) Dashboard generation based on user interaction
US11509527B1 (en) Assisted and context-driven network changes
CN112671897B (en) Access method, device, storage medium, equipment and product of distributed system
CN106412078B (en) Accurate information method for pushing, device and system
US10755707B2 (en) Selectively blacklisting audio to improve digital assistant behavior
US8745681B2 (en) Set top box resource allocation for executing a widget
CN110096305A (en) Gray scale dissemination method, device, equipment and storage medium
KR20110037969A (en) Targeted user notification of messages in a monitoring system
CN117955836A (en) Configuration method and device of fuse in micro-service system and micro-service system
CN111488163A (en) Firmware updating method and device, electronic equipment and storage medium
KR102004503B1 (en) Notification method about game, client, server and iot apparatus for performing the method
KR102031810B1 (en) System and method for providing service menu based on application service, and apparatus applied to the same
CN113010263A (en) Method, system, equipment and storage medium for creating virtual machine in cloud platform
KR100542410B1 (en) Element Management System in NGTS and Dynamic Management Component Construction Method thereon
CN111049943A (en) Method, device, equipment and medium for analyzing domain name
US11676591B1 (en) Smart computing device implementing artificial intelligence electronic assistant
US20090183172A1 (en) Middleware Bridge System And Method
CN113300901B (en) Data stream monitoring method and device, electronic equipment and storage medium
CN117573359B (en) Heterogeneous cluster-based computing framework management system and method

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