Market data communication method, device and medium
By reserving cache addresses and using intelligent continuous memory allocation technology, the problem of insufficient cache space in FPGA data transmission is solved, enabling more efficient data storage and transmission of market data and reducing data loss.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2026-03-24
AI Technical Summary
When the FPGA transmits data to the server, there is insufficient contiguous cache space in the continuous memory, which makes it impossible to allocate enough cache space to store a large amount of market data, and can easily lead to data loss.
By reserving cache addresses and using intelligent continuous memory allocation technology, cache space is requested based on the sending density of market data after memory initialization, and the cache space is released when no more data is received, so as to ensure the continuity and availability of cache addresses.
It improves the continuity of cache space, increases the probability of obtaining sufficient cache space, ensures the integrity and transmission efficiency of market data, and reduces the risk of data loss.
Smart Images

Figure CN114860446B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the communication technical field, in particular to a communication method and device for market data and a medium. BACKGROUND
[0002] A financial transaction system, such as a stock transaction system, has the characteristics of relatively concentrated transaction time, transaction instruction and data intensive, and has a high requirement for the processing speed of the transaction system. In the current technology, FPGA technology is used for high throughput, low latency, and other technical characteristics, and a large-scale data intensive parallel acceleration is realized by using FPGA special hardware structure. When the FPGA receives a large amount of data, the data is transmitted to the server for processing through driving.
[0003] When the FPGA transmits the data to the server through driving, it needs to apply for a cache space on the driving layer to store the data. It can be understood that, in order to ensure the integrity and continuity of the data, the applied cache space should be continuous. However, in the current technology, due to the use of users and other circumstances, the continuous cache space in the continuous memory is insufficient, and the user can only apply for 4MB of space. When a large amount of data is transmitted, the server is not timely to take out the data from the cache space, which is easy to cause data loss.
[0004] Therefore, how to apply for a large amount of continuous space when applying for a cache space to store more market data is a problem to be solved by those skilled in the art. SUMMARY
[0005] The purpose of the present application is to provide a communication method and device for market data and a medium, which is used to apply for a large amount of continuous space when applying for a cache space to store more market data.
[0006] To solve the above technical problems, the present application provides a communication method for market data, comprising:
[0007] Obtaining market data sent by a hardware device;
[0008] Applying for a cache space according to a reserved cache address and a sending density of the market data;
[0009] Storing the market data in the cache space for the server to take out;
[0010] If the market data sent by the hardware device is not obtained within a preset time, the cache space is released.
[0011] Preferably, the cache address is a low address.
[0012] Preferably, after the step of requesting cache space based on the pre-reserved cache address and the sending density of the market data, the method further includes:
[0013] Configure the size and number of protocol nodes in the cache space according to the sending density of the market data;
[0014] Accordingly, storing the market data into the cache space means storing the market data into the protocol node of the cache space.
[0015] Preferably, the method further includes: determining whether all the market data has been written to the current protocol node; if so, marking the market data in the current protocol node with the actual length of the market data; if not, marking the market data in the current protocol node with a feature value.
[0016] Preferably, after the step of determining whether all the market data has been written to the current protocol node, the method further includes: comparing whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent; if they are inconsistent, the market data is discarded.
[0017] Preferably, the determination of whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent further includes:
[0018] Determine whether the protocol nodes are consecutive nodes; if not, discard the market data.
[0019] Preferred options also include:
[0020] When the server retrieves data at a preset protocol node, it sends a transmission notification to the hardware device.
[0021] To address the aforementioned technical problems, this application also provides a communication device for market data, comprising:
[0022] The acquisition module is used to acquire market data sent by hardware devices;
[0023] The application module is used to apply for cache space based on the pre-reserved cache address and the sending density of the market data;
[0024] The storage module is used to store the market data into the cache space so that the server can retrieve it.
[0025] The release module is used to release the cache space if no more market data is received from the hardware device within a preset time.
[0026] To solve the above-mentioned technical problems, this application also provides another communication device for market data, including a memory for storing computer programs;
[0027] A processor is used to implement the steps of the market data communication method described above when executing the computer program.
[0028] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the market data communication method described above.
[0029] The market data communication method provided in this application addresses the current technology's inability to allocate sufficient cache space due to insufficient continuous cache space. This solution reserves cache addresses after memory initialization. Upon receiving market data from the hardware device, cache space is allocated based on the reserved cache addresses and the data transmission density. Since the cache addresses are pre-reserved and continuous, this space is not occupied by other data. The allocated cache space is released when no more data is received, and it can still be allocated from the reserved cache addresses in subsequent use. Therefore, the probability of allocating continuous space is greater, allowing for the storage of more market data.
[0030] Furthermore, the communication device and medium for market data provided in this application correspond to the communication method for market data and have the same effect as above. Attached Figure Description
[0031] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 A flowchart illustrating a method for communicating market data, as provided in an embodiment of this application;
[0033] Figure 2 A structural diagram of a communication device for market data provided in an embodiment of this application;
[0034] Figure 3 This is a structural diagram of another communication device for market data provided in an embodiment of this application. Detailed Implementation
[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0036] The core of this application is to provide a communication method, device, and medium for market data, which can allocate a large amount of contiguous space when applying for cache space to store more market data.
[0037] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Figure 1 A flowchart illustrating a method for communicating market data, as provided in this application embodiment, is shown below. Figure 1 As shown, the method includes:
[0039] S10: Obtain market data sent by hardware devices.
[0040] The hardware device in this embodiment refers to a Field Programmable Gate Array (FPGA), which is a further development based on programmable devices such as PAL and GAL. As a semi-custom circuit in the field of application-specific integrated circuits (ASICs), it addresses the shortcomings of custom circuits while overcoming the limitation of the limited gate count of traditional programmable devices. It receives market data uploaded from various regions via protocol interface and transmits it to the driver via the same protocol interface. The market data in this application includes not only specific financial data but also related transmission instructions and information.
[0041] S11: Request cache space based on the pre-reserved cache address and the sending density of market data.
[0042] Understandably, to ensure the integrity of market data and the speed of retrieval, the cache space in this application is contiguous, and it is only allocated when market data communication is required. In current technology, when a driver requests cache space to store market data, Direct Memory Access (DMA) technology is typically used. DMA is a hardware mechanism that allows peripheral devices and main memory to directly transfer I / O data without the involvement of the system processor. However, in practice, due to user activity, there may not be enough contiguous addresses in memory, preventing users from allocating sufficient cache space; typically, a maximum of only 4MB can be allocated. In this embodiment, cache addresses are reserved in advance using Contiguous Memory Allocator (CMA) technology. During memory usage, these cache addresses are not used to execute other commands; they are only used as cache space when market data transmission is required. The size of the available cache space is determined by the size of the reserved cache address, making it easier to allocate contiguous cache space. Understandably, the size of the pre-reserved cache address can be set based on the volume of market data in each region and the actual hardware facilities. For example, the Shanghai Stock Exchange has a large volume and high density of market data, and more hardware memory, so a larger cache address can be reserved. In this embodiment, the cache space is allocated based on the cache address, and the size of the cache space allocated each time can be dynamically adjusted according to the transmission density of market data. For example, if a transaction is frequent and the market data is large and dense, then a larger cache space will be allocated in this transaction. Understandably, due to issues such as auxiliary data or address failures, the allocated cache space should be smaller than the reserved cache address. Furthermore, memory management is performed through paging. In current technology, the default page table of the operating system is 4KB, and a maximum large page of 2MB is supported. In step S11, the size of the cache space is related to the reserved cache address. The larger the cache address, the more cache space can be, and the larger the page table supported by the operating system. When the page table becomes larger, each page can store more information, thereby reducing the number of page tables, reducing the required address translation, and reducing the number of cache misses of the Translation Lookaside Buffer (TLB), which improves memory access performance and reduces the CPU load.
[0043] S12: Store market data in the cache space so that the server can retrieve it.
[0044] S13: If no more market data is received from the hardware device within the preset time, the cache space will be released.
[0045] In step S13, the cache space needs to be released when it is no longer in use, so that it can be requested for use again later. In this embodiment, the determination of when the cache space is no longer in use is made by whether market data sent by the hardware device is received again within a preset time. In other embodiments, the cache space can also be released through user operation, such as closing the operation interface.
[0046] The market data communication method provided in this application addresses the current technology where insufficient continuous cache space prevents the allocation of enough cache space to store data. This technical solution reserves cache addresses after memory initialization. When market data sent by the hardware device is received, cache space is allocated based on the reserved cache addresses and the data transmission density. Since the cache addresses are pre-reserved and continuous, this space will not be occupied by other data. The allocated cache space is released when no more data is received, and cache space can still be allocated from the reserved cache addresses in subsequent use. Therefore, the probability of allocating continuous space is greater, allowing for the storage of more market data.
[0047] The cache address in this embodiment is reserved in advance. However, extensive experiments have shown that the lower the memory address, the faster the data transfer efficiency.
[0048] Therefore, based on the above embodiments, in this embodiment, the cache address is a low address.
[0049] In this embodiment, the reserved cache address is selected as a low address in memory, which can improve the transmission efficiency of market data compared to a high address.
[0050] In practice, market data is typically stored in the cache space, usually within the protocol nodes of that cache. Once a protocol node is full of market data, the server can retrieve the data from it. It's understandable that with a fixed cache size, the smaller each protocol node is, the more protocol nodes there are, and the easier it is for each node to fill up. This allows the server to retrieve data from a full protocol node more quickly.
[0051] Therefore, based on the above embodiments, in this embodiment, after the step of requesting cache space according to the pre-reserved cache address and the sending density of market data, the method further includes:
[0052] Configure the size and number of protocol nodes in the cache space according to the sending density of market data;
[0053] Correspondingly, storing market data in the cache space means storing market data in the protocol node of the cache space.
[0054] Understandably, once cache space is requested, protocol nodes can be configured. Similar to cache space request, the configuration of protocol nodes in this embodiment is also related to the transmission density of market data. When the transmission density of market data is high, the data transmission pressure is high. Therefore, the size of the protocol nodes is reduced so that they can be filled as soon as possible, allowing the server to retrieve data in a timely manner for subsequent transmission of other market data and avoiding data loss.
[0055] The above embodiments describe that market data will be stored in protocol nodes. In specific implementation, hardware devices receive market data from various regions. A market data may be stored in the same protocol node or it may be distributed across multiple protocol nodes. When the server retrieves market data from a protocol node, it cannot confirm whether the data retrieved from that node is the complete content of the market data, or whether there is any unretrieved data in subsequent protocol nodes.
[0056] Therefore, based on the above embodiments, this embodiment further includes:
[0057] Determine whether all market data has been written to the current protocol node. If so, mark the market data in the current protocol node with the actual length of the market data. If not, mark the market data in the current protocol node with the feature value.
[0058] In specific implementation, the length of the data will be counted. In this embodiment, 0 is used as the feature value. When the market data has filled the current protocol node and there is still some data in the next protocol node, the market data in the current protocol node is marked with 0 to represent that the data is incomplete. In the next protocol node, the length of the market data is used as the marker to represent that the data is complete.
[0059] This embodiment identifies whether the market data retrieved from the current protocol node is complete by marking the market data in the protocol node.
[0060] The above embodiment identifies whether the market data in a protocol node is complete by using feature values. In specific implementation, after receiving a protocol node marked with the actual length of the market data, it is also necessary to determine whether all protocol nodes occupied by the market data have been received.
[0061] Based on the above embodiments, in this embodiment, after determining whether all market data has been written to the current protocol node, the method further includes: comparing whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent; if they are inconsistent, the market data is discarded.
[0062] In this embodiment, the number of protocol nodes occupied by market data is counted, and the protocol nodes occupied by the same market data are marked with labels. Furthermore, considering that market data is cached in protocol nodes in the form of cache rings—that is, when market data fills a cache ring, it is overwritten from the beginning—when a market data set is very large, a single cache ring may not be sufficient to transmit the entire set of data. In this case, the feature value and actual length cannot represent the completeness of the data. Therefore, it is also necessary to count the number of cache rings occupied by the market data during the statistical analysis. Combining the number of cache rings occupied and the labels, the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server is compared to verify whether the market data is complete.
[0063] The market data communication method provided in this embodiment compares the number of protocol nodes occupied by the market data obtained by the hardware device and the market data retrieved by the server to determine whether the data is complete and whether there is any loss during the transmission process.
[0064] In the above embodiments, the completeness of market data is confirmed by counting the number of nodes. In this embodiment, the method of checking whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent also includes:
[0065] Determine if the protocol nodes are consecutive; if not, discard the market data.
[0066] After ensuring that the number of protocol nodes is consistent, this embodiment also determines whether the protocol nodes are consecutive nodes to avoid the loss of market data due to simultaneous errors in hardware devices and servers, thus further ensuring the integrity of the data.
[0067] In practice, after the server acquires a protocol node, the protocol node can continue to be used for subsequent purposes, and the hardware device can re-transmit market data.
[0068] In this embodiment, it also includes:
[0069] When the server retrieves data at a preset protocol node, it sends a transmission notification to the hardware device.
[0070] The market data communication method provided in this embodiment involves the server sending a transmission notification to the hardware device after retrieving the market data, so that the protocol node can be reused to transmit the data.
[0071] In the above embodiments, the communication method for market data has been described in detail. This application also provides embodiments corresponding to the communication device for market data. It should be noted that this application describes the embodiments of the device from two perspectives: one is based on the functional modules, and the other is based on the hardware.
[0072] Figure 2 A structural diagram of a communication device for market data provided in this application embodiment is shown below. Figure 2 As shown, the device includes:
[0073] The acquisition module 10 is used to acquire market data sent by the hardware device;
[0074] Application module 11 is used to apply for cache space based on the pre-reserved cache address and the sending density of market data;
[0075] Storage module 12 is used to store market data into the cache space so that the server can retrieve it;
[0076] Release module 13 is used to release the cache space if no more market data sent by the hardware device is obtained within a preset time.
[0077] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0078] The communication device for market data provided in this application embodiment addresses the issue in the prior art where insufficient continuous cache space prevents the allocation of enough cache space to store data. This technical solution reserves cache addresses after memory initialization. When market data sent by the hardware device is received, cache space is allocated based on the reserved cache addresses and the data transmission density. Since the cache addresses are pre-reserved and continuous, this space will not be occupied by other data. The allocated cache space is released when no more data is received, and cache space can still be allocated from the reserved cache addresses in subsequent use. Therefore, the probability of allocating continuous space is greater, allowing for the storage of more market data.
[0079] Figure 3 A structural diagram of another market data communication device provided in the embodiments of this application is shown below. Figure 3 As shown, the device includes: a memory 20 for storing computer programs;
[0080] The processor 21 is used to execute a computer program to implement the steps of the communication method for market data as described in the above embodiment.
[0081] The communication device for market data provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0082] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0083] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the market data communication method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary storage or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, market data.
[0084] In some embodiments, the communication device for market data may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0085] Those skilled in the art will understand that Figure 3 The structure shown does not constitute a limitation on the communication device for market data and may include more or fewer components than shown.
[0086] The market data communication device provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following methods: acquiring market data sent by the hardware device; applying for cache space according to the pre-reserved cache address and the sending density of market data; storing the market data in the cache space so that the server can retrieve it; and releasing the cache space if no more market data sent by the hardware device is acquired within a preset time.
[0087] The communication device for market data provided in this application embodiment addresses the issue in the prior art where insufficient continuous cache space prevents the allocation of enough cache space to store data. This technical solution reserves cache addresses after memory initialization. When market data sent by the hardware device is received, cache space is allocated based on the reserved cache addresses and the data transmission density. Since the cache addresses are pre-reserved and continuous, this space will not be occupied by other data. The allocated cache space is released when no more data is received, and cache space can still be allocated from the reserved cache addresses in subsequent use. Therefore, the probability of allocating continuous space is greater, allowing for the storage of more market data.
[0088] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.
[0089] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0090] The communication method, apparatus, and medium for market data provided in this application have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0091] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for communicating market data, characterized in that, include: Obtain market data sent by hardware devices; Request cache space based on the pre-reserved cache address and the sending density of the market data; The market data is stored in the cache space so that the server can retrieve it. If no more market data is received from the hardware device within a preset time, the cache space will be released. The step of requesting cache space based on the pre-reserved cache address and the sending density of the market data further includes: Configure the size and number of protocol nodes in the cache space according to the sending density of the market data; Accordingly, storing the market data into the cache space means storing the market data into the protocol node of the cache space; The method further includes: determining whether all the market data has been written to the current protocol node; if so, marking the market data in the current protocol node with the actual length of the market data; if not, marking the market data in the current protocol node with a feature value. After the step of determining whether all the market data has been written to the current protocol node, the method further includes: The number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are compared. If they are inconsistent, the market data is discarded. Whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent also includes: Determine whether the protocol nodes are consecutive nodes; if not, discard the market data. The market data is cached in the protocol node in the form of a cache ring; Accordingly, the method further includes: Count the number of cache rings occupied by the market data.
2. The communication method for market data according to claim 1, characterized in that, The cache address is a low address.
3. The communication method for market data according to claim 1, characterized in that, Also includes: When the server retrieves data at a preset protocol node, it sends a transmission notification to the hardware device.
4. A communication device for market data, characterized in that, include: The acquisition module is used to acquire market data sent by hardware devices; The application module is used to apply for cache space based on the pre-reserved cache address and the sending density of the market data; The storage module is used to store the market data into the cache space so that the server can retrieve it. The release module is used to release the cache space if no more market data sent by the hardware device is received within a preset time. The device is further configured to: configure the size and number of protocol nodes in the cache space according to the sending density of the market data; Accordingly, the storage module is specifically used to store the market data into the protocol node of the cache space; The device is further configured to: determine whether all the market data has been written to the current protocol node; if so, mark the market data in the current protocol node with the actual length of the market data; if not, mark the market data in the current protocol node with a feature value. The device is further configured to: compare whether the number of protocol nodes occupied by the market data obtained from the hardware device and the market data retrieved from the server are consistent; if they are inconsistent, discard the market data. The device is further configured to: determine whether the protocol nodes are consecutive nodes; if not, discard the market data. The market data is cached in the protocol node in the form of a cache ring; Accordingly, the device is also used to: count the number of buffer rings occupied by the market data.
5. A communication device for market data, characterized in that, Includes memory used to store computer programs; A processor, configured to implement the communication method for market data as described in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the market data communication method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Cache method and cache device
CN103067467A
Message communication method, device and apparatus, and readable storage medium
CN108958952A
Storage space release method and system
CN109189770A