Data access processing method, device, equipment, storage medium and program product

By continuously mapping the target storage area in virtual memory, it solves the performance problems caused by buffer boundaries in TCP communication and file streaming, achieves efficient data access processing, avoids the movement of unconsumed parts, and improves operating performance.

CN118573674BActive Publication Date: 2024-10-22HUNDSUN TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411046766.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-10-22
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

In the existing technology, in TCP communication and file stream transmission, the data receiver moves unconsumed parts due to buffer boundaries, which consumes CPU time and memory bandwidth and affects operating performance.

Method used

By mapping the target storage area twice in a row in the virtual memory, we obtain the first view and the second view with the same length and the same data stored in the Nth position, and determine the target data that can be written to the data to be stored to avoid unconsumed data. Partially moved, written directly to the target storage area.

Benefits of technology

It improves the efficiency and performance of data access processing, reduces the consumption of CPU time and memory bandwidth, and improves the utilization of the target storage area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118573674B_ABST
    Figure CN118573674B_ABST
Patent Text Reader

Abstract

The present application provides a data access processing method, device, equipment, storage medium and program product, wherein the method includes: receiving data to be stored; determining target data in the data to be stored that can be written into the first view and the second view according to the storage information of the stored data in the first view or the second view; writing the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and writing the target data into the target storage area based on the first view or the second view. The present application avoids operating on the unconsumed part in the target storage area, improves the utilization rate of the target storage area, reduces the unnecessary CPU time consumption and memory bandwidth consumption caused by the movement of the unconsumed part, and improves the operation performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data access processing method, device, equipment, storage medium and program product. Background Art

[0002] In scenarios such as Transmission Control Protocol (TCP) communication and file stream reading, there may be differences in the data transmission speed between the sender and receiver of network communication. In order to improve the efficiency and reliability of data transmission, a buffer is usually set so that the receiver can store data in the buffer before the data is read by the application.

[0003] In the prior art, a recyclable buffer is usually set in the continuous memory to receive and buffer data. However, due to the characteristics of TCP communication or file stream transmission, the receiver may first receive the first part of the data of a continuous logical segment, then encounter the buffer boundary, and then receive the second part of the data of the continuous logical segment. In order for the program to process this logical segment in the continuous memory, it is often necessary to move the unconsumed part to the head of the buffer.

[0004] However, this processing method of moving the unconsumed portion to the head of the buffer results in consumption of CPU time and memory bandwidth, affecting operating performance. Summary of the invention

[0005] The purpose of this application is to provide a data access processing method, device, equipment, storage medium and program product to address the deficiencies in the above-mentioned prior art, so as to solve the problems in the prior art of consuming CPU time, consuming memory bandwidth and affecting operating performance.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a data access processing method, the method comprising:

[0008] receiving data to be stored;

[0009] Determine, according to storage information of stored data in the first view or the second view, target data in the data to be stored that can be written into the first view and the second view, wherein the first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: length and end position;

[0010] The target data are written into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and the target data are written into the target storage area based on the first view or the second view.

[0011] In a second aspect, another embodiment of the present application provides a data access processing device, the device comprising:

[0012] A receiving module, used for receiving data to be stored;

[0013] a determination module, configured to determine, according to storage information of stored data in the first view or the second view, target data in the data to be stored that can be written into the first view and the second view, wherein the first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: a length and an end position;

[0014] A writing module is used to write the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and write the target data into the target storage area based on the first view or the second view.

[0015] In the third aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.

[0016] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.

[0017] In the fifth aspect, another embodiment of the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of any method described in the first aspect above.

[0018] The beneficial effects of the present application are as follows: by receiving data to be stored and mapping the target storage area twice in a row in the virtual memory, a first view and a second view with the same length and the same data stored at the Nth position can be obtained, and the first address of the second view is adjacent to the last address of the first view, so that the target data that can be written into the first view and the second view in the data to be stored can be determined according to the storage information of the stored data in the first view or the second view, thereby ensuring that data access processing can be performed with the maximum utilization of the first view and the second view, so that the target storage area can store the target data with the maximum space utilization, and on this basis, according to the end position of the stored data and the length of the target data, the target data is written into the first view and the second view respectively, and the target data is written into the target storage area based on the first view or the second view, The target data can be stored immediately after the stored data, so that the target data and the stored data can be stored continuously. Moreover, due to the mapping relationship between the first view, the second view and the target storage area, a continuous memory space with the same length as the theoretical storable space of the first view or the second view can appear in the first view and the second view. That is to say, based on the mapping relationship between the first view, the second view and the target storage area, after the target data is stored in the first view and the second view, the data stored in the target storage area can be updated synchronously, so that the target data can be written into the target storage area, and the movement of the unconsumed part in the target storage area is avoided. Therefore, on the basis of improving the utilization rate of the target storage area, unnecessary CPU time consumption and memory bandwidth consumption caused by the movement of the unconsumed part are reduced, thereby improving the operation performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A schematic diagram of using a buffer zone in the prior art;

[0021] Figure 2 A flowchart of a data access processing method provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a target storage area, a first view, and a second view in the data access processing method provided in an embodiment of the present application;

[0023] Figure 4Another schematic diagram of a target storage area, a first view, and a second view in the data access processing method provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of a flow chart of writing target data into a first view and a second view respectively in a data access processing method provided in an embodiment of the present application;

[0025] Figure 6 A schematic diagram of a first view, a second view, and a target storage area when writing target data in the data access processing method provided in an embodiment of the present application;

[0026] Figure 7 A schematic diagram of determining the storage end position of target data in the data access processing method provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of writing target data into a first view and a second view in a scrolling manner in the data access processing method provided in an embodiment of the present application;

[0028] Fig. 9 Another schematic diagram of writing target data into a first view and a second view in a scrolling manner in the data access processing method provided in an embodiment of the present application;

[0029] Fig.10 A schematic diagram of a flow chart of writing target data into a first view and a second view in a rolling manner in a data access processing method provided in an embodiment of the present application;

[0030] Fig.11 Another schematic diagram of writing target data into the first view and the second view in a scrolling manner in the data access processing method provided in the embodiment of the present application;

[0031] Fig.12 A schematic diagram of a flow chart for reading data to be read in the data access processing method provided in an embodiment of the present application;

[0032] Fig.13 A schematic diagram of a flow chart for determining a read end position in a data access processing method provided in an embodiment of the present application;

[0033] Fig.14 A schematic diagram of sequentially reading data to be read in the data access processing method provided in an embodiment of the present application;

[0034] Fig.15 Another schematic diagram of sequentially reading data to be read in the data access processing method provided in an embodiment of the present application;

[0035] Fig.16 A schematic diagram of a process for updating the starting position of the data stored in the first view and the starting position of the data stored in the second view in the data access processing method provided in an embodiment of the present application;

[0036] Fig.17 Another schematic diagram of updating the starting position of the data stored in the first view and the starting position of the data stored in the second view in the data access processing method provided in the embodiment of the present application;

[0037] Fig.18 A schematic diagram of a data access processing device provided in an embodiment of the present application;

