Data communication method and device, electronic equipment, storage medium and program product
By creating and mapping read pipeline files and writing pipeline files in cloud platform nodes, the problem of low communication efficiency between cloud platform nodes and container hosts is solved, low latency and efficient communication is achieved, management is simplified and data transmission stability is enhanced.
Patent Information
- Application Number
- CN202510609898.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-07-18
AI Technical Summary
The communication mode between traditional cloud platform nodes and container hosts has problems such as large communication overhead, high latency and low efficiency, especially in serverless architectures and microservice mesh.
Create read pipeline files and write pipeline files in cloud platform nodes and map them to the resources of the container host separately, and achieve two-way communication through these pipeline files.
It reduces communication delay, improves communication efficiency, simplifies management complexity, reduces operation and maintenance costs, and realizes physical isolation of read and write operations through memory buffers, enhancing the stability and reliability of data transmission.
Smart Images

Figure CN120343075A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular, to a data communication method, apparatus, electronic device, storage medium, and program product. Background Art
[0002] Against the backdrop of the rapid development of cloud computing and cloud native technologies, containerized deployment has become the cornerstone of modern infrastructure, but the communication mechanism between nodes and containers still faces the need for continuous evolution. In traditional solutions, although Kubernetes provides standardized container access capabilities through mechanisms such as container execution commands, there are still significant limitations in actual operation and maintenance: network communication relies on complex container network interface plugins and load balancing strategies, which can introduce additional latency and configuration burdens; the interaction method based on shared storage volumes is difficult to eliminate disk input / output bottlenecks; and the command-line-based interaction method has problems such as difficult security auditing and low automation. At the same time, emerging serverless architectures and microservice meshes have put forward higher requirements for lightweight and real-time two-way communication, and traditional solutions are gradually showing deficiencies in terms of resource occupancy and response speed. Against this backdrop, providing a communication method with low latency and high communication efficiency has become a key technical challenge that urgently needs to be solved in the field of communications. Summary of the Invention
[0003] The present invention provides a data communication method, apparatus, electronic device, storage medium, and program product, aiming to solve the problems of large communication overhead, high communication latency, and low communication efficiency between cloud platform nodes and container hosts in traditional communication modes.
[0004] On the one hand, an embodiment of the present invention provides a data communication method, including:
[0005] Creating a read pipe file and a write pipe file according to the node resources of the cloud platform node;
[0006] Mapping the read pipe file and the write pipe file to the container resources of the container host respectively;
[0007] Transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
[0008] On the one hand, an embodiment of the present invention provides a data communication apparatus, including:
[0009] A creation module, configured to create a read pipe file and a write pipe file according to the node resources of the cloud platform node;
[0010] A mapping module, configured to map the read pipe file and the write pipe file to the container resources of the container host respectively;
[0011] A transmission module, configured to transmit communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
[0012] Another aspect of the embodiments of the present invention provides an electronic device, including:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor;
[0015] Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data communication method according to any one of the embodiments of the present invention.
[0016] Another aspect of the embodiments of the present invention provides a computer-readable storage medium, including: computer instructions, and the computer instructions are used to enable a processor to execute the data communication method according to any one of the embodiments of the present invention when executed.
[0017] Another aspect of the embodiments of the present invention provides a program product, including: a computer program, and the computer program can execute the data communication method according to any one of the embodiments of the present invention when executed by a processor.
[0018] In the embodiments of the present invention, a read pipe file and a write pipe file are created in the node resources of the cloud platform node, and the created read pipe file and write pipe file are mapped to the container resources of the container host, and the communication data between the cloud platform node and the container host is transmitted through the mapped read pipe file and write pipe file. In the embodiments of the present invention, two-way communication between the cloud platform node and the container host can be realized by mapping the read pipe file and the write pipe file created in the cloud platform node to the container host, avoiding the overhead of data replication in the traditional communication mode, reducing the communication delay between the cloud platform node and the container host, and thus improving the communication efficiency between the cloud platform node and the container host.
[0019] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Description of the Drawings
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0021] Figure 1 is a flowchart of a data communication method provided in Embodiment 1 of the present invention;
[0022] Figure 2 is a schematic diagram of communication between a cloud platform node and a container host provided in Embodiment 1 of the present invention;
[0023] Figure 3 is another flowchart of a data communication method provided in Embodiment 2 of the present invention;
[0024] Figure 4 is a block diagram of a data communication device provided in Embodiment 4 of the present invention;
[0025] Figure 5 is a block diagram of an electronic device for executing a data communication method provided in Embodiment 5 of the present invention. Detailed implementation manners
[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the following clearly and completely describes the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above accompanying drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily need to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0028] Embodiment 1
[0029] Figure 1The following is a flowchart of a data communication method provided by Embodiment 1 of the present invention. The embodiments of the present invention are applicable to scenarios with high requirements for real-time performance and communication efficiency. This method can be executed by a data communication device, which can be implemented in the form of hardware and / or software, and the data communication device can be configured in an electronic device. As Figure 1 shown, the method includes:
[0030] S110. Create a read pipe file and a write pipe file according to the node resources of the cloud platform node.
[0031] Among them, the node resources refer to various resources owned by the cloud platform node, which can be used to support the operation of the cloud platform node and communication with the container host. By way of example, the node resources may include at least three types of node resources such as a pipe file storage path, an index identifier, and a memory buffer. The pipe file storage path refers to the specific location where the read pipe file and the write pipe file are created in the node. The index identifier refers to an identifier used to uniquely identify the pipe file. The memory buffer refers to an area used to temporarily store communication data. In some embodiments, when the cloud platform node allocates node resources such as an index identifier and a memory buffer for the read pipe file and the write pipe file, the cloud platform node can record the mapping relationship automatically established between the index identifier and the memory buffer, and the communication between the cloud platform node and the container host can be realized through this mapping relationship.
[0032] The read pipe file can be understood as a logical channel for transmitting data. It can be understood that the read pipe file has read permission and exists in the form of a file. After the cloud platform node creates the read pipe file, the cloud platform node can be controlled to allocate a unique index identifier for the read pipe file, and the read pipe file can be accessed through the index identifier uniquely corresponding to the read pipe file.
[0033] The write pipe file can be understood as another logical channel for transmitting data. The write pipe file has write permission and exists in the form of a file. The execution operation after creating the write pipe file is the same as that after creating the read pipe file. After the cloud platform node creates the write pipe file, the cloud platform node can be controlled to allocate a unique index identifier for the write pipe file, and the write pipe file can be accessed through the index identifier uniquely corresponding to the write pipe file.
[0034] Specifically, to obtain various node resources in the cloud platform node, the pipe file storage path indicating the specific locations for creating the read pipe file and the write pipe file can be searched in the obtained node resources. According to the searched pipe file storage path, the read pipe file and the write pipe file are created in the cloud platform node. In addition, in some embodiments of the invention, after the read pipe file and the write pipe file are created in the cloud platform node, the cloud platform node can also be controlled to independently allocate unique corresponding index identifiers and memory buffers and other node resources for the read pipe file and the write pipe file.
[0035] S120. Map the read pipe file and the write pipe file to the container resources of the container host respectively.
[0036] Among them, the container host can be understood as a hardware platform for providing a running environment for container instances.
[0037] Container resources refer to various resources owned by the container host, which are used to support the operation and communication of the container host. By way of example, container resources at least include: a read path for reading communication data and a write path for writing communication data. The read path refers to the path for the container host to access the communication data in the cloud platform node, and the write path refers to the path for the container host to receive the communication data in the cloud platform node.
[0038] Specifically, each pipe file may have its corresponding pipe file storage path. By viewing the pipe file storage path in the node resources, the read pipe file and the write pipe file and their respective corresponding read pipe file paths and write pipe file paths can be obtained, and the node resources including the read path and the write path in the container host can be obtained. By mapping the read pipe file path of the read pipe file to the write path in the container resources of the container host, and mapping the write pipe file path of the write pipe file to the read path in the container resources of the container host, the read pipe file and the write pipe file are mapped to the container resources of the container host respectively.
[0039] In some embodiments, when the container host is created, the mapping of the read pipe file to the write path, and the write pipe file to the read path can be implemented through command line parameters such as "--volume(-v) <read pipe file path of the cloud platform node>:<write path of the container host>:<permission>" or "--mount type=bind,source= / cloud platform node / write pipe file path,target= / container host / read path,permission".
[0040] S130. Transmit the communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
[0041] Specifically, the communication between the cloud platform node and the container host can be realized through the completed mapped read pipe file and write pipe file. The communication data between the cloud platform node and the container host can be transmitted through the read pipe file and the write pipe file, which may include: by controlling the cloud platform node, storing the communication data in the memory buffer corresponding to the write pipe file through the write pipe file, and by controlling the container host to read the communication data in the memory buffer through the read path, the transmission of communication data from the cloud platform node to the container host can be realized; or by controlling the container host, storing the communication data in the memory buffer corresponding to the read pipe file through the write path, and by controlling the cloud platform node to read the communication data in the corresponding memory buffer through the read pipe file, the transmission of communication data from the container host to the cloud platform node can be realized.
[0042] It should be noted that the write pipe file in the cloud platform node and the read path in the container host are mapped to the same memory buffer, and the read pipe file in the cloud platform node and the write path in the container host are mapped to the same memory buffer.
[0043] Exemplarily, it can be further described by showing a schematic diagram of the communication between a cloud platform node and a container host as Figure 2 shown, the transmission process of communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file. Figure 2 It shows that the read pipe file and the write pipe file can be accessed by the pipe proxy processes in both the cloud platform node and the container host at the same time. The transmission of communication data between the cloud platform node and the container host can be realized by using the pipe proxy processes, which may include: reading the communication data in the read pipe file through the pipe proxy process in the cloud platform node, and reading the communication data in the write pipe file through the pipe proxy process in the container host, where the communication data in the write pipe file is the communication data written by the cloud platform node. In addition, the pipe proxy process in the cloud platform node can also be responsible for sending the communication data to other monitoring services of the cloud platform node; the pipe proxy process in the container host can also execute the container host operation and maintenance instructions related to the container host contained in the communication data transmitted by the cloud platform node.
[0044] It can be understood that, based on the embodiments of the present invention, the data communication method provided by the embodiments of the present invention can also be used to realize the transmission of communication data between container hosts, which can be specifically manifested as: creating a read pipe file and a write pipe file according to the container resources of the container host; mapping the read pipe file and the write pipe file to the other container resources of another container host respectively; and transmitting the communication data between the container host and another container host based on the read pipe file and the write pipe file.
[0045] In the embodiment of the present invention, a read pipe file and a write pipe file are created in the node resources of the cloud platform node, and the created read pipe file and write pipe file are mapped to the container resources of the container host. The communication data between the cloud platform node and the container host is transmitted through the mapped read pipe file and write pipe file. In the embodiment of the present invention, the bidirectional communication between the cloud platform node and the container host can be realized by mapping the read pipe file and the write pipe file created in the cloud platform node to the container host, avoiding the overhead of data replication in the traditional communication mode, reducing the communication delay between the cloud platform node and the container host, and further improving the communication efficiency between the cloud platform node and the container host.
[0046] Embodiment 2
[0047] Figure 3 FIG. is a flowchart of another data communication method provided by the second embodiment of the present invention. The embodiment of the present invention is a refinement of the above embodiment. Specifically, it details the specific steps of how to create a read pipe file and a write pipe file according to the node resources of the cloud platform node, how to map the read pipe file and the write pipe file to the container resources of the container host respectively, and how to specifically implement the transmission of communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
[0048] On the basis of the above embodiment, the embodiment of the present invention also adds a technical feature of how to control the life cycle of the container host.
[0049] As Figure 3 shown, another data communication method may include the following specific steps:
[0050] S210. Determine the file storage path of the node resources, and create a read pipe file and a write pipe file according to the file storage path.
[0051] Among them, the file storage path refers to the specific location where the read pipe file and the write pipe file are created in the cloud platform node, and can be used to uniquely identify the locations of the read pipe file and the write pipe file.
[0052] Specifically, various types of node resources included in the cloud platform node can be obtained. Among the obtained various types of node resources, the specific location for creating the read pipe file and the write pipe file is found, that is, the file storage path for creating the read pipe file and the write pipe file is found, and a read pipe file and a write pipe file are created in the cloud platform node according to the found file storage path.
[0053] For example, the file storage path can be obtained in the node resources of the cloud platform node as / var / my_app / node_resource / , and according to the file storage path, a read pipe file read_pipe and a write pipe file write_pipe can be created in the cloud platform node, which may include: generating the mkfifo / var / my_app / node_resource / read_pipe command according to the file storage path, and creating a read pipe file named read_pipe in the cloud platform node according to the generated command; similarly, generating the mkfifo / var / my_app / node_resource / write_pipe command according to the file storage path, and creating a write pipe file named write_pipe in the cloud platform node according to the created command. The above command line operations are only for illustrative purposes to facilitate understanding of the specific process of creating pipe files.
[0054] S220. Allocate a first index identifier and a first memory buffer for the read pipe file in the node resources, and allocate a second index identifier and a second memory buffer for the write pipe file.
[0055] Among them, the first index identifier can be understood as an identifier that can be used to uniquely identify the read pipe file. The first memory buffer can be understood as a data storage area that can be used to temporarily store the communication data transmitted from the container host to the cloud platform node. The second index identifier can be understood as another identifier that can be used to uniquely identify the write pipe file. The second memory buffer can be understood as another data storage area that can be used to temporarily store the communication data transmitted from the cloud platform node to the container host. When the cloud platform node allocates node resources such as index identifiers and memory buffers for the pipe files, the mapping relationship between the index identifier and the memory buffer can be automatically established and recorded. Through the mapping relationship between the index identifier and the memory buffer, the specific location of the first memory buffer in the cloud platform node can be found through the first index identifier of the read pipe file, and the specific location of the second memory buffer in the cloud platform node can also be found through the second index identifier of the write pipe file, so as to realize the transmission of communication data between the cloud platform node and the container host.
[0056] Specifically, after creating the read pipe file, the cloud platform node can be controlled to allocate a first index identifier that uniquely identifies the read pipe file, and a first memory buffer for temporarily storing the communication data transmitted from the container host to the cloud platform node; and allocate a second index identifier that uniquely identifies the write pipe file, and a second memory buffer for temporarily storing the communication data transmitted from the cloud platform node to the container host.
[0057] S230. Create a read path and a write path according to the container resources of the container host.
[0058] Among them, the read path refers to the path for the container host to access the communication data in the cloud platform node. The container host can only read the communication data in the cloud platform node based on the read path, and cannot modify the communication data of the read path.
[0059] The write path refers to the path for transmitting communication data from the cloud platform node to the container host. The cloud platform node can transmit communication data to the container host based on the write path and can modify the communication data of the write path.
[0060] Specifically, obtain container resources for supporting the operation and communication of the container host, such as CPU or memory space, etc. Create a read path and a write path in the obtained container resources. Through the read path, the container host can access the communication data in the cloud platform node, and through the write path, the cloud platform node can transmit communication data to the container host.
[0061] S240. Mount the read pipe file to the write path of the container host.
[0062] Specifically, the read pipe file has a corresponding read pipe file storage path. The read pipe file and its corresponding read pipe file path can be obtained by viewing the pipe file storage path in the node resources, and the write path in the container host can be obtained. By establishing a mapping between the read pipe file path of the read pipe file and the write path in the container resources, the read pipe file can be mapped to the write path of the container host.
[0063] S250. Mount the write pipe file to the read path of the container host.
[0064] Specifically, the write pipe file has a corresponding write pipe file storage path. The write pipe file and its corresponding write pipe file path can be obtained by viewing the pipe file storage path in the node resources, and the read path in the container host can be obtained. By establishing a mapping between the write pipe file path of the write pipe file and the read path in the container resources, the write pipe file can be mapped to the read path of the container host.
[0065] S260. Control the container host to write the first communication data in the container resources to the first memory buffer of the read pipe file according to the write path.
[0066] Among them, the first communication data refers to the communication data stored in the container host. For example, the first communication data can at least include container monitoring data. Writing the first communication data including at least container monitoring data to the first memory buffer can realize the transmission of the container monitoring data in the container host to the cloud platform node, thereby realizing the operation and maintenance management of the container host by the cloud platform node.
[0067] Specifically, obtain the first communication data containing container monitoring data and the write path within the container resource, obtain the read pipe file and the first memory buffer within the node resource, and write the first communication data in the container resource into the first memory buffer within the node resource according to the write path within the container resource. Writing the first communication data into the first memory buffer can be achieved through the read pipe file mounted between the cloud platform node and the container host.
[0068] S270. Control the cloud platform node to determine the first index identifier of the read pipe file within the node resource, and read the first communication data from the first memory buffer according to the first index identifier; wherein, the first communication data includes at least container monitoring data.
[0069] Among them, the container monitoring data can be understood as a set of data reflecting the status of the container host. For example, the container monitoring data may include data such as the resource usage of the container host or the running status of the container host. It can be understood that controlling the cloud platform node to read the container monitoring data can enable the cloud platform node to generate operation and maintenance operation instructions related to the container host according to the container monitoring data, and control the container host to perform relevant start / stop, configuration, or update operations according to the operation and maintenance operation instructions.
[0070] Specifically, obtain the first index identifier of the read pipe file within the node resource and the mapping relationship between the first index identifier and the first memory buffer recorded in the cloud platform node. Utilize this mapping relationship to locate the first memory buffer temporarily storing the first communication data according to the obtained first index identifier, and then control the cloud platform node to read the first communication data from the first memory buffer to achieve the transmission of the first communication data to the cloud platform node.
[0071] S280. Control the cloud platform node to write the second communication data within the node resource into the second memory buffer of the write pipe file according to the second index identifier of the write pipe file.
[0072] Among them, the second communication data refers to the communication data stored in the cloud platform node. For example, the second communication data may include at least operation and maintenance operation instructions. Writing the second communication data including at least operation and maintenance operation instructions into the second memory buffer can achieve the transmission of the operation and maintenance operation instructions in the cloud platform node to the container host, thereby realizing the operation and maintenance management of the container host by the cloud platform node.
[0073] Specifically, obtain the second communication data containing operation and maintenance operation instructions and the read path within the container resource, obtain the write pipe file and the second memory buffer within the node resource, and write the second communication data in the container resource into the second memory buffer within the node resource according to the read path within the container resource. Writing the second communication data into the second memory buffer can be achieved through the read pipe file mounted between the cloud platform node and the container host.
[0074] S290, control the container host to read the second communication data in the second memory buffer according to the read path; wherein, the second communication data at least includes operation and maintenance operation instructions.
[0075] Among them, the operation and maintenance operation instructions can be understood as a set of data guiding the container host to perform operation and maintenance operations. By way of example, the operation and maintenance operation instructions may include: start / stop operation instructions, configuration operation instructions, update operation instructions, etc. It can be understood that controlling the container host to read the operation and maintenance operation instructions can control the container host to perform relevant start / stop, configuration or update operations according to the operation and maintenance operation instructions.
[0076] Specifically, the second index identifier of the write pipeline file in the node resources and the mapping relationship between the second index identifier recorded in the cloud platform node and the second memory buffer can be obtained. Using this mapping relationship, the second memory buffer for temporarily storing the second communication data is located according to the obtained second index identifier, and then the container host is controlled to read the second communication data in the second memory buffer to implement the transmission of the second communication data to the container host.
[0077] In an embodiment of the present invention, the file storage path of node resources is obtained, and according to the file storage path, a read pipe file and a write pipe file are created on the cloud platform node, and the cloud platform node is controlled to allocate a first index identifier and a first memory buffer for the read pipe file, and, for the write pipe file, allocate a second index identifier and a second memory buffer and other node resources. According to the container resources of the container host, a read path and a write path are created in the container host, the read pipe file is mounted to the write path of the container host, and the write pipe file is mounted to the read path of the container host. The container host is controlled to write the first communication data in the container resources to the first memory buffer of the read pipe file through the write path. The cloud platform node is controlled to determine the first index identifier of the read pipe file and read the first communication data in the first memory buffer according to the first index identifier. The cloud platform node is controlled to store the second communication data in the node resources into the second memory buffer corresponding to the write pipe file through the second index identifier of the write pipe file. The container host is controlled to read the second communication data in the second memory buffer according to the read path. In the embodiment of the present invention, two-way communication between the node and the container host is realized by creating a read pipe file and a write pipe file, the overhead of file copying in the traditional solution is solved, and the communication efficiency between the node and the container is improved; by allocating a first memory buffer for the read pipe file and a second memory buffer for the write pipe file, physical isolation of read and write operations is realized, data overwrite in a concurrent scenario is avoided, and the stability and reliability of data transmission are enhanced; by creating a read path and a write path as access interfaces for the read pipe file and the write pipe file, direct access to the memory buffer for communication data can be realized, direct acquisition of communication data is realized, and the latency of data communication is reduced; in addition, only two pipe files need to be maintained in the embodiment of the present invention to cover the mutual access requirements between the node and the container host, the management complexity is simplified, and the operation and maintenance cost is reduced.
[0078] Based on the above embodiment, in the embodiment of the present invention, when transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file, it further includes: obtaining the node load information of the cloud platform node, and controlling the cloud platform node to write the node load information into the second memory buffer of the write pipe file according to the second index identifier of the write pipe file; controlling the container host to read the node load information in the second memory buffer according to the read path; when the node load information is greater than the first load threshold configured by the container host, controlling the container host to shut down.
[0079] Among them, the node load information can be understood as a series of quantitative indicators, which can reflect the running state of the cloud platform node and can be used to determine the life cycle of the container host. The first load threshold can be understood as a boundary value, which can be used to indicate whether the container host triggers a protective operation.
[0080] Specifically, the node load information of the cloud platform node can be read within the node resources of the cloud platform node, the second index identifier of the write pipeline file of the cloud platform node can be obtained, the second memory buffer of the write pipeline file can be automatically mapped and queried based on the second index identifier, the node load information of the cloud platform node can be temporarily stored in the second memory buffer through the write pipeline file, the reading path within the container host can be obtained, the node load information can be read in the second memory buffer according to the reading path, the first load threshold for indicating whether the container host triggers a protective operation can be obtained in the container host, the container host can be controlled to compare the node load information with the first load threshold, and when it is determined that the node load information is greater than the first load threshold configured by the container host, the container host can be controlled to shut down.
[0081] In the embodiment of the present invention, by comparing the node load information with the first load threshold, it is automatically determined whether the container host triggers a protective operation, realizing automatic load monitoring and preventing problems such as performance degradation, service interruption, and even hardware damage of the container host caused by excessive load.
[0082] Embodiment III
[0083] Based on the above embodiments, Embodiment III of the present invention provides a method for realizing the operation and maintenance management of a container host by creating a named pipe file in a cloud platform node. It can be understood that in the Linux system, a pipe is a half-duplex communication method, and data can only flow in one direction. There are usually two types of pipes, namely anonymous pipes and named pipes. Among them, in the Linux system, pipes are by default anonymous, that is, they have no name, and anonymous pipes can only be used between the process that creates them and its child processes. A named pipe (also known as FIFO) has a name and exists in the form of a file. The named pipe file has a corresponding file name in the file system and can be accessed by unrelated processes.
[0084] In the embodiment of the present invention, 2 named pipes, that is, 2 named pipe files, are created in the cloud platform node, which can be respectively named a read named pipe file and a write named pipe file. In the embodiment of the present invention, a pipe proxy process can be used to access the read named pipe file and the write named pipe file to realize the operation and maintenance management of the container host by the cloud platform node.
[0085] Specifically, a method for implementing container host operation and maintenance management by creating named pipe files in cloud platform nodes may include the following steps: The mkfifo p1 and mkfifo p2 commands can be used to create a read named pipe file p1 and a write named pipe file p2 in the node. The Docker command can be used to run the container host, and the read named pipe file p1 and the write named pipe file p2 on the cloud platform node are mounted into the container host through the -v or --mount option. During the operation and maintenance management of the container host, the echo '{cpu:{usage:9,iowait:0}}'> / host / opt / pipe / p1 command can be used to control the container host to write monitoring data into the read named pipe file p1, and the cloud platform node can be controlled to read the monitoring data from the read pipe file p1 through root@topsail: / opt / pipe#python3 pf_client.py / opt / pipe / p1; Received message: 2025-03-07T15:40:47{cpu:{usage:9,iowait:0}}; After receiving the monitoring data transmitted by the container host, the echo '{"action":"restart_service","service":"nginx"}'> / opt / pipe / p2 command can be used to control the cloud platform node to write relevant operation and maintenance operation instructions into the write pipe file p2. The pipe agent process in the container host reads the operation and maintenance operation instructions from the pipe file p2, and after obtaining the operation and maintenance operation instructions, the container host can execute corresponding operation and maintenance operations according to the operation and maintenance operation instructions. The above command-line operations are only for illustrative purposes to facilitate understanding of the specific reading and writing processes. In actual production, the reading and writing of pipe files can be performed through the pipe agent process.
[0086] Embodiment 4
[0087] Figure 4 The following is a schematic structural diagram of a data communication device provided in Embodiment 4 of the present invention. As Figure 4 shown, the device includes:
[0088] A creation module 310, configured to create a read pipe file and a write pipe file according to the node resources of the cloud platform node;
[0089] A mapping module 320, configured to map the read pipe file and the write pipe file to the container resources of the container host respectively;
[0090] A transmission module 330, configured to transmit communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
[0091] Optionally, the creation module 310 includes: a pipeline creation unit for determining the file storage path of node resources and creating a read pipeline file and a write pipeline file according to the file storage path;
[0092] a resource allocation unit for allocating a first index identifier and a first memory buffer for the read pipeline file in the node resources, and allocating a second index identifier and a second memory buffer for the write pipeline file.
[0093] Optionally, the mapping module 320 includes: a path creation unit for creating a read path and a write path in the container resources of the container host;
[0094] a first path mounting unit for mounting the read pipeline file to the write path of the container host;
[0095] a second path mounting unit for mounting the write pipeline file to the read path of the container host.
[0096] Optionally, the transmission module 330 includes: a first data writing unit for controlling the container host to write first communication data in the container resources into the first memory buffer of the read pipeline file according to the write path;
[0097] a first data reading unit for controlling the cloud platform node to determine the first index identifier of the read pipeline file in the node resources and read the first communication data in the first memory buffer according to the first index identifier; wherein, the first communication data at least includes container monitoring data.
[0098] Optionally, the transmission module 330 further includes: a second data writing unit for controlling the cloud platform node to write second communication data in the node resources into the second memory buffer of the write pipeline file according to the second index identifier of the write pipeline file;
[0099] a second data reading unit for controlling the container host to read the second communication data in the second memory cache area according to the read path; wherein, the second communication data at least includes operation and maintenance operation instructions.
[0100] Optionally, the transmission module 330 further includes: a load acquisition unit for acquiring the node load information of the cloud platform node and controlling the cloud platform node to write the node load information into the second memory buffer of the write pipeline file according to the second index identifier of the write pipeline file;
[0101] a host control unit for controlling the container host to read the node load information in the second memory cache area according to the read path; when the node load information is greater than the first load threshold configured by the container host, controlling the container host to shut down.
[0102] The data communication device provided by the embodiments of the present invention can execute the data communication method provided by any embodiment of the present invention, and has the corresponding beneficial effects of executing the method.
[0103] Embodiment 5
[0104] The embodiments of the present invention provide an electronic device for executing a data communication method, a computer-readable storage medium, and a computer program product.
[0105] Figure 5 The structural schematic diagram of the electronic device that can be used to implement the data communication method of any embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown in the embodiments of the present invention, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the embodiments of the present invention described and / or required herein.
[0106] As Figure 5 shown, the electronic device includes at least one processor 11, and a memory communicatively connected to at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by at least one processor. The processor 11 can execute various appropriate actions and processes according to the computer program stored in the ROM 12 or the computer program loaded from the storage unit 18 into the RAM 13. In the RAM 13, various programs and data required for the operation of the electronic device can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0107] Multiple components in the electronic device are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0108] The processor 11 may be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit, a graphics processing unit, various dedicated artificial intelligence computing chips, various processors running machine learning model algorithms, a digital signal processor, and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, for example, the data communication method.
[0109] In some embodiments, the data communication method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps based on the data communication method may be performed. Alternatively, in other embodiments, the processor 11 may be configured for the data communication method by any other suitable means (e.g., by means of firmware).
[0110] The various embodiments of the systems and techniques described above in the embodiments of the present invention may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on a chip, programmable logic devices loaded with a program, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, and may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0111] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to the processors of general-purpose computers, special-purpose computers, or other programmable data processing devices, such that when the computer programs are executed by the processors, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0112] In the context of embodiments of the present invention, a computer-readable storage medium may be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a RAM, a 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.
[0113] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a device having: a display device (e.g., a cathode ray tube or a liquid crystal display monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including: acoustic input, speech input, or tactile input).
[0114] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area networks, wide area networks, blockchain networks, and the Internet.
[0115] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and virtual private server services.
[0116] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.
[0117] The above specific embodiments do not constitute a limitation on the protection scope of the embodiments of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A data communication method, characterized in that, The method includes: Creating a read pipe file and a write pipe file according to the node resources of the cloud platform node; Mapping the read pipe file and the write pipe file to the container resources of the container host respectively; Transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
2. The method according to claim 1, wherein The creating a read pipe file and a write pipe file according to the node resources of the cloud platform node includes: Determining the file storage path of the node resources, and creating the read pipe file and the write pipe file according to the file storage path; Allocating a first index identifier and a first memory buffer for the read pipe file in the node resources, and allocating a second index identifier and a second memory buffer for the write pipe file.
3. The method according to claim 1, characterized in that, The mapping the read pipe file and the write pipe file to the container resources of the container host respectively includes: Creating a read path and a write path according to the container resources of the container host; Mounting the read pipe file to the write path of the container host; Mounting the write pipe file to the read path of the container host.
4. The method according to claim 3, characterized in that The transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file includes: Controlling the container host to write first communication data in the container resources into the first memory buffer of the read pipe file according to the write path; Controlling the cloud platform node to determine the first index identifier of the read pipe file in the node resources, and reading the first communication data in the first memory buffer according to the first index identifier; Wherein, the first communication data at least includes container monitoring data.
5. The method according to claim 3, wherein The transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file includes: Controlling the cloud platform node to write second communication data in the node resources into the second memory buffer of the write pipe file according to the second index identifier of the write pipe file; Controlling the container host to read the second communication data in the second memory buffer according to the read path; Wherein, the second communication data at least includes operation and maintenance operation instructions.
6. The method according to claim 3, wherein The transmitting communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file further includes: Obtaining the node load information of the cloud platform node, and controlling the cloud platform node to write the node load information into the second memory buffer of the write pipe file according to the second index identifier of the write pipe file; Controlling the container host to read the node load information in the second memory buffer according to the read path; When the node load information is greater than a first load threshold configured by the container host, controlling the container host to shut down.
7. A data communication device, characterized in that, The device includes: A creating module, configured to create a read pipe file and a write pipe file according to the node resources of the cloud platform node; A mapping module, configured to map the read pipe file and the write pipe file to the container resources of the container host respectively; A transmission module, configured to transmit communication data between the cloud platform node and the container host based on the read pipe file and the write pipe file.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; And a memory communicatively connected to the at least one processor; Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data communication method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores: computer instructions, and the computer instructions are used to implement the data communication method according to any one of claims 1-6 when executed by a processor.
10. A computer program product, characterized in that, The computer program product includes: A computer program, which implements the data communication method according to any one of claims 1-6 when executed by a processor.