A method for caching application layer network data

By adopting the application layer network data caching method and multi-channel parallel publish-subscribe mechanism in financial transaction software, the problems of data discarding and delay in data transmission are solved, and efficient, reliable and low-latency data transmission is achieved.

CN114186163BActive Publication Date: 2025-04-01SHANGHAI FINANCIAL FUTURES INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111542793.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2025-04-01
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

Financial transaction software is prone to data discarding and delay problems during data transmission, especially when the receiving end processing rate is low or the network load is too heavy, resulting in overflow of the sending buffer area.

Method used

The application-layer network data caching method is adopted, and the multi-channel parallel publish-subscribe mechanism is realized through the thread pool mechanism, and the fast queue container and linked table memory node management is used to achieve efficient data incoming and dequeuing operations, and share data publishing tasks in a multi-network card environment.

Benefits of technology

It improves the throughput of data transmission, reduces overall delay, ensures high reliability and low latency transmission of data, and avoids the risks of data discarding and cache area overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114186163B_ABST
    Figure CN114186163B_ABST
Patent Text Reader

Abstract

This invention discloses an application-layer network data caching method, which implements a mechanism for managing network data caching at the application layer after the performance capacity of the communication middleware exceeds its limit. The technical solution is as follows: the method is adapted to the multi-channel parallel publish-subscribe mechanism based on a thread pool in multi-link reliable transmission communication components. When the receiving end does not accept data or its processing rate is lower than the sending rate, resulting in the underlying system's receiving buffer being full, the publishing end stores the unsuccessfully sent data in the application-layer buffer until there is space in the system's underlying sending queue for the corresponding sending channel. Then, the data in the application-layer buffer is rewritten sequentially into the sending queue for transmission. The application-layer network data caching method includes multi-threaded fixed memory pool allocation in memory management, memory reclamation in memory management, thread-local storage in memory management, and a message publishing process at the publishing end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a data caching method, and in particular to an application layer network data caching method applicable to the field of financial transaction software. Background Art

[0002] During the development and use of financial trading software, it is inevitable to involve data flow transmission between different modules. The data transmission between modules is generally entrusted to the transmission communication component, also known as communication middleware.

[0003] For transmission communication components, the communication channel, that is, the communication channel through which data needs to be transmitted, is crucial. For data transmission between different machines, the communication channel can be divided into four types: TCP, UDP broadcast, UDP unicast, and UDP multicast. For the scenario of data transmission between different machines, in order to ensure high data reliability, that is, for the messages generated by the publisher, it is necessary to ensure that the receiving end can receive them in order, a streaming communication mode is generally used, such as TCP communication.

[0004] As we all know, network congestion occurs:

[0005] (1) When multiple different nodes send data packets to the same target node at the same time, the network switch will queue them and then forward the data packets to the target network in turn. If the network is overloaded, the data packet may have to wait for a while before getting a chance to send. If the amount of data is too large, the switch queue is full and the subsequent data packets will be discarded.

[0006] (2) When the data packet arrives at the target machine, if all CPU cores are busy, the network data packet request will be queued by the operating system until the application can process it. Depending on the configuration and load of the machine, an uncertain waiting time will also be introduced here.

[0007] In order to meet the low latency characteristics of financial trading software, the publisher supports multi-channel parallel publishing. However, the underlying sending buffer of the system is limited. When the receiving end does not accept data, or the processing rate of the receiving end is lower than the sending rate of the publisher, its receiving buffer is full, which in turn causes the data sender's sending buffer to accumulate data or even fill up the buffer. At this time, an application-layer data cache management mechanism is needed.

[0008] Since the transmission and communication components of financial trading software need to meet the characteristics of low latency and high reliability, the network data cache management components of the application layer also need to have the following characteristics:

[0009] (1) The underlying data queue management needs to support high-performance enqueue and dequeue operations.

[0010] (2) Supports multi-threaded access security and supports the publishing end to use multi-threaded multi-channel parallel publishing mode.

