File transmission method, device, equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-08-11
AI Technical Summary
[0002]当前,单个数据资源(如模型、数字孪生底板等)的文件数量可达几千、几万等,当客户端请求下载文件数量较多的数据资源时,服务端一般会选择单文件传输或者并发传输,但是由于文件数量太多,单文件传输或并发传输的传输效率较低,导致客户端的下载速度变慢,影响用户的下载体验
Smart Images

Figure CN122554447A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data transmission technology, and in particular to a file transmission method, apparatus, device, and storage medium. Background Technology
[0002] Currently, the number of files in a single data resource (such as a model, digital twin base plate, etc.) can reach thousands or tens of thousands. When a client requests to download a data resource with a large number of files, the server usually chooses single file transfer or concurrent transfer. However, due to the large number of files, the transfer efficiency of single file transfer or concurrent transfer is low, which slows down the client's download speed and affects the user's download experience. Summary of the Invention
[0003] To address the problems existing in the aforementioned related technologies, this disclosure provides a file transfer method, apparatus, device, and storage medium.
[0004] The first aspect of this disclosure provides a file transfer method, comprising: In response to receiving a data download request from a client, retrieve multiple files corresponding to the data download request from a preset storage system; Multiple files are grouped to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file; Each target file group is packaged separately to obtain the data package corresponding to each target file group; Each data packet is sent to the client in parallel, so that the client can download the multiple files corresponding to the data download request.
[0005] Optionally, the above method of grouping multiple files to obtain at least one target file group includes: Get the total number of files and the size of each file; Based on the total number and the size of each file, multiple files are grouped to obtain at least one target file group.
[0006] Optionally, based on the total number and the size of each file, the above method groups multiple files to obtain at least one target file group, including: For each file in the multiple files, based on the target size range to which the file size belongs, the file is divided into the first file group corresponding to the target size range; For each first filegroup, calculate the ratio of the data size of the first filegroup to the number of files in the first filegroup to obtain the average file size of the first filegroup; For each first file group, based on the average file size and number of files in the first file group, the files in the first file group are divided into at least one target file group.
[0007] Optionally, the above-mentioned division of the files in the first filegroup into at least one target filegroup based on the average file size and number of files in the first filegroup includes: Obtain the number of target files corresponding to the average file size, where the number of target files is greater than 1, and the transmission time corresponding to the file group constructed by the number of target files and the average file size is less than or equal to the first preset time threshold. The transmission time is the time it takes for the file group to be transmitted to the client at the first preset network speed. Based on the number of target files, the files in the first file group are divided into at least one second file group and one third file group. The number of files in the second file group is equal to the number of target files, and the files in the third file group are the remaining files in the first file group excluding the second file group. The second and third file groups are designated as the target file groups.
[0008] Optionally, each target file group is packaged separately to obtain a data packet corresponding to each target file group, including: Each target file group is compressed to obtain a compressed package corresponding to each target file group; The compressed file corresponding to the target file group is identified as the data package corresponding to the target file group; Each data packet is sent to the client in parallel, so that the client can download multiple files corresponding to the data download request, including: Each data packet is sent to the client in parallel, so that the client can decompress each data packet to obtain multiple files corresponding to the data download request.
[0009] Optionally, the above compression process is performed on each target file group to obtain a compressed package corresponding to each target file group, including: Obtain the data volume of each target file group; Sort the target file groups in ascending order of data size to obtain a file group sequence; Starting with the first target file group in the file group sequence, each target file group is compressed sequentially according to its order in the file group sequence to obtain a compressed package corresponding to each target file group.
[0010] Optionally, the above compression process is performed on each target file group to obtain a compressed package corresponding to each target file group, including: For each target file group, a target compression algorithm is determined for the data volume of the target file group. The download time of the compressed package after the target compression algorithm compresses the data volume of the target file group is less than or equal to the second preset time threshold. The download time is the time from when the client sends a data download request to when it downloads the data volume of the target file group at the second preset network speed. The target file group is compressed using the target compression algorithm to obtain the compressed package corresponding to the target file group.
[0011] A second aspect of this disclosure provides a file transfer apparatus, comprising: The acquisition module is used to retrieve multiple files corresponding to the data download request from the preset storage system in response to receiving a data download request from the client. The grouping module is used to group multiple files to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file. The packaging module is used to package each target file group separately to obtain the data package corresponding to each target file group; The sending module is used to send data packets to the client in parallel, so that the client can download the multiple files corresponding to the data download request.
[0012] A third aspect of this disclosure provides a computer device comprising: The memory and processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the file transfer method of the first aspect described above is implemented.
[0013] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the file transfer method of the first aspect described above.
[0014] The technical solution provided in this disclosure has the following advantages compared with related technologies: In this embodiment of the disclosure, in response to receiving a data download request from a client, multiple files corresponding to the data download request are retrieved from a preset storage system; the multiple files are grouped to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file; each target file group is packaged to obtain a data packet corresponding to each target file group; and each data packet is sent to the client in parallel so that the client can download each data packet. Therefore, by grouping and packaging multiple files to obtain data packets corresponding to multiple files, with at least one data packet containing more than one file, and sending each data packet to the client in parallel, batch parallel transmission of multiple files can be achieved, which can improve file transfer efficiency, increase the client's file download speed, and improve the user's download experience.
[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0017] To more clearly illustrate the technical solutions in the embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of a file transfer method provided in an embodiment of this disclosure; Figure 2 This is a flowchart of another file transfer method provided in this disclosure embodiment; Figure 3 This is a flowchart of yet another file transfer method provided in this disclosure embodiment; Figure 4 This is a flowchart of a file compression method provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of a file transfer device provided in an embodiment of this disclosure; Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation
[0019] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0020] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0021] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0023] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] To better understand the inventive concept of the embodiments of this disclosure, the technical solutions of the embodiments of this disclosure will be described below in conjunction with exemplary embodiments.
[0025] The method provided in this disclosure can be executed by a computer device, which can be understood as any device with processing and computing capabilities. The device may include, but is not limited to, electronic devices such as servers, smartphones, laptops, tablets, in-vehicle terminals, wearable devices, digital TVs, desktop computers, smart home devices, etc.
[0026] Figure 1 This is a flowchart illustrating a file transfer method provided in an embodiment of this disclosure, which can be executed by a computer device. Figure 1 As shown, the file transfer method provided in this embodiment includes the following steps: Step 110: In response to receiving a data download request from the client, retrieve multiple files corresponding to the data download request from the preset storage system.
[0027] In this embodiment of the disclosure, when a client needs to download data, it can generate a data download request and then send the data download request to a computer device. The computer device can respond to the received data download request from the client by retrieving multiple files corresponding to the data download request from a preset storage system.
[0028] Multiple files means multiple files that are requested to be downloaded.
[0029] The client can be a client device or an application on a client device.
[0030] A default storage system can be understood as a storage system composed of devices capable of storing a large number of files. For example, a default storage system can be a high-performance distributed object storage system (minIO).
[0031] For example, a client can send a data download request to a computer device using the high-performance remote procedure call protocol (gRPC).
[0032] gRPC allows clients to invoke methods on remote servers as if they were local functions, thus simplifying the development and communication of distributed systems.
[0033] In some embodiments, a computer device may obtain a list of files to be downloaded from a data download request, the list of files may include attribute information of the files to be downloaded; and then obtain multiple files corresponding to the attribute information of the files from a preset storage system.
[0034] The data download request may include a list of files to be downloaded. This list may include attribute information about the files, such as file name, file size, and number of files.
[0035] Step 120: Group the multiple files to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file.
[0036] In this embodiment of the disclosure, after obtaining multiple files corresponding to the data download request, the computer device can group the multiple files requested for download to obtain at least one target file group.
[0037] Specifically, at least one target file group contains at least one file group with more than one file. In other words, at least one target file group contains at least one file group with more than one file.
[0038] Step 130: Package each target file group separately to obtain the data package corresponding to each target file group.
[0039] In this embodiment of the disclosure, after dividing the multiple files requested for download into at least one target file group, the computer device can package each target file group to obtain a data packet corresponding to that target file group. In other words, all files in a target file group can be packaged into a single data packet.
[0040] Step 140: Send each data packet to the client in parallel so that the client can download the multiple files corresponding to the data download request.
[0041] In this embodiment of the disclosure, after obtaining the data packets corresponding to each target file group, the computer device can send the data packets corresponding to each target file group to the client in parallel, so that the client can download the multiple files corresponding to the data download request, that is, the client downloads the requested multiple files.
[0042] Sending the data packets corresponding to each target file group to the client in parallel can be understood as sending the data packets corresponding to each target file group to the client through multiple communication channels.
[0043] For example, a communication channel can be assigned to each data packet corresponding to a target file group.
[0044] For example, multiple communication channels can be multiple coroutines.
[0045] Coroutines can be understood as a lighter-weight concurrent programming model than threads, which can pause (suspend) and resume during execution, thereby achieving efficient, non-blocking asynchronous operations.
[0046] In this embodiment of the disclosure, multiple files can be grouped and packaged to obtain data packets corresponding to multiple files, with at least one data packet containing more than one file. These data packets are then sent to the client in parallel, enabling batch parallel transmission of multiple files. This improves file transmission efficiency, increases the client's file download speed, and enhances the user's download experience.
[0047] Figure 2 This is a flowchart illustrating a file transfer method provided in an embodiment of this disclosure, which can be executed by a computer device. Figure 2 As shown, the file transfer method provided in this embodiment includes the following steps: Step 210: In response to receiving a data download request from the client, retrieve multiple files corresponding to the data download request from the preset storage system.
[0048] Step 220: Obtain the total number of files and the size of each file.
[0049] The size of a file can be understood as the amount of data in the file.
[0050] Step 230: Based on the total number and the size of each file, group the multiple files to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file.
[0051] In some embodiments, grouping multiple files based on the total number and the size of each file to obtain at least one target file group may include steps 2301-2303: Step 2301: For each file in the multiple files, based on the target size range to which the file belongs, divide the file into the first file group corresponding to the target size range.
[0052] In this embodiment of the disclosure, for each file in the multiple files corresponding to the download request, the computer device can divide the file into the first file group corresponding to the target size range based on the target size range to which the file belongs.
[0053] For example, if file a is 10MB in size and the target size range of 10MB is Q1, then file a can be assigned to the first file group 1 corresponding to the target size range Q1.
[0054] Step 2302: For each first file group, calculate the ratio of the data volume of the first file group to the number of files in the first file group to obtain the average file size of the first file group.
[0055] In this embodiment of the disclosure, after dividing the files into first file groups corresponding to the target size range, for each first file group, the computer device can calculate the ratio of the data volume of the first file group to the number of files in the first file group to obtain the average file size of the first file group.
[0056] Step 2303: For each first file group, based on the average file size and number of files in the first file group, divide the files in the first file group into at least one target file group.
[0057] In this embodiment of the disclosure, for each first file group, after obtaining the average file size and the number of files in the first file group, the computer device can divide the files in the first file group into at least one target file group based on the average file size and the number of files in the first file group.
[0058] In some embodiments, dividing the files in the first file group into at least one target file group based on the average file size and number of files in the first file group may include S11-S14: S11. Obtain the number of target files corresponding to the average file size, wherein the number of target files is greater than 1, and the transmission time corresponding to the file group constructed by the number of target files and the average file size is less than or equal to the first preset time threshold. The transmission time is the time it takes for the file group to be transmitted to the client at the first preset network speed.
[0059] The number of target files is greater than 1.
[0060] The time taken for a file group consisting of the target file and the average file size of the file to be transmitted from the computer device to the client at a first preset network speed is less than or equal to a first preset time threshold.
[0061] The first preset network speed can be set as needed, such as 50kbps; there is no limit here.
[0062] The first preset duration threshold can be set as needed, such as 10 seconds; there is no limit here.
[0063] S12. According to the number of target files, divide the files in the first file group into at least one second file group and a third file group, wherein the number of files in the second file group is equal to the number of target files, and the files in the third file group are the remaining files in the first file group excluding the second file group.
[0064] In some embodiments, when the number of files in the third file group is 1, the files in the third file group can be added to any second file group, and the third file group can be deleted.
[0065] S13. Determine the second and third file groups as the target file groups.
[0066] Step 240: Package each target file group separately to obtain the data package corresponding to each target file group.
[0067] Step 250: Send each data packet to the client in parallel so that the client can download the multiple files corresponding to the data download request.
[0068] Therefore, multiple files can be grouped according to their total number and size to obtain at least one target file group. At least one data packet contains more than one file. By grouping and packaging multiple files, data packets corresponding to multiple files are obtained, and each data packet is sent to the client in parallel. This enables batch parallel transmission of multiple files, which can improve file transmission efficiency, increase the client's file download speed, and enhance the user's download experience.
[0069] Figure 3 This is a flowchart illustrating a file transfer method provided in an embodiment of this disclosure, which can be executed by a computer device. Figure 3 As shown, the file transfer method provided in this embodiment includes the following steps: Step 310: In response to receiving a data download request from the client, retrieve multiple files corresponding to the data download request from the preset storage system.
[0070] Step 320: Group the multiple files to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file.
[0071] Step 330: Compress each target file group to obtain a compressed package corresponding to each target file group.
[0072] In this embodiment of the disclosure, after grouping multiple files to obtain at least one target file group, the computer device can compress each target file group, that is, compress all files in the target file group to obtain a compressed package corresponding to the target file group. The number of compressed packages corresponding to each target file group is 1.
[0073] In some embodiments, the above-described compression process for each target file group to obtain a compressed package corresponding to each target file group may include S21-S24: S21. Obtain the data volume of each target file group.
[0074] The data size of the target file group can be understood as the total data size of all files in the target file group.
[0075] S22. Sort the multiple target file groups in ascending order of data size to obtain a file group sequence.
[0076] For example, if the data size of target file group A is 10MB, the data size of target file group B is 15MB, and the data size of target file group C is 20MB, then the multiple target file groups are sorted in ascending order of data size, resulting in the file group sequence as target file group A, target file group B, and target file group C.
[0077] S23. Starting from the first target file group in the file group sequence, compress each target file group in turn according to the order of the target file groups in the file group sequence to obtain the compressed package corresponding to each target file group.
[0078] Related experiments show that compressing multiple target file groups sequentially in ascending order of data size can improve the compression speed of multiple file groups.
[0079] Therefore, in this embodiment of the present disclosure, the computer device can start from the first target file group in the file group sequence and compress each target file group in sequence according to the order of the target file groups in the file group sequence to obtain a compressed package corresponding to each target file group.
[0080] For example, if the file group sequence is target file group A, target file group B, and target file group C, then target file group A can be compressed first to obtain compressed package y1 corresponding to target file group A; then target file group B can be compressed to obtain compressed package y2 corresponding to target file group B; and finally target file group C can be compressed to obtain compressed package y3 corresponding to target file group C.
[0081] Therefore, multiple target file groups can be compressed sequentially in ascending order of data size, which improves the compression speed and efficiency of multiple file groups, reduces file processing time, further improves file transfer efficiency, increases client file download speed, and enhances the user's download experience.
[0082] Step 340: Identify the compressed package corresponding to the target file group as the data package corresponding to the target file group.
[0083] Step 350: Send each data packet to the client in parallel so that the client can decompress each data packet to obtain multiple files corresponding to the data download request.
[0084] In this embodiment of the disclosure, the computer device can send each data packet to the client in parallel. After receiving each data packet, the client can decompress each data packet using a decompression algorithm to obtain multiple files corresponding to the data download request.
[0085] For example, a computer device can store compressed files in a tape archive buffer (tar buffer) and write the compressed files in the tape archive buffer to a transmission pipe; then send each compressed file to the client in parallel via gRPC; the client decompresses each compressed file in a worker thread and creates a file based on the file format header identifier of the decompressed file.
[0086] Therefore, by grouping multiple files to obtain at least one target file group, compressing each target file group to obtain a compressed package corresponding to the target file group, and sending each compressed package to the client in parallel, batch compression and parallel transmission of multiple files can be achieved. Since compression can reduce the amount of data in the files, it can further improve file transmission efficiency, increase the file download speed of the client, and improve the user's download experience.
[0087] In some embodiments of this disclosure, the above-described compression process is performed on each target file group to obtain a compressed package corresponding to each target file group, which can be executed by a computer device. Figure 4A flowchart of a file compression method is provided, which can be executed by a computer device. For example... Figure 4 As shown, the file compression method provided in this embodiment includes the following steps: Step 410: For each target file group, determine the target compression algorithm corresponding to the data volume of the target file group. The download time of the compressed package after the target compression algorithm compresses the data volume of the target file group is less than or equal to the second preset time threshold. The download time is the time from when the client sends a data download request to when it downloads the data volume of the target file group at the second preset network speed.
[0088] In this embodiment of the disclosure, after grouping multiple files to obtain at least one target file group, the computer device can determine the target compression algorithm corresponding to the data size of each target file group. The data size of the target file group is the total data size of all files in the target file group.
[0089] In some embodiments, the computer device pre-configures target compression algorithms corresponding to each data volume, that is, pre-configures the correspondence between each data volume and the target compression algorithm. The computer device can determine the target compression algorithm corresponding to the data volume of the target file group based on the data volume of the target file group.
[0090] Among them, the download time of the compressed package corresponding to the data volume of the target file group after the target compression algorithm compresses the data volume of the target file group is less than or equal to the second preset time threshold.
[0091] Download time can be understood as the time it takes for a client to receive the data from the target file group at a second preset network speed, after sending a data download request.
[0092] The second preset network speed can be set as needed, such as 100kbps; there is no limit here.
[0093] The second preset duration threshold can be set as needed, such as 50 seconds; there is no limit here.
[0094] In some embodiments, the target compression algorithm corresponding to the data volume of the target file group described above may include steps 4101-4103: Step 4101: For each candidate compression algorithm in the candidate compression algorithm set, obtain the download time corresponding to the compressed package after the data volume of the target file group is compressed by the candidate compression algorithm.
[0095] In this embodiment of the disclosure, a set of candidate compression algorithms is pre-configured in the computer device, and the set of candidate compression algorithms includes multiple candidate compression algorithms.
[0096] For example, candidate compression algorithms could be Gzip, zlib, etc.
[0097] The computer equipment is pre-set with the download time corresponding to the compressed package after each candidate compression algorithm compresses each data volume, that is, the time from when the client sends a data download request to when the data volume is downloaded.
[0098] The computer device can obtain the download time corresponding to the compressed package after compressing the data volume of the target file group by each candidate compression algorithm in the candidate compression algorithm set.
[0099] In some embodiments, obtaining the download time corresponding to the compressed package after the candidate compression algorithm compresses the data volume of the target file group may include S31-S32: S31. From the preset duration database, obtain the target acquisition duration, target compression duration, target sending duration, and target decompression duration corresponding to the data volume of the target file group.
[0100] In this embodiment of the disclosure, the computer device is provided with a preset duration database, which includes the acquisition duration, compression duration, transmission duration and decompression duration corresponding to each data volume.
[0101] The acquisition time corresponding to the data volume can be understood as the time it takes for the computer device to acquire the data volume from the preset storage system under the second preset network speed. The compression time corresponding to the data volume can be understood as the time it takes for each candidate compression algorithm to compress the data volume and obtain the compressed package corresponding to the data volume; The transmission time corresponding to the data volume can be understood as the time it takes for the computer device to send the compressed package corresponding to the data volume to the client under the second preset network speed; The decompression time corresponding to the data volume can be understood as the time it takes for the client to decompress the compressed package obtained by each candidate compression algorithm for that data volume.
[0102] In this embodiment of the disclosure, the computer device can obtain the target acquisition time, target compression time, target transmission time and target decompression time corresponding to the data volume of the target file group from a preset duration database.
[0103] The target acquisition time can be understood as the time it takes for a computer device to acquire the data of the target file group from a preset storage system at a second preset network speed. The target compression time can be understood as the time it takes for the candidate compression algorithm to compress the data of the target file group and obtain the target compressed package corresponding to the data of the target file group; The target transmission time can be understood as the time it takes for the computer device to send the target compressed package to the client at the second preset network speed; The target decompression time can be understood as the time it takes for the client to decompress the target compressed file.
[0104] S32. Sum the target acquisition time, target compression time, target transmission time, and target decompression time to obtain the download time of the compressed package corresponding to the data volume of the target file group after compression by the candidate compression algorithm.
[0105] Therefore, based on the target acquisition time, target compression time, target transmission time, and target decompression time corresponding to the data volume of the target file group, the download time of the compressed package after each candidate compression algorithm compresses the data volume of the target file group can be obtained quickly and accurately.
[0106] Step 4102: Determine the shortest download time among the download times corresponding to each candidate compression algorithm.
[0107] Step 4103: Determine the candidate compression algorithm corresponding to the shortest download time as the target compression algorithm corresponding to the data volume of the target file group.
[0108] Therefore, the candidate compression algorithm with the shortest download time among all candidate compression algorithms can be determined as the target compression algorithm corresponding to the data size of the target file group. Thus, the file group can be compressed based on the target compression algorithm with the highest compression efficiency, which can greatly improve the compression speed of the file group. Moreover, the compression process can reduce the data size of the file, thereby further improving file transfer efficiency, increasing the file download speed of the client, and improving the user's download experience.
[0109] Step 420: Compress the target file group based on the target compression algorithm to obtain the compressed package corresponding to the target file group.
[0110] In this embodiment of the disclosure, after determining the target compression algorithm corresponding to the data volume of each target file group, the computer device can compress the target file group based on the target compression algorithm to obtain the compressed package corresponding to the target file group.
[0111] Therefore, the target file group can be compressed using the target compression algorithm corresponding to the data size of the target file group to obtain a compressed package corresponding to the target file group. This can improve the compression speed of the file group. Since the download time of the compressed package corresponding to the data size of the target file group after compression by the target compression algorithm is less than or equal to the second preset time threshold, and the compression process can reduce the data size of the file, it can further improve the file transfer efficiency, increase the file download speed of the client, and improve the user's download experience.
[0112] Figure 5 This is a schematic diagram of a file transfer device provided in an embodiment of this disclosure. This device can be understood as the aforementioned computer equipment or a functional module within the aforementioned computer equipment. Figure 5 As shown, the file transfer device 500 includes: The acquisition module 510 is used to acquire multiple files corresponding to the data download request from a preset storage system in response to receiving a data download request from a client. Grouping module 520 is used to group the plurality of files to obtain at least one target file group, wherein the at least one target file group contains at least one file group with more than one file; The packaging module 530 is used to package each of the target file groups separately to obtain data packets corresponding to each target file group; The sending module 540 is used to send each of the data packets to the client in parallel, so that the client can download the multiple files corresponding to the data download request.
[0113] The file transfer device provided in this disclosure can implement the method of any of the above embodiments, and its execution mode and beneficial effects are similar, so they will not be described again here.
[0114] This disclosure also provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.
[0115] The computer device in this disclosure can be understood as any device with processing and computing capabilities, including but not limited to electronic devices such as servers, smartphones, laptops, tablets, in-vehicle terminals, wearable devices, digital TVs, desktop computers, smart home devices, etc.
[0116] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure, such as... Figure 6 As shown, the computer device 600 may include a processor 610 and a memory 620. The memory 620 stores a computer program 621. When the computer program 621 is executed by the processor 610, it can implement the method provided in any of the above embodiments. The execution mode and beneficial effects are similar and will not be described again here.
[0117] Of course, for the sake of simplicity, Figure 6Only some of the components of the computer device 600 relevant to the present invention are shown in this illustration; components such as buses, input / output interfaces, input devices, and output devices are omitted. In addition, the computer device 600 may include any other suitable components depending on the specific application.
[0118] This disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.
[0119] The aforementioned computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0120] The computer program described above can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer device, partially on the user's device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.
[0121] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0122] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0123] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A file transfer method characterized by, include: In response to receiving a data download request from a client, multiple files corresponding to the data download request are retrieved from a preset storage system; The plurality of files are grouped to obtain at least one target file group, wherein at least one target file group contains at least one file group with more than one file; Each of the target file groups is packaged separately to obtain a data packet corresponding to each target file group; Each of the data packets is sent to the client in parallel, so that the client can download the multiple files corresponding to the data download request.
2. The method of claim 1, wherein, The multiple files are grouped to obtain at least one target file group, including: Obtain the total number of the multiple files and the size of each file; Based on the total number and the size of each file, the multiple files are grouped to obtain at least one target file group.
3. The method according to claim 2, characterized in that, The process of grouping the multiple files based on the total number and the size of each file to obtain at least one target file group includes: For each of the multiple files, based on the target size range to which the file belongs, the file is divided into the first file group corresponding to the target size range; For each of the first file groups, calculate the ratio of the data volume of the first file group to the number of files in the first file group to obtain the average file size of the first file group; For each of the first file groups, based on the average file size of the first file group and the number of files, the files in the first file group are divided into at least one target file group.
4. The method according to claim 3, characterized in that, The step of dividing the files in the first filegroup into at least one target filegroup based on the average file size and number of files in the first filegroup includes: Obtain the number of target files corresponding to the average file size, wherein the number of target files is greater than 1, and the transmission time corresponding to the file group constructed by the number of target files and the average file size is less than or equal to a first preset time threshold, wherein the transmission time is the time it takes for the file group to be transmitted to the client at a first preset network speed; According to the number of target files, the files in the first file group are divided into at least one second file group and one third file group, wherein the number of files in the second file group is equal to the number of target files, and the files in the third file group are the remaining files in the first file group excluding the second file group; The second file group and the third file group are identified as the target file group.
5. The method according to claim 1, characterized in that, The step of packaging each of the target file groups to obtain a data packet corresponding to each target file group includes: Each of the target file groups is compressed to obtain a compressed package corresponding to each target file group; The compressed package corresponding to the target file group is identified as the data package corresponding to the target file group; The step of sending each of the data packets to the client in parallel, so that the client can download the multiple files corresponding to the data download request, includes: The data packets are sent to the client in parallel, so that the client can decompress the data packets to obtain multiple files corresponding to the data download request.
6. The method according to claim 5, characterized in that, The step of compressing each of the target file groups to obtain a compressed package corresponding to each target file group includes: Obtain the data volume of each target file group; The target file groups are sorted in ascending order of data volume to obtain a file group sequence; Starting with the first target file group in the file group sequence, each target file group is compressed sequentially according to its arrangement order in the file group sequence to obtain a compressed package corresponding to each target file group.
7. The method according to claim 5 or 6, characterized in that, The step of compressing each of the target file groups to obtain a compressed package corresponding to each target file group includes: For each target file group, a target compression algorithm is determined corresponding to the data volume of the target file group. The download time of the compressed package after the target compression algorithm compresses the data volume of the target file group is less than or equal to a second preset time threshold. The download time is the time from when the client sends the data download request to when it downloads the data volume of the target file group at a second preset network speed. The target file group is compressed using the target compression algorithm to obtain a compressed package corresponding to the target file group.
8. A file transfer device, characterized in that, include: The acquisition module is used to acquire multiple files corresponding to the data download request from a preset storage system in response to receiving a data download request from a client. A grouping module is used to group the plurality of files to obtain at least one target file group, wherein the at least one target file group contains at least one file group with more than one file; The packaging module is used to package each of the target file groups separately to obtain data packets corresponding to each target file group; The sending module is used to send each of the data packets to the client in parallel, so that the client can download the multiple files corresponding to the data download request.
9. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the file transfer method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the file transfer method as described in any one of claims 1-7.