[0038] Fig.19 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0040] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0041] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0042] In the prior art, a recyclable buffer is usually set in the continuous memory to receive and buffer data. However, due to the characteristics of TCP communication or file stream transmission, the receiver may first receive the first part of the data of a continuous logical segment, then encounter the buffer boundary, and then receive the second part of the data of the continuous logical segment. In order for the program to process this logical segment in the continuous memory, it is often necessary to move the unconsumed part to the buffer header, so that the buffer can store as many continuous logical segments as possible and improve the utilization of the buffer.

[0043] For example, Figure 1 This is a schematic diagram of the use of a buffer in the prior art, referring to Figure 1 As shown, in the prior art, a buffer is set in the continuous memory of the receiver, and the address of the buffer starts from 0x1000000 and ends at 0x1007FFF, that is, the buffer is designed to store 32kb of data. Among them, the memory from address 0x1002000 to address 0x1003FFF has stored the data that the receiver has received in the past but has not read yet, that is, there is an 8kb unconsumed part, and the memory of the remaining addresses is in an idle state. At this time, the receiver receives the first 16kb of data of a continuous logical segment, and the receiver stores the first 16kb of data of the continuous logical segment in the memory from address 0x1004000 to address 0x1007FFF, and then encounters the buffer boundary, that is, the next address of 0x1007FFF. At the next moment, the receiver receives the last 8kb of data of the continuous logical segment.

[0044] It can be seen that continuing to refer to Figure 1 As shown, when the continuous logic fragment is not stored, the buffer has 24kb of free storage space in theory, specifically including 8kb of free storage space before the unconsumed part, and 16kb of free storage space after the unconsumed part. However, since the free 8kb storage space is before the unconsumed part, and the program needs to process this continuous logic fragment on continuous memory, the prior art needs to move the unconsumed part to the head of the buffer, and move the first 16kb of the continuous logic fragment to the back of the unconsumed part, so that the last 8kb of the continuous logic fragment can be stored after the first 16kb of the continuous logic fragment, so that the continuous logic fragment can be stored in the buffer, thereby improving the utilization rate of the buffer.

[0045] However, the processing method adopted in the prior art to move the unconsumed part to the head of the buffer may involve multi-threaded asynchronous reception or transmission. At the same time, since the data may need to be moved, it will increase the difficulty or performance of using atomic operations to achieve multi-threaded concurrency, resulting in consumption of CPU time and memory bandwidth, affecting operating performance.

[0046] Based on the above problem, the embodiment of the present application proposes a data access processing method, which maps the target storage area twice in a virtual memory to obtain a first view and a second view with the same length and the same data stored at the Nth position, and the first address of the second view is adjacent to the last address of the first view, so that when writing the data to be stored, the data to be stored can be written to the corresponding positions of the first view and the second view at the same time, and the target data is written into the target storage area based on the first view or the second view, and the mapping relationship between the first view, the second view and the target storage area can make the data stored in the first view, the second view and the target storage area consistent, so as to achieve writing the data to be stored in the target storage area. At the same time, because the first view and the second view are connected head to tail, a continuous memory space with the same length as the theoretical storable space of the first view or the second view can appear in the first view and the second view, that is, there is no need to move the unconsumed part, and the continuous logical fragments can be continuously stored through the mapping relationship between the first view, the second view and the target storage area, so as to improve the utilization rate of the target storage area and reduce the unnecessary CPU time consumption and memory bandwidth consumption caused by the movement of the unconsumed part, thereby improving the running performance.

[0047] It is worth noting that the data access processing method provided in the embodiment of the present application can be applied to the data receiving side in TCP communication or file stream transmission, and can also be applied to the data sending side. When the data access processing method provided in the embodiment of the present application is applied to the data receiving side, the data receiving party can store and read the data through the data access processing method provided in the embodiment of the present application, so that the data receiving party can operate on the received data. When the data access processing method provided in the embodiment of the present application is applied to the data sending side, the data access processing method provided in the embodiment of the present application can be used to store and read the data that needs to be sent to the receiving side, so that the data sender can send the data.

[0048] The data access processing method provided in the embodiments of the present application is described in detail below in combination with multiple embodiments.

[0049] Figure 2 A flow chart of a data access processing method provided in an embodiment of the present application, referring to Figure 2 As shown, the execution subject of the method can be any electronic device with processing capability, and the method includes:

[0050] S201, receiving data to be stored.

[0051] It can be understood that the data to be stored is the data currently required to be stored that is received by the electronic device through Transmission Control Protocol (TCP) communication or file stream transmission.

[0052] S202: Determine target data in the data to be stored that can be written into the first view and the second view according to storage information of the stored data in the first view or the second view.

[0053] The first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: length and end position.

[0054] It can be understood that in the first view and the second view, since the first view and the second view are obtained by mapping through the target storage area, the length of the first view and the second view are the same, and the data stored at the Nth position in the first view is the same as the data stored at the Nth position in the second view, that is, at any time, the data stored in the first view, the second view and the target storage area are completely the same, and it can be determined that the free memory space of the first view, the second view and the target storage area is also the same. When the data to be stored is received, the target data that can be written into the first view and the second view in the data to be stored can be determined according to the storage information of the stored data in the first view or the second view, and the target data that can be written into the first view and the second view by the data to be stored is the target data that can be written into the target storage area by the data to be stored. Among them, the storage information of the stored data may include the length of the stored data, the starting position of the stored data and the ending position of the stored data. That is, each time the data to be stored is received, the length of the free memory space in the first view, the second view and the target storage area is fixed. When the data to be stored is stored, since the length of the data to be stored may exceed the length of the free memory space in the first view or the second view, that is, exceed the length of the free memory space in the target storage area, when the data to be stored is written, it is necessary to first determine the target data that can be written first in the data to be stored and the remaining data that needs to wait for the next writing, and then write the remaining data in the data to be stored after the target data is written. The target storage area may be a file stored at a continuous address, and the first view and the second view may be any space with a continuous address in the virtual memory.

[0055] Optionally, Figure 3 A schematic diagram of a target storage area, a first view, and a second view in a data access processing method provided in an embodiment of the present application, with reference to Figure 3As shown, the target storage area is a file with a length of S. The target storage area is mapped to obtain a first view and a second view, wherein the starting address of the first view is P, and the ending address of the first view is P+S-1, the starting address of the second view is P+S, and the ending address of the second view is P+2S-1, the length of the first view is the same as the length of the second view, and both are S, and the first view stores stored data with a length of x, a starting address of P+B, and an ending address of P+B+x-1, that is, the aforementioned unconsumed part, and correspondingly, the second view also stores stored data with a length of x, a starting address of P+S+B, and an ending address of P+S+B+x-1.

[0056] Optionally, Figure 4 Another schematic diagram of the target storage area, the first view and the second view in the data access processing method provided in the embodiment of the present application, referring to Figure 4 As shown, the target storage area can be a file with a length of S. The target storage area is mapped to obtain a first view and a second view, wherein the starting address of the first view is P, and the ending address of the first view is P+S-1, the starting address of the second view is P+S, and the ending address of the second view is P+2S-1, the length of the first view is the same as the length of the second view, and both are S, and the first view stores stored data with a length of x, a starting address of P, and an ending address of P+x-1, that is, the aforementioned unconsumed part, and correspondingly, the second view also stores stored data with a length of x, a starting address of P+S, and an ending address of P+S+x-1.