[0011] However, there is no cache management system in the industry that implements the above-mentioned mechanism and features. Summary of the invention

[0012] A brief summary of one or more aspects is given below to provide a basic understanding of these aspects. This summary is not an exhaustive overview of all conceived aspects, and is neither intended to identify the key or critical elements of all aspects nor to define the scope of any or all aspects. Its only purpose is to give some concepts of one or more aspects in a simplified form as a prelude to a more detailed description that will be given later.

[0013] The purpose of the present invention is to solve the above-mentioned problems and provide an application layer network data caching method, which realizes a mechanism for managing the network data cache at the application layer by the communication middleware after the performance capacity exceeds the limit, realizes high-performance queuing and dequeuing operations, and for a communication environment with multiple network cards, allows the publisher to make full use of the transmission channels provided by different network cards to publish topic streams in parallel, thereby improving throughput and reducing overall latency, and the publisher and subscriber support multi-threaded parallel publishing and subscription.

[0014] The technical solution of the present invention is as follows: the present invention discloses an application layer network data caching method, the method is adapted to a multi-channel parallel publish-subscribe mechanism of a multi-link reliable transmission communication component based on a thread pool mechanism, the multi-link reliable transmission communication component comprises a publishing end and a receiving end, when the receiving end does not accept data or the processing rate of the receiving end is lower than the sending rate of the publishing end, resulting in its underlying system receiving buffer being full, the publishing end first stores the data that has not been successfully sent into the application layer buffer until there is space in the underlying sending queue of the system corresponding to the sending channel, and then re-writes the data in the application layer buffer into the sending queue in sequence for sending, the application layer network data caching method comprises a process of allocating a multi-threaded fixed memory pool in memory management, recycling memory in memory management, storing thread local storage in memory management, and publishing messages by the publishing end.

[0015] According to an embodiment of the application layer network data caching method of the present invention, the publishing end maintains multiple session channels through a session container to publish data of the subject stream, and the receiving end accesses multiple session channels to receive messages of the subject stream, wherein each publishing session of the publishing end runs independently in different thread entities to realize parallel publishing of messages; correspondingly, each receiving session of the receiving end runs independently in different thread entities to realize parallel receiving of messages.

[0016] According to an embodiment of the application layer network data caching method of the present invention, for a multi-network card environment, a session channel is allocated on each network card, and the task of publishing the data of the subject stream is allocated to each session channel.

[0017] According to an embodiment of the application layer network data caching method of the present invention, the processing of multi-threaded fixed memory pool allocation in memory management is further configured as follows:

[0018] The addresses of each memory node in the application layer cache are stored in a linear cache of a queue data structure using a fast queue container. The linear cache is a fast queue-based container used to maintain all memory nodes. Relying on the first-in-first-out feature of the fast queue, the unsent data is queued to the end of the queue, and then the data is taken from the head of the queue for sending. The interface layer of the memory node adopts a linked list format.

[0019] According to an embodiment of the application layer network data caching method of the present invention, the processing of memory recycling in memory management is further configured as follows:

[0020] When a memory node is used, a memory node is dequeued from the linear cache. When the read and write positions of the memory node are the same, the memory node resets the read and write positions to zero to indicate that the entire memory of the memory node is idle. At this time, if the linear cache has at least one memory node, the idle memory node is recycled by enqueuing it to the linear cache.

[0021] According to an embodiment of the application layer network data caching method of the present invention, the processing of thread local storage in memory management is further configured as follows:

[0022] Use the singleton mode to establish a memory node pool factory. The memory node pool factory has a built-in global table. The memory node pool factory uses the current thread number to query the address of each memory node pool in the built-in global table, so that each thread has its own independent data backup.

[0023] According to an embodiment of the application layer network data caching method of the present invention, the processing of thread local storage in memory management further includes:

[0024] When the application layer stores data in the application layer cache for the first time, there is no memory node in the application layer cache, and the memory node pool factory is requested for a memory node. The memory node pool factory uses the current thread number to find the address of the corresponding memory node pool. If the corresponding memory node pool does not exist yet, a new memory node pool is created.

[0025] After the memory node pool is created, a fixed memory is applied to establish a memory node, and then data is cached on the established memory node. After the established memory node is used, it is recycled to the created memory node pool;

[0026] When the application layer stores data into the application layer cache area next time, the memory node factory finds the previously created memory node pool according to the current thread number, and then extracts the previously created idle memory node from the found memory node pool to cache data on it.

[0027] According to an embodiment of the application layer network data caching method of the present invention, the process of the publishing end publishing the message further includes:

[0028] Step 1: The publisher starts publishing data. First, it confirms whether the session is in the session container. If it is in the session container, it finds the corresponding session channel and calls the sending method through the session channel. If it is not in the session container, the sending task ends.

[0029] Step 2: Each time the sending method is called, first determine whether the application layer buffer area of ​​the corresponding session channel is empty. If the application layer buffer area is empty, directly call the socket's sending method to push the data into the system layer buffer area, and put the data that has not been successfully pushed into the system layer buffer area into the application layer buffer area; if the application layer buffer area is not empty, directly put the data into the application layer buffer area and send it asynchronously;

[0030] Step 3: When data enters the application layer cache, a data write signal is immediately added to the input and output service, and the data write action is triggered through the input and output service mechanism. The data with the maximum send byte at the front is read from the application layer cache, and the application layer cache sends data by dequeueing until all the data in the application layer cache is sent.

[0031] Compared with the prior art, the present invention has the following beneficial effects: The present invention has the following innovations: (1) It provides a simple user interface, and the user does not need to worry about how to apply for and destroy memory internally. (2) Each memory node in the application layer cache area adopts a fast queue container to ensure the efficiency of data appending and reading. The interface layer adopts a linked list type to ensure the efficiency of data search. (3) It adapts to the multi-channel parallel "publish-subscribe" mechanism based on the thread pool mechanism of the high-performance multi-link reliable transmission communication component. For a topic stream, the publisher can publish the data of the topic stream through multiple session channels, and the receiver can access multiple session channels to receive topic stream messages. Each publishing session of the publisher can run independently in different thread entities to realize parallel publishing of messages; similarly, each receiving session of the receiver can also run independently in different thread entities to realize parallel collection of messages. For a multi-network card environment, a session channel can be allocated to each network card to fully utilize the transmission capacity of multiple network cards and distribute the data publishing tasks to each session channel. There is no need to worry about the risk of data loss and damage caused by hitting the machine performance bottleneck, thereby improving the overall throughput and reducing message delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The above features and advantages of the present invention can be better understood after reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings. In the drawings, the components are not necessarily drawn to scale, and components with similar related properties or features may have the same or similar reference numerals.

[0033] Figure 1 The overall architecture diagram of the application scenario of the application layer network data caching method of the present invention is shown.

[0034] Figure 2 A schematic diagram of a multi-threaded fixed memory pool allocation mechanism in memory management in an embodiment of the application layer network data caching method of the present invention is shown.

[0035] Figure 3 A schematic diagram of a memory recycling mechanism in memory management in an embodiment of the application layer network data caching method of the present invention is shown.

[0036] Figure 4 A schematic diagram of a thread local storage mechanism in memory management in an embodiment of an application layer network data caching method of the present invention is shown.

[0037] Figure 5 A schematic diagram showing a workflow for publishing end messages in an embodiment of the application layer network data caching method of the present invention is shown. DETAILED DESCRIPTION

[0038] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. Note that the aspects described below in conjunction with the accompanying drawings and specific embodiments are only exemplary and should not be construed as limiting the scope of protection of the present invention in any way.

