Monitoring method, monitoring device, computer equipment and medium
By using fuses to count error rates and hierarchical downgrade requests in the microservice architecture, the disconnection-reconnection cycle problem caused by insufficient performance is solved, and the stability and availability of server performance is improved.
Patent Information
- Application Number
- CN201910301559.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-15
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2039-04-15
AI Technical Summary
In microservice architecture, after the fuse is disconnected due to insufficient performance, the existing technology will fall into a disconnect-reconnect-disconnect-reconnect cycle, which cannot effectively solve the problem of business request failure caused by insufficient performance.
Through the fuse, the error rate is counted, the status is modified to disconnect, and a hierarchical downgrade request is sent to the server, and the downgrade identifier is assigned to allow the server to access the secondary server to reduce business functions and avoid cyclic disconnection.
It realizes the reduction of business functions through hierarchical downgrade operations when the server performance is insufficient, avoiding the disconnection-reconnect cycle, ensuring that the server performance supports remaining services, and improving the stability and availability of the microservice architecture.
Smart Images

Figure CN111831504B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a monitoring method, a monitoring device, a computer equipment and a medium. Background Art
[0002] In the prior art, for any client or server in a microservice architecture as the requester, when the requested server's fuse is disconnected due to insufficient performance, the prior art will restart the requested server after the fuse is disconnected and then resend the service request to the server. At this time, the requested server still performs operations according to its internal full-scale business, and will soon disconnect the fuse again due to insufficient performance, thus falling into a cycle of disconnect-reconnect-disconnect-reconnect. Summary of the invention
[0003] In view of this, the present disclosure provides an improved monitoring method, monitoring device, computer equipment and medium.
[0004] One aspect of the present disclosure provides a monitoring method, including: counting the error rate of sending service requests to a server within a first predetermined time through a fuse; when the error rate exceeds a predetermined threshold, changing the state of the fuse to disconnected; sending a hierarchical downgrade request to the server, so that the server assigns a downgrade identifier to one or more services in the server in response to the hierarchical downgrade request; changing the state of the fuse to connected, sending a service request to the server through the fuse, so that the server accesses a secondary server corresponding to a service not accompanied by a downgrade identifier and returns response data; and receiving the response data.
[0005] According to an embodiment of the present disclosure, the above method further includes: when the state of the fuse is modified to be disconnected, obtaining a first preset response content according to a first failure fallback rule.
[0006] According to an embodiment of the present disclosure, the above method also includes: before sending a hierarchical downgrade request to the server, obtaining a distributed lock from a shared storage space, and within a second predetermined time after a client or server obtains the distributed lock from the shared storage space, other clients or servers cannot obtain the distributed lock from the shared storage space.
[0007] According to an embodiment of the present disclosure, the method further includes: when all services of the server are accompanied by a downgrade mark, obtaining a second preset response content according to a second failure fallback rule.
[0008] According to an embodiment of the present disclosure, the above method also includes: before changing the state of the fuse to connected, sending a probe request to the server, and when receiving a confirmation response to the probe request from the server, changing the state of the fuse to connected.
[0009] Another aspect of the present disclosure provides a monitoring method, comprising: in response to a hierarchical downgrade request sent by a client, assigning a downgrade identifier to one or more services in the present server; in response to a service request sent by the client, accessing a secondary server corresponding to a service not accompanied by a downgrade identifier to obtain corresponding service data; and, returning the service data to the client.
[0010] According to an embodiment of the present disclosure, the above-mentioned allocating a downgrade flag to one or more services in this server includes: sorting the services included in this server according to service priority; and allocating a downgrade flag to the service with the lowest priority and currently not attached with a downgrade flag.
[0011] Another aspect of the present disclosure provides a monitoring device, including: a statistics module, a disconnection module, a downgrade request module, a connectivity module and a receiving module. The statistics module is used to count the error rate of service requests sent to the server within the first predetermined time before the fuse is counted. The disconnection module is used to modify the state of the fuse to disconnected when the error rate exceeds a predetermined threshold. The downgrade request module is used to send a hierarchical downgrade request to the server, so that the server assigns a downgrade identifier to one or more services in the server in response to the hierarchical downgrade request. The connectivity module is used to modify the state of the fuse to connected, send a service request to the server through the fuse, so that the server accesses the secondary server corresponding to the service without a downgrade identifier and returns response data. And, the receiving module is used to receive the response data.
[0012] Another aspect of the present disclosure provides a monitoring device, including: a downgrade processing module, an access module and a return module. The downgrade processing module is used to respond to the hierarchical downgrade request sent by the client and assign a downgrade identifier to one or more services in the server. The access module is used to respond to the service request sent by the client and access the secondary service corresponding to the service without the downgrade identifier to obtain the corresponding service data. And the return module is used to return the service data to the client.
[0013] Another aspect of the present disclosure provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.
[0014] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0015] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the method described above when executed.
[0016] According to an embodiment of the present disclosure, when the requested server is disconnected due to insufficient performance, the present solution reduces the service functions of the server in a hierarchical manner through hierarchical downgrade operations, so that the performance of the server can support the remaining services and will not fall into the disconnect-reconnect-disconnect-reconnect cycle of the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0018] Figure 1 An exemplary system architecture to which the monitoring method and apparatus according to an embodiment of the present disclosure can be applied is schematically shown;
[0019] Figure 2 The flowchart of the monitoring method according to the embodiment of the present disclosure is schematically shown;
[0020] Figure 3 A flowchart of a monitoring method according to another embodiment of the present disclosure is schematically shown;
[0021] Figure 4A The following schematically shows an architecture diagram of a monitoring method according to an embodiment of the present disclosure;
[0022] Figure 4B Schematically shows a flow chart of a client initiating a hierarchical downgrade request according to an embodiment of the present disclosure;
[0023] Figure 4C A flowchart schematically shows a hierarchical downgrade operation performed by a server according to an embodiment of the present disclosure;
[0024] Figure 5 A block diagram of a monitoring device according to an embodiment of the present disclosure is schematically shown;
[0025] Figure 6 A block diagram of a monitoring device according to another embodiment of the present disclosure is schematically shown;
[0026] Figure 7 A block diagram of a monitoring device according to another embodiment of the present disclosure is schematically shown;
[0027] Figure 8A block diagram schematically shows a monitoring device according to another embodiment of the present disclosure; and
[0028] Fig. 9 The block diagram of a computer device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0032] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0033] The embodiments of the present disclosure provide a monitoring method and a device capable of applying the method. The method can be applied to any client or any server in a microservice architecture, and includes an error monitoring phase, a disconnection phase, a downgrade request phase, and a recovery phase. In the error monitoring phase, the error rate of sending a service request to the server within the first predetermined time is counted by a fuse. When the error rate exceeds a predetermined threshold, the disconnection phase is entered, and the state of the fuse is modified to disconnect. In the downgrade request phase, a hierarchical downgrade request is sent to the server, so that the server assigns a downgrade identifier to one or more services in the server in response to the hierarchical downgrade request. Then in the recovery phase, a service request is sent to the server through a fuse, and the response data returned by the server accessing the secondary server corresponding to the service without a downgrade identifier is received.
[0034] Figure 1 The exemplary system architecture 100 to which the monitoring method and apparatus according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0035] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, primary servers 104, 105, and secondary servers 106-111, and different secondary servers may provide data related to different services.
[0036] The network 104 is used as a medium for providing a communication link between the terminal devices 101 , 102 , 103 and the server devices 104 , 105 .
[0037] The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc. The primary server 104 may communicate with the secondary servers 106, 107, and 108 via various wired or wireless communication links, and the primary server 105 may communicate with the secondary servers 109, 110, and 111 via various wired or wireless communication links.
[0038] The terminal devices 101, 102, 103 can be various electronic devices, including but not limited to smart phones, personal computers, tablet computers, smart watches, etc., which are not limited here.
[0039] Client applications (hereinafter referred to as "clients") with various functions may be installed in the terminal devices 101, 102, and 103. The functional support of any client in the terminal devices 101, 102, and 103 may be decomposed into discrete multi-layer servers. For example, when client A needs to obtain business data 1 to 6 when executing a function, client A may communicate with primary servers 104 and 105 through network 104. Primary server 104 may obtain corresponding business data 1 to 3 by accessing secondary servers 106, 107, and 108 respectively, and then return them to client A. Primary server 105 may obtain corresponding business data 4 to 6 by accessing secondary servers 109, 110, and 111 respectively, and then return them to client A.
[0040] The architecture composed of one or more clients and multi-level servers can be called a "microservice architecture", which aims to split a large service into multiple supporting microservices, can be managed in a distributed manner, and has a high degree of fault tolerance. The monitoring method and device according to the embodiment of the present disclosure can be used to monitor the operating status of the servers at all levels in the microservice architecture to ensure the normal operation of the microservice architecture.
[0041] It should be understood that Figure 1 The number of terminal devices, networks, primary servers and secondary servers, and the number of server levels are only for illustration purposes and can be set to any number according to actual needs.
[0042] Figure 2 A flowchart of a monitoring method according to an embodiment of the present disclosure is schematically shown, which can be applied to a client or a server in a microservice architecture.
[0043] like Figure 2 As shown, the method includes in operation S201, counting, by a fuse, an error rate of sending a service request to a server within a first predetermined time.
[0044] Among them, when Figure 2 When the method shown is applied to a client in a microservice architecture, the server in operation S201 refers to any server that can communicate directly with the client. Figure 2 When the method shown is applied to a server A in a microservice architecture, the server in operation S201 refers to any secondary server B that can communicate directly with the server A and on which the server A depends. The server A can be a primary server that communicates directly with the client, or a server at another level, without limitation. An error in sending a service request to the server within the first predetermined time refers to a high latency or request failure. The fuse is a tool that provides service isolation, fuse, and degradation mechanisms in the service architecture, and is used to maintain the high availability of the microservice architecture.
[0045] In operation S202, when the error rate exceeds a predetermined threshold, the state of the fuse is modified to be open.
[0046] In this operation, when the error rate of sending service requests to the server S exceeds the predetermined threshold, it indicates that the server S has a fault. If the service request continues to be sent to the server S, a large number of blockages will be generated, resulting in the exhaustion of the resources of the server S. Therefore, it is necessary to temporarily change the fuse status to disconnected. When a service request is sent, the fuse status is checked first. When the fuse status is disconnected, the service request is no longer sent to the server S.
[0047] In operation S203, a hierarchical downgrade request is sent to the server, so that the server allocates downgrade identifiers to one or more services in the server in response to the hierarchical downgrade request.
[0048] This operation sends a hierarchical downgrade request to the server S after changing the fuse status to open. The server S contains one or more services, and different services can depend on different secondary servers of the server S. The hierarchical downgrade request is used to notify the server S to assign downgrade identifiers to one or more services in a hierarchical manner according to certain rules.
[0049] In operation S204, the state of the fuse is changed to connected, and a service request is sent to the server through the fuse, so that the server accesses the secondary server corresponding to the service without a downgrade mark and returns response data.
[0050] After the server S finishes allocating the downgrade mark, this operation restores the fuse to the connected state. When a service request is issued, the fuse state is checked first. When the fuse state is connected, the service request is sent to the server S. At this time, the server S only executes the functions corresponding to the services without the downgrade mark, which is equivalent to realizing the hierarchical downgrade of the server S instead of the overall downgrade.
[0051] In operation S205, the response data is received.
[0052] visible, Figure 2The method shown is described from the perspective of any client or server in the microservice architecture as the requester. When the requested server is disconnected due to insufficient performance, the prior art will restart the requested server after the fuse is disconnected and then resend the service request to the server. The requested server still performs operations according to its internal full-volume services at this time, and will soon disconnect the fuse again due to insufficient performance. However, this solution reduces the service functions of the server in layers after the fuse is disconnected, so that the performance of the server can support the remaining services and will not fall into the disconnect-reconnect-disconnect-reconnect cycle of the prior art.
[0053] Furthermore, in order to ensure that the service request can still be responded to when the fuse is disconnected, in one embodiment of the present disclosure, the monitoring method according to the embodiment of the present disclosure further includes: when the state of the fuse is changed to disconnected, obtaining the first preset response content according to the first failure fallback rule. For example, for a client, when issuing a service request, the state of the fuse in the client is first checked, and if the state of the fuse is disconnected, the client obtains the preset template as the response content for display.
[0054] In one embodiment of the present disclosure, the monitoring method according to the embodiment of the present disclosure further includes: before sending a hierarchical downgrade request to the server, obtaining a distributed lock from a shared storage space, and within a second predetermined time after a client or server obtains the distributed lock from the shared storage space, other clients or servers cannot obtain the distributed lock from the shared storage space. The shared storage space can be shared by each client and server in the microservice architecture, and any client or server in the microservice architecture can access the shared storage space and obtain a distributed lock from the shared storage space.
[0055] For example, for a client, after determining that the server S fails, the state of the fuse is changed to disconnected. Then a request is made to obtain the distributed lock from the shared storage space. If the lock is obtained, it indicates that no other client or server is making a hierarchical downgrade request within the current second predetermined time, and the client can make a hierarchical downgrade request. If the lock is not obtained, it indicates that other clients or servers are making hierarchical downgrade requests within the current second predetermined time, and it is necessary to wait for the hierarchical downgrade requests of other clients or servers to end before obtaining the lock.
[0056] This embodiment uses a distributed lock to limit a period of time in the microservice architecture to only one client or server to make a hierarchical downgrade request, so as to avoid a situation where a server responds to multiple hierarchical downgrade requests at the same time, causing all services to be downgraded.
[0057] Furthermore, in some specific cases, if all services in a requested server are downgraded, in order to ensure that the service request can still be responded to when the fuse is disconnected, in one embodiment of the present disclosure, the monitoring method according to the embodiment of the present disclosure also includes: when the services of the server are all accompanied by a downgrade mark, obtaining a second preset response content according to a second failure fallback rule.
[0058] This embodiment is equivalent to setting a backup strategy (Miscellaneous Provisions). When the server cannot respond to the service request of the requester, it can also respond by using the second preset response content set locally on the requester.
[0059] In one embodiment of the present disclosure, the monitoring method according to the embodiment of the present disclosure further includes: before changing the state of the fuse to connected, sending a probe request to the server, and when receiving a confirmation response from the server to the probe request, changing the state of the fuse to connected. For example, for a client, after determining that the server S has a fault, the state of the fuse is changed to disconnected, and a hierarchical downgrade request is sent to the server S. After the hierarchical downgrade request is sent, in order to determine whether the server S has completed the hierarchical downgrade operation, while keeping the state of the fuse disconnected, a probe request is sent to the server S. Specifically, the probe request can be a small number of service requests, such as sending 3 service requests to the server S. If responses from the server S to the three service requests are received respectively without delay, it means that a confirmation response from the server S to the probe request is received, and the state of the fuse is changed to connected at this time.
[0060] Figure 3 A flowchart of a monitoring method according to another embodiment of the present disclosure is schematically shown, which can be applied to any server in a microservice architecture.
[0061] like Figure 3 As shown, the method includes, in operation S301, allocating a downgrade identifier to one or more services in the server in response to a hierarchical downgrade request sent by a client.
[0062] Among them, when Figure 3 When the method shown is applied to a primary server in a microservice architecture, the primary server receives a hierarchical downgrade request sent by a client. Figure 3 When the method shown is applied to other secondary servers in the microservice architecture, the secondary server receives the hierarchical downgrade request sent by the previous server. Based on the same processing logic, Figure 3Take this server as a primary server for example. This server contains one or more services, and different services can depend on different secondary servers of this server. After receiving the hierarchical downgrade request, this server allocates downgrade identifiers to one or more services in a hierarchical manner according to certain rules.
[0063] In operation S302, in response to the service request sent by the client, a secondary server corresponding to the service without a downgrade mark is accessed to obtain corresponding service data.
[0064] In operation S303, the service data is returned to the client.
[0065] visible, Figure 3 The method shown is described from the perspective of any server in the microservice architecture as the requested party, Figure 2 The methods shown correspond to each other, and the interaction between the two constitutes a complete monitoring process. This solution is suitable for scenarios where the fuse is disconnected due to insufficient server performance. It replaces overall degradation with layered degradation, reduces the server load while ensuring the normal operation of the main business, and maintains the high availability of the microservice architecture.
[0066] In one embodiment of the present disclosure, the above-mentioned assigning a downgrade identifier to one or more services in the server includes: sorting the services included in the server according to the service priority, and assigning a downgrade identifier to the service with the lowest priority and not currently attached with a downgrade identifier. The server assigns the downgrade identifier to the service according to the service priority, so that the low-priority service is downgraded first, and the service of the main process is not affected.
[0067] Reference below Figure 4A to Figure 4C , the monitoring method according to the embodiment of the present disclosure is described in detail in combination with specific embodiments.
[0068] Figure 4A The following schematically shows an architecture diagram of a monitoring method according to an embodiment of the present disclosure.
[0069] like Figure 4A As shown, in this example, clients A and B are the requesters, server S is the requested party, and Redis database is used as the shared storage space. This solution uses Hystrix (a fault-tolerant framework open sourced by Netflix) fuse to provide related functions of calling failure fallback rules (fallback) after disconnection, as well as the function of distributed locks in the Redis database. On this basis, refined hierarchical degradation is achieved in the distributed environment of the microservice architecture. Clients A and B can include Hystrix fuse modules and hierarchical degradation request modules, and server S can include server hierarchical degradation modules and server degradation configuration modules (not shown in the figure).
[0070] The Hystrix fuse module is used to send the business request sent by the client A and B to the server S when the fuse is in the connected state, and to modify the fuse state to disconnected when the error rate of the business request exceeds the predetermined threshold, and request to return the first preset response content according to the first failure fallback rule. After a period of time, a small part of the traffic is put in to monitor whether the server S is restored and available. If the server S is restored and available, the fuse state is modified to connected, otherwise it remains disconnected. The hierarchical downgrade request module is mainly used to initiate hierarchical downgrade requests, and ensure that hierarchical downgrade requests are not repeatedly initiated within a certain period of time by using the distributed lock in the Redis database. The server hierarchical downgrade module is mainly used to monitor the hierarchical downgrade requests sent by the clients A and B and hierarchically downgrade the server S according to the local downgrade configuration. The server downgrade configuration module is used to divide the service and process of the server, divide the main process and non-main process business into levels, and configure the priority. When starting the server, the local downgrade configuration is initialized. When the server responds to the service request, the server determines whether to enter the corresponding business module based on the downgrade mark in the configuration.
[0071] Figure 4B The flowchart of a client initiating a hierarchical downgrade request according to an embodiment of the present disclosure is schematically shown.
[0072] Since the logic of client A and client B initiating hierarchical downgrade requests is the same, client A is used as an example for explanation. Figure 4B As shown, client A sends a service request to server S. When the error rate of service requests within the first predetermined time is counted to exceed the predetermined threshold, the state of the fuse in client A is modified to disconnected, and the first failure fallback rule is entered. Based on the first failure fallback rule, the first preset response content is returned to client A on the one hand, and the hierarchical downgrade request module is triggered on the other hand. The downgrade request module attempts to obtain the distributed lock (Redis distributed hierarchical downgrade lock) in the Redis database through asynchronous calls and sets a timeout. If the distributed lock is successfully obtained, a hierarchical downgrade request is initiated to server S. If the distributed lock fails to be obtained, the hierarchical downgrade request is not sent. After the distributed lock expires and is released, if the state of the fuse is still disconnected, the downgrade request module is triggered again to initiate a hierarchical downgrade request according to the above process.
[0073] Figure 4C The flowchart schematically shows the hierarchical downgrade operation performed by the server according to the embodiment of the present disclosure.
[0074] like Figure 4CAs shown, after receiving the hierarchical downgrade request, the server S obtains the local downgrade configuration, in which the current downgrade level is recorded: the server S contains services a, b and c, service a corresponds to priority 1, and is not currently downgraded, service b corresponds to priority 2, and is not currently downgraded, and service c corresponds to priority 3, and is currently downgraded. Priorities 1 to 3 represent priorities from high to low. At this time, firstly, based on the local downgrade configuration, it is determined whether all services in the server S have been downgraded. If so, the second failure fallback rule can be entered, and the second preset response content is returned to the client based on the second failure fallback rule. If not, a downgrade identifier can be assigned to the currently undowngraded service. The allocation principle is: assign a downgrade identifier to the currently undowngraded service with the lowest priority. In this example, the service with the lowest priority that has not been reduced in the server S is service b, so a downgrade identifier is assigned to service b and the local downgrade configuration is updated.
[0075] When the client's fuse is reconnected, the server S will no longer follow the services and processes marked as downgraded after receiving the service request. In this example, the business data of service a is provided by the secondary server S1 of server S, the business data of service b is provided by the secondary server S2 of server S, and the business data of service c is provided by the secondary server S3 of server S. After receiving the service request, server S will no longer access servers S2 and S3, but only access server S1 to obtain the business data of service a and return it to the client. Among them, when server S is restarted, all downgrade flags are cleared and the downgrade flags are assigned to the services again according to priority based on the hierarchical downgrade request sent by the client.
[0076] When a failure occurs on the server side, this solution will perform hierarchical downgrade on the services on the server side, shutting down some non-main process functions on the server side. The performance of the server side will be improved to a certain extent, so that it can support more concurrent business requests without frequent fuses, improving the overall stability and availability of the microservice architecture. In addition, during the hierarchical downgrade process, the functions or processes on the server side are gradually shut down hierarchically according to priority, so that the main process functions of the service segment are retained to the maximum extent, thereby ensuring the availability of business functions.
[0077] Figure 5 A block diagram of a monitoring device according to an embodiment of the present disclosure is schematically shown. The monitoring device 500 is configured in any client or any server of the microservice architecture.
[0078] like Figure 5 As shown, the monitoring device 500 includes: a statistics module 510 , a disconnection module 520 , a downgrade request module 530 , a connection module 540 , and a receiving module 550 .
[0079] The statistical module 510 is used to collect, through the fuse statistics, the error rate of sending service requests to the server within the first predetermined time before.
[0080] The disconnection module 520 is used to modify the state of the fuse to disconnected when the error rate exceeds a predetermined threshold.
[0081] The downgrade request module 530 is used to send a hierarchical downgrade request to the server, so that the server allocates a downgrade identifier to one or more services in the server in response to the hierarchical downgrade request.
[0082] The connection module 540 is used to modify the state of the fuse to connected, and send a service request to the server through the fuse, so that the server accesses the secondary server corresponding to the service without a downgrade mark and returns response data.
[0083] And, the receiving module 550 is used to receive the response data.
[0084] Figure 6 A block diagram of a monitoring device according to another embodiment of the present disclosure is schematically shown. The monitoring device 600 is configured in any client or any server of the microservice architecture.
[0085] like Figure 6 As shown, the monitoring device 600 includes: a statistics module 610, a disconnection module 620, a downgrade request module 630, a connection module 640, and a receiving module 650. The statistics module 610, the disconnection module 620, the downgrade request module 630, the connection module 640, and the receiving module 650 respectively have the same functions as the statistics module 510, the disconnection module 520, the downgrade request module 530, the connection module 540, and the receiving module 550, and the repeated parts are not repeated.
[0086] In one embodiment of the present disclosure, the monitoring device 600 further includes a first fallback module 660, which is used to obtain preset response content according to a first failure fallback rule when the disconnection module 620 modifies the state of the fuse to disconnected.
[0087] In one embodiment of the present disclosure, the monitoring device 600 also includes a locking module 670, which is used to obtain a distributed lock from a shared storage space before the downgrade request module 630 sends a hierarchical downgrade request to the server. Within a second predetermined time after a client or server obtains the distributed lock from the shared storage space, other clients or servers cannot obtain the distributed lock from the shared storage space.
[0088] In one embodiment of the present disclosure, the monitoring device 600 further includes a second fallback module 680, which is used to obtain preset response content according to a second failure fallback rule when all services of the server are accompanied by a degradation mark.
[0089] In one embodiment of the present disclosure, the monitoring device 600 also includes a probe module 690, which is used to send a probe request to the server before the connectivity module 640 changes the state of the fuse to connected, and when a confirmation response to the probe request is received from the server, the connectivity module 640 is notified to change the state of the fuse to connected.
[0090] Figure 7 A block diagram of a monitoring device according to another embodiment of the present disclosure is schematically shown. The monitoring device 700 is configured in any service end of the microservice architecture.
[0091] like Figure 7 As shown, the monitoring device 700 includes: a degradation processing module 710, an access module 720, and a return module 730.
[0092] The downgrade processing module 710 is used to allocate downgrade identifiers to one or more services in the server in response to the hierarchical downgrade request sent by the client.
[0093] The access module 720 is used to access the secondary server corresponding to the service without a downgrade mark to obtain corresponding service data in response to the service request sent by the client.
[0094] And, the returning module 730 is used to return the business data to the client.
[0095] Figure 8 A block diagram of a monitoring device according to another embodiment of the present disclosure is schematically shown. The monitoring device 800 is configured in any service end of the microservice architecture.
[0096] like Figure 8 As shown, the monitoring device 800 includes: a degradation processing module 810, an access module 820, and a return module 830. The degradation processing module 810, the access module 820, and the return module 830 have the same functions as the degradation processing module 710, the access module 720, and the return module 730, respectively, and the repeated parts are not repeated here.
[0097] In one embodiment of the present disclosure, the degradation processing module 810 includes a sorting submodule 811 and a marking submodule 812 .
[0098] The sorting submodule 811 is used to sort the services included in the server according to the service priority. And the marking submodule 812 is used to assign a downgrade mark to the service with the lowest priority and currently not attached with a downgrade mark.
[0099] It should be noted that the implementation methods, technical problems solved, functions realized, and technical effects achieved of each module / unit / sub-unit in the device part embodiment are the same or similar to the implementation methods, technical problems solved, functions realized, and technical effects achieved of each corresponding step in the method part embodiment, and will not be repeated here.
[0100] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0101] For example, any multiple of the statistics module 610, the disconnection module 620, the downgrade request module 630, the connection module 640, the receiving module 650, the first fallback module 660, the locking module 670, the second fallback module 680, and the probing module 690 may be implemented in one module, or any one of the modules may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the statistics module 610, the disconnection module 620, the downgrade request module 630, the connectivity module 640, the receiving module 650, the first fallback module 660, the locking module 670, the second fallback module 680, and the probe module 690 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the statistics module 610, the disconnection module 620, the downgrade request module 630, the connectivity module 640, the receiving module 650, the first fallback module 660, the locking module 670, the second fallback module 680, and the probe module 690 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0102] For another example, any multiple of the downgrade processing module 810, the access module 820, and the return module 830 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the downgrade processing module 810, the access module 820, and the return module 830 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in an appropriate combination of any of them. Alternatively, at least one of the downgrade processing module 810, the access module 820, and the return module 830 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0103] Fig. 9 The block diagram schematically shows a computer device suitable for implementing the method described above according to an embodiment of the present disclosure. Fig. 9 The computer device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0104] like Fig. 9 As shown, the computer device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0105] In RAM 903, various programs and data required for the operation of device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other through bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0106] According to an embodiment of the present disclosure, the device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The device 900 may further include one or more of the following components connected to the I / O interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.
[0107] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0108] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0109] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus, or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 902 and / or RAM 903 described above and / or one or more memories other than ROM 902 and RAM 903.
[0110] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0112] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A monitoring method, comprising: The error rate of sending service requests to the server within the first predetermined time is counted by the fuse; When the error rate exceeds a predetermined threshold, the state of the fuse is changed to disconnected, and when the state of the fuse is disconnected, no service request is sent to the server; Sending a hierarchical downgrade request to the server, so that the server allocates downgrade identifiers to one or more services in the server in response to the hierarchical downgrade request, wherein the server includes one or more services, different services depend on different secondary servers of the server, and the hierarchical downgrade request is used to notify the server to allocate downgrade identifiers hierarchically to one or more services according to service priorities; Modify the state of the fuse to connected, send a service request to the server through the fuse, so that the server accesses the secondary server corresponding to the service without a downgrade mark and returns response data; as well as receiving the response data; The method further comprises: When all services of the server are accompanied by degradation marks, the second preset response content is obtained according to the second failure fallback rule.
2. The method according to claim 1, further comprising: When the state of the fuse is modified to be disconnected, the first preset response content is obtained according to the first failure fallback rule.
3. The method according to claim 1, further comprising, before sending the hierarchical downgrade request to the server: Obtaining a distributed lock from a shared storage space, within a second predetermined time after a client or a server obtains the distributed lock from the shared storage space, other clients or servers cannot obtain the distributed lock from the shared storage space.
4. The method according to claim 1, further comprising, before modifying the state of the fuse to be connected: A probe request is sent to the server, and when a confirmation response to the probe request is received from the server, the state of the fuse is changed to connected.
5. A monitoring method, comprising: In response to the hierarchical downgrade request sent by the client, assign downgrade identifiers to one or more services in the server; In response to the service request sent by the client, access the secondary server corresponding to the service not accompanied by the downgrade mark to obtain corresponding service data; as well as Returning the service data to the client; The allocating degradation identifiers to one or more services in the server includes: sorting the services included in the server according to the service priority; and A downgrade indicator is assigned to the service with the lowest priority and which does not currently have an associated downgrade indicator.
6. A monitoring device, comprising: A statistics module, used to count the error rate of business requests sent to the server within a first predetermined time before the fuse is counted; A disconnection module, used for modifying the state of the fuse to be disconnected when the error rate exceeds a predetermined threshold value, and when the state of the fuse is disconnected, no service request is sent to the server, the server includes one or more services, different services depend on different secondary servers of the server, and the hierarchical downgrade request is used to notify the server to allocate downgrade identifiers hierarchically to one or more services according to service priorities; A downgrade request module, configured to send a hierarchical downgrade request to the server, so that the server allocates downgrade identifiers to one or more services in the server in response to the hierarchical downgrade request; A connection module, used to change the state of the fuse to connected, send a service request to the server through the fuse, so that the server accesses the secondary server corresponding to the service without a downgrade mark and returns response data; as well as A receiving module, used for receiving the response data; The device also includes: A failure fallback module is used to obtain a second preset response content according to a second failure fallback rule when all services of the server are accompanied by a degradation mark.
7. A monitoring device, comprising: A downgrade processing module, configured to allocate downgrade identifiers to one or more services in the server in response to a hierarchical downgrade request sent by a client; An access module, configured to access a secondary server corresponding to a service not accompanied by a downgrade mark to obtain corresponding service data in response to a service request sent by the client; as well as A return module, used for returning the service data to the client; Wherein, the degradation processing module includes: A sorting submodule is used to sort the services included in this server according to the service priority; and The downgrade mark allocation submodule is used to allocate a downgrade mark to the service with the lowest priority and which is not currently attached with a downgrade mark.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program: The monitoring method according to any one of claims 1 to 5.
9. A computer-readable storage medium having executable instructions stored thereon, which instructions, when executed by a processor, cause the processor to perform: The monitoring method according to any one of claims 1 to 5.
