Method and system for probing components based on gRPC communication
By using a probe port system based on gRPC communication, the system can detect component status in real time and restore unavailable components, solving the problem of time-consuming and laborious component status judgment in existing technologies, and achieving rapid response and high availability.
Patent Information
- Application Number
- CN202211187068.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-09-28
AI Technical Summary
In existing technologies, determining whether a component is running normally requires a lot of manual logging, which is time-consuming and labor-intensive, and cannot detect component service failures in a timely manner, which can easily lead to project errors or data loss.
A port probing system based on gRPC communication is adopted, including client and server modules. It determines the availability of components by sending ping requests in real time, restores unavailable components in real time, records the component status, and notifies the operation and maintenance personnel.
It enables real-time detection of component status, reduces maintenance time for operations and maintenance personnel, avoids data loss, improves system availability and scalability, and reduces data congestion caused by client access.
Smart Images

Figure CN115643195B_ABST
Abstract
Description
Technical Field
[0001] This invention discloses a method and system that relate to the field of communication information management technology, specifically a method and system based on gRPC communication to detect the component to which the port belongs. Background Technology
[0002] Nowadays, more and more large-scale projects require various specific types of products to support their business operations. For example, there are time-series databases for time-series data, in-memory databases for fast data storage and retrieval, and message queues for temporary data storage. These components may be used as external dependencies during project operation, so sometimes it is impossible to determine whether a component is still running normally. Therefore, failure to detect non-operating components can easily cause program errors in the project, or even major losses such as data loss.
[0003] In existing methods, determining whether a component is still running normally requires operations personnel to check the component's own logs, operating system logs, and logs of projects that use the component. This not only requires a lot of transmission time, but also requires operations personnel to check a large number of logs because it is unknown when the component will stop providing service, which is very time-consuming and labor-intensive. Summary of the Invention
[0004] This invention addresses the problems of existing technologies by providing a method and system for detecting the component to which a port belongs based on gRPC communication. It provides a method for real-time detection and recovery to address the problem of not being able to detect component service interruptions in a timely manner during project operation and maintenance. It can also provide feedback on abnormal information of each component and notify operation and maintenance personnel to handle the issue.
[0005] The specific solution proposed in this invention is as follows:
[0006] This invention provides a system for detecting the component to which a port belongs based on gRPC communication. The system includes a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module.
[0007] The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components.
[0008] The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module.
[0009] The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module.
[0010] Furthermore, the steps performed by the server-side gRPC receiving module in the system based on the gRPC communication probe port are as follows:
[0011] Receive requests from client gRPC sending modules in various locations.
[0012] Decode the request to obtain client information and the name of the component you want to probe.
[0013] Accessing content in the server-side storage module based on component name
[0014] The accessed content is packaged, encoded, and returned to the client from the corresponding request source.
[0015] Furthermore, the steps performed by the client gRPC sending module in the system based on the component to which the gRPC communication probe port belongs are as follows:
[0016] The name of the component to be detected is encoded and sent to the server-side gRPC receiving module.
[0017] The return information from the server-side gRPC receiving module is decoded. If the decoded information indicates that the component is available, the original logic is executed normally. If the decoded information indicates that the component is unavailable, the original logic is stopped, and requests are continuously sent to the server-side gRPC module until a message indicating that the component is available is returned.
[0018] Furthermore, the steps performed by the server-side self-test module in the system based on gRPC communication to detect the component to which the port belongs are as follows:
[0019] Continuously send ping requests to the open ports of each component. If the ping request is successful, record the ping request return value of the corresponding component as running normally and as available in the server storage module.
[0020] If a ping request fails, the server-side storage module records that the corresponding component has stopped running and records the ping request return value indicating that the corresponding component is unavailable.
[0021] Back up and restart unavailable components. After restarting, ping the components again to determine if they are available.
[0022] If the component is unavailable, notify the operations and maintenance personnel to restore it; if it is available, import the backed-up data, modify the record in the server-side storage module, change the component to available, and record the ping request return value as available.
[0023] Furthermore, in the system based on gRPC communication to detect the component to which the port belongs, the server-side data storage module stores the mapping relationship between component name and port, the mapping relationship between port and availability, the time when each component becomes unavailable, and the time when each component becomes available again.
[0024] Furthermore, the system based on gRPC communication to detect the port also includes a server-side log information module, which outputs corresponding anomaly detection records and alarm events through preset parameters such as info, debug, error, and others.
[0025] This invention also provides a method for detecting the component to which a port belongs based on gRPC communication. The method utilizes a system for detecting the component to which a port belongs, comprising a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module.
[0026] The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components.
[0027] The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module.
[0028] The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module.
[0029] The present invention also provides a computer-readable medium storing computer instructions, which, when executed by a processor, cause the processor to perform the method for probing the component to which the gRPC communication port belongs.
[0030] The advantages of this invention are:
[0031] This invention provides a system for detecting the component to which a port belongs based on gRPC communication. Based on gRPC communication, the server-side gRPC receiving module can simultaneously receive a large number of requests from clients. The server-side self-checking module can always promptly detect when a component stops providing service and block the service of the relevant component in a timely manner. This makes it easier for operation and maintenance personnel to know the program's running status, reducing the maintenance time and cost for operation and maintenance personnel. At the same time, the availability of components is saved, so that clients can only obtain the availability of components based on the saved data, which can effectively avoid the problems of data congestion and excessively long response times caused by a large number of client accesses. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a schematic diagram of the system application framework of the present invention.
[0034] Figure 2 This is a schematic diagram illustrating the operation of the server-side data storage module in the system of this invention.
[0035] Figure 3 This is a flowchart illustrating the execution function of the server-side self-test module in the system of this invention. Detailed Implementation
[0036] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0037] This invention provides a system for detecting the component to which a port belongs based on gRPC communication. The system includes a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module.
[0038] The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components.
[0039] The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module.
[0040] The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module.
[0041] The system of this invention includes a server-side gRPC receiving module, primarily used to receive requests from various locations, process business logic, and return the results to the client; a client-side gRPC sending module, used by the client to access specified ports; a server-side data storage module, which records the availability of each component and specific events, such as error messages; and a server-side self-checking module, which periodically sends check requests to each component to determine if the component is still running, and if a component is not running, it can restore the component to a running state. It may also include a log information module, which, based on the abnormal log information of each module, determines whether the error is due to an error in the client's request or an error occurring in the component, and returns the error information to the user for alerting and handling.
[0042] In specific applications, in some embodiments of the system of the present invention, the system includes a client gRPC sending module, a server gRPC receiving module, a server data storage module, and a server self-test module, and may also include a log information module, see reference. Figure 1 ,
[0043] The client-side gRPC sending module sends a request, containing the client's name and the name of the component it wants to probe. Based on the returned information, it determines whether the desired component is available. If available, it proceeds with the next task logic; otherwise, it stops. It can specify a frequency to continue sending requests to the server until the component's state recovers and a "component available" message is returned. The main steps executed by the client-side gRPC sending module are as follows:
[0044] The name of the component to be detected is encoded and sent to the server-side gRPC receiving module.
[0045] The return information from the server-side gRPC receiving module is decoded. If the decoded information indicates that the component is available, the original logic is executed normally. If the decoded information indicates that the component is unavailable, the original logic is stopped, and requests are continuously sent to the server-side gRPC module until a message indicating that the component is available is returned.
[0046] The server-side gRPC receiving module can request a gRPC server during the main program's execution to receive requests from various clients. The request content mainly includes the client's name and the name of the component the client wants to probe. The server retrieves the component's open port from the server-side data storage module based on the component name, and then obtains the ping request return value to determine if this port is available, serving as evidence of whether the component is running normally. The main steps performed by the server-side gRPC receiving module are as follows:
[0047] Receive requests from client gRPC sending modules in various locations.
[0048] Decode the request to obtain client information and the name of the component you want to probe.
[0049] Accessing content in the server-side storage module based on component name
[0050] The accessed content is packaged, encoded, and returned to the client from the corresponding request source.
[0051] The main execution steps of the server-side self-check module can be found in the following reference. Figure 3 You can specify the frequency to send ping requests to each component. If the ping request returns a value indicating that the component is available, then the corresponding port value of the component recorded in the server-side data storage module will be set to available.
[0052] If the ping request returns a value indicating that the component is unavailable, the corresponding port value recorded in the server-side data storage module is set to unavailable, and the component name and timestamp are recorded in the server-side data storage module. Then, the data storage directory of the unavailable component is backed up, the component is restarted, and the backed-up data is re-imported into the component. After the import is complete, a ping request is made to the component again. If this ping request returns an available value, the corresponding port value of the component in the server-side data storage module is set to available, and the timestamp is recorded in the server-side data storage module. If the component still returns unavailable, the operations and maintenance personnel are notified by SMS or email to repair it in a timely manner.
[0053] The system of this invention may also include a log information module. Based on preset parameters such as info, debug, error, and others in the log information module, corresponding anomaly detection records are output. If there is an error message, maintenance personnel need to check why the data is incorrect and how to resolve it. For info and debug messages, maintenance personnel can easily check the correctness of the logic before and after the error message.
[0054] In this invention, because the server-side self-check module is always running, the program can promptly detect when a component stops providing service and immediately block the service of that component. The server-side self-check module can restore component functionality without data loss, avoiding catastrophic scenarios caused by data loss.
[0055] The logging module effectively helps operations and maintenance personnel view system status and the causes of errors by outputting logs for each part of the logic. This eliminates the need for operations and maintenance personnel to monitor the program for extended periods; log alerts are generated for errors, reducing maintenance time and costs.
[0056] This invention's system stores component availability information, allowing clients to determine component availability solely based on this stored data. This effectively avoids data congestion and excessively long response times caused by a large number of client requests. The server-side gRPC receiving module can simultaneously receive a large number of requests from clients, providing the program with significant scalability and concurrency.
[0057] This invention also provides a method for detecting the component to which a port belongs based on gRPC communication. The method utilizes a system for detecting the component to which a port belongs, comprising a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module.
[0058] The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components.
[0059] The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module.
[0060] The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module.
[0061] The information interaction and execution process involved in the above method are based on the same concept as the system embodiments of the present invention, and the specific details can be found in the descriptions in the system embodiments of the present invention, and will not be repeated here.
[0062] Similarly, the method of this invention is based on gRPC communication. The server-side gRPC receiving module can simultaneously receive a large number of requests from clients, and the server-side self-checking module can always know when a component stops service and block the service of the relevant component in a timely manner. This makes it easier for operation and maintenance personnel to know the program running status, reduces the maintenance time cost for operation and maintenance personnel, and saves the availability of components. This allows clients to obtain the availability of components only based on the saved data, which can effectively avoid the problems of data congestion and excessively long response time caused by a large number of client accesses.
[0063] It should be noted that not all steps and modules in the above processes and system structure diagrams are mandatory; some steps or modules can be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.
[0064] The present invention also provides a computer-readable medium storing computer instructions, which, when executed by a processor, cause the processor to perform the method for probing the component to which the gRPC communication port belongs.
[0065] Specifically, a system or apparatus equipped with a storage medium may be provided, on which software program code implementing the functions of any of the embodiments described above is stored, and the computer (or CPU or MPU) of the system or apparatus may read and execute the program code stored in the storage medium.
[0066] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.
[0067] Examples of storage media used to provide program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0068] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0069] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0070] The above-described embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.
Claims
1. A system based on gRPC communication to detect the component to which a port belongs, characterized by: The system includes a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module. The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components. The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module. The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module. The steps performed by the server-side self-test module are as follows: Continuously send ping requests to the open ports of each component. If the ping request is successful, record the ping request return value of the corresponding component as running normally and as available in the server storage module. If a ping request fails, the server-side storage module records that the corresponding component has stopped running and records the ping request return value indicating that the corresponding component is unavailable. Back up and restart unavailable components. After restarting, ping the components again to determine if they are available. If it is unavailable, notify the operations and maintenance personnel to restore the component. If available, import the backed-up data, modify the record in the server-side storage module, change the component to available, and record the ping request return value as available.
2. The system based on gRPC communication to detect the component to which the port belongs, as described in claim 1, is characterized in that: The steps performed by the server-side gRPC receiving module are as follows: Receive requests from client gRPC sending modules in various locations. Decode the request to obtain client information and the name of the component you want to probe. Accessing content in the server-side storage module based on component name The accessed content is packaged, encoded, and returned to the client from the corresponding request source.
3. The system based on gRPC communication to detect the component to which the port belongs, as described in claim 1, is characterized in that: The steps performed by the client gRPC sending module are as follows: The name of the component to be detected is encoded and sent to the server-side gRPC receiving module. The return information from the server-side gRPC receiving module is decoded. If the decoded information indicates that the component is available, the original logic is executed normally. If the decoded information indicates that the component is unavailable, the original logic is stopped, and requests are continuously sent to the server-side gRPC module until a message indicating that the component is available is returned.
4. The system based on gRPC communication to detect the component to which the port belongs, as described in claim 1, is characterized in that: The server-side data storage module stores the mapping relationship between component names and ports, the mapping relationship between ports and availability, the time when each component becomes unavailable, and the time when each component becomes available again.
5. The system based on gRPC communication to detect the component to which the port belongs, as described in claim 1, is characterized in that... It also includes a server-side log information module, which outputs corresponding anomaly detection records and alarm events based on the preset parameters such as info, debug, error, and others.
6. A method for detecting the component to which a port belongs based on gRPC communication, characterized by: A system for detecting the component to which a port belongs, based on gRPC communication, is used. This system includes a client-side gRPC sending module, a server-side gRPC receiving module, a server-side data storage module, and a server-side self-test module. The client-side gRPC sending module sends requests, and the returned information is used to determine the availability of the probed components. The server-side gRPC receiving module receives the request, obtains client information and the name of the component to be probed based on the request, retrieves the open port of the corresponding component and the ping request return value of the open port from the server-side data storage module based on the component name, determines whether the component is available based on the ping request return value, and organizes the return information to send to the client-side gRPC sending module. The server-side self-test module continuously sends ping requests to the open ports of each component in real time, obtains the ping request return values, and writes the component, the corresponding open port of the component, and the corresponding ping request return values into the server-side data storage module. The steps performed by the server-side self-test module are as follows: Continuously send ping requests to the open ports of each component. If the ping request is successful, record the ping request return value of the corresponding component as running normally and as available in the server storage module. If a ping request fails, the server-side storage module records that the corresponding component has stopped running and records the ping request return value indicating that the corresponding component is unavailable. Back up and restart unavailable components. After restarting, ping the components again to determine if they are available. If it is unavailable, notify the operations and maintenance personnel to restore the component. If available, import the backed-up data, modify the record in the server-side storage module, change the component to available, and record the ping request return value as available.
7. A computer-readable medium, characterized in that... The computer-readable medium stores computer instructions that, when executed by a processor, cause the processor to perform the method of claim 6 for probing the component to which the gRPC communication port belongs.
Citation Information
Patent Citations
Distributed task allocation method, device and system
CN111522649A
System, method and device for checking health state of cloud host and storage medium
CN111865914A