[0057] Optionally, after obtaining the data to be stored, since the first view and the second view are obtained by mapping through the target storage area, and the lengths of the free memory spaces in the target storage area, the first view, and the second view are fixed and the same, the lengths of the free memory spaces in the first view and the second view can be determined first according to the storage information of the data stored in the first view or the second view, thereby determining the target data in the data to be stored that can be written into the first view and the second view, so that the target data can be finally written into the area to be stored.

[0058] S203 . Write the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and write the target data into the target storage area based on the first view or the second view.

[0059] It can be understood that after obtaining the target data, that is, determining the length of the data that can be stored in the target storage area, the first view, and the second view, the target data can be written into the first view and the second view, and the target data can be written into the target storage area based on the first view or the second view. When writing the target data, due to the TCP communication characteristics, the data to be stored needs to be written on the basis of the stored data. At the same time, since the free memory space may be divided by the stored data, and the length of the first view and the second view is fixed, different situations after the target data is written can be considered according to the end position of the stored data and the length of the target data, so that the target data can be written into the first view and the second view respectively.

[0060] Optionally, after obtaining the target data, the storage end position after the target data is written can be determined according to the end position of the stored data and the length of the target data, thereby determining different situations after the target data is written to the first view and the second view, thereby being able to write the target data to the first view and the second view at the same time according to the different situations after the target data is written to the first view and the second view, thereby being able to write the target data to the target storage area based on the first view or the second view.

[0061] That is, when writing the target data to the first view and the second view respectively, since the free memory spaces in the first view and the second view are not necessarily continuous, they may be split by the stored data, and the free memory spaces after the splitting and after the stored data may be able to store the target data, or may not be able to store the target data. Therefore, when writing the target data, different situations after the target data is written can be determined, so that the target data can be processed separately according to the different situations after the target data is written to the first view and the second view, so that the target data can be written to the first view and the second view at the same time, so that the target data can be written to the target storage area based on the first view or the second view.

[0062] For example, continue to refer to Figure 3 As shown, when writing the target data to the first view and the second view respectively, taking the first view as an example, it is necessary to consider the relationship between the length (P+S-1)-(P+B+x-1) of the free memory space after the stored data after being split by the stored data and the length of the target data, so as to simultaneously write the target data to which areas in the first view. These areas may only include the area from address P+B+x to address P+S-1, or may also include the area from address P+B+x to address P+S-1 and the area from address P to address P+B-1.

[0063] For example, continue to refer to Figure 3 As shown, in one possible case, when the target data is written to the area from address P+B+x to address P+S-1 in the first view, the target data is simultaneously written to the area from address P+S+B+x to address P+2S-1 in the second view, so that the target data can be stored continuously in the first view and the second view, and based on the mapping relationship between the first view, the second view and the target storage area, the target data is written to the corresponding area of ​​the target storage area.

[0064] For example, continue to refer to Figure 3 As shown, in one possible case, when the target data is written to the area from address P+B+x to address P+S-1 and the area from address P to address P+B-1 of the first view, at the same time, the target data is written to the area from address P+S+B+x to address P+2S-1 and the area from address P+S to address P+S+B-1 of the second view. At this time, since the first view is continuous with the second view, it can be regarded as writing the target data to the continuous area from address P+B+x in the first view to address P+S+B-1 in the second view, and based on the mapping relationship between the first view, the second view and the target storage area, the target data is written to the corresponding area of ​​the target storage area.

[0065] For example, continue to refer to Figure 4 As shown, in one possible case, when writing the target data to the first view and the second view respectively, since the free memory space is continuous, the target data can be written to the continuous area from address P+x to address P+S-1 in the first view, and written to the continuous area from address P+S+x to address P+2S-1 in the second view, and based on the mapping relationship between the first view, the second view and the target storage area, the target data is written to the corresponding area of ​​the target storage area.

[0066] In this embodiment, by receiving the data to be stored and mapping the target storage area twice in succession in the virtual memory, a first view and a second view having the same length and the same data stored at the Nth position can be obtained, and the first address of the second view is adjacent to the last address of the first view, so that the target data that can be written into the first view and the second view in the data to be stored can be determined according to the storage information of the stored data in the first view or the second view, thereby ensuring that data access processing can be performed with the maximum utilization rate of the first view and the second view, so that the target storage area can store the target data with the maximum space utilization rate, and on this basis, according to the end position of the stored data and the length of the target data, the target data is written into the first view and the second view respectively, and the target data is written into the target storage area based on the first view or the second view, so that The target data can be stored immediately following the stored data, so as to realize continuous storage of the target data and the stored data. Moreover, due to the mapping relationship between the first view, the second view and the target storage area, a continuous memory space having the same length as the theoretical storable space of the first view or the second view can appear in the first view and the second view. That is to say, based on the mapping relationship between the first view, the second view and the target storage area, after the target data is stored in the first view and the second view, the data stored in the target storage area can be synchronously updated, so as to realize writing the target data into the target storage area, avoiding moving the unconsumed part in the target storage area, thereby reducing unnecessary CPU time consumption and memory bandwidth consumption caused by moving the unconsumed part on the basis of improving the utilization rate of the target storage area, and improving the operation performance.

[0067] In a possible implementation, a process of determining target data that can be written into the first view and the second view in the data to be stored is exemplarily described. Specifically, the above step S202 includes:

[0068] The target data is determined according to the length of the first target view, the length of the stored data, and the length of the data to be stored.

[0069] It can be understood that since the first view and the second view have the same length and the data stored in the first view and the second view are also the same, when determining the target data, calculation can be performed based on the length of the first view or the second view, the length of the stored data, and the length of the data to be stored to determine whether the data to be stored needs to be split, so as to obtain the target data.

[0070] Optionally, the length of the free memory space in the first target view is calculated according to the length of the first target view and the length of the stored data, and the length of the free memory space in the first target view is compared with the length of the data to be stored. If the length of the free memory space is greater than the length of the data to be stored, the data to be stored is used as the target data. If the length of the free memory space is less than the length of the data to be stored, the target data of the length of the free memory space is taken out from the data to be stored, and after the target data is written, the remaining data in the data to be stored is written. The first target view is the first view or the second view.

[0071] For example, continue to refer to Figure 3 As shown, at this time, the length of the free memory space in the first view and the second view can be obtained through Sx. When the data to be stored is received, the length of the data to be stored can be compared with the length Sx of the free memory space, so as to determine the length of the target data that can be written into the first view and the second view in the data to be stored, thereby determining the target data in the data to be stored.

[0072] For example, continue to refer to Figure 4 As shown, at this time, the length of the free memory space in the first view and the second view can be obtained through Sx. When the data to be stored is received, the length of the data to be stored can be compared with the length Sx of the free memory space, so as to determine the length of the target data that can be written into the first view and the second view in the data to be stored, thereby determining the target data in the data to be stored.

[0073] By determining the target data in the data to be stored through the length of the first target view, the length of the stored data, and the length of the data to be stored, the first view and the second view can store as much data to be stored as possible, thereby improving the space utilization of the first view and the second view, thereby improving the space utilization of the target storage area, and thus helping to improve the operating performance.

[0074] In a possible implementation, a process of writing target data into the first view and the second view respectively and writing the target data into the target storage area based on the first view or the second view is exemplarily described. Specifically, Figure 5 A flow chart of writing target data into the first view and the second view respectively in the data access processing method provided in the embodiment of the present application, referring to Figure 5 As shown, the above step S203 includes:

[0075] S501. Determine the storage end position of the target data according to the end position of the stored data and the length of the target data.

[0076] It is worth noting that when writing the target data, due to the characteristics of TCP communication, the data to be stored needs to be written based on the stored data. At the same time, since the lengths of the first view and the second view are fixed, and the first view and the second view are used cyclically, it is necessary to determine the storage end position after the target data is written based on the end position of the stored data and the length of the target data, so as to write the target data into the first view and the second view respectively.

[0077] That is to say, when determining the storage end position of the target data, the possible location of the target data after being stored can be determined based on the end position of the stored data and the length of the target data. However, since the possible location of the target data after being stored will be used for the next storage and the target data can only be stored in the first view or the second view, it is also necessary to process whether the possible location of the target data after being stored exceeds the first view or the second view, so as to determine the storage end position of the target data.

[0078] Optionally, the theoretical position of the target data after being stored can be determined based on the end position of the stored data and the length of the target data, and a judgment is made as to whether the theoretical position of the target data after being stored exceeds the first view or the second view. After the theoretical position of the target data after being stored exceeds the first view or the second view, the theoretical position of the target data after being stored is processed to obtain the storage end position of the target data.

[0079] S502, starting from the next position of the end position of the stored data and ending at the storage end position, write the target data into the first view and the second view in a rolling manner, and map the target data into the target storage area based on the first view or the second view.

[0080] It can be understood that after obtaining the storage end position of the target data, different writing schemes for the target data can be determined based on the relative relationship between the storage end position of the target storage data and the end position of the stored data, so that the target data can be written in the first view and the second view in a rolling manner, so that the target data can be written into the corresponding area of ​​the target storage area based on the mapping relationship between the first view, the second view and the target storage area.

[0081] Taking the first view as an example, writing the target data into the first view in a rolling manner means that during the writing process of the target data, the current writing position of the target data in the first view will be scrolled in the first view, that is, the current writing position of the target data in the first view will start from the next position of the end position of the stored data, increase in sequence, and after reaching the end address of the first view, scroll back to the beginning address of the first view. In other words, when writing the target data into the first view, the value range of the current writing position of the target data will only cycle between 1 and S.

[0082] Optionally, after obtaining the storage end position of the target storage data, if the address of the end position of the stored data is smaller than the address of the storage end position, the target data can be written into corresponding positions of the first view and the second view in sequence, with the next position of the end position of the stored data as the starting point and the storage end position as the end point.

[0083] Optionally, after obtaining the storage end position of the target storage data, if the address of the end position of the stored data is greater than the address of the storage end position, the target data can be written into the corresponding positions of the first view and the second view in a scrolling manner, with the next position of the end position of the stored data as the starting point and the storage end position as the end point.

[0084] Optionally, after writing the target data into the first view and the second view, the target data in the first view or the second view may be mapped to a corresponding area of ​​the target storage area based on a mapping relationship among the first view, the second view and the target storage area.

[0085] For example, Figure 6 A schematic diagram of a first view, a second view, and a target storage area when writing target data in a data access processing method provided in an embodiment of the present application, with reference to Figure 6 As shown, in Figure 3On the basis of, assuming that the storage end position is Y at this time, and P+Y in the first view is less than P+B+x-1, or P+S+Y in the second view is less than P+S+B+x-1, then when storing the target data, the target data can be stored in the next position P+B+x of the end position of the stored data in the first view to the tail address P+S-1 of the first view and the first address P of the first view to the storage end position P+Y of the first view, and the target data can be stored in the next position P+S+B+x of the end position of the stored data in the second view to the tail address P+2S-1 of the second view and the first address P+S of the second view to the storage end position P+S+Y of the second view, that is, with the next position of the end position of the stored data as the starting point and the storage end position as the end point, the target data is written into the first view and the second view in a rolling manner.

[0086] For example, continue to refer to Figure 6 As shown, after writing the target data into the first view and the second view, the target data in the first view or the second view can be mapped to the corresponding area of ​​the target storage area based on the mapping relationship among the first view, the second view and the target storage area. Specifically, the first view or the second view can be mapped to the target storage area in a selective manner.

[0087] For example, continue to refer to Figure 6 As shown, when the target data in the first view or the second view is mapped to the corresponding area of ​​the target storage area, the first view and the second view may also be mapped to the target storage area at the same time. Specifically, the target data stored in the next position P+B+x of the end position of the stored data in the first view to the end address P+S-1 of the first view may be first mapped to the corresponding position of the target storage area, and then the target data stored in the first address P+S of the second view to the storage end position P+S+Y of the second view may be mapped to the corresponding position of the target storage area.

[0088] Exemplarily, the process of mapping the target data in the first view and / or the second view to the target storage area may also be implemented by an operating system.

[0089] The storage end position of the target data is determined by the end position of the stored data and the length of the target data, and the target data is written into the first view and the second view in a rolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point. Different situations after the target data is written can be considered, so that the target data is written into the first view and the second view respectively, and the target data is mapped to the target storage area based on the first view or the second view. After the target data is stored in the first view and the second view, the data stored in the target storage area can be synchronously updated, so that the target data is written into the target storage area, avoiding the movement of the unconsumed part in the target storage area, thereby reducing unnecessary CPU time consumption and memory bandwidth consumption caused by the movement of the unconsumed part on the basis of improving the utilization rate of the target storage area, and improving the running performance.

[0090] In a possible implementation, the process of determining the storage end position of the target data is exemplarily described. Specifically, the above step S501 includes:

[0091] A first sum of the length of the target data and the end position of the stored data is determined, and the first sum is modulo the length of the first view, and the modulo result is used as the storage end position.

[0092] It should be understood that when determining the end storage position of the target data, the theoretical position of the target data after being stored can be calculated based on the end position of the stored data and the length of the target data, and a judgment is made as to whether the theoretical position of the target data after being stored exceeds the first view or the second view. After the theoretical position of the target data after being stored exceeds the first view or the second view, the theoretical position of the target data after being stored is processed to obtain the end storage position of the target data.

[0093] Optionally, the first sum of the length of the target data and the end position of the stored data can be calculated, and the first sum is modulo the length of the first view, or the first sum is modulo the length of the second view, and the modulo result is used as the storage end position.

[0094] Optionally, the first sum of the length of the target data and the stored end position, i.e., the theoretical position after the target data is stored, can also be calculated, and when the first sum is greater than the length of the first view or the first sum is greater than the length of the second view, the length of the first view or the length of the second view can be subtracted from the first sum, and the result obtained can be used as the storage end position. That is, if the theoretical position after the target data is stored exceeds the first view or the second view, the length of the first view or the second view can be subtracted from the theoretical position after the target data is stored, and the result obtained can be used as the storage end position.

[0095] For example, Figure 7 A schematic diagram of determining the storage end position of target data in the data access processing method provided in the embodiment of the present application, referring to Figure 7 As shown, the starting address of the first view is P, the ending address of the first view is P+S-1, the starting address of the second view is P+S, the ending address of the second view is P+2S-1, the length of the first view is the same as the length of the second view, and both are S, the first view stores stored data with a length of x, a starting address of P+B and an ending address of P+B+x-1, and the second view also stores stored data with a length of x, a starting address of P+S+B and an ending address of P+S+B+x-1. If the length of the target data received at this time is t, taking the first view as an example, it can be determined that the first sum of the length t of the target data and the ending position P+B+x-1 of the stored data is P+B+x+t, and the first sum P+B+x+t is modulo the length S of the first view, and the modulo result is used as the storage end position.