[0039] Figure 1 The overall architecture of the application scenario of the application layer network data caching method of the present invention is shown. The application layer network data caching method is configured on the sending channel of the publishing end. The function to be implemented by the application layer network data caching method in the overall architecture is: when the receiving end does not accept data, or the processing rate of the receiving end is lower than the sending rate of the publishing end, resulting in the receiving buffer area of ​​the underlying system of the receiving end being full, the publishing end will first store the data that has not been successfully sent into the application layer buffer area, until there is space in the sending queue of the underlying system of the corresponding sending channel, and then re-write the data in the application layer buffer area into the sending queue in sequence for sending.

[0040] like Figure 1 As shown in the figure, the multi-channel parallel "publish-subscribe" mechanism based on the thread pool mechanism is adapted to the high-performance multi-link reliable transmission communication component. For a topic stream, the publisher can maintain multiple session channels through the session container to publish the data of the topic stream, and the receiver can access multiple session channels to receive the topic stream messages. Each publishing session of the publisher can run independently on different thread entities (such as Figure 1 In the thread 1 to thread n in the process, the message can be published in parallel; similarly, each receiving session at the receiving end can also run independently in different thread entities to receive messages in parallel. For a multi-NIC environment, a session channel can be allocated to each NIC to fully utilize the transmission capabilities of multiple NICs and distribute the data publishing tasks to each session channel. There is no need to worry about the risk of data loss and damage caused by hitting the machine performance bottleneck, thereby improving the overall throughput and reducing message delay.

[0041] The embodiment of the application layer network data caching method of the present invention includes the following parts: Figure 2 As shown in the multi-threaded fixed memory pool allocation in memory management, Figure 3 As shown in the memory management for memory recycling, Figure 4 Thread local storage in memory management, and Figure 5 The workflow of message publishing on the publisher side is shown.

[0042] Figure 2 The implementation of the multi-threaded fixed memory pool allocation mechanism in memory management in the method of this embodiment is shown.

[0043] like Figure 2As shown in the figure, it is the principle of memory node allocation by a multi-threaded fixed memory pool allocator. Each memory node in the application layer cache uses a fast queue container to ensure the efficiency of data appending and reading. The interface layer of the memory node adopts a linked list format to ensure the efficiency of data search. The memory space requested by the multi-threaded fixed memory pool allocator from the memory node pool thread_catch_pool each time is called a memory node Catch_node. The address of each memory node is saved in a linear buffer List_buffer of a queue structure using a fast queue container. When each memory node is initialized, a fixed size of 10M memory space is requested. Each memory node contains an integer variable Write_loc to record the location where the current data of this memory node is written. Modifying this variable value can record the address of the next write after the current data is written. There is also an integer variable read_loc to record the location where the current data of this memory node is read. The address of this data read can be obtained through this variable value. After the reading is completed, modifying this variable marks the address of the next read.

[0044] The linear buffer is a container based on the fast queue used to maintain all memory nodes. For the application layer, each socket corresponds to a buffer, and the socket is used to send data on the session channel of the publisher. The linear buffer relies on the first-in-first-out feature of the fast queue to put the unsent data into the queue at the end, and then take the data from the head of the queue for sending.

[0045] Figure 3 The principle of the memory recycling mechanism in memory management in the method of this embodiment is shown. Figure 3 As shown in the figure, it is the implementation of memory recycling by a multi-threaded fixed memory pool allocator. When a memory node is needed, a memory node is popped out (a well-known operation process of the queue data structure, i.e., dequeuing) from the linear cache of the queue data structure. When the read and write positions of a memory node (the position for reading data is write_loc in the figure, and the position for writing data is read_loc in the figure) are the same, it means that there is no new data to be cached at this time. The memory node will reset the read and write positions to zero to indicate that the entire memory of this memory node is idle. At this time, if the entire linear cache has more than one memory node, the idle memory node can be recycled. Figure 3 The action of pushing (a well-known operation processing of queue data structure, i.e., entering into a queue) a memory node to the memory node pool means that the idle memory node is recycled.

[0046] Figure 4 It is shown that the thread local storage mechanism in memory management in the method of this embodiment realizes simultaneous support for multi-threaded access and has the characteristic of high concurrency.

[0047] Thread local storage technology is used to associate data with a specific thread being executed. Generally speaking, global variables in a process and static variables defined in a function are shared by all threads. If one thread modifies them, all threads will be affected, which raises thread safety issues. If thread synchronization is used, a lot of additional overhead will be generated, and the complexity of the synchronization code will also make maintenance difficult. Figure 4 As shown, this embodiment uses the singleton mode to establish a memory node pool factory (thread_catch_pool_factory), and the memory node pool factory has a built-in global table. The memory node pool factory uses the current thread number (thread ID) to query the address of the memory node pool (thread_catch_pool1&2) in the built-in global table, so that each thread (thread1&2 shown in the figure) has its own independent data backup.

[0048] When the application layer stores data in the application layer cache for the first time, there is no memory node in the application layer cache, so it requests a memory node from the memory node pool factory. The memory node pool factory uses the current thread number to find the address of the corresponding memory node pool. If the corresponding memory node pool does not exist yet, a new memory node pool will be created. After the memory node pool is created, a fixed memory is requested to establish a memory node, and then data is cached on the established memory node. The established memory node is recycled to the created memory node pool after use. When the application layer stores data in the application layer cache next time, the memory node factory finds the previously created memory node pool according to the current thread number, and then extracts the previously established idle memory node from the found memory node pool to cache data on it.

[0049] Figure 5 The flowchart of the method of this embodiment for publishing messages on the publishing end is shown.

[0050] Step 1: The publisher on the server side starts publishing data. First, it confirms whether the session is in the session container. If it is in the session container, it finds the corresponding session channel and calls the send method through this session channel. If it is not in the session container, the sending task ends.

[0051] pass Figure 5 It can be seen from the process that users can send data through a simple calling interface without worrying about how to apply for and destroy the memory occupied by the data internally.

[0052] Step 2: Each time the sending method is called, first determine whether the application layer buffer area of ​​the corresponding session channel is empty. If the application layer buffer area is empty, directly call the socket's sending method to push the data into the system layer buffer area, and put the data that has not been successfully pushed into the system layer buffer area into the application layer buffer area; if the application layer buffer area is not empty (indicating that there is a backlog of data before), put the data directly into the application layer buffer area and send it asynchronously.

[0053] The publisher publishes messages through multiple session channels, each of which is in its own thread and each sends data through a socket.

[0054] Step 3: When data enters the application layer cache, a data write signal is immediately added to the input and output service (IO service). The data write action is triggered through the IO service mechanism, and the data with the maximum send byte at the front is read from the application layer cache. The application layer cache sends data by dequeueing until all the data in the application layer cache is sent.

[0055] Although the above methods are illustrated and described as a series of actions for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the actions, because according to one or more embodiments, some actions may occur in a different order and / or concurrently with other actions from those illustrated and described herein or not illustrated and described herein but understandable to those skilled in the art.

[0056] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. The technician may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.

[0057] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in cooperation with a DSP core, or any other such configuration.

[0058] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, a storage medium may be integrated into a processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and the storage medium may reside in a user terminal as discrete components.

[0059] In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented as a computer program product in software, each function may be stored on or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include both computer storage media and communication media, including any medium that facilitates the transfer of a computer program from one place to another. Storage media may be any available medium that can be accessed by a computer. As an example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer. Any connection is also properly referred to as a computer-readable medium. For example, if the software is transmitted from a website, a server, or other remote source using a coaxial cable, a fiber optic cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wherein disk often reproduces data magnetically, while disc reproduces data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0060] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for caching application layer network data, characterized in that: The method is adapted to a multi-channel parallel publish-subscribe mechanism based on a thread pool mechanism of a multi-link reliable transmission communication component. The multi-link reliable transmission communication component includes a publisher and a receiver. When the receiver does not accept data or the processing rate of the receiver is lower than the sending rate of the publisher, resulting in the bottom system receiving buffer being full, the publisher stores the unsuccessfully sent data in the application layer buffer until there is space in the bottom system sending queue of the corresponding sending channel, and then re-writes the data in the application layer buffer into the sending queue in sequence for sending. The application layer network data caching method includes multi-threaded fixed memory pool allocation in memory management, memory recycling in memory management, thread local storage in memory management, and a message publishing process of the publisher. Among them, the processing of multi-threaded fixed memory pool allocation in memory management is further configured as follows: The addresses of each memory node in the application layer cache are stored in a linear cache of a queue data structure using a fast queue container. The linear cache is a fast queue-based container used to maintain all memory nodes. Relying on the first-in-first-out feature of the fast queue, the unsent data is queued to the end of the queue, and then the data is taken from the head of the queue for sending. The interface layer of the memory node adopts a linked list format. Among them, the processing of memory recycling in memory management is further configured as follows: When a memory node is used, a memory node is dequeued from the linear cache. When the read and write positions of the memory node are the same, the memory node resets the read and write positions to zero to indicate that the entire memory of the memory node is idle. At this time, if the linear cache has at least one memory node, the idle memory node is recycled by enqueuing it to the linear cache. The processing of thread local storage in memory management is further configured as follows: Use the singleton mode to establish a memory node pool factory. The memory node pool factory has a built-in global table. The memory node pool factory uses the current thread number to query the address of each memory node pool in the built-in global table, so that each thread has its own independent data backup.

