WO2022126919A1 - 文件传输方法、装置、计算机设备及存储介质 - Google Patents

文件传输方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2022126919A1
WO2022126919A1 PCT/CN2021/083759 CN2021083759W WO2022126919A1 WO 2022126919 A1 WO2022126919 A1 WO 2022126919A1 CN 2021083759 W CN2021083759 W CN 2021083759W WO 2022126919 A1 WO2022126919 A1 WO 2022126919A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
read
file
client
information
Prior art date
Application number
PCT/CN2021/083759
Other languages
English (en)
French (fr)
Inventor
田玉凯
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022126919A1 publication Critical patent/WO2022126919A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Definitions

  • the present application relates to the technical field of data transmission, and in particular, to a file transmission method, device, computer equipment and storage medium.
  • the DMA method can directly read data from the disk to the page cache, or write data directly from the page cache back to the disk, instead of directly between the application address space and the disk.
  • the data needs to perform multiple data copy operations between the application address space and the page cache during the transmission process.
  • the CPU Central Processing Unit, central processing unit
  • memory brought by these data copy operations
  • the overhead is very large.
  • the inventor found that the CPU is involved in context switching and data copying activities, and the CPU's participation cannot be completely avoided during file transfer, which will cause CPU resource occupation and consumption.
  • the above-mentioned zero-copy The file method can only target some specific file systems, and cannot meet the requirements of general file systems.
  • the embodiments of the present application provide a file transmission method, apparatus, computer equipment, and storage medium, which aim to solve the problem of CPU resource occupation during file transmission.
  • an embodiment of the present application provides a file transmission method, which includes the following steps: judging whether the cached data stored in the server has reached a saturated state; if the cached data stored in the server has reached a saturated state, then Copy the super block information of the file block group of the cached data to the server memory; remotely transmit the super block information stored in the server memory to the client through RDMA; obtain the client generated based on the super block information
  • the remote data read request includes the address space of the data to be read; according to the remote data read request, the data to be read is remotely transmitted to the client through RDMA.
  • an embodiment of the present application further provides a file transmission device, comprising: a cache judgment unit for judging whether the cached data stored in the server has reached a saturation state; an information copy unit for The cached data has reached a saturated state, then copy the superblock information of the file block group of the cached data to the server memory; the information transmission unit is used to remotely transmit the superblock information stored in the server memory through RDMA to a client; a request acquisition unit, configured to acquire a remote data read request generated by the client based on the super block information, where the remote data read request includes the address space of the data to be read; a data transmission unit, According to the remote data read request, the data to be read is remotely transmitted to the client through DMA.
  • an embodiment of the present application further provides a computer device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned file transmission method when executing the computer program.
  • an embodiment of the present application further provides a computer-readable storage medium, where the storage medium stores a computer program, the computer program includes program instructions, and the program instructions can implement the above file when executed by a processor transfer method.
  • Embodiments of the present application provide a file transmission method, apparatus, computer device, and storage medium.
  • this embodiment of the present application when the server is full of cached data, only the superblock information of the cached data is copied to the server memory, which reduces the transmission pressure of the cached data, and is transmitted to the client remotely through RDMA.
  • Read the address space of the data and directly read the target data from the memory of the server through DMA remote transmission based on the address space, without involving the processing of the operating system and the CPU, simplifying the data transmission processing process, reducing the amount of data copy transmission, and improving the Data transmission efficiency, improve the universality of the scene of remote file transmission.
  • FIG. 1 is a schematic diagram of an application scenario of a file transmission method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a file transmission method provided by an embodiment of the present application.
  • FIG. 3 is a schematic sub-flow diagram of a file transmission method provided by an embodiment of the present application.
  • FIG. 4 is a schematic sub-flow diagram of a file transmission method provided by an embodiment of the present application.
  • FIG. 5 is a schematic sub-flow diagram of a file transmission method provided by an embodiment of the present application.
  • FIG. 6 is a schematic sub-flow diagram of a file transmission method provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a file transmission method provided by another embodiment of the present application.
  • FIG. 8 is a schematic block diagram of a file transmission apparatus provided by an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of an information copying unit of a file transmission apparatus provided by an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a data transmission unit of a file transmission apparatus provided by an embodiment of the present application.
  • FIG. 11 is a schematic block diagram of a data encryption module of a file transmission apparatus provided by an embodiment of the present application.
  • FIG. 12 is a schematic block diagram of a file transmission apparatus provided by another embodiment of the present application.
  • FIG. 13 is a schematic block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 1 is a schematic diagram of an application scenario of the file transmission method provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a file transmission method provided by an embodiment of the present application.
  • the file transfer method is applied to the server, the server and the client perform data interaction and realize remote file transfer.
  • the server copies the superblock information of the cached data to the server memory, and transmits it to the client remotely through RDMA.
  • the client obtains the address space of the data to be read by parsing the superblock information. And based on the address space, the corresponding data is obtained from the server memory through RDMA remote transmission.
  • the client may include terminal devices such as a first terminal and a second terminal that can perform network data transmission.
  • FIG. 2 is a schematic flowchart of a file transmission method provided by an embodiment of the present application. As shown in the figure, the method includes the following steps S110-150.
  • the user process enters the kernel state by calling the sys_read() command through the read() command, the process scheduler allocates a CPU (Central Processing Unit, central processing unit), and the CPU sends IO (Input/Output, input/output) operation to DMA, DMA drives the hardware through requests, the hardware caches the cached data, and the size of the cached data also determines the frequency of interrupts. If the cached data cached by the server has reached a saturation state, a CPU interrupt will be triggered, which will then trigger the DMA auxiliary data to be stored in the server's memory.
  • a CPU Central Processing Unit, central processing unit
  • IO Input/Output, input/output
  • DMA Direct Memory Access, Direct Memory Access
  • DMA allows hardware devices of different speeds to communicate without relying on a large amount of interrupt load on the CPU.
  • the cache data is composed of multiple file block groups, and each file block group includes: an Inode, a super block, a Dentry cache, and a data block.
  • This scheme only copies the super block information to the server memory through DMA, and does not copy the remaining Inode, Dentry cache and data blocks, so as to reduce the size of the DMA copy data and improve the DMA copy efficiency.
  • the super block contains information for managing the entire file system. Based on the super block information of the file block group, the inode corresponding to each file in the server hard disk can be obtained, and the i_mapping and i_data fields in the inode structure actually map each file on the server hard disk. Therefore, all data in the hard disk can be obtained through the super block information.
  • Inode Chinese is an index node, used to store file meta information, each file has file meta information, file meta information includes file creator information, file creation date information, file address information and file size information, etc. Information describing the corresponding file.
  • the file address information is the i_mapping and i_data fields in the above-mentioned Inode structure.
  • step S120 includes steps S121-S123.
  • the cached data needs to be parsed to obtain a file block group that composes the cached data, and then each file is read out from the parsed file block group
  • the super block information of the block group is copied to the server memory through DMA technology, so that the client can directly obtain it through remote transmission through RDMA technology.
  • this solution uses RDMA technology, and the client can remotely access the data in the server memory through RDMA, directly copy the file in the memory (that is, the above-mentioned super block information) and transmit it to the client, that is, The server remotely transmits the super block information in the memory to the client through RDMA, and the client further processes it, and directly copies the super block information in the server memory to the client through RDMA, which does not involve the processing of the operating system and the CPU, which simplifies the The data transmission processing process reduces the amount of data copy transmission from the server to the client, and improves the data transmission efficiency.
  • RDMA Remote Direct Memory Access
  • Remote Direct Data Access is generated to solve the delay of server data processing in network transmission.
  • RDMA transfers data directly into the computer's storage area through the network, and moves the data from one system to the remote system memory quickly without any impact on the operating system, so that it does not require much computer processing power. It eliminates the overhead of external memory copying and context switching, thus freeing up memory bandwidth and CPU cycles to improve application system performance.
  • the client parses and obtains the address space of all or part of the files in the server file system based on the obtained super block information, and the client generates a remote data read request according to its own requirements and based on the obtained address space, wherein the remote The data read request includes the address space of the data to be read.
  • the data blocks and other file information in the corresponding address space can be copied directly through DMA to complete the data remote between the server and the client. transmission.
  • the client can directly copy data blocks and other file information in the corresponding address space on the server through DMA, so as to complete the remote data transmission between the server and the client.
  • the remote data read request may include multiple address spaces for data to be read.
  • a remote data read request may include the address space of data to be read a, data b to be read, and data c to be read.
  • the client can directly remotely copy the corresponding data a to be read through DMA. , the data blocks and other file information of the data b to be read and the data c to be read, so as to complete the remote data transmission between the server and the client.
  • step S150 includes steps S151-S153.
  • S152 Encrypt the data to be read to obtain an encrypted data packet.
  • this solution encrypts the corresponding data to be obtained when the data to be read is copied and transmitted from the server to the client, and directly transfers the data to be obtained through DMA. Transmission to the client to ensure data security.
  • step S152 includes steps S1521-S1523.
  • an encryption algorithm is used to encrypt the data to be read to obtain encrypted data to ensure data security, wherein the encryption algorithm can be conventional/symmetric encryption algorithm, asymmetric encryption algorithm, etc. Unconventional encryption algorithms to further improve data security.
  • the encrypted data is encapsulated into data packets, and subsequent data transmission is performed in the form of data packets, which can ensure the transmission quality and efficiency of the encrypted data when the data volume of the encrypted data is relatively large.
  • step S1522 includes steps S1522a and S1522b.
  • S1522a Divide the encrypted data into multiple file parts according to the information amount of the encrypted data.
  • packing the encrypted data means compressing the encrypted data to obtain a data package in a compressed package format.
  • the encrypted data is firstly divided into multiple file parts according to the information amount of the encrypted data, and the multiple file parts together form the encrypted data, and the above-mentioned file parts are compressed in parallel by the preset compression software to obtain multiple compressed data.
  • the sub-data package in the format greatly shortens the overall compression time of encrypted data through parallel compression, and improves the packaging efficiency of encrypted data.
  • the data package in the compressed package format is a compressed package file in zip or rar format, and the encrypted data is packaged for transmission, which effectively ensures the data stability of the encrypted data during the transmission process.
  • the identifier of the encryption algorithm is added to the packet header of the data packet, which can identify the state corresponding to the current data packet, indicating that the data packet has been encrypted and encapsulated, and data transmission can be performed.
  • FIG. 7 is a schematic flowchart of a file transmission method provided by another embodiment of the present application. As shown in FIG. 7 , the file transmission method of this embodiment includes steps S210-S270.
  • the steps S210-S250 are similar to the steps S110-S150 in the above-mentioned embodiment, and are not repeated here.
  • the steps S260-S270 added in this embodiment will be described in detail below.
  • the client parses and obtains the data information of all or part of the files in the server file system and the address space associated with the data information based on the obtained super block information, and the client first determines the data to be read according to the data information, According to the address space associated with the data to be read, a remote data read request is generated.
  • the remote data read request includes the address space of the data to be read. Based on the remote data read request, the corresponding address can be copied directly through DMA. Data blocks and other file information under the space to complete the remote transmission of data between the server and the client.
  • the technical methods in this application can be applied to application scenarios including data transmission, such as smart government affairs/smart city management/smart community/smart security/smart logistics/smart medical care/smart education/smart environmental protection/smart transportation, so as to promote the construction of smart cities .
  • FIG. 8 is a schematic block diagram of a file transmission apparatus provided by an embodiment of the present application. As shown in FIG. 8 , corresponding to the above file transmission method, the present application further provides a file transmission apparatus.
  • the file transmission device includes a unit for executing the above-mentioned file transmission method, and the device can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals.
  • the file transmission device 400 includes a cache determination unit 10 , an information copy unit 20 , an information transmission unit 30 , a request acquisition unit 40 and a data transmission unit 50 .
  • the cache judgment unit 10 is used for judging whether the cache data stored in the server has reached a saturation state.
  • the user process enters the kernel state by calling the sys_read() command through the read() command, the process scheduler allocates a CPU (Central Processing Unit, central processing unit), and the CPU sends IO (Input/Output, input/output) operation to DMA, DMA drives the hardware through requests, and the hardware caches the cached data, and the size of the cached data also determines the frequency of interrupts.
  • a CPU interrupt is triggered, which in turn triggers DMA auxiliary data to the server's memory.
  • DMA Direct Memory Access, Direct Memory Access
  • DMA allows hardware devices of different speeds to communicate without relying on a large amount of interrupt load on the CPU.
  • the information copying unit 20 is configured to copy the super block information of the file block group of the cache data into the server memory if the cache data stored in the server has reached a saturation state.
  • the cache data is composed of multiple file block groups, and each file block group includes: an Inode, a super block, a Dentry cache, and a data block.
  • This scheme only copies the super block information to the server memory through DMA, and does not copy the remaining Inode, Dentry cache and data blocks, so as to reduce the size of the DMA copy data and improve the DMA copy efficiency.
  • the super block contains information for managing the entire file system. Based on the super block information of the file block group, the inode corresponding to each file in the server hard disk can be obtained, and the i_mapping and i_data fields in the inode structure actually map each file on the server. The address space of the hard disk, so all data in the hard disk can be obtained through the super block information.
  • Inode Chinese is an index node, used to store file meta information, each file has file meta information, file meta information includes file creator information, file creation date information, file address information and file size information, etc. Information describing the corresponding file.
  • the file address information is the i_mapping and i_data fields in the above-mentioned Inode structure.
  • the information copying unit 20 includes a data parsing module 21 , an information acquiring module 22 and an information copying module 23 .
  • the data parsing module 21 is used for parsing the cached data to obtain a plurality of file block groups that constitute the cached data.
  • the information acquisition module 22 is used for acquiring super block information in each file block group.
  • the information copying module 23 is used for copying the super block information in all file block groups to the server memory through DMA.
  • the cached data needs to be parsed to obtain a file block group that composes the cached data, and then each file is read out from the parsed file block group
  • the super block information of the block group is copied to the server memory through DMA technology, so that the client can directly obtain it through remote transmission through RDMA technology.
  • the information transmission unit 30 is used for remotely transmitting the super block information stored in the memory of the server to the client through RDMA.
  • this solution uses RDMA technology, and the client can remotely access the data in the server memory through RDMA, directly copy the file in the memory (that is, the above-mentioned super block information) and transmit it to the client, that is, The server remotely transmits the super block information in the memory to the client through RDMA, and the client further processes it, and directly copies the super block information in the server memory to the client through RDMA, which does not involve the processing of the operating system and the CPU, which simplifies the The data transmission processing process reduces the amount of data copy transmission from the server to the client, and improves the data transmission efficiency.
  • RDMA Remote Direct Memory Access
  • Remote Direct Data Access is generated to solve the delay of server data processing in network transmission.
  • RDMA transfers data directly into the computer's storage area through the network, and quickly moves data from one system to the remote system memory without any impact on the operating system, so that it does not require much computer processing power. It eliminates the overhead of external memory copying and context switching, thus freeing up memory bandwidth and CPU cycles to improve application system performance.
  • the request obtaining unit 40 is configured to obtain a remote data read request generated by the client based on the super block information, where the remote data read request includes the address space of the data to be read.
  • the client parses and obtains the address space of all or part of the files in the server file system based on the obtained super block information, and the client generates a remote data read request according to its own requirements and based on the obtained address space, wherein the remote The data read request includes the address space of the data to be read.
  • the data blocks and other file information in the corresponding address space can be copied directly through DMA to complete the data remote between the server and the client. transmission.
  • the data transmission unit 50 is configured to remotely transmit the data to be read to the client through DMA according to the remote data reading request.
  • the client can directly copy data blocks and other file information in the corresponding address space on the server through DMA, so as to complete the remote data transmission between the server and the client.
  • the remote data read request may include multiple address spaces for data to be read.
  • a remote data read request may include the address space of data to be read a, data b to be read, and data c to be read.
  • the client can directly remotely copy the corresponding data a to be read through DMA. , the data blocks and other file information of the data b to be read and the data c to be read, so as to complete the remote data transmission between the server and the client.
  • the data transmission unit 50 includes a data acquisition module 51 , a data encryption module 52 and a data transmission module 53 .
  • the data acquisition module 51 is configured to acquire the data to be read corresponding to the address space according to the address space.
  • the data encryption module 52 is used for encrypting the data to be read to obtain encrypted data packets.
  • the data transmission module 53 is used to remotely transmit the encrypted data packet to the client through DMA.
  • this solution encrypts the corresponding data to be obtained when the data to be read is copied and transmitted from the server to the client, and directly transfers the data to be obtained through DMA. Transmission to the client to ensure data security.
  • the data encryption module 52 includes an encryption sub-module 521 , an encapsulation sub-module 522 and an identification sub-module 523 .
  • the encryption sub-module 521 is configured to encrypt the data to be read through a preset encryption algorithm to obtain encrypted data.
  • an encryption algorithm is used to encrypt the data to be read to obtain encrypted data to ensure data security, wherein the encryption algorithm may adopt conventional/ Unconventional encryption algorithms to further improve data security.
  • the encapsulation sub-module 522 is further configured to divide the encrypted data into multiple file parts according to the information amount of the encrypted data; perform parallel compression on the multiple file parts to obtain multiple sub-data packages.
  • packing the encrypted data means compressing the encrypted data to obtain a data package in a compressed package format.
  • the encrypted data is firstly divided into multiple file parts according to the information amount of the encrypted data, and the multiple file parts together form the encrypted data, and the above-mentioned file parts are compressed in parallel by the preset compression software to obtain multiple compressed data.
  • the sub-data package in the format greatly shortens the overall compression time of encrypted data through parallel compression, and improves the packaging efficiency of encrypted data.
  • the data package in the compressed package format is a compressed package file in zip or rar format, and the encrypted data is packaged for transmission, which effectively ensures the data stability of the encrypted data during the transmission process.
  • the identification sub-module 523 is used for adding the identification of the encryption algorithm to the packet header of the data packet to obtain the encrypted data packet.
  • the identifier of the encryption algorithm is added to the packet header of the data packet, which can identify the state corresponding to the current data packet, indicating that the data packet has been encrypted and encapsulated, and data transmission can be performed.
  • the server when the server has reached a saturation state, only the super block information of the cached data is copied to the server memory, which reduces the transmission pressure of the cached data, and is transmitted to the client remotely through RDMA, and the client obtains the data to be read based on the super block information analysis.
  • data is directly read from the memory of the server through DMA remote transmission, without involving the processing of the operating system and the CPU, which simplifies the data transmission processing process, reduces the amount of data copy transmission, and improves the data transmission efficiency. Improve the generality of scenarios where files are transferred remotely.
  • FIG. 12 is a schematic block diagram of a file transmission apparatus provided by another embodiment of the present application. As shown in FIG. 12 , the file transmission apparatus 400 of this embodiment is based on the above-mentioned embodiment, and an information analysis unit 60 and a request generation unit 70 are added.
  • the information parsing unit 60 is configured to parse the super block information to obtain the data information of the data stored in the server and the address space corresponding to the data.
  • the request generating unit 70 is configured to acquire the address space of the data to be read according to the data information, and generate a remote data read request based on the address space of the data to be read.
  • the client parses and obtains the data information of all or part of the files in the server file system and the address space associated with the data information based on the obtained super block information, and the client first determines the data to be read according to the data information, According to the address space associated with the data to be read, a remote data read request is generated.
  • the remote data read request includes the address space of the data to be read. Based on the remote data read request, the corresponding address can be copied directly through DMA. Data blocks and other file information under the space to complete the remote transmission of data between the server and the client.
  • the above-mentioned file transfer apparatus can be implemented in the form of a computer program that can be executed on a computer device as shown in FIG. 13 .
  • the computer device 500 may be a terminal or a server, wherein the terminal may be an electronic device with communication functions, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
  • the server can be an independent server or a server cluster composed of multiple servers.
  • the computer device 500 includes a processor 502 , a memory and a network interface 505 connected by a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
  • the nonvolatile storage medium 503 can store an operating system 5031 and a computer program 5032 .
  • the computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform a file transfer method.
  • the processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
  • the internal memory 504 provides an environment for running the computer program 5032 in the non-volatile storage medium 503.
  • the processor 502 can execute a file transfer method.
  • the network interface 505 is used for network communication with other devices.
  • the structure shown in FIG. 13 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
  • the specific computer device 500 may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
  • the processor 502 is used for running the computer program 5032 stored in the memory.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like.
  • the computer program includes program instructions, and the computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium.
  • the program instructions are executed by at least one processor in the computer system to implement the flow steps of the above-described method embodiments.
  • the present application also provides a storage medium.
  • the storage medium may be a computer-readable storage medium.
  • the storage medium stores a computer program, wherein the computer program includes program instructions.
  • the storage medium may be various computer-readable storage media that can store program codes, such as a U disk, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk.
  • program codes such as a U disk, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a storage medium.
  • the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种文件传输方法、装置、计算机设备及存储介质。方法包括:判断服务器中所存储的缓存数据是否已达到饱和状态;若服务器中所存储的缓存数据已达到饱和状态,则将缓存数据的文件块组的超级块信息拷贝至服务器内存中并通过RDMA远程传输至客户端;获取客户端基于超级块信息生成的远程数据读取请求,远程数据读取请求中包含待读取数据的地址空间;根据远程数据读取请求,将待读取数据通过DMA远程传输至客户端。本申请基于数据传输优化技术,通过只拷贝缓存数据的超级块信息到服务器内存,降低缓存数据传输压力;并通过DMA远程传输目标数据,不涉及操作系统和CPU的处理,减少了数据拷贝传输量,提高了数据传输效率。