[0096] By determining the first sum of the length of the target data and the end position of the stored data, taking the modulus of the first sum and the length of the first view, and using the modulo result as the storage end position, the storage end position after the target data is stored in a scrolling manner can be accurately determined.

[0097] The process of determining the storage end position of the target data is described in detail above. After the storage end position of the target data is obtained, different writing schemes of the target data can be determined according to the relative relationship between the storage end position of the target storage data and the end position of the stored data, so that the target data is written into the first view and the second view in a scrolling manner with the next position of the end position of the stored data as the starting position and the storage end position as the end position. The details are described below.

[0098] In a possible implementation, an exemplary description is given of writing the target data into the first view and the second view in a scrolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point in the first case. Specifically, the above step S502 includes:

[0099] If the length from the end position of the stored data to the end position of the first target view is greater than or equal to the target data length, the target data is sequentially written into the first view starting from a position next to the end position of the stored data of the first view and ending with the storage end position of the first view, and the target data is sequentially written into the second view starting from a position next to the end position of the stored data of the second view and ending with the storage end position of the second view.

[0100] The first target view is the first view or the second view.

[0101] It can be understood that whether the end position of the stored data is scrolled in the first view or the second view can be determined by judging the end position of the stored data and the end position of the first view or the second view. If the length between the end position of the stored data and the end position of the first target view is greater than or equal to the target data length, that is, the area in the first view starting from the next position of the end position of the stored data to the storage end position of the first view can store the target data, then the target data can be directly stored in the first view and the second view.

[0102] For example, Figure 8 A schematic diagram of writing target data into the first view and the second view in a scrolling manner in the data access processing method provided in the embodiment of the present application, referring to Figure 8 As shown, in Figure 3 On the basis of, taking the first view as an example, if the length (P+S-1)-(P+B+x-1) between the end position P+B+x-1 of the stored data and the end position P+S-1 of the first target view is greater than or equal to the target data length t, then starting from the next position P+B+x of the end position of the stored data of the first view and ending with the storage end position P+B+x+t-1 of the first view, the target data is sequentially written into the first view, and, starting from the next position P+S+B+x of the end position of the stored data of the second view and ending with the storage end position P+S+B+x+t-1 of the second view, the target data is sequentially written into the second view.

[0103] In a possible implementation, the second case is described as follows: writing the target data into the first view and the second view in a scrolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point. Specifically, the above step S502 includes:

[0104] If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is the end position of the first target view, then starting from the start position of the first view and ending with the storage end position of the first view, the target data is sequentially written into the first view, and starting from the start position of the second view and ending with the storage end position of the second view, the target data is sequentially written into the second view.

[0105] The first target view is the first view or the second view.

[0106] It can be understood that whether the end position of the stored data is scrolled in the first view or the second view can be determined by judging the end position of the stored data and the end position of the first view or the second view. If the length between the end position of the stored data and the end position of the first target view is less than the target data length, and the end position of the stored data is the end position of the first target view, that is, the end position of the stored data in the first view has reached the end address of the first view, then the current storage position of the target data needs to be scrolled so that the target data is stored from the first address of the first view and ends at the storage end position of the first view, and at the same time, the target data is stored from the first address of the second view and ends at the storage end position of the second view.

[0107] For example, Fig. 9 Another schematic diagram of writing target data into the first view and the second view in a scrolling manner in the data access processing method provided in the embodiment of the present application, referring to Fig. 9 As shown, taking the first view as an example, if the length (P+S-1)-(P+B+x-1) between the end position P+B+x-1 of the stored data and the end position P+S-1 of the first target view is less than the target data length t, and the end position P+B+x-1 of the stored data is the end position P+S-1 of the first view, then starting from the first address P of the first view, the target data is sequentially written into the first view, and ends with the storage end position P+t-1 of the first view, and, starting from the first address P+S of the second view, the target data is sequentially written into the second view, and ends with the storage end position P+S+t-1 of the second view.

[0108] In a possible implementation, an exemplary description is given of writing the target data into the first view and the second view in a scrolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point in the third case. Specifically, Fig.10 A schematic diagram of a flow chart of writing target data into a first view and a second view in a rolling manner in a data access processing method provided in an embodiment of the present application, referring to Fig.10 As shown, the above step S502 includes:

[0109] S1001. If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is not the end position of the first target view, then perform the following steps S1002 and S1003 simultaneously.

[0110] S1002: sequentially store the first M data in the target data into a first storage area in the first view, and sequentially store the data other than the first M data in the target data into a second storage area in the first view.

[0111] Among them, the starting position of the first storage area is the next position of the ending position of the stored data, the ending position of the first storage area is the ending position of the first view, the starting position of the second storage area is the starting position of the first view, and the ending position of the second storage area is the storage ending position of the first view.

[0112] S1003: sequentially store the first M data in the target data into a third storage area in the second view, and sequentially store the data other than the first M data in the target data into a fourth storage area in the second view.

[0113] Among them, the starting position of the third storage area is the next position of the ending position of the stored data, the ending position of the third storage area is the ending position of the second view, the starting position of the fourth storage area is the starting position of the second view, and the ending position of the fourth storage area is the storage ending position of the second view.

[0114] The first target view is the first view or the second view.

[0115] It can be understood that whether the end position of the stored data is scrolled in the first view or the second view can be determined by judging the end position of the stored data and the end position of the first view or the second view. If the length between the end position of the stored data and the end position of the first view or the second view is less than the target data length, and the end position of the stored data is not the end position of the first view or the second view, that is, the target data storage area can include an area formed by the end position of the stored data to the tail address of the first view or the second view, and an area formed by the first address of the first view or the second view to the storage end position, then the current storage position of the target data needs to be scrolled, so that the target data can be stored in the area formed by the end position of the stored data to the tail address of the first view, and the first address of the first view to the storage end position, and the target data can be stored in the area formed by the end position of the stored data to the tail address of the second view, and the first address of the second view to the storage end position.

[0116] For example, Fig.11 Another schematic diagram of writing target data into the first view and the second view in a scrolling manner in the data access processing method provided in the embodiment of the present application, referring to Fig.11 As shown, in Figure 6On the basis of, taking the first view as an example, if the length (P+S-1)-(P+B+x-1) between the end position P+B+x-1 of the stored data and the end position P+S-1 of the first target view is less than the target data length t, and the end position P+B+x-1 of the stored data is not the end position P+S-1 of the first view, the first M data in the target data are sequentially stored in the first storage area in the first view, and the data other than the first M data in the target data are sequentially stored in the second storage area in the first view, and the first M data in the target data are sequentially stored in the third storage area in the second view, and the data other than the first M data in the target data are sequentially stored in the fourth storage area in the second view.

[0117] The starting position of the first storage area is the next position P+B+x of the end position of the stored data in the first view, the end position of the first storage area is the end position P+S-1 of the first view, the starting position of the second storage area is the starting position P of the first view, and the end position of the second storage area is the address P+Y of the storage end position of the first view. Y can be determined by subtracting the length of the first storage area (P+S-1)-(P+B+x) from the length t of the target data. The value of M can be determined according to the length of the first storage area.

