FPGA-based publish-subscribe message transmission method, system, device, and medium
The publish-subscribe message transmission method of FPGA and message forwarding platform solves the problem of CPU limiting data transmission speed, realizes efficient and flexible data transmission, improves the scalability of the system, and is suitable for core and particle physics with high data volume. experiment.
Patent Information
- Application Number
- CN202411003281.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-07-25
AI Technical Summary
In nuclear and particle physics experiments, the performance of the CPU limits the data transmission speed between the FPGA and the data acquisition platform, especially when the amount of data is large, resulting in a slow transmission speed.
Adopt a publish-subscribe message transmission method based on FPGA, interact with the message forwarding platform through the communication module, establish a distributed cluster, manage the connection between nodes and running nodes, use the preset decoding algorithm to configure the FPGA, and cache and forward collection on the message forwarding platform data to achieve efficient data transmission.
It solves the problem of CPU limiting the amount of data forwarding, improves the scalability and flexibility of the system, achieves efficient data transmission, avoids CPU performance bottlenecks, and is suitable for experimental environments with high data volumes.
Smart Images

Figure CN118524151B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and more specifically to a publish-subscribe message transmission method, system, device, and medium based on FPGA. Background Art
[0002] The signal readout system is one of the core parts of nuclear and particle physics experimental equipment. Its performance affects the ability to obtain experimental data. With the development of the network and the improvement of data processing performance, many data processing tasks can be completed in real time on a single or small computer cluster. Compared with data processing methods that are performed offline after data storage or using dedicated fast electronic equipment, this software-based real-time data processing method has greater flexibility and better adaptability, and has become a development trend in physical experiment data acquisition systems.
[0003] In the related art, a CPU (Central Processing Unit) is required to forward information between an FPGA (Field-Programmable Gate Array) and a data acquisition platform to complete signal reading. However, the performance of the CPU limits the amount of data acquired by the data acquisition platform. For large amounts of data, the data transmission speed is slow. Summary of the invention
[0004] In view of the above problems, the present invention provides a publish-subscribe message transmission method, system, device, and medium based on FPGA.
[0005] According to a first aspect of the present invention, a publish-subscribe message transmission method based on FPGA is provided, wherein the FPGA comprises a communication module and a consumption module, the communication module performs information interaction with a message forwarding platform, the message forwarding platform is deployed in a distributed cluster, the message forwarding platform comprises a management node and an operation node, and the FPGA also stores an address identifier of the management node of the message forwarding platform, including: establishing a communication connection with the message forwarding platform; sending a query instruction to a management node corresponding to the address identifier of the management node through the communication module, the query instruction comprising a preset subscription topic, the preset subscription topic is set according to a detection channel of a detector interacting with the FPGA, the detection channel represents the data type and / or collection location collected by the detector; in response to a received operation node address identifier having a corresponding relationship with the preset subscription topic, establishing a connection with an operation node of the message forwarding platform; sending the preset subscription topic to the operation node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic; in response to a received configuration instruction sent by the message forwarding platform, The above-mentioned consumption module obtains configuration data based on the above-mentioned configuration instructions using a preset decoding algorithm; configures the above-mentioned FPGA based on the above-mentioned configuration data; and in response to receiving the collection data sent by the above-mentioned detector, sends the packaged collection data to the above-mentioned operation node, so that the above-mentioned message forwarding platform caches and forwards the above-mentioned packaged collection data, and the above-mentioned collection data is obtained based on the collection of multiple detection channels of the above-mentioned detector.
[0006] According to an embodiment of the present invention, the above-mentioned FPGA also includes a coordination module and multiple production modules, and the above-mentioned method also includes: for each of the above-mentioned production modules in an idle state, in response to the enable signal sent by the above-mentioned coordination module, obtaining the detection data to be packaged; using a preset packaging algorithm, encapsulating the above-mentioned detection data to be packaged to obtain the information to be transmitted; sending the above-mentioned information to be transmitted to the above-mentioned running node through the above-mentioned communication module; in response to the confirmation mark corresponding to the above-mentioned information to be transmitted sent by the above-mentioned message forwarding platform, deleting the above-mentioned information to be transmitted in the cache.
[0007] According to an embodiment of the present invention, the above method also includes: in response to the control information sent by the above message forwarding platform, the above consumption module uses a preset decoding algorithm to obtain control instructions and subscription topics based on the above control information; and sends the above control instructions to the detector corresponding to the above subscription topic, so that the above detector performs the operation corresponding to the above control instructions.
[0008] According to an embodiment of the present invention, the message forwarding platform also stores a first correspondence between different subscription topics and FPGAs, and the method further includes: the message forwarding platform obtains the subscription topic and configuration data in the first configuration instruction in response to receiving the first configuration instruction sent by the data acquisition platform; the message forwarding platform determines the target FPGA based on the subscription topic and the first correspondence; the message forwarding platform uses a preset encoding algorithm to encode the subscription topic and the configuration data to obtain a second configuration instruction; the message forwarding platform sends the second configuration instruction to the target FPGA, so that the FPGA is configured based on the second configuration instruction.
[0009] According to an embodiment of the present invention, the message forwarding platform determines a target decoding algorithm from multiple decoding algorithms based on the encoding type; the message forwarding platform uses the target decoding algorithm to obtain a subscription topic and configuration data based on the first configuration instruction in the message body.
[0010] According to an embodiment of the present invention, the message forwarding platform interacts with multiple FPGAs for information exchange, and the method further includes: the message forwarding platform, in response to receiving transmission information sent by the multiple FPGAs, obtains detection data based on the transmission information using a preset decoding algorithm; the message forwarding platform caches the detection data; the message forwarding platform responds to a pull instruction from the data acquisition platform and sends the detection data to the data acquisition platform.
[0011] The second aspect of the present invention provides a publish-subscribe message transmission system based on FPGA, wherein the FPGA includes a communication module and a consumption module, the communication module interacts with a message forwarding platform, the message forwarding platform is deployed in a distributed cluster, the message forwarding platform includes a management node and an operation node, and the FPGA also stores the management node address identifier of the message forwarding platform, including: a connection establishment module, used to establish a communication connection with the message forwarding platform; a query module, used to send a query instruction to the management node corresponding to the management node address identifier through the communication module, the query instruction includes a preset subscription topic, the preset subscription topic is set based on the detection channel of the detector interacting with the FPGA, and the detection channel represents the data type and / or collection location collected by the detector; a connection module, used to establish a connection with the operation node in response to a received operation node address identifier having a corresponding relationship with the preset subscription topic; a subscription topic sending module, used to send a preset subscription topic to the operation node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic; a decoding module, used to respond to the received configuration instruction sent by the message forwarding platform, The above-mentioned consumption module uses a preset decoding algorithm to obtain configuration data based on the above-mentioned configuration instructions; the configuration module is used to configure the above-mentioned FPGA based on the above-mentioned configuration data; and the collection data sending module is used to respond to receiving the collection data sent by the above-mentioned detector, send the packaged collection data to the above-mentioned operation node, so that the above-mentioned message forwarding platform caches and forwards the above-mentioned packaged collection data, and the above-mentioned collection data is obtained based on the collection of multiple detection channels of the above-mentioned detector.
[0012] According to an embodiment of the present invention, the above-mentioned FPGA also includes a coordination module and multiple production modules, and the above-mentioned system also includes: a data acquisition module for obtaining data to be packaged, which is used for obtaining detection data to be packaged for each of the above-mentioned production modules in an idle state in response to an enable signal sent by the above-mentioned coordination module; an encapsulation module, which uses a preset encapsulation algorithm to encapsulate the above-mentioned detection data to be packaged to obtain information to be transmitted; an information sending module for sending the above-mentioned information to be transmitted to the above-mentioned running node through the above-mentioned communication module; and a deletion module, which is used to delete the above-mentioned information to be transmitted in the cache in response to a confirmation identifier corresponding to the above-mentioned information to be transmitted sent by the above-mentioned message forwarding platform.
[0013] According to an embodiment of the present invention, the above-mentioned system also includes: a control information decoding module, which is used to respond to the control information sent by the above-mentioned message forwarding platform, and the above-mentioned consumption module obtains the control instruction and the subscription topic based on the above-mentioned control information using a preset decoding algorithm; a detector control module, which is used to send the above-mentioned control instruction to the detector corresponding to the above-mentioned subscription topic, so that the above-mentioned detector performs the operation corresponding to the above-mentioned control instruction.
[0014] According to an embodiment of the present invention, the system also includes a message forwarding platform, which also stores a first correspondence between different subscription topics and FPGAs. The message forwarding platform also includes: an acquisition module, which is used to obtain the subscription topic and configuration data in the first configuration instruction in response to receiving a first configuration instruction sent by the data acquisition platform; a determination module, which is used to determine the target FPGA based on the subscription topic and the first correspondence; an encoding module, which is used to encode the subscription topic and the configuration data using a preset encoding algorithm to obtain a second configuration instruction; and a configuration instruction sending module, which is used to send the second configuration instruction to the target FPGA so that the FPGA is configured based on the second configuration instruction.
[0015] According to an embodiment of the present invention, the above-mentioned first configuration instruction is a preset coding format, and the above-mentioned preset coding format includes packet length, coding type, packet header length, packet header and information body. The above-mentioned acquisition module includes: a target decoding algorithm determination submodule, which is used to determine the target decoding algorithm from multiple decoding algorithms based on the above-mentioned coding type; a first configuration instruction decoding submodule, which is used to use the above-mentioned target decoding algorithm to obtain the subscription topic and configuration data based on the first configuration instruction in the above-mentioned message body.
[0016] According to an embodiment of the present invention, the message forwarding platform interacts with multiple FPGAs for information exchange, and the system further includes: a transmission information decoding module for obtaining detection data based on the transmission information received from the multiple FPGAs using a preset decoding algorithm; a detection data caching module for caching the detection data; and a detection data sending module for sending the detection data to the data acquisition platform in response to a pull instruction from the data acquisition platform.
[0017] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0018] The fourth aspect of the present invention further provides a computer-readable storage medium on which a computer program or instruction is stored, and the steps of the above method are implemented when the above computer program or instruction is executed by a processor.
[0019] The fifth aspect of the present invention also provides a computer program product, including a computer program or instructions, which implement the steps of the above method when executed by a processor.
[0020] According to an embodiment of the present invention, a query instruction is sent to a management node in a message forwarding platform to obtain an address identifier of a running node corresponding to a subscription topic on the FPGA, and a connection is established with the above-mentioned running node to send a preset subscription topic, so that the message forwarding platform saves the correspondence between the FPGA and the subscription topic. When the message forwarding platform receives a configuration instruction of the corresponding topic, it forwards it to the corresponding FPGA for configuration, thereby solving the problem of the CPU limiting the amount of data forwarding. Further, through publish-subscribe data transmission, the system is decoupled and the scalability of the system is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0022] Figure 1 A readout electronics system in the related art is shown;
[0023] Figure 2 Another readout electronics system in the related art is shown;
[0024] Figure 3 An application scenario diagram of a publish-subscribe message transmission method and system based on FPGA according to an embodiment of the present invention is shown;
[0025] Figure 4 A flow chart of a publish-subscribe message transmission method based on FPGA according to an embodiment of the present invention is shown;
[0026] Figure 5 A finite state machine schematic diagram of a communication module according to an embodiment of the present invention is shown;
[0027] Figure 6 A schematic diagram of a message mechanism communication module in an FPGA according to an embodiment of the present invention is shown;
[0028] Figure 7 shows a unit timing diagram of a production module according to an embodiment of the present invention;
[0029] Figure 8 Shows a message encoding method according to an embodiment of the present invention;
[0030] Fig. 9 A schematic diagram of a push consumption module according to an embodiment of the present invention is shown;
[0031] Fig.10 A data reading system according to an embodiment of the present invention is shown;
[0032] Fig.11 shows the throughput test results according to an embodiment of the present invention;
[0033] Fig.12 A structural block diagram of a publish-subscribe message transmission system based on FPGA according to an embodiment of the present invention is shown;
[0034] Fig.13 A block diagram of an electronic device suitable for implementing a publish-subscribe message transmission method based on FPGA according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0035] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0036] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0037] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0038] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0039] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, invention and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0040] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present invention provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0041] With the increase in the power of experimental devices and the application of new detection technologies, the amount of data generated in nuclear and particle physics experiments has increased significantly. In this case, the main challenge facing the signal readout system is how to flexibly, efficiently and in real time read out the massive data of multiple channels. Therefore, high-performance, flexible and decoupled data transmission technology has become the key to the current readout system design. The main parts of the signal readout system include: detectors, front-end analog circuits, readout electronics and data acquisition systems. Among them, various detectors in nuclear and particle physics experimental devices are used to capture the electrical signals generated by various microscopic particles during the experiment, and then sent to the front-end electronics adjacent to the detectors to perform analog conditioning and processing on the electrical signals to obtain signals related to physical information (such as energy, time, charge, etc.). Then the signals are sent to the readout electronics system to convert the relevant physical information into digital signals in a specified format. Finally, these digital signals are received, processed and stored in real time by the data acquisition system. In traditional readout electronics systems, a CPU is usually used to forward data between the FPGA and the data acquisition system.
[0042] Figure 1 A readout electronics system in the related art is shown.
[0043] like Figure 1As shown, the FPGA and CPU are independent of each other. The FPGA communicates with the CPU in the zero slot of the chassis through the NIM (Network Interface Module), PCI (Peripheral Component Interconnect) or PCIe (Peripheral Component Interconnect Express, a high-speed connection standard for peripheral devices) inter-board bus. Data is aggregated from each readout plug-in (FPGA) to the zero slot through the chassis backplane bus. The CPU in the zero slot sends the aggregated data to the data acquisition system through TCP / IP (Transmission Control Protocol / Internet Protocol). In this readout electronics structure, the data on the FPGA side is aggregated and centralized through the chassis backplane bus. This design makes the transmission speed of the chassis backplane bus easily become the performance bottleneck of the entire electronic readout system.
[0044] Figure 2 Another readout electronics system in the related art is shown.
[0045] like Figure 2 As shown in the figure, the readout electronics system uses SoC (System on Chip) FPGA technology, integrating the CPU system and FPGA commonly used in embedded systems into the same chip. The FPGA and CPU use the on-chip bus and the on-chip bus standard for data transmission, and the CPU directly sends the data collected by the FPGA in a single readout plug-in to the data acquisition system. In this readout electronics system structure, SoC FPGA simplifies the hardware design, but its cost and power consumption are higher than ordinary FPGAs; and because the SoC FPGA chip integrates both the processor and programmable logic, the performance of its processor part is limited, which will become the throughput bottleneck of the readout plug-in data transmission. Its processor characteristics are fixed and its flexibility is not as good as that of pure FPGA.
[0046] In view of this, an embodiment of the present invention provides a publish-subscribe message transmission method based on FPGA, wherein the FPGA includes a communication module and a consumption module, the communication module interacts with a message forwarding platform for information, the message forwarding platform is deployed in a distributed cluster, the message forwarding platform includes a management node and an operation node, and the FPGA also stores an address identifier of the management node of the message forwarding platform, and the method includes: establishing a communication connection with the message forwarding platform; sending a query instruction to the management node corresponding to the address identifier of the management node through the communication module, the query instruction including a preset subscription topic, the preset subscription topic is set according to the detection channel of the detector interacting with the FPGA, and the detection channel represents the data type and / or collection location collected by the detector; in response to the received operation node address identifier having a corresponding relationship with the preset subscription topic, establishing a connection with the operation node of the message forwarding platform; sending the preset subscription topic to the operation node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic; in response to the received configuration instruction sent by the message forwarding platform, the consumption module obtains configuration data based on the configuration instruction using a preset decoding algorithm; and configures the FPGA based on the configuration data.
[0047] Figure 3 The application scenario diagram of the FPGA-based publish-subscribe message transmission method and system according to an embodiment of the present invention is shown.
[0048] like Figure 3 As shown, the application scenario 300 according to this embodiment may include a first detector 301, a second detector 302, a third detector 303, a first readout node 304, a second readout node 305, a third readout node 306, a network 307, a first server 308, and a terminal device 309. The network 307 is used to provide a medium for a communication link between the first detector 301, the second detector 302, the third detector 303, the first readout node 304, the second readout node 305, the third readout node 306, the first server 308, and the terminal device 309. The network 307 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0049] The first detector 301 , the second detector 302 , and the third detector 303 interact with the first readout node 304 , the second readout node 305 , and the third readout node 306 respectively through the network 307 to receive or send messages and the like.
[0050] The first readout node 304, the second readout node 305, and the third readout node 306 may include a digitization module and an FPGA. The digitization module is used to digitize the data collected by the detector and send it to the FPGA. The FPGA maps different detector channels and subscription topics through an internal mapping module, and sends the data to a first server 308 running a message forwarding platform through a network 307.
[0051] The first server 308 may be a server that provides various services, such as a background management server that provides support for browsing websites (for example only). The background management server may analyze and process the received user request and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device, wherein the first server 308 may run a message forwarding platform.
[0052] The terminal device 309 may be any electronic device having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like.
[0053] It should be noted that the FPGA-based publish-subscribe message transmission method provided in the embodiment of the present invention can generally be executed by the first server 308. Accordingly, the FPGA-based publish-subscribe message transmission device provided in the embodiment of the present invention can generally be set in the first server 308. The FPGA-based publish-subscribe message transmission method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the first server 308 and can communicate with the first read node 304, the second read node 305, the third read node 306 and / or the first server 308. Correspondingly, the FPGA-based publish-subscribe message transmission device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the first server 308 and can communicate with the first read node 304, the second read node 305, the third read node 306 and / or the first server 308.
[0054] It should be understood that Figure 3 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of detectors, readout nodes, terminal devices, networks and servers may be provided according to the implementation requirements.
[0055] The following will be based on Figure 3 The scene described by Figure 4~Figure 11 The publish-subscribe message transmission method based on FPGA in an embodiment of the present invention is described in detail.
[0056] Figure 4A flow chart of a publish-subscribe message transmission method based on FPGA according to an embodiment of the present invention is shown.
[0057] like Figure 4 As shown, the FPGA-based publish-subscribe message transmission method of this embodiment includes operations S410 to S470.
[0058] It should be noted that the FPGA of the embodiment of the present invention includes a communication module and a consumption module. The communication module interacts with the message forwarding platform. The message forwarding platform is deployed in a distributed cluster. The message forwarding platform includes a management node and an operation node. The FPGA also stores the management node address identifier of the message forwarding platform.
[0059] In operation S410, a communication connection is established with a message forwarding platform.
[0060] It should be noted that in the present invention, the communication connection is established directly between the FPGA and the message forwarding platform, and the FPGA in the present invention does not include a CPU.
[0061] In operation S420, a query instruction is sent to a management node corresponding to the management node address identifier through a communication module.
[0062] The query instruction includes a preset subscription topic, which is set according to a detection channel of a detector interacting with the FPGA, and the detection channel represents the type of data and / or the collection position collected by the detector.
[0063] According to an embodiment of the present invention, the above-mentioned message forwarding platform may be, for example, Apache Kafka, Apache Pulsar, etc., preferably RocketMQ, wherein both Kafka and Pulsar use ZooKeeper to coordinate server cluster metadata, and Pulsar also needs to use BookKeeper to implement message storage. The dependence of these external components will increase the complexity of system design and the difficulty of maintenance. RocketMQ does not rely on any external components, and is the message technology with the highest throughput rate (single-machine throughput rate is in the order of 100,000 messages / second) together with Kafka. For performance, complexity and maintainability considerations, RocketMQ is preferably used in an embodiment of the present invention to implement a publish-subscribe message transmission method based on FPGA. RocketMQ will be used as an example below. In the related art, RocketMQ does not support communication with FPGA, so it is necessary to formulate a communication protocol for FPGA based on the existing RocketMQ protocol, which includes three parts: network layer, data interaction layer and message layer.
[0064] According to an embodiment of the present invention, the RocketMQ network layer is based on the TCP / IP protocol communication. The FPGA uses the SiTCP module to establish and communicate with the RocketMQ server through a basic TCP / IP connection. SiTCP is an IPCore (Intellectual Property Core) that can be integrated into the FPGA.
[0065] For ease of understanding, the publish-subscribe message transmission in the present invention is first explained. The publish-subscribe mode is a message delivery mode, which includes producers and consumers. Producers and consumers communicate through a message forwarding platform. Producers publish messages to the message forwarding platform, and consumers subscribe to the message types of interest. When the message forwarding platform receives a new message, it will pass the message to all consumers who have subscribed to the corresponding message type.
[0066] According to an embodiment of the present invention, the data interaction layer is located above the network layer. RocketMQ, as a message forwarding platform, transmits messages between producers and consumers. A request / response communication protocol is used between the FPGA and the message forwarding platform. Requests and responses generally use the same general format and the same encoding and decoding methods. The message forwarding platform regards producers and consumers as clients. In the message mechanism communication, the client's requests include: message production request, message publishing request, topic subscription request, topic query routing information request, etc. The message forwarding platform responds to these requests according to the predefined protocol.
[0067] According to an embodiment of the present invention, the top layer of the above-mentioned communication protocol is the message protocol, which defines the production and consumption behaviors of messages. FPGA sends scientific data collected by the detector, which belongs to message production; and FPGA receives configuration information and slow control information from the data acquisition platform, which belongs to message consumption.
[0068] In operation S430, in response to the received operating node address identifier having a corresponding relationship with the preset subscription topic, a connection is established with the operating node of the message forwarding platform.
[0069] In operation S440, a preset subscription topic is sent to the running node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic.
[0070] Figure 5 A schematic diagram of a finite state machine of a communication module according to an embodiment of the present invention is shown.
[0071] like Figure 5As shown, after startup, the communication module will automatically initialize and establish a connection with the management node (name server) of the message forwarding platform (RocketMQ) based on the management node address identifier of the message forwarding platform, and query the corresponding running node (proxy server) from the management node according to the preset subscription topic. After the address query and resolution is successful, the communication module allows the SiTCP module to disconnect from the management node and reconnect with the running node. After the connection is successful, the communication module of the FPGA sends a request for subscription topic to the running node, so that the message forwarding platform saves the corresponding relationship between the above FPGA and the subscription topic. After that, the communication module will enter the message forwarding state. When receiving the message from the message forwarding platform, it will broadcast it to the corresponding consumption module in the FPGA for processing. When the message production module produces the message, it will be sent to the message forwarding platform through the communication module. It should be noted that the message production module and the message consumption module can detect the message according to the message number and process it by themselves. If the connection is interrupted during the connection to the running node of the message forwarding platform or the message forwarding process, resulting in a timeout, the communication module will enter an abnormal timeout state, and it will select another running node to connect or reconnect to the management node to update the address of the running node.
[0072] According to an embodiment of the present invention, the management node address identifier may be, for example, an IP (Internet Protocol) address and a MAC (Media Access Control) address of the management node.
[0073] In operation S450, in response to the received configuration instruction sent by the message forwarding platform, the consumption module obtains configuration data based on the configuration instruction using a preset decoding algorithm.
[0074] According to an embodiment of the present invention, the consumption module receives the configuration instruction forwarded by the communication module, and parses it into configuration data for execution by the corresponding user logic in the FPGA.
[0075] Optionally, the above-mentioned consumption module can also be configured to return a confirmation message to the running node of the message forwarding platform after the parsing is completed to ensure reliable consumption of the message.
[0076] In operation S460 , the FPGA is configured based on the configuration data.
[0077] In operation S470, in response to receiving the collected data sent by the detector, the encapsulated collected data is sent to the running node, so that the message forwarding platform caches and forwards the encapsulated collected data.
[0078] The collected data is obtained based on multiple detection channels of the detector.
[0079] According to an embodiment of the present invention, while receiving the configuration instructions sent by the message forwarding platform, the data collected by the detector can also be encapsulated and sent to the message forwarding platform. The message forwarding platform encapsulates the collected data and waits for the data acquisition platform to pull it. After receiving the pulling instruction, the corresponding data is sent to the data acquisition platform.
[0080] According to an embodiment of the present invention, a query instruction is sent to a management node in a message forwarding platform to obtain an address identifier of a running node corresponding to a subscription topic on the FPGA, and a connection is established with the above-mentioned running node to send a preset subscription topic, so that the message forwarding platform saves the correspondence between the FPGA and the subscription topic. When the message forwarding platform receives a configuration instruction of the corresponding topic, it is forwarded to the corresponding FPGA for configuration, thereby solving the problem of CPU limiting the amount of data forwarding. Further, through publish-subscribe data transmission, the system is decoupled and the scalability of the system is improved. At the same time, when receiving the configuration instruction, the collected data is sent to the message forwarding platform, and the message forwarding platform caches the collected data, which can improve the flexibility and scalability of the system.
[0081] According to an embodiment of the present invention, the above-mentioned FPGA also includes a coordination module and multiple production modules, and the above-mentioned method also includes: for each production module in an idle state, in response to the enable signal sent by the coordination module, obtaining the detection data to be packaged; using a preset packaging algorithm, packaging the detection data to be packaged to obtain information to be transmitted; sending the information to be transmitted to the running node through the communication module; in response to the confirmation identifier corresponding to the information to be transmitted sent by the received message forwarding platform, deleting the information to be transmitted in the cache.
[0082] Figure 6 A schematic diagram of a message mechanism communication module in an FPGA according to an embodiment of the present invention is shown.
[0083] like Figure 6 As shown in the figure, multiple production modules are instantiated in FPGA to realize reliable concurrent message production, so as to improve the message transmission rate by using the 10 Gigabit Ethernet bandwidth. Each production module encapsulates the data collected by the detector into a message request, transmits it to the communication module in the connection and routing module through the sending interconnection module, and sends it to the message forwarding platform through SiTCP, and caches the message waiting for the confirmation of the running node of the message forwarding platform. Multiple production platforms maintain their own message production process control respectively, and share a sending channel. A coordination module coordinates the data input and transmission enable of each production unit.
[0084] Figure 7 A unit timing diagram of a production module according to an embodiment of the present invention is shown.
[0085] like Figure 7As shown in the figure, there are 6 states in the production module, namely idle, receiving data message encapsulation (rx), message encapsulation process (process), waiting for enable (wait), sending message (tx), waiting for confirmation (wait_ack), and receiving confirmation (ack). The coordination module selects a production module in an idle state through polling, pulls up its input enable, and transmits data to the production module. After the data is received, the production unit encapsulates the data into messages and waits for the enable signal of the coordination module. The coordination module polls and selects the production module that has completed the message encapsulation and is ready, and pulls up the sending enable signal of the production module. The production module transmits the data to the connection and routing module for sending; after the sending is completed, the production module enters the waiting for confirmation state, at which time the production module still caches the previously sent message; until the coordination module receives a response message with the same number value as the sent message, and pulls up the receiving confirmation (ack) signal of the production module, the production unit considers that the message production is successful, clears the cache, enters the idle state, and waits for the next round of message production.
[0086] According to an embodiment of the present invention, if no response message is received for a long time, the production module will resend the message to the corresponding operation node until the preset reset times are exceeded.
[0087] According to an embodiment of the present invention, by setting up multiple production units in the FPGA, a large number of messages can be produced simultaneously, thereby improving the message transmission speed. By caching the sent messages before receiving the response messages and clearing the messages in the cache after receiving the response messages, it can be ensured that the messages are correctly received and processed by the message forwarding platform, thereby improving the reliability of the system and further realizing a high-throughput, high-reliability data message transmission mechanism.
[0088] According to an embodiment of the present invention, the above method also includes: in response to the control information sent by the received message forwarding platform, the consumption module uses a preset decoding algorithm to obtain the control instruction and the subscription topic based on the control information; and sends the control instruction to the detector corresponding to the subscription topic, so that the detector performs the operation corresponding to the control instruction.
[0089] According to an embodiment of the present invention, a detector channel-theme mapping module may also be configured in the FPGA to map the detector channel with the theme, thereby achieving precise control of the detector.
[0090] According to the embodiment of the present invention, control information is forwarded to the corresponding FPGA in real time through a message forwarding platform, which can effectively improve the system response speed, and accurate control of the detector can be achieved by mapping and associating the detector channel with the subscription topic.
[0091] According to an embodiment of the present invention, the message forwarding platform also stores a first correspondence between different subscription topics and FPGAs, and the method also includes: the message forwarding platform obtains the subscription topic and configuration data in the first configuration instruction in response to receiving the first configuration instruction sent by the data acquisition platform; the message forwarding platform determines the target FPGA based on the subscription topic and the first correspondence; the message forwarding platform uses a preset encoding algorithm to encode the subscription topic and configuration data to obtain a second configuration instruction; the message forwarding platform sends the second configuration instruction to the target FPGA, so that the FPGA is configured based on the second configuration instruction.
[0092] According to an embodiment of the present invention, the above-mentioned first configuration instruction is a preset coding format, and the preset coding format includes packet length, coding type, packet header length, packet header and information body. Obtaining the subscription topic and configuration data in the first configuration instruction includes: the message forwarding platform determines the target decoding algorithm from multiple decoding algorithms based on the coding type; the message forwarding platform uses the target decoding algorithm to obtain the subscription topic and configuration data based on the first configuration instruction in the message body.
[0093] According to an embodiment of the present invention, the second configuration instruction is also in the preset encoding format.
[0094] According to an embodiment of the present invention, the unified communication format in RocketMQ is called RemotingCommand, which defines the packet length, serialization type, message header and message body, wherein the message header includes the request code, request number and a string type key-value pair table for extending the request parameters. The existing encoding and decoding methods for RemotingCommand are software-general serialization methods such as JSON and RocketMQ custom encoding. In order to adapt to the working mode of FPGA, the present invention designs an encoding method (FPGA_Serialize) based on code value definition, as follows Figure 8 The message encoding method according to the embodiment of the present invention is shown.
[0095] like Figure 8 As shown, the encoding format includes packet length, encoding type, header length, header and message body. FPGA serializes data according to the encoding method and parses the message or response received from the RocketMQ running ground. RocketMQ has also expanded the corresponding protocol format support. By parsing the encoding type field in the packet format, the corresponding decoding algorithm can be found for decoding, thereby realizing universal processing of messages from the data acquisition platform or FPGA.
[0096] According to an embodiment of the present invention, on the basis of the existing encoding of RemotingCommand, a decoding method corresponding to the newly added encoding method in the present invention needs to be added. A decoding function for FPGA and an encoding function for FPGA can be defined in RocketMQ. When the encoding type field is identified as FPGA_Serialize, the corresponding function can be called to implement the expansion of the encoding method.
[0097] According to an embodiment of the present invention, the running node of RocketMQ currently does not support the push consumption module, so this method adds a push consumption module therein accordingly.
[0098] Fig. 9 A schematic diagram of a push consumption module according to an embodiment of the present invention is shown.
[0099] like Fig. 9 As shown, after receiving a message from a producer, the message forwarding platform RocketMQ will query the topic mapping table through the production processor. The topic mapping table stores the relationship between different subscription topics and consumers in the FPGA. After querying the corresponding consumer who subscribes to the topic, it will be pushed to the corresponding consumer through the consumer communication channel; the above topic mapping table is saved after the message forwarding platform receives a subscription message including a subscription topic.
[0100] According to an embodiment of the present invention, by adding a coding format for communicating with FPGA to the coding format supported by the message forwarding platform, and configuring a corresponding decoding algorithm in the message forwarding platform, after detecting that the coding type is a preset coding type, the corresponding decoding algorithm is used for decoding, thereby improving the scalability of the system.
[0101] According to an embodiment of the present invention, the message forwarding platform interacts with multiple FPGAs, and the method further includes: the message forwarding platform obtains detection data based on the transmission information received from the multiple FPGAs using a preset decoding algorithm; the message forwarding platform caches the detection data; and the message forwarding platform sends the detection data to the data acquisition platform in response to a pull instruction from the data acquisition platform.
[0102] Fig.10 A data readout system according to an embodiment of the present invention is shown.
[0103] like Fig.10As shown, the message forwarding platform can communicate with the FPGA in multiple readout nodes at the same time. The readout node is composed of an ADC module and an FPGA. The FPGA can be, for example, Xilinx UltraScale FPGAXCKU060 (Xilinx FPGA with model XCKU060). The ADC module is responsible for receiving and digitizing the detector data. The FPGA performs real-time analysis and judgment on the received data to determine whether the trigger condition is met to trigger further data processing. The FPGA instantiates the message mechanism transmission module proposed in the present invention, which is used to receive configuration and transmit data. The data is interacted through AXI (Advanced eXtensible Interface). The subscription topic maps the data from different channels of the detector to different topics as signals and outputs them to the message mechanism transmission module through the channel exchange module. The transmission node in the figure is connected to the 10G switch through an optical fiber cable to form a 10G network, and is connected to the message forwarding platform together with the data acquisition platform to realize decoupled data interaction and control. The black arrow in the figure represents an electrical signal, and the bidirectional arrow represents message publishing / subscription.
[0104] According to an embodiment of the present invention, the data acquisition platform may be, for example, a DAQ (Data Acquisition Platform), and the message forwarding platform may be deployed on a computer, using a memory as a storage medium for acceleration.
[0105] Fig.11 The throughput test result according to the embodiment of the present invention is shown.
[0106] like Fig.11 As shown, the horizontal axis represents the test time and the vertical axis represents the throughput. After a 24-hour throughput test on the above-mentioned FPGA-based publish-subscribe message transmission method, it can be found that the throughput of a single FPGA producing messages to the RocketMQ server can stably reach 8.5Gbps. The specific throughput change curve over time is shown in the figure. During the test, the number of the received message was recorded on the RocketMQ server. In the 24-hour test, the message numbering was complete and the message loss rate was 0.
[0107] According to an embodiment of the present invention, a message forwarding platform can simultaneously receive and cache messages sent by multiple FPGAs, and transmit the corresponding messages to the aforementioned data acquisition platform when the data acquisition platform pulls them, thereby achieving high-throughput transmission, and directly using FPGA for data transmission without the need for CPU forwarding, thereby avoiding the problem of low throughput caused by CPU performance limitations. Furthermore, the message mechanism transmission has the characteristics of being asynchronous, decoupled, and traceable, and can process data in real time. At the same time, when building a system, since the CPU is not used, the selection range of FPGA can be expanded, system costs can be saved, system complexity can be reduced, and the portability of the network and the scalability of the system can be improved. It is more suitable for experiments with high event rates, high event rate triggering methods, and front-end raw waveform data upload with richer information, as well as providing a distributed, flexible and integrated readout system for experiments with relatively dispersed detectors and spectrometers.
[0108] Based on the above FPGA-based publish-subscribe message transmission method, the present invention also provides an FPGA-based publish-subscribe message transmission system. Fig.12 The device is described in detail.
[0109] Fig.12 The structure block diagram of a publish-subscribe message transmission system based on FPGA according to an embodiment of the present invention is shown.
[0110] like Fig.12 As shown, the FPGA-based publish-subscribe message transmission system 1200 of this embodiment includes a connection establishment module 1210, a query module 1220, a connection module 1230, a subscription topic sending module 1240, a decoding module 1250, a configuration module 1260 and a collection data sending module 1270.
[0111] The connection establishment module 1210 is used to establish a communication connection with the message forwarding platform. In one embodiment, the connection establishment module 1210 can be used to perform the operation S410 described above, which will not be described in detail here.
[0112] The query module 1220 is used to send a query instruction to the management node corresponding to the management node address identifier through the communication module, and the query instruction includes a preset subscription topic, and the preset subscription topic is set based on the detection channel of the detector interacting with the FPGA, and the detection channel represents the data type and / or collection location collected by the detector. In one embodiment, the query module 1220 can be used to perform the operation S420 described above, which will not be repeated here.
[0113] The connection module 1230 is used to establish a connection with the operation node in response to the received operation node address identifier corresponding to the preset subscription topic. In one embodiment, the connection module 1230 can be used to perform the operation S430 described above, which will not be repeated here.
[0114] The subscription topic sending module 1240 is used to send a preset subscription topic to the running node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic. In one embodiment, the subscription topic sending module 1240 can be used to perform the operation S440 described above, which will not be repeated here.
[0115] The decoding module 1250 is used to respond to the configuration instruction sent by the received message forwarding platform, and the consumption module obtains the configuration data based on the configuration instruction using a preset decoding algorithm. In one embodiment, the decoding module 1250 can be used to perform the operation S450 described above, which will not be repeated here.
[0116] The configuration module 1260 is used to configure the FPGA based on the configuration data. In one embodiment, the configuration module 1260 can be used to perform the operation S460 described above, which will not be described in detail here.
[0117] The collected data sending 1270 is used to send the encapsulated collected data to the running node in response to receiving the collected data sent by the detector, so that the message forwarding platform caches and forwards the encapsulated collected data, and the collected data is collected based on multiple detection channels of the detector. In one embodiment, the collected data sending 1270 can be used to perform the operation S470 described above, which will not be repeated here.
[0118] According to an embodiment of the present invention, the above-mentioned FPGA also includes a coordination module and multiple production modules, and the above-mentioned system also includes: a data acquisition module for obtaining data to be packaged, which is used for obtaining detection data to be packaged for each of the above-mentioned production modules in an idle state in response to an enable signal sent by the above-mentioned coordination module; an encapsulation module, which uses a preset encapsulation algorithm to encapsulate the above-mentioned detection data to be packaged to obtain information to be transmitted; an information sending module for sending the above-mentioned information to be transmitted to the above-mentioned running node through the above-mentioned communication module; and a deletion module, which is used to delete the above-mentioned information to be transmitted in the cache in response to a confirmation identifier corresponding to the above-mentioned information to be transmitted sent by the above-mentioned message forwarding platform.
[0119] According to an embodiment of the present invention, the above-mentioned system also includes: a control information decoding module, which is used to respond to the control information sent by the above-mentioned message forwarding platform, and the above-mentioned consumption module obtains the control instruction and the subscription topic based on the above-mentioned control information using a preset decoding algorithm; a detector control module, which is used to send the above-mentioned control instruction to the detector corresponding to the above-mentioned subscription topic, so that the above-mentioned detector performs the operation corresponding to the above-mentioned control instruction.
[0120] According to an embodiment of the present invention, the system also includes a message forwarding platform, which also stores a first correspondence between different subscription topics and FPGAs. The message forwarding platform also includes: an acquisition module, which is used to obtain the subscription topic and configuration data in the first configuration instruction in response to receiving a first configuration instruction sent by the data acquisition platform; a determination module, which is used to determine the target FPGA based on the subscription topic and the first correspondence; an encoding module, which is used to encode the subscription topic and the configuration data using a preset encoding algorithm to obtain a second configuration instruction; and a configuration instruction sending module, which is used to send the second configuration instruction to the target FPGA so that the FPGA is configured based on the second configuration instruction.
[0121] According to an embodiment of the present invention, the above-mentioned first configuration instruction is a preset coding format, and the above-mentioned preset coding format includes packet length, coding type, packet header length, packet header and information body. The above-mentioned acquisition module includes: a target decoding algorithm determination submodule, which is used to determine the target decoding algorithm from multiple decoding algorithms based on the above-mentioned coding type; a first configuration instruction decoding submodule, which is used to use the above-mentioned target decoding algorithm to obtain the subscription topic and configuration data based on the first configuration instruction in the above-mentioned message body.
[0122] According to an embodiment of the present invention, the message forwarding platform interacts with multiple FPGAs for information exchange, and the system further includes: a transmission information decoding module for obtaining detection data based on the transmission information received from the multiple FPGAs using a preset decoding algorithm; a detection data caching module for caching the detection data; and a detection data sending module for sending the detection data to the data acquisition platform in response to a pull instruction from the data acquisition platform.
[0123] According to an embodiment of the present invention, any multiple modules among the connection establishment module 1210, the query module 1220, the connection module 1230, the subscription topic sending module 1240, the decoding module 1250, the configuration module 1260 and the collection data sending module 1270 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the connection establishment module 1210, the query module 1220, the connection module 1230, the subscription topic sending module 1240, the decoding module 1250, the configuration module 1260 and the acquisition data sending module 1270 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware and firmware or by a proper combination of any of them. Alternatively, at least one of the connection establishment module 1210, the query module 1220, the connection module 1230, the subscription topic sending module 1240, the decoding module 1250, the configuration module 1260 and the acquisition data sending module 1270 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0124] Fig.13 A block diagram of an electronic device suitable for implementing a publish-subscribe message transmission method based on FPGA according to an embodiment of the present invention is shown.
[0125] like Fig.13 As shown, the electronic device 1300 according to an embodiment of the present invention includes a processor 1301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1302 or a program loaded from a storage part 1308 to a random access memory (RAM) 1303. The processor 1301 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1301 may also include an onboard memory for caching purposes. The processor 1301 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0126] In RAM 1303, various programs and data required for the operation of electronic device 1300 are stored. Processor 1301, ROM 1302 and RAM 1303 are connected to each other via bus 1304. Processor 1301 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 1302 and / or RAM 1303. It should be noted that the program can also be stored in one or more memories other than ROM 1302 and RAM 1303. Processor 1301 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in the one or more memories.
[0127] According to an embodiment of the present invention, the electronic device 1300 may further include an input / output (I / O) interface 1305, which is also connected to the bus 1304. The electronic device 1300 may further include one or more of the following components connected to the input / output (I / O) interface 1305: an input portion 1306 including a keyboard, a mouse, etc.; an output portion 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 1308 including a hard disk, etc.; and a communication portion 1309 including a network interface card such as a LAN card, a modem, etc. The communication portion 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the input / output (I / O) interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed, so that a computer program read therefrom is installed into the storage portion 1308 as needed.
[0128] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0129] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 1302 and / or RAM 1303 described above and / or one or more memories other than ROM 1302 and RAM 1303.
[0130] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program includes a program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the FPGA-based publish-subscribe message transmission method provided by the embodiment of the present invention.
[0131] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 1301. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0132] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 1309, and / or installed from the removable medium 1311. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0133] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1309, and / or installed from the removable medium 1311. When the computer program is executed by the processor 1301, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0134] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.
[0137] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A publish-subscribe message transmission method based on FPGA, It is characterized in that The FPGA includes a communication module and a consumption module, the communication module interacts with a message forwarding platform, the message forwarding platform is deployed in a distributed cluster, the message forwarding platform includes a management node and an operation node, the FPGA also stores a management node address identifier of the message forwarding platform, and the method includes: Establishing a communication connection with the message forwarding platform; Sending a query instruction to the management node corresponding to the management node address identifier through the communication module, the query instruction including a preset subscription topic, the preset subscription topic is set according to a detection channel of a detector interacting with the FPGA, and the detection channel represents the type of data and / or collection location collected by the detector; In response to the received operation node address identifier having a corresponding relationship with the preset subscription topic, establishing a connection with the operation node of the message forwarding platform; Sending the preset subscription topic to the running node so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic; In response to the received configuration instruction sent by the message forwarding platform, the consumption module obtains configuration data based on the configuration instruction using a preset decoding algorithm; configuring the FPGA based on the configuration data; and In response to receiving the collected data sent by the detector, the encapsulated collected data is sent to the running node, so that the message forwarding platform caches and forwards the encapsulated collected data, and the collected data is collected based on multiple detection channels of the detector.
2. The method according to claim 1, It is characterized in that The FPGA further includes a coordination module and a plurality of production modules, and the method further includes: For each of the production modules in an idle state, in response to an enable signal received from the coordination module, obtaining detection data to be packaged; Using a preset encapsulation algorithm, encapsulating the detection data to be encapsulated to obtain information to be transmitted; Sending the information to be transmitted to the operating node through the communication module; In response to receiving a confirmation identifier corresponding to the information to be transmitted and sent by the message forwarding platform, the information to be transmitted in the cache is deleted.
3. The method according to claim 1, It is characterized in that The method further comprises: In response to the received control information sent by the message forwarding platform, the consumption module obtains the control instruction and subscription topic based on the control information by using a preset decoding algorithm; The control instruction is sent to the detector corresponding to the subscription topic, so that the detector performs the operation corresponding to the control instruction.
4. The method according to claim 1, It is characterized in that The message forwarding platform also stores a first correspondence between different subscription topics and FPGAs, and the method further includes: The message forwarding platform, in response to receiving the first configuration instruction sent by the data acquisition platform, acquires the subscription topic and configuration data in the first configuration instruction; The message forwarding platform determines a target FPGA based on the subscription topic and the first corresponding relationship; The message forwarding platform uses a preset encoding algorithm to encode the subscription topic and the configuration data to obtain a second configuration instruction; The message forwarding platform sends a second configuration instruction to the target FPGA, so that the FPGA is configured based on the second configuration instruction.
5. The method according to claim 4, It is characterized in that The first configuration instruction is a preset coding format, and the preset coding format includes a packet length, a coding type, a packet header length, a packet header, and an information body. The obtaining of the subscription topic and the configuration data in the first configuration instruction includes: The message forwarding platform determines a target decoding algorithm from a plurality of decoding algorithms based on the encoding type; The message forwarding platform uses the target decoding algorithm to obtain the subscription topic and configuration data based on the first configuration instruction in the message body.
6. The method according to claim 4, It is characterized in that The message forwarding platform interacts with multiple FPGAs for information exchange, and the method further includes: The message forwarding platform, in response to receiving the transmission information sent by the plurality of FPGAs, uses a preset decoding algorithm to obtain detection data based on the transmission information; The message forwarding platform caches the detection data; The message forwarding platform sends the detection data to the data acquisition platform in response to the pull instruction of the data acquisition platform.
7. A publish-subscribe message transmission system based on FPGA, It is characterized in that The FPGA includes a communication module and a consumption module. The communication module interacts with a message forwarding platform. The message forwarding platform is deployed in a distributed cluster. The message forwarding platform includes a management node and an operation node. The FPGA also stores an address identifier of a management node of the message forwarding platform. The system includes: A connection establishment module, used to establish a communication connection with the message forwarding platform; A query module, configured to send a query instruction to the management node corresponding to the management node address identifier through the communication module, wherein the query instruction includes a preset subscription topic, wherein the preset subscription topic is set based on a detection channel of a detector interacting with the FPGA, and the detection channel represents a data type and / or a collection location collected by the detector; A connection module, configured to establish a connection with the running node in response to a received running node address identifier having a corresponding relationship with the preset subscription topic; A subscription topic sending module, used to send a preset subscription topic to the running node, so that the message forwarding platform saves the corresponding relationship between the FPGA and the subscription topic; A decoding module, configured to respond to the received configuration instruction sent by the message forwarding platform, and the consumption module obtains the configuration data based on the configuration instruction by using a preset decoding algorithm; a configuration module, configured to configure the FPGA based on the configuration data; and A collection data sending module is used to send encapsulated collection data to the running node in response to receiving the collection data sent by the detector, so that the message forwarding platform caches and forwards the encapsulated collection data, and the collection data is collected based on multiple detection channels of the detector.
8. The system according to claim 7, It is characterized in that The system further includes a message forwarding platform, the message forwarding platform further stores a first correspondence between different subscription topics and FPGAs, and the message forwarding platform further includes: An acquisition module, configured to acquire, in response to receiving a first configuration instruction sent by a data acquisition platform, a subscription topic and configuration data in the first configuration instruction; A determination module, configured to determine a target FPGA based on the subscription topic and the first corresponding relationship; An encoding module, used to encode the subscription topic and the configuration data using a preset encoding algorithm to obtain a second configuration instruction; The configuration instruction sending module is used to send a second configuration instruction to the target FPGA, so that the FPGA is configured based on the second configuration instruction.
9. An electronic device, include: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program or instructions stored thereon, It is characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