2. The method for caching application layer network data according to claim 1, characterized in that: The publishing end maintains multiple session channels through the session container to publish the data of the topic stream, and the receiving end accesses multiple session channels to receive the messages of the topic stream, wherein each publishing session of the publishing end runs independently in different thread entities to realize parallel publishing of messages; correspondingly, each receiving session of the receiving end runs independently in different thread entities to realize parallel receiving of messages.

3. The application layer network data caching method according to claim 2, characterized in that: For a multi-NIC environment, a session channel is allocated on each NIC, and the task of publishing the topic stream data is distributed to each session channel.

4. The application layer network data caching method according to claim 1, characterized in that: The processing of thread local storage in memory management also includes: When the application layer stores data in the application layer cache for the first time, the application layer cache If there is no memory node in the memory node pool, the memory node pool factory is requested to apply for the memory node. The memory node pool factory uses the current thread number to find the address of the corresponding memory node pool. If the corresponding memory node pool does not exist, a new memory node pool is created. After the memory node pool is created, a fixed memory is applied to establish a memory node, and then data is cached on the established memory node. After the established memory node is used, it is recycled to the created memory node pool; When the application layer stores data into the application layer cache area next time, the memory node factory finds the previously created memory node pool according to the current thread number, and then extracts the previously created idle memory node from the found memory node pool to cache data on it.

5. The application layer network data caching method according to claim 1, characterized in that: The process of publishing messages on the publishing end further includes: Step 1: The publisher starts publishing data. First, it confirms whether the session is in the session container. If it is in the session container, it finds the corresponding session channel and calls the sending method through the session channel. If it is not in the session container, the sending task ends. Step 2: Each time the sending method is called, first determine whether the application layer buffer area of ​​the corresponding session channel is empty. If the application layer buffer area is empty, directly call the socket's sending method to push the data into the system layer buffer area, and put the data that has not been successfully pushed into the system layer buffer area into the application layer buffer area; if the application layer buffer area is not empty, directly put the data into the application layer buffer area and send it asynchronously; Step 3: When data enters the application layer cache, a data write signal is immediately added to the input and output service, and the data write action is triggered through the input and output service mechanism. The data with the maximum send byte at the front is read from the application layer cache, and the application layer cache sends data by dequeueing until all the data in the application layer cache is sent.

Citation Information

Patent Citations

  • Multi-link transmission system is provided

    CN111314217A

  • Data transmission method, device and system based on distributed storage system

    CN111522663A