Description

文件传输方法、装置、计算机设备及存储介质
本申请要求于2020年12月18日提交中国专利局、申请号为202011509142.2,发明名称为“文件传输方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据传输技术领域,尤其涉及一种文件传输方法、装置、计算机设备及存储介质。
背景技术
在现有的缓存I/O机制中,DMA方式可以将数据直接从磁盘读到页缓存中,或者将数据从页缓存直接写回到磁盘上,而不能直接在应用程序地址空间和磁盘之间进行数据传输,这样的话,数据在传输过程中需要在应用程序地址空间和页缓存之间进行多次数据拷贝操作,这些数据拷贝操作所带来的CPU(Central Processing Unit,中央处理器)以及内存开销是非常大的。
为了提高数据读取的效率,目前Linux系统层面做了很多的改进,比如:加入内存共享(mmap,内存映射文件的方法);使用Sendfile零拷贝技术,在代表输入文件的描述符in_fd和代表输出文件的描述符out_fd之间传送文件内容,通过DMA直接将文件描述符发送到Socket缓冲区,而数据也是由DMA引擎拷贝到socket缓冲区;在数据一定要经过用户空间时,也有使用COW技术(Copy On Write,写时复制)。
在以上几种常见的零拷贝技术中,发明人发现CPU均参与到了上下文切换和数据拷贝活动中,文件传输时无法完全避免CPU的参与,会造成CPU资源的占用和消耗,同时上述的零拷贝文件方式只能针对一些特定的文件系统,无法满足通用文件系统的要求。
发明内容
本申请实施例提供了一种文件传输方法、装置、计算机设备及存储介质,旨在解决文件传输时对CUP资源占用的问题。
第一方面,本申请实施例提供了一种文件传输方法,其包括以下步骤:判断服务器中所存储的缓存数据是否已达到饱和状态;若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;根据所述远程数据读取请求,将所述待读取数据通过RDMA远程传输至客户端。
第二方面,本申请实施例还提供了一种文件传输装置,包括:缓存判断单元,用于判断服务器中所存储的缓存数据是否已达到饱和状态;信息拷贝单元,用于若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;信息传输单元,用于将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;请求获取单元,用于获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;数据传输单元,根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端。
第三方面,本申请实施例还提供了一种计算机设备,其包括存储器及处理器,所述存储器上存储有计算机程序,所述处理器执行所述计算机程序时实现上述文件传输方法。
第四方面,本申请实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时可实现上述文件传输方法。
本申请实施例提供了一种文件传输方法、装置、计算机设备及存储介质。本申请实施例由于在服务器中存满缓存数据时,只拷贝缓存数据的超级块信息到服务器内存,降低缓存数据传输压力,并通过RDMA远程传输至客户端,客户端基于超级块信息解析得到待读取数据的 地址空间,并基于地址空间通过DMA远程传输从服务器的内存直接读取目标数据,不涉及操作系统和CPU的处理,简化了数据传输处理流程,减少了数据拷贝传输量,提高了数据传输效率,提高文件远程传输的场景的普遍性。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的文件传输方法的应用场景示意图;
图2为本申请实施例提供的文件传输方法的流程示意图;
图3为本申请实施例提供的文件传输方法的子流程示意图;
图4为本申请实施例提供的文件传输方法的子流程示意图;
图5为本申请实施例提供的文件传输方法的子流程示意图;
图6为本申请实施例提供的文件传输方法的子流程示意图;
图7为本申请另一实施例提供的文件传输方法的流程示意图;
图8为本申请实施例提供的文件传输装置的示意性框图;
图9为本申请实施例提供的文件传输装置的信息拷贝单元的示意性框图;
图10为本申请实施例提供的文件传输装置的数据传输单元的示意性框图;
图11为本申请实施例提供的文件传输装置的数据加密模块的示意性框图;
图12为本申请另一实施例提供的文件传输装置的示意性框图;以及
图13为本申请实施例提供的计算机设备的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
请参阅图1和图2,图1为本申请实施例提供的文件传输方法的应用场景示意图。图2为本申请实施例提供的文件传输方法的示意性流程图。该文件传输方法应用于服务器中,服务器与客户端进行数据交互,并实现文件远程传输。服务器通过服务器所存储的缓存数据已经饱和时,将缓存数据的超级块信息拷贝至服务器内存中,并通过RDMA远程传输至客户端,客户端基于超级块信息解析得到待读取数据的地址空间,并基于地址空间通过RDMA远程传输从服务器内存获取对应的数据。如图1所示,客户端可包括第一终端和第二终端等可进行网络数据传输的终端设备。
图2是本申请实施例提供的一种文件传输方法的流程示意图。如图所示,该方法包括以下步骤S110-150。
S110、判断服务器中所存储的缓存数据是否已达到饱和状态。
在本实施例中,服务器的文件系统在正常使用时,用户进程通过read()命令调用sys_read()命令进入到内核态,进程调度器分配CPU(Central Processing Unit,中央处理器),CPU发送IO(Input/Output,输入/输出)操作至DMA,DMA通过请求对硬件进行驱 动,硬件将缓存数据进行缓存,缓存数据的大小也决定了中断的频率。若服务器所缓存的缓存数据已经达到饱和状态,则会触发CPU中断,进而触发DMA辅助数据到服务器的内存中。
其中,DMA(Direct Memory Access,直接存储器访问)是所有现代计算机的重要功能,DMA允许不同速度的硬件装置进行沟通,而不需要依赖于CPU的大量中断负载。
S120、若服务器中所存储的缓存数据已达到饱和状态,则将缓存数据的文件块组的超级块信息拷贝至服务器内存中。
在本实施例中,缓存数据由多个文件块组组成,每个文件块组包含有:Inode、超级块、Dentry缓存和数据块。本方案只将超级块信息通过DMA拷贝到服务器内存中,而不对剩下的Inode、Dentry缓存和数据块进行拷贝,以减少DMA拷贝数据大小,进而提高DMA拷贝效率。超级块内包含有管理整个文件系统的信息,基于文件块组的超级块信息,可以获取服务器硬盘中各个文件所对应的Inode,而Inode结构中i_mapping与i_data字段则实际映射了各个文件在服务器硬盘的地址空间,因此硬盘中所有的数据均可通过超级块信息来获取。
其中,Inode,中文为索引节点,用于存储文件元信息,每个文件都具有文件元信息,文件元信息包含有文件创建者信息、文件创建日期信息、文件地址信息和文件大小信息等等用于描述对应的文件的信息。其中,文件地址信息即为上述的Inode结构中i_mapping与i_data字段。
参考图3,在一实施例中,步骤S120包括步骤S121-S123。
S121、解析缓存数据,得到组成缓存数据的多个文件块组。
S122、获取每个文件块组中的超级块信息。
S123、将所有文件块组中的超级块信息通过DMA拷贝至服务器内存中。
在本实施例中,在通过DMA将超级块信息拷贝到服务器内存之前,需要对缓存数据进行解析,以得到组成缓存数据的文件块组,再从解析出来的文件块组中读取出各个文件块组的超级块信息,并通过DMA技术拷贝到服务器内存中,以便客户端直接通过RDMA技术远程传输取得。
S130、将存储于服务器内存中的超级块信息通过RDMA远程传输至客户端。
在本实施例中,本方案使用RDMA技术,客户端可以通过RDMA远程访问服务器内存中的数据,直接拷贝内存中文件(也即是上述的超级块信息)并传输到客户端,也即是,服务器将内存中的超级块信息通过RDMA远程传输至客户端,并由客户端进一步处理,通过RDMA直接将服务器内存中的超级块信息拷贝到客户端,不涉及操作系统和CPU的处理,简化了数据传输处理流程,减少了服务器到客户端的数据拷贝传输量,提高了数据传输效率。
其中,RDMA(Remote Direct Memory Access)技术全称远程直接数据存取,就是为了解决网络传输中服务器数据处理的延迟而产生的。RDMA通过网络把资料直接传入计算机的存储区,将数据从一个系统快速移动到远程系统存储器中,而不对操作系统造成任何影响,这样就不需要用到多少计算机的处理功能。它消除了外部存储器复制和上下文切换的开销,因而能解放内存带宽和CPU周期用于改进应用系统性能。
S140、获取客户端基于超级块信息生成的远程数据读取请求,远程数据读取请求中包含待读取数据的地址空间。
在本实施例中,客户端基于获取到的超级块信息解析得到服务器文件系统中全部或部分文件的地址空间,客户端根据自身需求并基于得到的地址空间生成一远程数据读取请求,其中远程数据读取请求,包括了待读取数据的地址空间,基于远程数据读取请求可以直接通过DMA远程拷贝对应地址空间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
S150、根据远程数据读取请求,将待读取数据通过DMA远程传输至客户端。
在本实施例中,基于客户端的远程数据读取请求,客户端可以直接通过DMA远程拷贝服务器上对应的地址空间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
具体的,远程数据读取请求中可以包括多个待读取数据的地址空间。例如远程数据读取请求可以包括待读取数据a、待读取数据b和待读取数据c的地址空间,客户端基于该远程数据读取请求可以直接通过DMA远程拷贝对应待读取数据a、待读取数据b和待读取数据c的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
参考图4,在一实施例中,步骤S150包括步骤S151-S153。
S151、根据地址空间,获取与地址空间相对应的待读取数据。
S152、对待读取数据进行加密,以得到加密后的数据包。
S153、将加密后的数据包通过DMA远程传输至客户端。
在本实施例中,为了保证数据的完整性和安全性,本方案在将待读取数据进行服务器到客户端拷贝传输时,向加密对应的待获取数据,并将待获取数据通过DMA远程直接传输至客户端,确保数据的安全。
参考图5,步骤S152包括步骤S1521-S1523。
S1521、通过预设的加密算法对待读取数据进行加密,以得到加密数据。
在本实施例中,获取到待读取数据之后,采用加密算法对该待读取数据进行加密以得到加密数据,确保数据安全,其中加密算法可以采用对称加密算法、非对称加密算法等常规/非常规的加密算法,以进一步提高数据安全。
S1522、将加密数据封装成数据包。
在本实施例中,将加密数据封装成数据包,以数据包的形式进行后续数据传输,可以在加密数据的数据量比较大时,保证加密数据的传输质量和效率。
参考图6,在本实施例中,步骤S1522包括步骤S1522a和S1522b。
S1522a、根据加密数据的信息量,将加密数据划分成多个文件部分。
S1522b、对多个文件部分进行并行压缩,得到多个子数据包。
在本方案中,打包加密数据也即是对加密数据进行压缩,得到压缩包格式的数据包。本方案中,先根据加密数据的信息量将加密数据分成多个文件部分,多个文件部分共同组成该加密数据,另外采用预置的压缩软件对上述的文件部分进行并行压缩,得到多个压缩格式的子数据包,通过并行压缩大大缩短了加密数据的整体压缩时间,提高了加密数据打包效率。其中,压缩包格式的数据包,为zip或rar格式的压缩包文件,对加密数据进行打包后进行传输,有效保证了加密数据在传输过程的数据稳定性。
S1523、于数据包的包头中加入加密算法的标识,以得到加密后的数据包。
在本实施例中,数据包的包头中加入加密算法的标识,可以标识出对应当前数据包的状态,表示该数据包已经完成加密和封装,可以进行数据传输。
本申请实施例在服务器缓存数据已经达到饱和状态,只拷贝缓存数据的超级块信息到服务器内存,降低缓存数据传输压力,并通过RDMA远程传输至客户端,客户端基于超级块信息解析得到待读取数据的地址空间,并基于地址空间通过DMA远程传输从服务器的内存直接读取数据,不涉及操作系统和CPU的处理,简化了数据传输处理流程,减少了数据拷贝传输量,提高了数据传输效率,提高文件远程传输的场景的普遍性。
图7是本申请另一实施例提供的一种文件传输方法的流程示意图。如图7所示,本实施例的文件传输方法包括步骤S210-S270。其中步骤S210-S250与上述实施例中的步骤S110-S150类似,在此不再赘述。下面详细说明本实施例中所增加的步骤S260-S270。
S260、解析超级块信息以得到存储于服务器的数据的数据信息数据对应关联的地址空间。
S270、根据数据信息获取待读取数据的地址空间,并基于待读取数据的地址空间生成远程数据读取请求。
在本实施例中,客户端基于获取到的超级块信息解析得到服务器文件系统中全部或部分文件的数据信息和与数据信息关联的地址空间,客户端根据数据信息先确定需要读取的数据,在根据与待读取数据关联的地址空间,生成远程数据读取请求,其中远程数据读取请求,包括了待读取数据的地址空间,基于远程数据读取请求可以直接通过DMA远程拷贝对应地址空 间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
本申请中的技术方法可应用于智慧政务/智慧城管/智慧社区/智慧安防/智慧物流/智慧医疗/智慧教育/智慧环保/智慧交通等包含数据传输的应用场景中,从而推动智慧城市的建设。
图8是本申请实施例提供的一种文件传输装置的示意性框图。如图8所示,对应于以上文件传输方法,本申请还提供一种文件传输装置。该文件传输装置包括用于执行上述文件传输方法的单元,该装置可以被配置于台式电脑、平板电脑、手提电脑、等终端中。具体地,请参阅图8,该文件传输装置400包括缓存判断单元10,信息拷贝单元20,信息传输单元30,请求获取单元40和数据传输单元50。
缓存判断单元10,用于判断服务器中所存储的缓存数据是否已达到饱和状态。
在本实施例中,服务器的文件系统在正常使用时,用户进程通过read()命令调用sys_read()命令进入到内核态,进程调度器分配CPU(Central Processing Unit,中央处理器),CPU发送IO(Input/Output,输入/输出)操作至DMA,DMA通过请求至对硬件进行驱动,硬件将缓存数据进行缓存,缓存数据大小也决定中断的频率。在服务器已经达到饱和状态,会触发CPU中断,进而触发DMA辅助数据到服务器的内存中。
其中,DMA(Direct Memory Access,直接存储器访问)是所有现代计算机的重要功能,DMA允许不同速度的硬件装置进行沟通,而不需要依赖于CPU的大量中断负载。
信息拷贝单元20,用于若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中。
在本实施例中,缓存数据由多个文件块组组成,每个文件块组包含有:Inode、超级块、Dentry缓存和数据块。本方案只将超级块信息通过DMA拷贝到服务器内存中,而不对剩下的Inode、Dentry缓存和数据块进行拷贝,以减少DMA拷贝数据大小,进而提高DMA拷贝效率。超级块内包含有管理整个文件系统的信息,基于文件块组的超级块信息,可以获取服务器硬盘中各个文件所对应的Inode,而Inode结构中i_mapping与i_data字段则实际的映射了各个文件在服务器硬盘的地址空间,因此硬盘中所有的数据均可通过超级块信息来获取到。
其中,Inode,中文为索引节点,用于存储文件元信息,每个文件都具有文件元信息,文件元信息包含有文件创建者信息、文件创建日期信息、文件地址信息和文件大小信息等等用于描述对应的文件的信息。其中,文件地址信息即为上述的Inode结构中i_mapping与i_data字段。
参考图9,信息拷贝单元20包括数据解析模块21,信息获取模块22和信息拷贝模块23。
数据解析模块21,用于解析缓存数据,得到组成缓存数据的多个文件块组。
信息获取模块22,用于获取每个文件块组中的超级块信息。
信息拷贝模块23,用于将所有文件块组中的超级块信息通过DMA拷贝至服务器内存中。
在本实施例中,在通过DMA将超级块信息拷贝到服务器内存之前,需要对缓存数据进行解析,以得到组成缓存数据的文件块组,再从解析出来的文件块组中读取出各个文件块组的超级块信息,并通过DMA技术拷贝到服务器内存中,以便客户端直接通过RDMA技术远程传输取得。
信息传输单元30,用于将存储于服务器内存中的超级块信息通过RDMA远程传输至客户端。
在本实施例中,本方案使用RDMA技术,客户端可以通过RDMA远程访问服务器内存中的数据,直接拷贝内存中文件(也即是上述的超级块信息)并传输到客户端,也即是,服务器将内存中的超级块信息通过RDMA远程传输至客户端,并由客户端进一步处理,通过RDMA直接将服务器内存中的超级块信息拷贝到客户端,不涉及操作系统和CPU的处理,简化了数据传输处理流程,减少了服务器到客户端的数据拷贝传输量,提高了数据传输效率。
其中,RDMA(Remote Direct Memory Access)技术全称远程直接数据存取,就是为了解决网络传输中服务器数据处理的延迟而产生的。RDMA通过网络把资料直接传入计算机的存储区, 将数据从一个系统快速移动到远程系统存储器中,而不对操作系统造成任何影响,这样就不需要用到多少计算机的处理功能。它消除了外部存储器复制和上下文切换的开销,因而能解放内存带宽和CPU周期用于改进应用系统性能。
请求获取单元40,用于获取客户端基于超级块信息生成的远程数据读取请求,远程数据读取请求中包含待读取数据的地址空间。
在本实施例中,客户端基于获取到的超级块信息解析得到服务器文件系统中全部或部分文件的地址空间,客户端根据自身需求并基于得到的地址空间生成一远程数据读取请求,其中远程数据读取请求,包括了待读取数据的地址空间,基于远程数据读取请求可以直接通过DMA远程拷贝对应地址空间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
数据传输单元50,用于根据远程数据读取请求,将待读取数据通过DMA远程传输至客户端。
在本实施例中,基于客户端的远程数据读取请求,客户端可以直接通过DMA远程拷贝服务器上对应的地址空间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
具体的,远程数据读取请求中可以包括多个待读取数据的地址空间。例如远程数据读取请求可以包括待读取数据a、待读取数据b和待读取数据c的地址空间,客户端基于该远程数据读取请求可以直接通过DMA远程拷贝对应待读取数据a、待读取数据b和待读取数据c的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
参考图10,在一实施例中,数据传输单元50包括数据获取模块51,数据加密模块52和数据传输模块53。
数据获取模块51,用于根据地址空间,获取与地址空间相对应的待读取数据。
数据加密模块52,用于对待读取数据进行加密,以得到加密后的数据包。
数据传输模块53,用于将加密后的数据包通过DMA远程传输至客户端。
在本实施例中,为了保证数据的完整性和安全性,本方案在将待读取数据进行服务器到客户端拷贝传输时,向加密对应的待获取数据,并将待获取数据通过DMA远程直接传输至客户端,确保数据的安全。
参考图11,在一实施例中,数据加密模块52包括加密子模块521,封装子模块522和标识子模块523。
加密子模块521,用于通过预设的加密算法对待读取数据进行加密,以得到加密数据。
在本实施例中,获取到待读取数据之后,采用加密算法对该待读取数据进行加密以得到加密数据,确保数据安全,其中加密算法可以采用对称加密算法、非对称加密算法等常规/非常规的加密算法,以进一步提高数据安全。
封装子模块522,还用于根据加密数据的信息量,将加密数据划分成多个文件部分;对多个文件部分进行并行压缩,得到多个子数据包。
在本实施例中,打包加密数据也即是对加密数据进行压缩,得到压缩包格式的数据包。本方案中,先根据加密数据的信息量将加密数据分成多个文件部分,多个文件部分共同组成该加密数据,另外采用预置的压缩软件对上述的文件部分进行并行压缩,得到多个压缩格式的子数据包,通过并行压缩大大缩短了加密数据的整体压缩时间,提高了加密数据打包效率。其中,压缩包格式的数据包,为zip或rar格式的压缩包文件,对加密数据进行打包后进行传输,有效保证了加密数据在传输过程的数据稳定性。
标识子模块523,用于于数据包的包头中加入加密算法的标识,以得到加密后的数据包。
在本实施例中,数据包的包头中加入加密算法的标识,可以标识出对应当前数据包的状态,表示该数据包已经完成加密和封装,可以进行数据传输。
本申请实施例在服务器已经达到饱和状态,只拷贝缓存数据的超级块信息到服务器内存,降低缓存数据传输压力,并通过RDMA远程传输至客户端,客户端基于超级块信息解析得到待 读取数据的地址空间,并基于地址空间通过DMA远程传输从服务器的内存直接读取数据,不涉及操作系统和CPU的处理,简化了数据传输处理流程,减少了数据拷贝传输量,提高了数据传输效率,提高文件远程传输的场景的普遍性。
图12是本申请另一实施例提供的一种文件传输装置的示意性框图。如图12所示,本实施例的文件传输装置400是上述实施例的基础上增加了信息解析单元60和请求生成单元70。
信息解析单元60,用于解析超级块信息以得到存储于服务器的数据的数据信息和与数据对应关联的地址空间。
请求生成单元70,用于根据数据信息获取待读取数据的地址空间,并基于待读取数据的地址空间生成远程数据读取请求。
在本实施例中,客户端基于获取到的超级块信息解析得到服务器文件系统中全部或部分文件的数据信息和与数据信息关联的地址空间,客户端根据数据信息先确定需要读取的数据,在根据与待读取数据关联的地址空间,生成远程数据读取请求,其中远程数据读取请求,包括了待读取数据的地址空间,基于远程数据读取请求可以直接通过DMA远程拷贝对应地址空间下的数据块和其他文件信息,以完成服务器和客户端之间的数据远程传输。
需要说明的是,所属领域的技术人员可以清楚地了解到,上述文件传输装置400和各单元的具体实现过程,可以参考前述方法实施例中的相应描述,为了描述的方便和简洁,在此不再赘述。
上述文件传输装置可以实现为一种计算机程序的形式,该计算机程序可以在如图13所示的计算机设备上运行。
请参阅图13,图13是本申请实施例提供的一种计算机设备的示意性框图。该计算机设备500可以是终端,也可以是服务器,其中,终端可以是智能手机、平板电脑、笔记本电脑、台式电脑、个人数字助理和穿戴式设备等具有通信功能的电子设备。服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。
参阅图13,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032包括程序指令,该程序指令被执行时,可使得处理器502执行一种文件传输方法。
该处理器502用于提供计算和控制能力,以支撑整个计算机设备500的运行。
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行一种文件传输方法。
该网络接口505用于与其它设备进行网络通信。本领域技术人员可以理解,图13中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
其中,所述处理器502用于运行存储在存储器中的计算机程序5032。
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
本领域普通技术人员可以理解的是实现上述实施例的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序包括程序指令,计算机程序可存储于一存储介质中,该存储介质为计算机可读存储介质。该程序指令被该计算机系统中的至少一个处理器执行,以实现上述方法的实施例的流程步骤。
因此,本申请还提供一种存储介质。该存储介质可以为计算机可读存储介质。该存储介 质存储有计算机程序,其中计算机程序包括程序指令。
所述存储介质可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的计算机可读存储介质。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的。例如,各个单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种文件传输方法,包括以下步骤:
    判断服务器中所存储的缓存数据是否已达到饱和状态;
    若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;
    将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;
    获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;
    根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端。
  2. 根据权利要求1所述的文件传输方法,其中,所述根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端的步骤,包括:
    根据所述地址空间,获取与所述地址空间相对应的待读取数据;
    对所述待读取数据进行加密,以得到加密后的数据包;
    将所述加密后的数据包通过DMA远程传输至所述客户端。
  3. 根据权利要求2所述的文件传输方法,其中,所述对所述待读取数据进行加密,以得到加密后的数据包的步骤,包括:
    通过预设的加密算法对所述待读取数据进行加密,以得到加密数据;
    将所述加密数据封装成数据包;
    于所述数据包的包头中加入所述加密算法的标识,以得到加密后的数据包。
  4. 根据权利要求3所述的文件传输方法,其中,所述将所述加密数据封装成数据包的步骤,包括:
    根据所述加密数据的信息量,将所述加密数据划分成多个文件部分;
    对多个所述文件部分进行并行压缩,得到多个子数据包。
  5. 根据权利要求1所述的文件传输方法,其中,所述获取所述客户端基于所述超级块信息生成的远程数据读取请求的步骤之前,包括:
    解析所述超级块信息以得到存储于服务器的数据的数据信息和与所述数据对应关联的地址空间;
    根据所述数据信息获取待读取数据的地址空间,并基于所述待读取数据的地址空间生成远程数据读取请求。
  6. 根据权利要求1所述的文件传输方法,其中,所述将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中的步骤,包括:
    解析所述缓存数据,得到组成所述缓存数据的多个文件块组;
    获取每个所述文件块组中的超级块信息;
    将所有文件块组中的所述超级块信息通过DMA拷贝至服务器内存中。
  7. 根据权利要求4所述的文件传输方法,其中,所述对多个所述文件部分进行并行压缩,得到多个子数据包,包括:
    对多个所述文件部分进行并行压缩,得到多个zip或rar格式的子数据包。
  8. 一种文件传输装置,包括:
    缓存判断单元,用于判断服务器中所存储的缓存数据是否已达到饱和状态;
    信息拷贝单元,用于若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;
    信息传输单元,用于将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;
    请求获取单元,用于获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;
    数据传输单元,用于根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输 至所述客户端。
  9. 一种计算机设备,所述计算机设备包括存储器及处理器,所述存储器上存储有计算机程序,其中,所述处理器执行所述计算机程序时执行以下步骤:
    判断服务器中所存储的缓存数据是否已达到饱和状态;
    若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;
    将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;
    获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;
    根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端。
  10. 根据权利要求9所述的计算机设备,其中,所述根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端的步骤,包括:
    根据所述地址空间,获取与所述地址空间相对应的待读取数据;
    对所述待读取数据进行加密,以得到加密后的数据包;
    将所述加密后的数据包通过DMA远程传输至所述客户端。
  11. 根据权利要求10所述的计算机设备,其中,所述对所述待读取数据进行加密,以得到加密后的数据包的步骤,包括:
    通过预设的加密算法对所述待读取数据进行加密,以得到加密数据;
    将所述加密数据封装成数据包;
    于所述数据包的包头中加入所述加密算法的标识,以得到加密后的数据包。
  12. 根据权利要求11所述的计算机设备,其中,所述将所述加密数据封装成数据包的步骤,包括:
    根据所述加密数据的信息量,将所述加密数据划分成多个文件部分;
    对多个所述文件部分进行并行压缩,得到多个子数据包。
  13. 根据权利要求9所述的计算机设备,其中,所述获取所述客户端基于所述超级块信息生成的远程数据读取请求的步骤之前,包括:
    解析所述超级块信息以得到存储于服务器的数据的数据信息和与所述数据对应关联的地址空间;
    根据所述数据信息获取待读取数据的地址空间,并基于所述待读取数据的地址空间生成远程数据读取请求。
  14. 根据权利要求9所述的计算机设备,其中,所述将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中的步骤,包括:
    解析所述缓存数据,得到组成所述缓存数据的多个文件块组;
    获取每个所述文件块组中的超级块信息;
    将所有文件块组中的所述超级块信息通过DMA拷贝至服务器内存中。
  15. 根据权利要求12所述的计算机设备,其中,所述对多个所述文件部分进行并行压缩,得到多个子数据包,包括:
    对多个所述文件部分进行并行压缩,得到多个zip或rar格式的子数据包。
  16. 一种存储介质,所述存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时执行以下步骤:
    判断服务器中所存储的缓存数据是否已达到饱和状态;
    若服务器中所存储的缓存数据已达到饱和状态,则将所述缓存数据的文件块组的超级块信息拷贝至服务器内存中;
    将存储于服务器内存中的所述超级块信息通过RDMA远程传输至客户端;
    获取所述客户端基于所述超级块信息生成的远程数据读取请求,所述远程数据读取请求中包含待读取数据的地址空间;
    根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端。
  17. 根据权利要求16所述的存储介质,其中,所述根据所述远程数据读取请求,将所述待读取数据通过DMA远程传输至所述客户端的步骤,包括:
    根据所述地址空间,获取与所述地址空间相对应的待读取数据;
    对所述待读取数据进行加密,以得到加密后的数据包;
    将所述加密后的数据包通过DMA远程传输至所述客户端。
  18. 根据权利要求17所述的存储介质,其中,所述对所述待读取数据进行加密,以得到加密后的数据包的步骤,包括:
    通过预设的加密算法对所述待读取数据进行加密,以得到加密数据;
    将所述加密数据封装成数据包;
    于所述数据包的包头中加入所述加密算法的标识,以得到加密后的数据包。
  19. 根据权利要求18所述的存储介质,其中,所述将所述加密数据封装成数据包的步骤,包括:
    根据所述加密数据的信息量,将所述加密数据划分成多个文件部分;
    对多个所述文件部分进行并行压缩,得到多个子数据包。
  20. 根据权利要求16所述的存储介质,其中,所述获取所述客户端基于所述超级块信息生成的远程数据读取请求的步骤之前,包括:
    解析所述超级块信息以得到存储于服务器的数据的数据信息和与所述数据对应关联的地址空间;
    根据所述数据信息获取待读取数据的地址空间,并基于所述待读取数据的地址空间生成远程数据读取请求。
