CN114363221B - Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system - Google Patents

Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system Download PDF

Info

Publication number
CN114363221B
CN114363221B CN202111681591.XA CN202111681591A CN114363221B CN 114363221 B CN114363221 B CN 114363221B CN 202111681591 A CN202111681591 A CN 202111681591A CN 114363221 B CN114363221 B CN 114363221B
Authority
CN
China
Prior art keywords
url
micro
file
record
recording
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111681591.XA
Other languages
Chinese (zh)
Other versions
CN114363221A (en
Inventor
刘言军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Fiberhome Information Integration Technologies Co ltd
Original Assignee
Wuhan Fiberhome Information Integration Technologies 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 Wuhan Fiberhome Information Integration Technologies Co ltd filed Critical Wuhan Fiberhome Information Integration Technologies Co ltd
Priority to CN202111681591.XA priority Critical patent/CN114363221B/en
Publication of CN114363221A publication Critical patent/CN114363221A/en
Application granted granted Critical
Publication of CN114363221B publication Critical patent/CN114363221B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a heartbeat detection method, a storage medium, electronic equipment and a system based on a micro-service system, and relates to the field of computer software, wherein the method comprises the steps of corresponding each functional module in the micro-service with at least one URL to obtain a query file, and recording all the functional modules to be detected to obtain the query file; reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs; recording according to the response condition of the URL: if the normal response of the URL is obtained, recording the time information of the URL at the current access and the connection is not disconnected; if the response of the URL is overtime, the reconnection times are increased by one, the URL response is retried to be acquired until the reconnection times exceed the preset times, and the time information and disconnection of the current access of the URL are recorded. The invention can elastically and timely feed back the running state of each service of the micro-service system, and reduce the resource consumption of front and rear end requests.

Description

Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system
Technical Field
The invention relates to the field of computer software, in particular to a heartbeat detection method, a storage medium, electronic equipment and a system based on a micro-service system.
Background
With the development of the current software industry, more and more software systems have formed micro-service system architecture. Under the new micro-service system architecture, the software development forms an independent running individual among the services of the background and provides a service module with a certain function. The micro-service can realize functions more flexibly, consumes fewer resources and has higher efficiency.
However, the existing micro services are replicated and deployed in a split process, and the traditional single-point service abnormality can cause abnormality of the function interfaces of the part, so that the software functions are not available. After the single service node of the micro service system is abnormal, the service can be continuously used normally as long as other copied service nodes are normally operated. This results in that the heartbeat detection at the client and server side can no longer be detected in the conventional way (conventional heartbeat detection usually only determines whether a service is available by testing whether the link of one bus is normal or not).
In addition, the conventional heartbeat detection mechanism always requests background service through a timed polling thread, so that the mechanism for repeating the timed polling does not stop regardless of whether the network request is normal, and rated network request waste is caused.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a heartbeat detection method, a storage medium, electronic equipment and a system based on a micro-service system, which can provide various strategies for each specific functional module of the micro-service system through a configuration method so as to perform heartbeat detection on each specific service module of the micro-service system and timely feed back the running state of each service of the micro-service system; and an elastic detection strategy is introduced to reduce the number of times of request calling and reduce the consumption of front-end and back-end request resources.
To achieve the above object, in a first aspect, an embodiment of the present invention provides a heartbeat detection method based on a micro service system:
each functional module in the micro-service is corresponding to at least one URL to obtain a query file, and all functional modules to be detected are recorded to obtain a polling file;
Reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
Recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
On the basis of the technical scheme, the searching and accessing the corresponding URL in the query file comprises the following steps:
searching the URL in the query file and reading a record corresponding to the URL;
if the URL in the record is disconnected, acquiring the next URL or inquiring and accessing the URL corresponding to the next functional module;
if the record is empty or the URL in the record is not disconnected, the URL is accessed.
On the basis of the above technical solution, recording the time information and disconnection of the current access of the URL until the reconnection times exceeds a preset number of times includes:
When the reconnection times caused by URL response timeout exceeds the preset times, recording the current URL, the function module, disconnection, reconnection times and access time;
And notifying all application parties that the URL corresponding to the functional module is disconnected.
On the basis of the technical scheme, the query file is HMAP, the polling file is DMAP, and the file for recording the response condition of the URL is RECORD.
On the basis of the technical proposal, the response situation is tested according to the URL in HMAP and recorded in RECORD in each heartbeat period according to the sequence in DMAP.
On the basis of the technical scheme, the searching the function module in the query file and accessing the corresponding URL comprises the following steps:
inquiring the URL of the inquiry file according to the functional module;
Judging whether the URL is matched with RECORD, if so, directly reading the RECORD, judging whether the module is available, otherwise, recording according to the response condition of the URL
On the basis of the technical scheme, if the response of the obtained URL is overtime, switching to other URLs corresponding to the functional module until the response of all the URLs is overtime or at least one URL responds normally.
In a second aspect, an embodiment of the present invention provides a heartbeat detection system based on a micro-service system, including:
the creation module is used for corresponding each functional module in the micro service with at least one URL to obtain a query file, and recording all the functional modules to be detected to obtain the query file;
The round-robin module is used for reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
the recording module is used for recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
In a third aspect, embodiments of the present invention further provide a storage medium having stored thereon a computer program which, when executed by a processor, implements the method in the embodiments of the first aspect.
In a fourth aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, where the memory stores a computer program running on the processor, and the processor implements the method in the embodiment of the first aspect when executing the computer program.
Compared with the prior art, the invention has the advantages that:
the heartbeat detection method based on the micro service system records the function modules in each micro service one by one, ensures that any function can be detected, and secondly, can carry out heartbeat detection and recording on each URL, realizes flexible heartbeat detection on the micro service system, monitors the running states of a plurality of service modules respectively, feeds back abnormal conditions of the system timely, and simultaneously effectively reduces the heartbeat request times and effectively relieves the network resource consumption of heartbeat detection through the associated analysis processing with other requests of the system.
Drawings
For a clearer description of the technical solutions of the embodiments of the present invention, the following description will be given for a brief description of the drawings corresponding to the embodiments, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating steps of an embodiment of a heartbeat detection method based on a micro-server system;
FIG. 2 is a flowchart illustrating steps of main processing logic heartbeat detection in an embodiment of a heartbeat detection method based on a micro-server system according to the present invention;
Fig. 3 is a flowchart illustrating steps of detecting other foreground requests according to an embodiment of a heartbeat detection method based on a micro-server system.
Detailed Description
Embodiments of the present invention are described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a heartbeat detection method, a storage medium, an electronic device, and a system based on a micro service system, which flexibly detect functional modules of the micro service in the form of URLs, monitor the operation of each functional module, ensure abnormal instant feedback, reduce the resource consumption of heartbeat detection, and realize that few functional modules are abnormal in real time, so that the micro service can also operate normally.
In order to achieve the technical effects, the general idea of the application is as follows:
each functional module in the micro-service is corresponding to at least one URL to obtain a query file, and all functional modules to be detected are recorded to obtain a polling file;
Reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
Recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
In summary, if the conventional micro services operate independently and are detected according to the previous whole, the failure of one micro service to respond causes a whole judgment error. In the invention, each micro service is corresponding to the URL, and the heartbeat detection of the URL is used for realizing flexible detection. The invention further provides an elastic detection strategy for recording the detection result, and the detected functional modules are not continuously detected, so that the waste of resources is reduced.
In order to better understand the above technical solution, the following detailed description is provided in connection with specific embodiments.
The embodiment of the invention provides a heartbeat detection method based on a micro-service system, which comprises the following steps:
s1, each functional module in the micro service is corresponding to at least one URL to obtain a query file, and all functional modules to be detected are recorded to obtain a polling file;
each micro service is corresponding in the form of URL, and the functional module to be detected is recorded, so that all the micro services and the functional modules are single corresponding, and flexible detection and flexible recording can be realized.
Preferably, the query file is HMAP, the polling file is DMAP, and the file recording the response of the URL is RECORD.
Furthermore, the summary record is carried out in the form of a file, so that the management of the micro service and the functional module can be more effectively realized.
Preferably, the response is tested against the URL in HMAP and recorded in RECORD every heartbeat cycle, in order in DMAP.
Further, whether the URL is matched with the RECORD is judged, if so, the RECORD is directly read, whether the module is available is judged, and if not, the RECORD is carried out according to the response condition of the URL.
S2, reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
The real-time polling can cause a great deal of resource waste, and the embodiment of the invention can reduce the resource waste by polling the functional module through the heartbeat period and can track the current state of the functional module.
Furthermore, the function modules in the polling file are queried and accessed, so that the query sequence can be better determined, and the query file can give out effective URLs for access.
Specifically, the searching and accessing the corresponding URL in the query file includes:
searching the URL in the query file and reading a record corresponding to the URL;
if the URL in the record is disconnected, acquiring the next URL or inquiring and accessing the URL corresponding to the next functional module;
if the record is empty or the URL in the record is not disconnected, the URL is accessed.
S3, recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
Specifically, until the reconnection times exceeds a preset number, recording the time information and disconnection of the current access of the URL, including:
When the reconnection times caused by URL response timeout exceeds the preset times, recording the current URL, the function module, disconnection, reconnection times and access time;
And notifying all application parties that the URL corresponding to the functional module is disconnected.
Optionally, if the response of the obtained URL is overtime, switching to other URLs corresponding to the function module until the response of all URLs is overtime, or at least one URL responds normally.
Providing a plurality of strategies through a configuration method to perform heartbeat detection on each specific service module of the micro service system so as to timely feed back the running state of each service of the micro service system; and an elastic detection strategy is introduced to reduce the number of times of request calling and reduce the consumption of front-end and back-end request resources.
The configuration method may be to focus on heartbeat detection of the core function module, or detection one by one, or jump random detection, so long as the function module in the micro service can be detected.
As shown in fig. 2, taking main program heartbeat detection as an example, the present invention provides an embodiment of a heartbeat detection method based on a micro service system:
A1, setting a heartbeat detection URL access address corresponding to a service module, and storing a Map data structure (key value is a service name, value is a heartbeat detection URL address corresponding to the service module), wherein the service module is defined as HMap; a mapping rule dictionary of many to one between the URL addresses of the same kind and the service module is established, and Map data structure storage (key value is used as the name of the service module, value is used as List, and one or more regular expression character strings are stored in the List) is defined as Record;
a2, setting heartbeat detection related parameters (a heartbeat detection default time period T (unit: millisecond) and a heartbeat detection failure frequency N (unit: times)), initializing a Map of a heartbeat detection Record (wherein a key value is a service module name, value is a structural body Record, and the Record comprises fields including a service module name, whether disconnection occurs, the last heartbeat detection time and the failure reconnection frequency) and defining the Map as a polling file DMap;
a3, starting a detection thread, and preparing heartbeat polling;
A4, according to the query file HMap, all service module names are polled, and a detection Record corresponding to the service module name in the poll file DMap is obtained through the service module name;
A5, judging that Record exists in the polling file DMap, if the Record does not exist, directly jumping to the step A8, and if the Record exists, jumping to the step A6;
A6, judging whether the Record is disconnected, if yes, jumping to the step A4, continuing to poll the next time, and if no, jumping to the step A7;
A7, judging whether the current time and the last heartbeat detection time are less than the heartbeat detection period T, if not, jumping to the step A4, and if so, jumping to the step A8;
A8, acquiring a heartbeat detection URL address of the module in HMap through the name of the service module, and simulating access;
a9, judging whether the access returns normally, if so, jumping to the step A10, and if not, jumping to the step A11;
a10, setting DMap to Record information corresponding to the module (no disconnection, the last heartbeat detection time is the current time, and the failed reconnection times are 0);
A11, after adding 1 to the reconnection times in the Record, judging whether the heartbeat detection failure times N are exceeded, if so, jumping to the step A13, and if not, jumping to the step A12;
A12, setting DMap corresponding Record information (no disconnection, the last heartbeat detection time is the current time, and the number of failed reconnections is increased by 1) of the service module, and jumping to the step A15;
a13, setting Record information corresponding to the service module in DMap (the time of disconnection and last heartbeat detection is the current time, and the number of failed reconnections is increased by 1);
a14, triggering a heartbeat timeout event, and broadcasting and notifying all application program client access terminals;
And A15, judging whether to stop heartbeat detection, if not, jumping to the step A4, and if so, ending the flow.
As shown in fig. 3, in addition to the main process, other foreground may request an update record:
B1, calling a URL interface by a user through a system function;
b2, judging whether the URL interface returns normally, if so, jumping to the step B3, and if so, jumping to the step B6;
b3, judging whether the URL can be matched with the regular expression stored by Value in the Record, if so, jumping to B4, otherwise jumping to B6;
B4, obtaining a corresponding Key (service module name) according to the Value, and then finding a Record corresponding to the service module from DMap according to the service module name;
B5, setting the service of Record as normal or not, setting the last heartbeat detection time as the current time and setting the failed reconnection time as 0;
And B6, judging whether to end using the system, if not, jumping to the step B1, and if so, ending the flow.
Namely, whether the main process or other foreground is adopted, the embodiment of the invention can realize heartbeat detection on the micro-service system, can respectively monitor the running states of a plurality of service modules and timely feed back abnormal conditions of the system. And the system is used for carrying out association analysis and processing with other requests of the system so as to effectively reduce the frequency of heartbeat requests and effectively relieve the consumption of network resources for heartbeat detection.
Based on the same inventive concept, the present application provides an embodiment of a heartbeat detection device based on a micro-service system, and its specific implementation manner is as follows.
The creation module is used for corresponding each functional module in the micro service with at least one URL to obtain a query file, and recording all the functional modules to be detected to obtain the query file;
The round-robin module is used for reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
the recording module is used for recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
The various modifications and specific examples of the foregoing method embodiments are equally applicable to the system of the present embodiment, and those skilled in the art will be aware of the implementation of the system of the present embodiment through the foregoing detailed description of the method, so they will not be described in detail herein for brevity of description.
Based on the same inventive concept, the present application provides an embodiment of a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a micro-service system based heartbeat detection method as provided in any embodiment of the present application, the method comprising:
each functional module in the micro-service is corresponding to at least one URL to obtain a query file, and all functional modules to be detected are recorded to obtain a polling file;
Reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
Recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information of the current access of the URL and disconnection are recorded.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Based on the same inventive concept, the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program running on the processor, and the processor implements all or part of the method steps in the first embodiment when executing the computer program.
The Processor may be a central processing unit (Central Processing Unit, CPU), other general purpose Processor, digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is a control center of the computer device, connecting various parts of the overall computer device using various interfaces and lines.
The memory may be used to store the computer program and/or modules, and the processor may implement various functions of the computer device by running or executing the computer program and/or modules stored in the memory, and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card (SMART MEDIA CARD, SMC), secure Digital (SD) card, flash memory card (FLASH CARD), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
In general, the heartbeat detection method, the storage medium, the electronic device and the system based on the micro-service system provided by the embodiment of the invention can detect any function, and secondly, the invention can carry out heartbeat detection and recording on each URL, so that flexible heartbeat detection on the micro-service system is realized, the running states of a plurality of service modules are respectively monitored, the abnormal condition of the system is timely fed back, and meanwhile, the frequency of heartbeat requests is effectively reduced and the consumption of network resources for heartbeat detection is effectively relieved through the correlation analysis processing with other requests of the system.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (9)

1. A micro-service system-based heartbeat detection method, comprising:
Each functional module in the micro-service is corresponding to at least one URL to obtain a query file, all the functional modules to be detected are recorded to obtain the query file, wherein each micro-service is corresponding to the URL, and the functional modules to be detected are recorded, so that all the micro-service and the functional modules are single corresponding;
Reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
Recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information and disconnection of the current access of the URL are recorded;
Wherein,
The searching and accessing the corresponding URL in the query file comprises the following steps:
searching the URL in the query file and reading a record corresponding to the URL;
if the URL in the record is disconnected, acquiring the next URL or inquiring and accessing the URL corresponding to the next functional module;
if the record is empty or the URL in the record is not disconnected, the URL is accessed.
2. A micro-service system based heartbeat detection method as claimed in claim 1, wherein,
Recording the current access time information and disconnection of the URL until the reconnection times exceeds the preset times, wherein the method comprises the following steps:
When the reconnection times caused by URL response timeout exceeds the preset times, recording the current URL, the function module, disconnection, reconnection times and access time;
And notifying all application parties that the URL corresponding to the functional module is disconnected.
3. A micro-service system based heartbeat detection method as claimed in claim 1, wherein: the query file is HMAP, the polling file is DMAP, and the file for recording the response condition of the URL is RECORD.
4. A micro-service system based heartbeat detection method as claimed in claim 3, wherein: in order in the DMAP, the response is tested against the URL in HMAP and recorded in RECORD every heartbeat cycle.
5. A method for detecting heartbeat based on a micro-service system as claimed in claim 3, wherein said searching the function module in the query file and accessing the corresponding URL includes:
inquiring the URL of the inquiry file according to the functional module;
Judging whether the URL is matched with the RECORD, if so, directly reading the RECORD, judging whether the function module is available, otherwise, recording according to the response condition of the URL.
6. The heartbeat detection method based on a micro service system according to claim 1, wherein if the response of the obtained URL is overtime, switching to other URLs corresponding to the functional module until the responses of all URLs are overtime, or at least one URL responds normally.
7. Heartbeat detection device based on little service system, its characterized in that:
The creation module is used for corresponding each functional module in the micro-service with at least one URL to obtain a query file, recording all the functional modules to be detected to obtain a polling file, wherein each micro-service is corresponding in the form of the URL, and recording the functional modules to be detected, so that all the micro-services and the functional modules are single corresponding;
The round-robin module is used for reading the function modules in the polling file one by one according to the heartbeat period, searching the function modules in the polling file and accessing the corresponding URLs;
the recording module is used for recording according to the response condition of the URL:
-if a normal response of the URL is obtained, recording the time information of the URL at the current access and the unconnected URL;
-if the response of the URL is obtained overtime, the number of reconnections is increased by one, and the acquisition of URL responses is retried until the number of reconnections exceeds a preset number, and the time information and disconnection of the current access of the URL are recorded;
Wherein,
The searching and accessing the corresponding URL in the query file comprises the following steps:
searching the URL in the query file and reading a record corresponding to the URL;
if the URL in the record is disconnected, acquiring the next URL or inquiring and accessing the URL corresponding to the next functional module;
if the record is empty or the URL in the record is not disconnected, the URL is accessed.
8. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program that runs on the processor, characterized in that: the processor, when executing the computer program, implements the method of any one of claims 1 to 6.
9. A storage medium having a computer program stored thereon, characterized by: the computer program, when executed by a processor, implements the method of any of claims 1 to 6.
CN202111681591.XA 2021-12-29 2021-12-29 Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system Active CN114363221B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111681591.XA CN114363221B (en) 2021-12-29 2021-12-29 Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111681591.XA CN114363221B (en) 2021-12-29 2021-12-29 Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system

Publications (2)

Publication Number Publication Date
CN114363221A CN114363221A (en) 2022-04-15
CN114363221B true CN114363221B (en) 2024-05-03

Family

ID=81105828

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111681591.XA Active CN114363221B (en) 2021-12-29 2021-12-29 Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system

Country Status (1)

Country Link
CN (1) CN114363221B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108173911A (en) * 2017-12-18 2018-06-15 中国科学院声学研究所 A kind of micro services fault detect processing method and processing device
CN108400904A (en) * 2018-01-26 2018-08-14 北京奇艺世纪科技有限公司 A kind of health examination method and device based on micro services framework
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
CN111078688A (en) * 2019-11-18 2020-04-28 福建天泉教育科技有限公司 Method for micro-service health check and storage medium
CN111147308A (en) * 2019-12-30 2020-05-12 武汉市烽视威科技有限公司 Network management method and system based on micro-service architecture
CN111341445A (en) * 2020-02-05 2020-06-26 网宿科技股份有限公司 Health detection method and health detection system of micro-service call chain
CN112039723A (en) * 2020-08-18 2020-12-04 北京金和网络股份有限公司 Method and device for detecting state of micro-service network and electronic equipment
CN112218325A (en) * 2020-09-03 2021-01-12 苏宁云计算有限公司 Network testing method and device
CN112564980A (en) * 2020-12-17 2021-03-26 航天精一(广东)信息科技有限公司 Service monitoring method and system based on micro-service architecture
CN112994958A (en) * 2021-05-17 2021-06-18 新华三技术有限公司 Network management system, method and device and electronic equipment
CN113010378A (en) * 2021-03-04 2021-06-22 万翼科技有限公司 Log processing method and device of microservice module, storage medium and electronic device
CN113656473A (en) * 2021-07-30 2021-11-16 平安消费金融有限公司 Interface access method, device, equipment and medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9015847B1 (en) * 2014-05-06 2015-04-21 Synack, Inc. Computer system for distributed discovery of vulnerabilities in applications
CN107431630B (en) * 2015-01-30 2021-06-25 卡尔加里科学公司 Highly scalable, fault-tolerant remote access architecture and method of interfacing therewith

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108173911A (en) * 2017-12-18 2018-06-15 中国科学院声学研究所 A kind of micro services fault detect processing method and processing device
CN108400904A (en) * 2018-01-26 2018-08-14 北京奇艺世纪科技有限公司 A kind of health examination method and device based on micro services framework
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
CN111078688A (en) * 2019-11-18 2020-04-28 福建天泉教育科技有限公司 Method for micro-service health check and storage medium
CN111147308A (en) * 2019-12-30 2020-05-12 武汉市烽视威科技有限公司 Network management method and system based on micro-service architecture
CN111341445A (en) * 2020-02-05 2020-06-26 网宿科技股份有限公司 Health detection method and health detection system of micro-service call chain
CN112039723A (en) * 2020-08-18 2020-12-04 北京金和网络股份有限公司 Method and device for detecting state of micro-service network and electronic equipment
CN112218325A (en) * 2020-09-03 2021-01-12 苏宁云计算有限公司 Network testing method and device
CN112564980A (en) * 2020-12-17 2021-03-26 航天精一(广东)信息科技有限公司 Service monitoring method and system based on micro-service architecture
CN113010378A (en) * 2021-03-04 2021-06-22 万翼科技有限公司 Log processing method and device of microservice module, storage medium and electronic device
CN112994958A (en) * 2021-05-17 2021-06-18 新华三技术有限公司 Network management system, method and device and electronic equipment
CN113656473A (en) * 2021-07-30 2021-11-16 平安消费金融有限公司 Interface access method, device, equipment and medium

Also Published As

Publication number Publication date
CN114363221A (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN111752799A (en) Service link tracking method, device, equipment and storage medium
CN113840012B (en) Block chain-based screen recording evidence obtaining method and system and electronic equipment
WO2021151312A1 (en) Method for determining inter-service dependency, and related apparatus
CN112667426B (en) Log analysis method and device
US9852051B2 (en) Second failure data capture in co-operating multi-image systems
US9727394B2 (en) Establishing causality order of computer trace records
CN111897978A (en) Live broadcast state monitoring method and device, electronic equipment and storage medium
CN110457132B (en) Method and device for creating functional object and terminal equipment
CN108647102B (en) Service request processing method and device of heterogeneous system and electronic equipment
CN114363221B (en) Heartbeat detection method, storage medium, electronic equipment and system based on micro-service system
CN111376255B (en) Robot data acquisition method and device and terminal equipment
CN114500348B (en) CDN gateway testing method and system
CN113282347B (en) Plug-in operation method, device, equipment and storage medium
CN109033189B (en) Compression method and device of link structure log, server and readable storage medium
CN110716841A (en) Monitoring data collection method, device and equipment
CN113656106B (en) Plug-in loading method, device, electronic equipment and computer readable storage medium
CN114710685B (en) Video stream processing method and device, terminal equipment and storage medium
CN116955287A (en) Data processing method, device, equipment and storage medium
CN109446166B (en) Method for detecting file directory, computer readable storage medium and terminal device
CN115038089B (en) Multi-terminal data monitoring and collecting method based on information extraction
CN112035471B (en) Transaction processing method and computer equipment
CN115203063B (en) Playback method and system of production flow re-running risk program based on real-time recording
CN112261051B (en) User registration method, device and system
CN111209121B (en) Recording method of application program, terminal equipment and medium
CN116126674A (en) Interface testing method and device

Legal Events

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