[0118] Among them, the starting position of the third storage area is the next position P+S+B+x of the end position of the stored data, the end position of the third storage area is the end position P+2S-1 of the second view, the starting position of the second storage area is the starting position P+S of the second view, and the end position of the second storage area is the storage end position P+S+Y of the second view.

[0119] The above describes in detail the process of writing the data to be stored in the data access processing method provided in the embodiment of the present application. On this basis, the following describes in detail the process of reading data in the data access processing method provided in the embodiment of the present application.

[0120] In a possible implementation, a process of reading the data to be read is exemplarily described. Specifically, Fig.12 A schematic diagram of a flow chart of reading data to be read in the data access processing method provided in the embodiment of the present application, referring to Fig.12 As shown, the data access processing method provided in the embodiment of the present application also includes:

[0121] S1201, obtaining the data length of the data to be read.

[0122] It can be understood that after the data to be stored is stored in the first view and the second view, the storage information of the stored data can be obtained, so that after the data length of the data to be read is obtained, the stored data can be read according to the storage information of the stored data to obtain the data to be read. The storage information includes: the length of the stored data, the starting position of the stored data, and the ending position of the stored data.

[0123] Optionally, the electronic device may obtain the data length of the data to be read that currently needs to be read.

[0124] S1202: Determine a reading end position according to storage information of stored data in the first view or the second view and a data length of the data to be read.

[0125] It is worth noting that, when reading the data to be read, due to the existence of the above steps S201-S203, it can be ensured that the storage information of the stored data in the first view and the second view is the same, that is, the data to be read of the data length can be taken out in the first view and the second view. On this basis, since the addresses of the first view and the second view are continuous, it can be determined that there is at least one continuously stored data to be read in the first view and the second view, then by determining the reading end position, different situations of the continuously stored data to be read can be processed respectively, so that the data to be read can be quickly read from the first view and the second view.

[0126] That is to say, when reading the data to be read, it is necessary to consider different situations of data writing. Taking the first view as an example, if the data to be read is stored continuously in the first view, that is, the data to be read is not split into different parts for writing when writing, then the reading end position after the reading is completed must be in the first view or at the boundary of the first view. Correspondingly, if the data to be read is not stored continuously in the first view, that is, the data to be read is split into two parts when writing, and written to the first storage area and the second storage area respectively, then at this time, in the first view and the second view, there will be a continuous area storing the data to be read, and the continuous area spans the first view and the second view, including the first storage area of ​​the first view and the third storage area of ​​the second view, then the reading end position after the reading is completed must be in the second view.

[0127] At the same time, since the stored data in the first view and the second view are the same, when reading the data to be read, it is only necessary to start reading from the first view to obtain the data to be read. When reading from the first view, the reading end position must be in the first view or the second view. Therefore, the reading end position is the position in the first view or the position in the second view.

[0128] Optionally, the reading end position of the data to be read may be calculated according to the storage information of the stored data in the first view or the second view and the data length of the data to be read.

[0129] S1203 . Read the data to be read sequentially from the second target view according to the read end position, and update the starting position of the data stored in the first view and the starting position of the data stored in the second view according to the read end position.

[0130] The second target view includes: the first view, or the first view and the second view.

[0131] It can be understood that after obtaining the read end position, different reading schemes can be obtained according to whether the read end position is in the first view or the second view, and the read data can be read. In addition, since the lengths of the first view and the second view are fixed, and the first view and the second view are used cyclically, the read end position needs to be updated after each reading, so that there is a determined and unique read end position in the first view and the second view, so that the read end position can be used as the starting position of the stored data during the next reading.

[0132] That is to say, taking the first view as an example, the reading end position can be judged. When the reading end position is in the first view, reading can be performed directly from the first view. If the reading end position is in the second view, the data to be read in the first view can be read first, and then the remaining data to be read can be read from the second view. After the reading is completed, it is necessary to ensure that the reading end position can return to the first view, so that the reading end position can be updated to the starting position of the stored data to ensure the normal reading of the next time.

[0133] By acquiring the data length of the data to be read, and determining the reading end position according to the storage information of the stored data in the first view or the second view and the data length of the data to be read, the data to be read is sequentially read from the second target view according to the reading end position, and the starting position of the data stored in the first view and the starting position of the data stored in the second view are updated according to the reading end position, different situations of the data to be read can be considered, and in different situations, the data to be read can be directly accessed with continuous and sequential memory addresses, so as to quickly realize the reading of the data to be read, reduce unnecessary CPU time consumption and memory bandwidth consumption, and improve the operation performance.

[0134] In a possible implementation, the process of determining the end position of reading is exemplarily described. Specifically, Fig.13A flow chart of determining the end position of reading in the data access processing method provided in the embodiment of the present application, referring to Fig.13 As shown, the above step S1202 includes:

[0135] S1301: Determine a second sum of a starting position of stored data in a first view or a second view and a data length of data to be read.

[0136] Optionally, taking the first view as an example, the second sum of the starting position of the data stored in the first view and the data length of the data to be read may be calculated.

[0137] S1302: If the second sum is less than or equal to the length of the first view, use the position corresponding to the second sum in the first view as the reading end position.

[0138] Optionally, the second sum is judged, and if the second sum is less than or equal to the length of the first view, it is determined that the data to be read can be obtained from the first view, and the position corresponding to the second sum in the first view can be used as the reading end position.

[0139] S1303: If the second sum is greater than the length of the first view, determine the difference between the second sum and the length of the first view, and use the position corresponding to the difference in the second view as the reading end position.

[0140] Optionally, the second sum is judged. If the second sum is greater than the length of the first view, it is determined that the data to be read can be obtained from the first view and the second view. The difference between the second sum and the length of the first view can be determined, and the position corresponding to the difference in the second view is used as the reading end position.

[0141] By determining the starting position of the stored data in the first view or the second view and the second sum of the data length of the data to be read, and making a judgment based on the second sum and the length of the first view, different situations of the data to be read can be considered, ensuring that in different situations, the data to be read can be directly accessed with continuous and sequential memory addresses, thereby quickly realizing the reading of the data to be read, reducing unnecessary CPU time consumption and memory bandwidth consumption, and improving the running performance.

[0142] In a possible implementation, a process of sequentially reading the to-be-read data from the second target view according to the read end position is exemplarily described. Specifically, the above step S1203 includes:

[0143] If the second sum is greater than the length of the first view, data from the start position of the stored data in the first view to the end position of the first view is read sequentially, and data from the start position to the end position of the reading of the second view is read sequentially.

[0144] For example, Fig.14 A schematic diagram of sequentially reading the data to be read in the data access processing method provided in the embodiment of the present application, referring to Fig.14 As shown, in Figure 3 Based on this, taking the first view as an example, assuming that the data length of the data to be read at this time is b, in this case, the reading end position is P+B+b-1, and the reading end position is still in the first view, then the data to be read can be read starting from the starting position P+B of the stored data in the first view, and the reading is completed at the reading end position P+B+b-1, and after the reading is completed, the reading end position P+B+b-1 is updated to the starting position of the stored data in the first view.

[0145] For example, Fig.15 Another schematic diagram of sequentially reading the data to be read in the data access processing method provided in the embodiment of the present application, referring to Fig.15 As shown, taking the first view as an example, assuming that the data length of the data to be read is b, in this case, the read end position is P+B+b-1, and the read end position is in the second view, then the data to be read can be read from the starting position P+B of the stored data to the end position P+S-1 of the first view in the first view, and the reading is completed from the first address P+S of the second view to the read end position P+B+b-1 in the second view, and after the reading is completed, the read end position P+B+b-1 is processed, and the starting position of the stored data in the first view is updated.