PCT/CN2021/083759 2020-12-18 2021-03-30 文件传输方法、装置、计算机设备及存储介质 WO2022126919A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011509142.2A CN112612734B (zh) 2020-12-18 2020-12-18 文件传输方法、装置、计算机设备及存储介质
CN202011509142.2 2020-12-18

Publications (1)

Publication Number Publication Date
WO2022126919A1 true WO2022126919A1 (zh) 2022-06-23

Family

ID=75240712

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083759 WO2022126919A1 (zh) 2020-12-18 2021-03-30 文件传输方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN112612734B (zh)
WO (1) WO2022126919A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115495026A (zh) * 2022-11-21 2022-12-20 杭州字节方舟科技有限公司 一种优化内存处理方法、装置、设备及存储介质
CN116881191A (zh) * 2023-09-06 2023-10-13 苏州浪潮智能科技有限公司 数据处理方法、装置、设备及存储介质
CN117112508A (zh) * 2023-10-20 2023-11-24 杭州美创科技股份有限公司 基于序号的文件同步方法、装置、计算机设备及存储介质
WO2024174892A1 (zh) * 2023-02-23 2024-08-29 中兴通讯股份有限公司 文件传输方法、电子设备、计算机可读存储介质

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113110800A (zh) * 2021-04-12 2021-07-13 百度在线网络技术(北京)有限公司 数据处理方法、装置、电子设备及存储介质
CN113138969A (zh) * 2021-04-30 2021-07-20 青岛盛世影云影视科技有限公司 数据传输方法、装置、电子设备和计算机可读存储介质
CN113297110B (zh) * 2021-05-17 2024-06-18 阿里巴巴创新公司 数据采集系统、方法以及装置
CN114442951B (zh) * 2022-01-24 2024-08-02 珠海泰芯半导体有限公司 传输多路数据的方法、装置、存储介质和电子设备
CN117271073A (zh) * 2022-06-15 2023-12-22 顺丰科技有限公司 计算任务的执行方法及装置
CN115086306B (zh) * 2022-08-18 2022-11-18 天津市天河计算机技术有限公司 一种数据传输方法、装置、电子设备和存储介质
CN116775510B (zh) * 2023-08-22 2023-11-24 成都泛联智存科技有限公司 数据访问方法、装置、服务器和计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108268208A (zh) * 2016-12-30 2018-07-10 清华大学 一种基于rdma的分布式内存文件系统
CN109240617A (zh) * 2018-09-03 2019-01-18 郑州云海信息技术有限公司 分布式存储系统写请求处理方法、装置、设备及存储介质
CN110191194A (zh) * 2019-06-13 2019-08-30 华中科技大学 一种基于rdma网络的分布式文件系统数据传输方法和系统
US20200364148A1 (en) * 2019-05-15 2020-11-19 EMC IP Holding Company LLC Method, device and computer program product for implementing file system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10257273B2 (en) * 2015-07-31 2019-04-09 Netapp, Inc. Systems, methods and devices for RDMA read/write operations

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108268208A (zh) * 2016-12-30 2018-07-10 清华大学 一种基于rdma的分布式内存文件系统
CN109240617A (zh) * 2018-09-03 2019-01-18 郑州云海信息技术有限公司 分布式存储系统写请求处理方法、装置、设备及存储介质
US20200364148A1 (en) * 2019-05-15 2020-11-19 EMC IP Holding Company LLC Method, device and computer program product for implementing file system
CN110191194A (zh) * 2019-06-13 2019-08-30 华中科技大学 一种基于rdma网络的分布式文件系统数据传输方法和系统

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115495026A (zh) * 2022-11-21 2022-12-20 杭州字节方舟科技有限公司 一种优化内存处理方法、装置、设备及存储介质
CN115495026B (zh) * 2022-11-21 2023-03-10 杭州字节方舟科技有限公司 一种优化内存处理方法、装置、设备及存储介质
WO2024174892A1 (zh) * 2023-02-23 2024-08-29 中兴通讯股份有限公司 文件传输方法、电子设备、计算机可读存储介质
CN116881191A (zh) * 2023-09-06 2023-10-13 苏州浪潮智能科技有限公司 数据处理方法、装置、设备及存储介质
CN116881191B (zh) * 2023-09-06 2024-01-16 苏州浪潮智能科技有限公司 数据处理方法、装置、设备及存储介质
CN117112508A (zh) * 2023-10-20 2023-11-24 杭州美创科技股份有限公司 基于序号的文件同步方法、装置、计算机设备及存储介质
CN117112508B (zh) * 2023-10-20 2024-02-06 杭州美创科技股份有限公司 基于序号的文件同步方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN112612734B (zh) 2023-09-26
CN112612734A (zh) 2021-04-06