[0146] In a possible implementation, a process of updating a starting position of data stored in a first view and a starting position of data stored in a second view is exemplarily described. Specifically, Fig.16 A schematic diagram of a flow chart for updating the starting position of the data stored in the first view and the starting position of the data stored in the second view in the data access processing method provided in the embodiment of the present application, with reference to Fig.16 As shown, the above S1203 includes:

[0147] S1601, determine the modulus of the read end position and the length of the first view, and use the modulus result as the updated start position.

[0148] Optionally, the read end position and the length of the first view or the length of the second view may be modulo-calculated, and the modulo-calculated result may be used as the updated start position.

[0149] Optionally, the length of the first view or the length of the second view may be subtracted from the reading end position, and the obtained result may be used as the updated start position.

[0150] S1602: Update the starting position of the data stored in the first view to the updated starting position.

[0151] Optionally, after obtaining the updated starting position, the starting position of the stored data of the first view may be updated to the updated starting position.

[0152] S1603: Update the starting position of the data stored in the second view to the updated starting position.

[0153] Optionally, after obtaining the updated starting position, the starting position of the stored data of the second view may be updated to the updated starting position.

[0154] For example, Fig.17 Another schematic diagram of updating the starting position of the data stored in the first view and the starting position of the data stored in the second view in the data access processing method provided in the embodiment of the present application, with reference to Fig.17 As shown, taking the first view as an example, assuming that the data length of the data to be read is b, in this case, the read end position is P+B+b, and the read end position is in the second view, then the data to be read can be read from the starting position P+B of the stored data to the end position P+S-1 of the first view in the first view, and the reading is completed from the first address P+S of the second view to the read end position P+B+b-1 in the second view, and after the reading is completed, the read end position P+B+b-1 is modulo processed to obtain an updated starting position of (P+B+b-1)%S, and the starting position of the stored data in the first view is updated to the updated starting position (P+B+b-1)%S.

[0155] The data access processing method provided in the embodiment of the present application is described in detail above. Based on the data access processing method provided in the embodiment of the present application, after the simulation test of the sender-receiver, it is assumed that when the producer sends the data to be stored, there is a 50% probability of writing an element of 100B~14KB, a 25% probability of writing an element of 14KB~500KB, a 20% probability of writing an element of 50KB~100KB, and a 5% probability of writing an element of 100KB~2MB. At the same time, for each element produced, the producer consumes 10+size / 2KB microseconds, and rests for 0~0.5 milliseconds after the production is completed, and the producer does not send it at full strength. At the same time, it is assumed that the consumer consumes each element set to consume size / 2KB+(random 10~1010) microseconds, and the consumption capacity is capped at 446MB / s in the test case. It can be obtained that after data processing by the method provided in the prior art, the rate is 1195.3 / s, 332.3MB / s, and after data access processing by the data access processing method provided in the embodiment of the present application, the obtained rate is 1327.6 / s, 369.4MB / s. At the same time, the write latency is reduced from an average of 285us to 203us. And because the data access processing method provided in the embodiment of the present application does not use atomic operations during simulation testing, that is, lock-free implementation, it can be determined that the data access processing method provided in the embodiment of the present application still has room for optimization in terms of operating performance.

[0156] Based on the same inventive concept, a data access processing device corresponding to the data access processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned data access processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0157] Fig.18 A schematic diagram of a data access processing device provided in an embodiment of the present application, referring to Fig.18 As shown, the device includes: a receiving module 1801, a determining module 1802 and a writing module 1803;

[0158] Receiving module 1801, used for receiving data to be stored;

[0159] The determining module 1802 is used to determine the target data that can be written into the first view and the second view in the data to be stored according to the storage information of the stored data in the first view or the second view, wherein the first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: length and end position;

[0160] The writing module 1803 is used to write the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and write the target data into the target storage area based on the first view or the second view.

[0161] In a possible implementation, the determining module 1802 is specifically configured to:

[0162] The target data is determined according to the length of the first target view, the length of the stored data, and the length of the data to be stored. The first target view is the first view or the second view.

[0163] In a possible implementation, the writing module 1803 is specifically configured to:

[0164] Determine the storage end position of the target data according to the end position of the stored data and the length of the target data;

[0165] Starting from the next position of the end position of the stored data and ending at the storage end position, the target data is written into the first view and the second view in a rolling manner, and the target data is mapped into the target storage area based on the first view or the second view.

[0166] In a possible implementation, the writing module 1803 is specifically configured to:

[0167] A first sum of the length of the target data and the end position of the stored data is determined, and the first sum is modulo the length of the first view, and the modulo result is used as the storage end position.

[0168] In a possible implementation, the writing module 1803 is specifically configured to:

[0169] If the length from the end position of the stored data to the end position of the first target view is greater than or equal to the target data length, the target data is sequentially written into the first view starting from the position next to the end position of the stored data of the first view and ending with the storage end position of the first view, and the target data is sequentially written into the second view starting from the position next to the end position of the stored data of the second view and ending with the storage end position of the second view, wherein the first target view is the first view or the second view.

[0170] In a possible implementation, the writing module 1803 is specifically configured to:

[0171] If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is the end position of the first target view, then starting from the start position of the first view and ending with the storage end position of the first view, the target data is sequentially written into the first view, and starting from the start position of the second view and ending with the storage end position of the second view, the target data is sequentially written into the second view.

[0172] In a possible implementation, the writing module 1803 is specifically configured to:

[0173] If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is not the end position of the first target view, then:

[0174] The first M data in the target data are sequentially stored in a first storage area in the first view, and the data except the first M data in the target data are sequentially stored in a second storage area in the first view, the starting position of the first storage area is the next position of the ending position of the stored data, the ending position of the first storage area is the ending position of the first view, the starting position of the second storage area is the starting position of the first view, and the ending position of the second storage area is the storage ending position of the first view;

[0175] The first M data in the target data are sequentially stored in the third storage area in the second view, and the data in the target data except the first M data are sequentially stored in the fourth storage area in the second view, the starting position of the third storage area is the next position of the ending position of the stored data, the ending position of the third storage area is the ending position of the second view, the starting position of the fourth storage area is the starting position of the second view, and the ending position of the fourth storage area is the storage ending position of the second view.

[0176] In a possible implementation, the storage information further includes: a starting position; the device further includes: a reading module;

[0177] A reading module is used to obtain the data length of the data to be read;

[0178] A reading module, used to determine a reading end position according to storage information of stored data in the first view or the second view and a data length of the data to be read, where the reading end position is a position in the first view or a position in the second view;

[0179] A reading module is used to sequentially read the data to be read from the second target view according to the reading end position, and update the starting position of the data stored in the first view and the starting position of the data stored in the second view according to the reading end position, and the second target view includes: the first view, or the first view and the second view.

[0180] In a possible implementation, the reading module is specifically used to:

[0181] Determine a second sum of a starting position of stored data in the first view or the second view and a data length of the data to be read;

[0182] If the second sum is less than or equal to the length of the first view, the position corresponding to the second sum in the first view is used as the reading end position;

[0183] If the second sum is greater than the length of the first view, the difference between the second sum and the length of the first view is determined, and the position corresponding to the difference in the second view is used as the reading end position.

[0184] In a possible implementation, the reading module is specifically used to:

[0185] If the second sum is greater than the length of the first view, data from the start position of the stored data in the first view to the end position of the first view is read sequentially, and data from the start position to the end position of the reading of the second view is read sequentially.

[0186] In a possible implementation, the reading module is specifically used to:

[0187] Determine the modulus of the read end position and the length of the first view, and use the modulus result as the updated start position;

[0188] Updating the starting position of the data stored in the first view to the updated starting position;

[0189] The starting position of the data stored in the second view is updated to the updated starting position.

[0190] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0191] The present application embodiment also provides an electronic device 1900, such as Fig.19 As shown, Fig.19 The structural diagram of the electronic device provided in the embodiment of the present application includes: a processor 1901, a memory 1902, and optionally, a bus 1903. The memory 1902 stores machine-readable instructions executable by the processor 1901 (for example, Fig.18In the device, the receiving module 1801, the determining module 1802 and the writing module 1803 correspond to the execution instructions, etc.), when the electronic device 1900 is running, the processor 1901 communicates with the memory 1902 through the bus 1903, and when the machine-readable instructions are executed by the processor 1901, the steps of the above-mentioned data access processing method are executed.

[0192] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned data access processing method are executed.

[0193] An embodiment of the present application also provides a computer program product, which includes a computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of the above-mentioned data access processing method.

[0194] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0195] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.

[0196] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A data access processing method, characterized in that: include: receiving data to be stored; Determine, according to storage information of stored data in the first view or the second view, target data in the data to be stored that can be written into the first view and the second view, wherein the first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: length and end position; writing the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and writing the target data into the target storage area based on the first view or the second view; The step of writing the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and writing the target data into the target storage area based on the first view or the second view comprises: Determining the storage end position of the target data according to the end position of the stored data and the length of the target data; Taking the next position of the end position of the stored data as the starting point and the storage end position as the end point, the target data is written into the first view and the second view in a rolling manner, and the target data is mapped to the target storage area based on the first view or the second view.

2. The data access processing method according to claim 1, characterized in that: The determining, according to the storage information of the stored data in the first view or the second view, target data in the data to be stored that can be written into the first view and the second view includes: The target data is determined according to a length of a first target view, a length of the stored data, and a length of the data to be stored, wherein the first target view is the first view or the second view.

3. The data access processing method according to claim 1, characterized in that: The step of determining the storage end position of the target data according to the end position of the stored data and the length of the target data includes: A first sum of the length of the target data and the end position of the stored data is determined, and the first sum is modulo the length of the first view, and the modulo result is used as the storage end position.

4. The data access processing method according to claim 1, characterized in that: The step of writing the target data into the first view and the second view in a rolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point comprises: If the length from the end position of the stored data to the end position of the first target view is greater than or equal to the length of the target data, the target data is sequentially written into the first view starting from a position next to the end position of the stored data of the first view and ending with the storage end position of the first view, and the target data is sequentially written into the second view starting from a position next to the end position of the stored data of the second view and ending with the storage end position of the second view, wherein the first target view is the first view or the second view.

5. The data access processing method according to claim 1, characterized in that: The step of writing the target data into the first view and the second view in a rolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point comprises: If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is the end position of the first target view, then starting from the start position of the first view and ending with the storage end position of the first view, the target data is sequentially written into the first view, and starting from the start position of the second view and ending with the storage end position of the second view, the target data is sequentially written into the second view.

6. The data access processing method according to claim 1, characterized in that: The step of writing the target data into the first view and the second view in a rolling manner with the next position of the end position of the stored data as the starting point and the storage end position as the end point comprises: If the length from the end position of the stored data to the end position of the first target view is less than the target data length, and the end position of the stored data is not the end position of the first target view, then: The first M data in the target data are sequentially stored in a first storage area in the first view, and the data in the target data other than the first M data are sequentially stored in a second storage area in the first view, wherein the starting position of the first storage area is the next position of the ending position of the stored data, the ending position of the first storage area is the ending position of the first view, the starting position of the second storage area is the starting position of the first view, and the ending position of the second storage area is the storage ending position of the first view; The first M data in the target data are sequentially stored in a third storage area in the second view, and the data in the target data except the first M data are sequentially stored in a fourth storage area in the second view, wherein the starting position of the third storage area is the next position of the ending position of the stored data, the ending position of the third storage area is the ending position of the second view, the starting position of the fourth storage area is the starting position of the second view, and the ending position of the fourth storage area is the storage ending position of the second view.

7. The data access processing method according to any one of claims 1 to 5, characterized in that: The storage information also includes: a starting position; The method further comprises: Get the data length of the data to be read; Determine a read end position according to the storage information of the stored data in the first view or the second view and the data length of the data to be read, wherein the read end position is a position in the first view or a position in the second view; According to the read end position, the data to be read is sequentially read from the second target view, and the starting position of the stored data in the first view and the starting position of the stored data in the second view are updated according to the read end position, and the second target view includes: the first view, or the first view and the second view.

8. The data access processing method according to claim 7, characterized in that: The determining the read end position according to the storage information of the stored data in the first view or the second view and the data length of the data to be read includes: Determine a second sum of a starting position of the stored data in the first view or the second view and a data length of the data to be read; If the second sum is less than or equal to the length of the first view, taking the position corresponding to the second sum in the first view as the reading end position; If the second sum is greater than the length of the first view, a difference between the second sum and the length of the first view is determined, and a position corresponding to the difference in the second view is used as the reading end position.

9. The data access processing method according to claim 8, characterized in that: The step of sequentially reading the to-be-read data from the second target view according to the read end position includes: If the second sum is greater than the length of the first view, data from the starting position of the stored data in the first view to the end position of the first view is read in sequence, and data from the starting position of the second view to the reading end position is read in sequence.

10. The data access processing method according to claim 7, characterized in that: The updating the starting position of the stored data in the first view and the starting position of the stored data in the second view according to the read end position includes: Determine the modulus of the read end position and the length of the first view, and use the modulus result as the updated start position; Updating the starting position of the stored data in the first view to the updated starting position; The starting position of the stored data in the second view is updated to the updated starting position.

11. A data access processing device, characterized in that: include: A receiving module, used for receiving data to be stored; a determination module, configured to determine, according to storage information of stored data in the first view or the second view, target data in the data to be stored that can be written into the first view and the second view, wherein the first view and the second view are both mapping views of the target storage area, and the first view is connected end to end with the second view, and the storage information at least includes: a length and an end position; a writing module, configured to write the target data into the first view and the second view respectively according to the end position of the stored data and the length of the target data, and write the target data into the target storage area based on the first view or the second view; The writing module is specifically used to: determine the storage end position of the target data according to the end position of the stored data and the length of the target data; The target data is written into the first view and the second view in a rolling manner, starting from the next position of the end position of the stored data and ending at the storage end position, and mapped into the target storage area based on the first view or the second view.

12. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the data access processing method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data access processing method according to any one of claims 1 to 10 are executed.

14. A computer program product, characterized in that The computer program product includes computer program codes. When the computer program codes are executed by a computing device, the computing device executes the steps of the data access processing method according to any one of claims 1 to 10.