Similar Documents

Publication Publication Date Title
WO2022126919A1 (zh) 文件传输方法、装置、计算机设备及存储介质
JP6521403B2 (ja) サービスとしての効率的なデータ圧縮及び分析
WO2019161557A1 (zh) 一种通信的方法及装置
US9300578B2 (en) Large receive offload functionality for a system on chip
US8300823B2 (en) Encryption and compression of data for storage
US11095626B2 (en) Secure in-line received network packet processing
US11397820B2 (en) Method and apparatus for processing data, computer device and storage medium
CN114153778B (zh) 跨网络桥接
CN109857545B (zh) 一种数据传输方法及装置
EP4152140B1 (en) Network card and method for network card to process data
WO2019134403A1 (zh) 发送数据包的方法、装置及计算机可读存储介质
CN107622207B (zh) 加密系统级数据结构
WO2024217333A1 (zh) 一种基于块存储的io访问方法、装置、电子设备及介质
WO2022228485A1 (zh) 一种数据传输方法、数据处理方法及相关产品
CN114201421A (zh) 一种数据流处理方法、存储控制节点及可读存储介质
WO2023104194A1 (zh) 一种业务处理方法及装置
JP2019517692A (ja) OpenFabricsにおけるスループットの改善
CN116049085A (zh) 一种数据处理系统及方法
KR20080029687A (ko) 암호화 기능이 내장된 메모리를 이용한 고속 대용량의암호화 장치 및 그 구현 방법
JP7501957B2 (ja) ネットワークアダプタのデータ処理方法およびネットワークアダプタ
Manohar et al. Progressive vector quantization of multispectral image data using a massively parallel SIMD machine
US11038856B2 (en) Secure in-line network packet transmittal
CN102663276B (zh) Linux中提供用户空间信息摘要、加密和压缩统一接口的系统及方法
CN113422792B (zh) 数据传输方法、装置、电子设备及计算机存储介质
CN115379028A (zh) 基于dpdk的高性能密码服务方法、装置、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21904859

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21904859

Country of ref document: EP

Kind code of ref document: A1