Method and apparatus for large file transfer
By obtaining the upload information of small files, selecting target files for subsequent upload based on efficiency and data volume, and appropriately splitting or merging them during the transmission process, the problem of low efficiency in large file transmission is solved, and efficient and reliable file transmission is achieved.
Patent Information
- Application Number
- CN202411828242.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-12-12
AI Technical Summary
Existing large file splitting methods cannot guarantee smooth and efficient transmission of large files, resulting in transmission failures or slow transmission.
By obtaining the upload information of small files, files with target data volume are selected for subsequent upload based on upload efficiency and data volume. During the small file transmission process, the files are further split, integrated, or maintained as they are, ensuring full utilization of resources.
It improves the efficiency of large file transmission, reduces the probability of transmission failure, and avoids the problem of slow transmission caused by excessive file data volume.
Smart Images

Figure CN119788663B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a large file transmission method, a large file transmission device, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the popularization of technologies such as high-definition video, virtual reality, and three-dimensional (3D) modeling, the demand for uploading / downloading large files continues to grow.
[0003] Currently, uploading large files mainly involves splitting the large file into several small files, and uploading multiple small files in a synchronous / asynchronous manner to achieve the upload of the large file.
[0004] However, if a large file is split excessively, the number of small files will be too large. Every time a small file is transferred, system resources need to be called once. The transfer of too many small files requires frequent calls to system resources. If the system does not provide enough resources for file transfer, there will not be enough resources available for small files, which will lead to file transfer failure. If the number of small files split from a large file is small, the amount of data in each small file will be too large. Small files with too large a data volume are prone to jamming during the transfer process, resulting in file transfer failure. It can be seen that the existing method of splitting large files cannot guarantee the smooth and efficient transmission of large files. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a large file transmission method, a large file transmission device, an electronic device and a computer-readable storage medium, which can realize the smooth and efficient transmission of large files.
[0006] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0007] The first aspect of the present application provides a large file transmission method, the method comprising: obtaining upload information of a target small file currently being uploaded, the upload information being used to indicate the upload efficiency of the target small file, the target small file being at least one small file among multiple small files or a partial file in a small file, the small file being obtained by splitting the large file to be uploaded; according to the upload efficiency indicated by the upload information and the data volume of the target small file, selecting a file corresponding to the target data volume from the unuploaded small files for the next upload, wherein the upload efficiency is positively correlated with the target difference, and the target difference is used to characterize the difference between the target data volume and the data volume of the target small file.
[0008] Compared with the existing technology, the large file transmission method provided in the first aspect of this application, after pre-splitting the large file into multiple small files, during the small file transmission process, according to the upload efficiency of the small files, the small files that have not been transmitted subsequently are further split, integrated or maintained in their current state, which can ensure that each subsequent transmission of small files can fully utilize the provided resources, and there will be no problem of slow transmission due to excessive file data volume, thereby improving the transmission efficiency of large files as a whole.
[0009] In some changed implementations of the first aspect of the present application, the upload information includes the upload duration; based on the upload efficiency indicated by the upload information and the data volume of the target small file, a file corresponding to the target data volume is selected from the small files that have not been uploaded for uploading, including: based on the upload duration and the data volume of the target small file, a file corresponding to the target data volume is selected from the small files that have not been uploaded for uploading, wherein the shorter the upload duration, the higher the upload efficiency.
[0010] Since the upload time is the most direct representation of the upload efficiency of the target small file, the upload time of the target small file can be used to accurately determine the upload efficiency of the target small file, thereby accurately selecting the file size for the next transmission process and improving file transmission efficiency.
[0011] In some modified implementations of the first aspect of the present application, the upload information of the currently uploaded target small file is obtained, including: monitoring the real-time data volume of the target small file uploaded; if the real-time data volume reaches the preset data volume, obtaining the upload duration of the target small file, and calculating the upload duration of the target small file based on the uploaded duration and the preset data volume, wherein the preset data volume is less than the total data volume of the target small file.
[0012] When a target small file is partially uploaded, the upload duration is obtained, and the complete upload duration of the target small file is calculated based on the upload duration and the preset data volume. In this way, the upload duration of the target small file can be accurately and quickly obtained before the upload is complete, so that subsequent small files can be processed in advance based on the upload duration, so that subsequent small files can be uploaded faster and the overall file upload efficiency is improved.
[0013] In some changed implementations of the first aspect of the present application, the upload information includes the current network transmission speed; based on the upload efficiency indicated by the upload information and the data volume of the target small file, a file corresponding to the target data volume is selected from the small files that have not been uploaded for uploading, including: based on the network transmission speed and the data volume of the target small file, a file corresponding to the target data volume is selected from the small files that have not been uploaded for uploading, wherein the greater the network transmission speed, the higher the upload efficiency.
[0014] Since the network transmission speed is easy to obtain, the upload efficiency of the target small file can be determined more conveniently through the network transmission speed when the target small file is uploaded, thereby quickly determining the file size of the next transmission process and improving the file transmission efficiency.
[0015] In some modified implementations of the first aspect of the present application, the upload information of the currently uploaded target small file is obtained, including: obtaining the network transmission speed at multiple moments after the target small file starts to be uploaded, the multiple moments including the moment when the target small file starts to be uploaded and the moment when the upload is completed; predicting the network transmission trend based on the network transmission speed at multiple moments; predicting the future network transmission speed based on the network transmission trend and the network transmission speed corresponding to the moment when the target small file is completed to be uploaded, and determining the future network transmission speed as the current network transmission speed.
[0016] By using the network trend when uploading the target small file, the network transmission speed of the files uploaded thereafter is estimated. Compared with the network transmission speed when uploading the target small file, the estimated network transmission speed is more in line with the actual situation during subsequent file transmission, and can more accurately determine the file data volume of the next transmission, thereby improving the transmission efficiency of subsequent files.
[0017] In some changed implementations of the first aspect of the present application, before obtaining the upload information of the currently uploaded target small file, the method also includes: obtaining the current time information in response to receiving the large file to be uploaded; obtaining the target splitting threshold corresponding to the current time information from a preset information table, where different time information and its corresponding splitting threshold are stored in the preset information table; and splitting the large file to be uploaded into multiple small files according to the target splitting threshold.
[0018] Since the network conditions at different times are different, determining the splitting threshold according to the current time and then using the determined splitting threshold to split the large file can make the split small files more in line with the current network conditions, reduce the number of subsequent mergers or splits between small files, and improve the overall file transmission efficiency.
[0019] In some changed implementations of the first aspect of the present application, before splitting the large file to be uploaded into multiple small files according to the target splitting threshold, the method also includes: if the current time information indicates a working day, then starting from the target splitting threshold and decreasing in sequence to obtain multiple splitting thresholds; according to the target splitting threshold, splitting the large file to be uploaded into multiple small files, including: according to multiple splitting thresholds, splitting the large file to be uploaded into multiple small files.
[0020] Since network conditions are generally more congested during weekdays, file transfers can become increasingly limited due to resource constraints. Therefore, when receiving large files on weekdays, the size of the split files should be reduced accordingly. This can reduce the number of times files need to be split again when subsequent transfers are limited, improving file transfer efficiency.
[0021] A second aspect of the present application provides a large file transmission device, which includes: an acquisition module for acquiring upload information of a currently uploaded target small file, where the upload information is used to indicate the upload efficiency of the target small file, where the target small file is at least one small file among multiple small files or a partial file in a small file, and the small file is obtained by splitting the large file to be uploaded; an upload module for selecting a file corresponding to a target data volume from unuploaded small files for the next upload based on the upload efficiency indicated by the upload information and the data volume of the target small file, where the upload efficiency is positively correlated with the target difference, and the target difference is used to characterize the difference between the target data volume and the data volume of the target small file.
[0022] The third aspect of the present application provides an electronic device, which includes: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the method in the first aspect.
[0023] A fourth aspect of the present application provides a computer-readable storage medium, the storage medium comprising: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in the first aspect.
[0024] The large file transmission device provided in the second aspect, the electronic device provided in the third aspect, and the computer-readable storage medium provided in the fourth aspect of this application have the same or similar beneficial effects as the large file transmission method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above and other objects, features and advantages of the exemplary embodiments of the present application will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0026] Figure 1 This is a flow chart of the large file transmission method in the embodiment of the present application. Figure 1 ;
[0027] Figure 2 This is a schematic diagram of an example process of large file transmission in an embodiment of the present application;
[0028] Figure 3 This is a flow chart of the large file transmission method in the embodiment of the present application. Figure 2 ;
[0029] Figure 4 This is a schematic diagram of the structure of the large file transmission device in the embodiment of the present application. Figure 1 ;
[0030] Figure 5 This is a schematic diagram of the structure of the large file transmission device in the embodiment of the present application. Figure 2 ;
[0031] Figure 6 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following describes exemplary embodiments of the present application in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. Instead, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0033] It should be noted that, unless otherwise specified, the technical or scientific terms used in this application should have the common meanings understood by those skilled in the art to which this application belongs.
[0034] Currently, large file splitting is difficult to control during large file transfers. Excessive file splitting can create more small files, leading to excessive transfers and potentially failures due to frequent resource usage. Splitting a large file into fewer small files can also result in overly large files, causing each transfer to take longer and more prone to failure. Therefore, existing methods for splitting large files cannot guarantee smooth and efficient large file transfers.
[0035] In view of this, the embodiments of the present application provide a large file transmission method, a large file transmission device, an electronic device, and a computer-readable storage medium. These methods can first split a large file into several small files, and then upload one or some of the small files to check the upload status of the small files. The method then integrates, splits, or maintains the status of the small files that are subsequently uploaded, and then uploads the processed files in batches. In this way, the processed files are more compatible with the current network environment, can fully utilize current resources, reduce the probability of transmission failure, and improve the overall transmission efficiency of large files.
[0036] It should be noted that the large files transmitted in the embodiments of the present application are all legal and compliant files. Moreover, the execution subject in the embodiments of the present application can be any system, processor, terminal device, etc. that can transmit large files.
[0037] First, the large file transmission method provided in the embodiment of the present application is described in detail.
[0038] Figure 1 This is a flow chart of the large file transmission method in the embodiment of the present application. Figure 1 , see Figure 1 As shown, the method may include: S11-S12.
[0039] S11: Obtain the upload information of the currently uploaded target small file.
[0040] The target small file is at least one small file among multiple small files, or a partial file within a small file. Small files are created by splitting the large file to be uploaded. That is, when a large file is uploaded, it is first split into multiple small files, which are then uploaded in batches. During the batch upload process, one of the small files uploaded is the target small file. When each batch of small files is uploaded, the number of small files to be uploaded is determined based on the upload status of the previous batch (details will be explained later). If the previous batch of small files uploads successfully, the current batch may contain at least one small file, such as one small file, two small files, and so on. If the previous batch of small files uploads unsuccessfully, the current batch may contain partial files, such as half of a small file, one-third of a small file, and so on. In some cases, when uploading multiple small files in a batch, the small files can be merged and uploaded. This means that the multiple small files are compressed or concatenated into a single file before uploading.
[0041] The upload information is used to indicate the upload efficiency of the target small file. During the upload process of the target small file, the upload efficiency of the target small file will be monitored, and upload information that can indicate the upload efficiency of the target small file will be obtained. The upload efficiency here is used to indicate how fast the target small file is uploaded. The upload information can include various information that can characterize the upload efficiency, such as: upload time, current network speed, etc. The longer the upload time, the lower the upload efficiency. The higher the current network speed, the higher the upload efficiency. As for the specific content contained in the upload information, it is sufficient to characterize the upload efficiency, and there is no limitation here.
[0042] In large file transfers, after a file is received, it will be cached. When it is determined that the file needs to be transferred, the data volume of the file is obtained, and it is determined whether the obtained data volume is greater than the preset data volume. The preset data volume here is used to distinguish between large files and normal files. The so-called large file may refer to a file with a large data volume and a long time to transfer in one go. The specific value of the preset data volume is not limited here. When the data volume of a file is greater than the preset data volume, the file is determined to be a large file and needs to be split before being transferred. When the data volume of a file is less than or equal to the preset data volume, the file is determined to be a normal file and can be transferred directly.
[0043] After determining that the received file is a large file, the large file can be split according to the preset threshold to obtain multiple small files. The preset threshold here can be the data volume of a single small file or the total number of split small files. For example, assuming the size of the large file is 100G, if the preset threshold is 1G, 100 small files of 1G can be split. If the preset threshold is 10, 10 small files of 10G can be split. The specific meaning and value of the preset threshold are not limited here and can be determined according to actual transmission requirements.
[0044] After obtaining multiple small files, you can upload one of the small files first to determine the strategy for the next upload based on the upload effect of the small file. The strategy can be the number or data volume of the small files to be uploaded next time. When it is determined that the number of small files to be uploaded next time is multiple, it is necessary to merge the multiple small files. When it is determined that the number of small files to be uploaded next time is a value less than 1, it is necessary to split the small files according to the data. When it is determined that the data volume of the small files to be uploaded next time is large, the corresponding number of small files can be merged. When it is determined that the data volume of the small files to be uploaded next time is small, the corresponding amount of data can be split from the small files.
[0045] If the upload efficiency of the first small file is lower than the preset efficiency, it means that the small file is transmitted slowly, and the amount of data transmitted in a single time may still be large. Afterwards, the second small file can be further split into multiple sub-files. The next time you upload, you can upload a sub-file, and determine the strategy for the next upload based on the upload performance of the sub-file. If the upload efficiency of the first small file is higher than the preset efficiency, it means that the small file is transmitted quickly, and the amount of data transmitted in a single time may be small, and more data can be transmitted simultaneously. Afterwards, merge the second small file and the subsequent small files. Upload the merged small file next time, and determine the strategy for the next upload based on the upload performance of the merged small file. If the upload efficiency of the first small file is equal to the preset efficiency, it means that the amount of data transmitted in a single time of the small file is moderate, and the transmission can continue in this way. Then, upload the second small file next time, and determine the strategy for the next upload based on the upload performance of the second small file.
[0046] The preset efficiency here can be a specific value or a range of values. The specific content of the preset efficiency is not limited here and can be determined based on actual transmission requirements.
[0047] When uploading files for the second time, the number of small files to be uploaded for the third time also needs to be determined based on the results of the second file upload. Each subsequent file upload will need to determine the number of small files to be uploaded next time based on the results of the previous file upload until all large files are uploaded.
[0048] The target small file in step S11, that is, the file that has been uploaded or is being uploaded, is, for example, the first small file when uploading a file for the first time; for another example, the second small file when uploading a file for the second time, the target small file is the second small file or a small file that processes the second small file based on the efficiency of the previous file upload. In one example, if the previous file upload efficiency before the target small file is transmitted is low, the target small file is a file that is split from a certain small file. If the previous file upload efficiency before the target small file is transmitted is high, the target small file is a file that is a combination of several small files. If the previous upload efficiency before the target small file is transmitted is moderate, the target small file is a small file.
[0049] S12: According to the upload efficiency indicated by the upload information and the data volume of the target small file, a file corresponding to the target data volume is selected from the unuploaded small files for next upload.
[0050] The upload efficiency is positively correlated with the target difference, which represents the difference between the target data size and the target small file size. This means that higher upload efficiency leads to a larger difference between the target data size and the target small file size; conversely, lower upload efficiency leads to a smaller difference between the target data size and the target small file size.
[0051] The difference between the target data size and the target small file size is the result obtained by directly subtracting the target data size from the target small file size. The result can be a positive number, a negative number, or zero.
[0052] When the upload efficiency of the target small file exceeds the preset efficiency, it means that more data can be uploaded simultaneously without causing upload congestion. Therefore, the target data volume for the next upload can be predicted based on the current upload performance. In this case, the target data volume can be set to a value greater than the target small file data volume. The greater the difference between the upload efficiency and the preset efficiency, the greater the excess of the target data volume over the target small file data volume. Consequently, the next upload of one or more selected small files will result in a larger data volume.
[0053] When the upload efficiency of the target small file is equal to the preset efficiency, it means that the data size of the target small file uploaded this time is moderate. At this time, the target data size can be determined as the target small file data size. Then, the data size of one or more small files selected for the next upload is the target small file data size.
[0054] If the upload efficiency of the target small file is lower than the preset efficiency, it indicates that the target small file being uploaded is large. In this case, the target data size can be set to a value smaller than the target small file size. The greater the difference between the upload efficiency and the preset efficiency, the smaller the portion where the target data size is smaller than the target small file size. Consequently, the size of the selected small file or files for the next upload will be smaller.
[0055] In the embodiment of the present application, based on the upload efficiency and data volume of the currently uploaded target small file, the next uploaded file can be obtained by, but is not limited to, the following methods:
[0056] Step A1: Determine whether the upload efficiency indicated by the upload information is greater than the first efficiency and less than the second efficiency; if it is greater than the first efficiency and less than the second efficiency, execute step A2; if it is less than or equal to the first efficiency, execute step A3; if it is greater than or equal to the second efficiency, execute step A4;
[0057] Step A2: Obtain a first file with the same data volume as the target small file from the small files that have not been uploaded, and upload the first file next time;
[0058] Step A3: obtaining a second file with a smaller data size than the target small file from the small files that have not been uploaded, and uploading the second file next time;
[0059] Step A4: Obtain a third file having a data volume larger than the target small file from the small files that have not been uploaded, and upload the third file next time.
[0060] That is to say, the upload efficiency is divided into three intervals. 0-first efficiency is the low efficiency interval, first efficiency-second efficiency is the medium efficiency interval, and second efficiency-+∞ is the high efficiency interval. The upload efficiency of the target small file is in the low efficiency interval, which means that the target small file is uploaded too slowly. The amount of file data to be uploaded next time needs to be smaller than the target small file to reduce the time taken for a single upload. The upload efficiency of the target small file is in the medium efficiency interval, which means that the target small file is uploaded moderately. The amount of file data to be uploaded next time can be the same as the target small file to maintain normal upload. The upload efficiency of the target small file is in the high efficiency interval, which means that the target small file is uploaded quickly. The amount of file data to be uploaded next time can be larger than the target small file to make full use of the resources for a single transmission and reduce the number of transmissions.
[0061] When determining the next file to upload based on the target small file's data volume, you can select a small file from the multiple small files that have not yet been uploaded that is larger than, equal to, or smaller than the target small file's data volume. You can also select several small files in order according to the ranking of the multiple small files that have not yet been uploaded, or split the small file that ranks first, so that the total data volume of the selected small files (i.e., the target data volume) is larger than, equal to, or smaller than the target small file's data volume. Once the target data volume for the next upload has been determined, if the data volume of one or more selected small files cannot completely match the target data volume, you can select one or more small files that are slightly smaller than the target data volume.
[0062] Of course, in addition to using steps A1-A4 above to determine the target data size for the next file upload, the target data size can also be determined by calculating it using a preset data relationship based on the upload efficiency indicated in the upload information and the target small file size, for example: y = ax + b. Here, y represents the target data size, x represents the upload efficiency, b represents the target small file size, and a is a value between -1 and 2. The specific value of a is positively correlated with the size of x; the larger x is, the larger a is.
[0063] Figure 2This is a schematic diagram of an example process for large file transfer in an embodiment of the present application. Assume that a large file is 10GB and is split into five 2GB small files: small file a, small file b, small file c, small file d, and small file e. Small file a is uploaded for the first time, and its upload information is obtained. At this point, it is discovered that the upload efficiency indicated by the upload information for small file a is lower than the first efficiency. In the second upload, small file b is split into subfile b1 and subfile b2. In the second upload, only subfile b1 is uploaded. Next, the upload information for subfile b1 is obtained. At this point, it is discovered that the upload efficiency indicated by the upload information for subfile b1 is higher than the second efficiency. This may be because the network environment suddenly improved while subfile b1 was being uploaded. In the third upload, subfile b2 can be merged with small file c and uploaded. Next, the upload information for subfile b2 and small file c is obtained. At this point, it is discovered that the upload efficiency indicated by the upload information for subfile b2 and small file c is still higher than the second efficiency. In the fourth upload, small files d and small file e can be merged and uploaded. At this point, the large file has been uploaded.
[0064] From the above content, it can be seen that the large file transmission method provided in the embodiment of the present application, after pre-splitting the large file into multiple small files, during the small file transmission process, further splits, integrates or maintains the status quo of the small files that have not been transmitted subsequently according to the upload efficiency of the small files, which can ensure that each subsequent transmission of small files can fully utilize the provided resources, and there will be no problem of slow transmission due to excessive file data volume, thereby improving the transmission efficiency of large files as a whole.
[0065] Furthermore, as a Figure 1 As a refinement and extension of the method shown, an embodiment of the present application also provides a large file transmission method.
[0066] Figure 3 This is a flow chart of the large file transmission method in the embodiment of the present application. Figure 2 , see Figure 3 As shown, the method may include: S31-S10.
[0067] S31: In response to receiving the large file to be uploaded, obtaining current time information.
[0068] After obtaining the large file to be uploaded, in addition to directly splitting the large file based on the preset threshold, you can also infer the current network conditions based on the time when the large file is received, and thus select different thresholds to accurately split the large file.
[0069] The acquired time information may refer to a specific moment, such as October 1, 2024, or a specific time period, such as a weekday, weekend, or nighttime, or a specific season, such as summer or winter. The specific content of the time information may be determined based on actual network conditions for large file transfers and is not specifically limited here.
[0070] S32: Obtain the target splitting threshold corresponding to the current time information from the preset information table.
[0071] The preset information table stores different time information and their corresponding splitting thresholds. In other words, the changing patterns of network status at different times are pre-calculated, and then different splitting thresholds are configured for different network states. This generates different time information and their corresponding splitting thresholds. These different time information and their corresponding splitting thresholds are then stored in the preset information table for subsequent search and use.
[0072] For example, suppose it is observed that: for a certain network, the network is severely congested from 8:00 to 12:00, the network is relatively congested from 12:00 to 18:00, the network is generally congested from 18:00 to 21:00, and the network is idle from 21:00 to 8:00. At this time, when the network is severely congested, large files need to be split into more and smaller files before they can be transmitted. Therefore, when the network is severely congested, the split threshold can be configured to the minimum, for example: 100K. Similarly, when the network is relatively congested, the split threshold is configured to be smaller, for example: 1M. When the network is generally congested, the split threshold is configured to be moderate, for example: 5M. When the network is idle, the split threshold is configured to be the maximum, for example: 20M. In this way, the preset information table obtained is:
[0073] Time information Split threshold 8∶00-12∶00 100K 12∶00-18∶00 1M 18∶00-21∶00 5M 21∶00-8∶00 20M
[0074] After obtaining the time information for receiving the large file, you can search for the corresponding time information in the preset time table. The corresponding time information can be the same time information or the time period in which the obtained time information falls. The split threshold corresponding to the found corresponding time information is then used as the target split threshold to be used.
[0075] S33: Split the large file to be uploaded into multiple small files according to the target splitting threshold.
[0076] After obtaining the target splitting threshold, on the one hand, the large file can be split directly from the beginning based on the target splitting threshold until further splitting based on the target splitting threshold is no longer possible, at which point the large file is split. On the other hand, the target splitting threshold can be adjusted a second time based on the current time characteristics, and the large file can be split based on the adjusted target splitting threshold. The time characteristics here can refer to any time characteristics related to changes in network status, such as: specific season, whether it is a weekday, etc.
[0077] Specifically, before the above step S33, the method may further include:
[0078] Step B1: Determine whether the current time information indicates a working day. If yes, execute step B2; if no, execute step S33.
[0079] Specifically, the time information can be matched with the time information corresponding to a working day. If the match is successful, it is determined that the current time information indicates a working day. If the match fails, it is determined that the current time information does not indicate a working day. The time information corresponding to a working day can be determined based on the calendar and specific holiday schedule notifications.
[0080] Step B2: Starting from the target splitting threshold, the thresholds are decreased in sequence to obtain multiple splitting thresholds.
[0081] When decreasing, you can use a fixed value. For example, if the target split threshold is 20M, and you decrease it by a fixed value, the resulting split thresholds might be: 20M, 19M, 18M, 17M, 16M, and so on. You can also use a random value. For example, if the target split threshold is 20M, and you decrease it by a fixed value, the resulting split thresholds might be: 20M, 18M, 17M, 15M, and so on.
[0082] The number of splitting thresholds obtained can be positively correlated with the data size of the large file. The larger the data size of the large file, the greater the number of splitting thresholds obtained. This allows for precise splitting of the entire large file, thereby improving large file transfer efficiency.
[0083] Accordingly, the above step S33 may include: splitting the large file to be uploaded into multiple small files according to multiple splitting thresholds.
[0084] This way, the sizes of the multiple smaller files obtained after splitting a large file decrease in sequence. This can reduce the number of times a file is split again, ensuring efficient transmission of large files, especially on weekdays when the network is congested and unstable.
[0085] On non-working days, the network is generally more stable. In this case, a fixed value, namely the target splitting threshold, can be used to split large files before transmission.
[0086] After a large file is split into multiple small files, one or part of the small files is uploaded first. Then, based on the upload information of this or part of the small files, the upload strategy for the next small files is determined, that is, uploading a single small file, uploading multiple small files together, or further splitting the small files and uploading them individually.
[0087] Different upload information can affect the judgment of current network conditions and, consequently, the upload strategy for subsequent small files. To ensure that subsequent small files can fully utilize the resources provided by the current network for efficient upload, upload information can be used, respectively, as upload duration and current network transmission speed. The following describes how to determine the upload strategy for subsequent small files based on these two factors: upload duration and current network transmission speed.
[0088] 1. Upload information includes upload duration.
[0089] Upload duration is the most direct and accurate indicator of file upload status. In addition to obtaining the upload duration of a target small file after it has finished uploading, it can also be obtained in advance during the upload process. This allows for early acquisition of the target small file's upload duration, eliminating the need to separately obtain the target small file's upload duration after it has finished uploading but before determining its upload efficiency. This speeds up the determination of subsequent small file transfer strategies and improves file transfer efficiency.
[0090] To ensure the accuracy of the target small file upload duration during upload, it is necessary to ensure that the target small file upload reaches the preset data volume before calculating the target small file upload duration. The specific size of the preset data volume is not limited here.
[0091] S34a: Monitors the real-time data volume of target small files uploaded.
[0092] S35a: Determine whether the real-time data volume has reached the preset data volume. If so, execute S36a; if not, execute S34a.
[0093] Among them, the preset data amount is less than the total data amount of the target small file. In actual applications, the preset data amount can be more than half of the total data amount of the target small file. For example: if the data amount of the target small file is 1G, the preset data amount can be any data amount greater than or equal to 0.5G and less than 1G. The upload duration will be calculated after more than half of the target small file has been uploaded. In this way, the upload duration of the target small file can be obtained before the upload of the target small file is completed, and the upload duration of the target small file can be calculated more accurately based on the actual upload situation of the target small file to the maximum extent.
[0094] S36a: Obtain the upload duration of the target small file, and calculate the upload duration of the target small file based on the upload duration and the preset data volume.
[0095] Since the target small file is not large in size overall, it can be viewed as a uniformly uploaded process. Therefore, after uploading a portion of the target small file, the upload duration of this portion can be calculated based on the proportion of the total target small file size and the uploaded data.
[0096] For example, assume that the size of the target small file is 100M and the preset data volume is 50M. During the upload process of the target small file, the real-time data volume of the target small file uploaded at time 1 is 20M. 20M is less than 50M, indicating that the target small file has not yet been uploaded more than half, and the data volume uploaded by the target small file continues to be monitored. The real-time data volume of the target small file uploaded at time 2 is 50M. The data volume of the target small file uploaded, 50M, is equal to the target data volume of 50M, indicating that the target small file has been uploaded more than half. The time elapsed from the start of the upload of the target small file to time 2, that is, the uploaded time is 3s, 3s×100M / 50M, and the upload time of the target small file is 6s.
[0097] Next, based on the upload duration and the target small file's data size, a file corresponding to the target data size is selected from the unuploaded small files and uploaded. Upload duration is negatively correlated with upload efficiency, while upload efficiency is positively correlated with target difference. The target difference represents the difference between the target data size and the target small file's data size. This can be understood as follows: the shorter the upload duration, the higher the upload efficiency, and the greater the difference between the target data size and the target small file's data size; conversely, the longer the upload duration, the lower the upload efficiency, and the smaller the difference between the target data size and the target small file's data size.
[0098] When determining the target data volume for the next upload based on the upload duration and data volume of the currently uploaded target small file, the data volume of the target small file can be modified directly based on the upload duration of the target small file to obtain the target data volume. Specifically, during the modification, a certain duration interval is used as the boundary. Within this duration interval, the target data volume is the data volume of the target small file, either unchanged or modified. In some embodiments, the difference between the data volume of the modified target small file and the data volume of the target small file before modification is no greater than a preset value. In some examples, the preset value is no greater than the data volume of the target small file before modification. In other examples, the preset value can be set as needed, but in theory should not be greater than the value by which the target small file data volume decreases when the duration is greater than the upper limit of the duration interval, or no greater than the value by which the target small file data volume increases when the duration is less than the lower limit of the duration interval. For durations greater than the upper limit of the duration interval, the longer the upload duration, the greater the reduction in the target small file data volume. For durations less than the lower limit of the duration interval, the shorter the upload duration, the greater the increase in the target small file data volume. The target data volume can also be determined based on a fixed relationship table of different time intervals and their corresponding data volumes.
[0099] S37a: Determine whether the upload duration is greater than the first duration and less than the second duration. If greater than the first duration and less than the second duration, execute S38; if greater than or equal to the second duration, execute S39; if less than or equal to the first duration, execute S310.
[0100] Among them, the first duration is smaller than the second duration.
[0101] That is to say, the upload duration of the target small file is determined to determine whether it falls within the three time intervals of 0-first duration (including the first duration), first duration-second duration (excluding the first and second durations), and second duration-+∞ (including the second duration).
[0102] If the upload duration of the target small file is within the time interval of 0-the first duration, it means that the upload time of the target small file is short and the upload efficiency is high. Subsequent small files can be considered for merging and uploading.
[0103] If the upload duration of the target small file is within the time interval of the first duration - the second duration, it means that the upload time of the target small file is acceptable and the upload efficiency is average. Subsequent small files can be uploaded according to the target small file.
[0104] If the upload time of the target small file is within the time interval of the second time - +∞, it means that the upload time of the target small file is long and the upload efficiency is low. Subsequent small files can be considered to be further split and uploaded in sequence.
[0105] 2. Upload information includes the current network transmission speed.
[0106] The network transmission speed can directly represent the network status. In addition to directly obtaining the network transmission speed when the target small file is uploaded, the subsequent network transmission speed can also be inferred based on the network transmission speed of the entire target small file upload process. The file upload status can be judged based on the inferred network transmission speed, and the subsequent file transfer strategy can be determined.
[0107] S34b: Obtain the network transmission speed at multiple times after the target small file starts to be uploaded.
[0108] The multiple moments include the moment when the target small file starts uploading and the moment when the upload is completed. That is, after the target small file starts uploading, the network transmission speed at each moment is continuously obtained. For example, if the target small file starts uploading at moment 1 and ends up uploading at moment 5, then the network transmission speed a is obtained at moment 1, the network transmission speed b is obtained at moment 2, the network transmission speed c is obtained at moment 3, the network transmission speed d is obtained at moment 4, and the network transmission speed e is obtained at moment 5.
[0109] The time interval and number of network transmission speeds obtained from the start of uploading the target small file to the completion of uploading can be comprehensively determined based on the timeliness and accuracy requirements of the network transmission speed prediction. The time interval for obtaining the network transmission speed is positively correlated with the timeliness parameter and negatively correlated with the accuracy parameter. The number of multiple network transmission speeds obtained is negatively correlated with the timeliness parameter and positively correlated with the accuracy parameter. In other words, the higher the timeliness requirements for network transmission data, the longer the time interval for obtaining the network transmission speed, and the fewer the number obtained. The higher the accuracy requirements for network transmission data, the shorter the time interval for obtaining the network transmission speed, and the more accurate the number obtained.
[0110] S35b: Predicting a network transmission trend based on network transmission speeds at multiple moments.
[0111] S36b: Predicting the future network transmission speed based on the network transmission trend and the network transmission speed corresponding to the moment when the target small file is uploaded, and determining the future network transmission speed as the current network transmission speed.
[0112] That is, based on the trends of network transmission speeds at multiple moments, the network transmission speed at the next moment is estimated. If the network transmission speed increases at multiple moments, it indicates that the network condition is improving and the network transmission trend is continuing to improve. The network transmission speed at the next moment can continue to increase based on this. If the network transmission speed decreases at multiple moments, it indicates that the network condition is deteriorating and the network transmission trend is continuing to decline. The network transmission speed at the next moment can continue to decrease based on this. If the network transmission speed fluctuates continuously at multiple moments, it indicates that the network condition is unstable and the network transmission trend is fluctuating. The network transmission speed at the next moment will continue to fluctuate within this range. The average value within this range can be taken as the network transmission speed at the next moment.
[0113] Next, based on the network transmission speed and the target small file's data size, a file corresponding to the target data size is selected from the unuploaded small files and uploaded. Network transmission speed is positively correlated with upload efficiency, which in turn is positively correlated with target difference. The target difference represents the difference between the target data size and the target small file's data size. This means that higher network transmission speeds and higher upload efficiency lead to a greater difference between the target data size and the target small file's data size. Conversely, lower network transmission speeds and lower upload efficiency lead to a smaller difference between the target data size and the target small file's data size.
[0114] When determining the target data volume for the next upload based on the current network transmission speed and the target small file's data volume, the target small file's data volume can be modified directly based on the current network transmission speed to obtain the target data volume. Specifically, the modification is based on a certain network transmission speed interval. Within this speed interval, the target data volume is the data volume of the target small file, either unchanged or modified. In some embodiments, the difference between the data volume of the modified target small file and the data volume of the target small file before modification is no greater than a preset value. In some examples, the preset value is no greater than the data volume of the target small file before modification. In other examples, the preset value can be set as needed, but in theory should be no greater than the value by which the target small file's data volume increases when the speed is greater than the upper limit of the speed interval, or no greater than the value by which the target small file's data volume decreases when the speed is less than the lower limit of the speed interval. For speeds greater than the upper limit of the speed interval, the higher the current network transmission speed, the greater the increase in the target small file's data volume. For speeds less than the lower limit of the speed interval, the lower the current network transmission speed, the greater the decrease in the target small file's data volume. The target data volume can also be determined based on a fixed relationship table of different speed intervals and their corresponding data volumes.
[0115] S37b: Determine whether the current network transmission speed is greater than the first speed and less than the second speed. If it is greater than the first speed and less than the second speed, execute S38; if it is less than or equal to the first speed, execute S39; if it is greater than or equal to the second speed, execute S310.
[0116] The first speed is lower than the second speed.
[0117] That is, it is determined whether the estimated future network transmission speed is within the three speed intervals of 0-first speed (including the first speed), first speed-second speed (excluding the first speed and the second speed), and second speed-+∞ (including the second speed).
[0118] If the estimated future network transmission speed is within the speed range of 0-first speed, it indicates that the network condition will be poor and the file upload efficiency will be low. The file needs to be split into smaller pieces. Subsequent small files can be further split and uploaded in sequence.
[0119] If the estimated future network transmission speed is within the speed range of the first speed - the second speed, it indicates that the network condition will be moderate and the file upload efficiency will also be moderate. Target small files can be uploaded without wasting resources or over-uploading.
[0120] If the estimated future network transmission speed is within the speed range of the second speed - +∞, it means that the network condition will be good in the future, the file upload efficiency will be higher, and more data can be uploaded at the same time. Subsequent small files can be considered for merged upload.
[0121] S38: Obtain a first file having the same data volume as the target small file from the small files that have not been uploaded, and upload the first file next time.
[0122] S39: Obtain a second file having a smaller data volume than the target small file from the small files that have not been uploaded, and upload the second file next time.
[0123] S310: Obtain a third file having a data volume larger than the target small file from the small files that have not been uploaded, and upload the third file next time.
[0124] The specific implementation of steps S38-S310 here is the same as that of steps A2-A4 in the aforementioned embodiment. Please refer to the relevant description in the aforementioned embodiment and will not be repeated here.
[0125] At this point, the large file transmission method provided in the embodiments of the present application has been fully described.
[0126] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application also provides a large file transmission device.
[0127] Figure 4 This is a schematic diagram of the structure of the large file transmission device in the embodiment of the present application. Figure 1 , see Figure 4 As shown, the device may include: an acquisition module 41 and an upload module 42.
[0128] Acquisition module 41 is used to obtain the upload information of the target small file currently being uploaded. The upload information is used to indicate the upload efficiency of the target small file. The target small file is at least one small file among multiple small files or a part of a small file. The small file is obtained by splitting the large file to be uploaded.
[0129] The upload module 42 is used to select a file corresponding to the target data volume from the unuploaded small files for the next upload based on the upload efficiency indicated by the upload information and the data volume of the target small file, wherein the upload efficiency is positively correlated with the target difference, and the target difference is used to characterize the difference between the target data volume and the data volume of the target small file.
[0130] Furthermore, as a Figure 4 As a refinement and extension of the device shown, an embodiment of the present application also provides a large file transmission device.
[0131] Figure 5 This is a schematic diagram of the structure of the large file transmission device in the embodiment of the present application. Figure 2 , see Figure 5 As shown, the device may include: a splitting module 51, an acquisition module 52 and an uploading module 53.
[0132] The splitting module 51 includes: a time acquiring unit 511 , a threshold determining unit 512 , a first splitting unit 513 and a second splitting unit 514 .
[0133] The time acquisition unit 511 is configured to acquire current time information in response to receiving a large file to be uploaded.
[0134] The threshold determination unit 512 is configured to obtain a target splitting threshold corresponding to the current time information from a preset information table. The preset information table stores different time information and their corresponding splitting thresholds.
[0135] The first splitting unit 513 is configured to, if the current time information indicates a working day, sequentially decrease from the target splitting threshold to obtain multiple splitting thresholds; and split the large file to be uploaded into multiple small files according to the multiple splitting thresholds.
[0136] The second splitting unit 514 is configured to split the large file to be uploaded into multiple small files according to a target splitting threshold if the current time information indicates that the file is not a working day.
[0137] In the case that the upload information includes the upload duration, the acquisition module 52 includes: an upload monitoring unit 521a and a duration calculation unit 522a.
[0138] The upload monitoring unit 521a is used to monitor the real-time data volume of the target small file uploaded.
[0139] The duration calculation unit 522a is used to obtain the upload duration of the target small file if the real-time data volume reaches the preset data volume, and calculate the upload duration of the target small file based on the uploaded duration and the preset data volume, wherein the preset data volume is less than the total data volume of the target small file.
[0140] The upload module 53 is used to select files corresponding to the target data volume from the unuploaded small files for upload based on the upload time and the data volume of the target small files. The shorter the upload time, the higher the upload efficiency.
[0141] In the case where the upload information includes the current network transmission speed, the acquisition module 52 includes: a network acquisition unit 521b, a trend prediction unit 522b and a network speed determination unit 523b.
[0142] The network acquisition unit 521b is used to acquire the network transmission speed at multiple moments after the target small file starts to be uploaded, the multiple moments including the moment when the target small file starts to be uploaded and the moment when the upload is completed.
[0143] The trend prediction unit 522b is configured to predict the network transmission trend based on the network transmission speeds at multiple moments.
[0144] The network speed determining unit 523b is used to predict the future network transmission speed based on the network transmission trend and the network transmission speed corresponding to the moment when the target small file is uploaded, and determine the future network transmission speed as the current network transmission speed.
[0145] The upload module 53 is used to select files corresponding to the target data volume from the unuploaded small files and upload them according to the network transmission speed and the data volume of the target small files. The higher the network transmission speed, the higher the upload efficiency.
[0146] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0147] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.
[0148] Figure 6 This is a schematic diagram of the structure of the electronic device in the embodiment of the present application, see Figure 6As shown, the electronic device may include: a processor 61, a memory 62, and a bus 63; wherein the processor 61 and the memory 62 communicate with each other through the bus 63; the processor 61 is used to call the program instructions in the memory 62 to execute the method in one or more of the above embodiments.
[0149] It should be noted that the description of the electronic device embodiment above is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the electronic device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0150] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.
[0151] It should be noted that the description of the above storage medium embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the storage medium embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0152] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A large file transmission method, characterized in that: The method comprises: Obtain upload information of a target small file currently being uploaded, where the upload information is used to indicate the upload efficiency of the target small file. The target small file is at least one small file among multiple small files or a partial file within a small file. The small file is obtained by splitting the large file to be uploaded according to a target splitting threshold, where the target splitting threshold is determined based on time information corresponding to the splitting. The data volume and file processing strategy of the small file to be uploaded next time are determined according to the upload efficiency indicated by the upload information, a small file corresponding to the target data volume is selected from the small files that have not been uploaded, and the file processing strategy is executed on the selected small file before the next upload, wherein the upload efficiency is positively correlated with the target difference, and the target difference is used to characterize the difference between the target data volume and the data volume of the target small file, and the file processing strategy includes merging small files, splitting small files, and selecting a small file.
2. The method according to claim 1, characterized in that The upload information includes the upload duration; and the step of selecting a file corresponding to the target data volume from the unuploaded small files for uploading based on the upload efficiency indicated by the upload information and the data volume of the target small file includes: According to the upload duration and the data volume of the target small file, a file corresponding to the target data volume is selected from the unuploaded small files for uploading, wherein the shorter the upload duration, the higher the upload efficiency.
3. The method according to claim 2, characterized in that The method of obtaining the upload information of the currently uploaded target small file includes: Monitor the real-time data volume of the target small file uploaded; If the real-time data volume reaches the preset data volume, the upload duration of the target small file is obtained, and the upload duration of the target small file is calculated based on the upload duration and the preset data volume, wherein the preset data volume is less than the total data volume of the target small file.
4. The method according to claim 1, wherein The upload information includes a current network transmission speed; and selecting a file corresponding to a target data volume from the unuploaded small files for uploading based on the upload efficiency indicated by the upload information and the data volume of the target small file, including: According to the network transmission speed and the data volume of the target small file, a file corresponding to the target data volume is selected from the unuploaded small files for uploading, wherein the greater the network transmission speed, the higher the upload efficiency.
5. The method according to claim 4, characterized in that The method of obtaining the upload information of the currently uploaded target small file includes: Obtaining the network transmission speed at multiple times after the target small file starts to be uploaded, the multiple times including the time when the target small file starts to be uploaded and the time when the upload is completed; predicting a network transmission trend based on the network transmission speeds at the plurality of moments; The future network transmission speed is predicted based on the network transmission trend and the network transmission speed corresponding to the moment when the target small file is completed uploaded, and the future network transmission speed is determined as the current network transmission speed.
6. The method according to any one of claims 1 to 5, characterized in that Before obtaining the upload information of the currently uploaded target small file, the method further includes: In response to receiving the large file to be uploaded, obtaining current time information; Obtaining a target splitting threshold corresponding to the current time information from a preset information table, wherein the preset information table stores different time information and its corresponding splitting threshold; The large file to be uploaded is split into multiple small files according to the target splitting threshold.
7. The method according to claim 6, characterized in that Before splitting the large file to be uploaded into multiple small files according to the target splitting threshold, the method further includes: If the current time information indicates a working day, multiple splitting thresholds are obtained by decreasing the target splitting threshold in sequence; The step of splitting the large file to be uploaded into multiple small files according to the target splitting threshold comprises: The large file to be uploaded is split into multiple small files according to the multiple splitting thresholds.
8. A large file transmission device, characterized in that: The device comprises: An acquisition module is configured to acquire upload information of a target small file currently being uploaded, where the upload information indicates the upload efficiency of the target small file. The target small file is at least one small file among a plurality of small files or a portion of a small file. The small file is obtained by splitting the large file to be uploaded according to a target splitting threshold, where the target splitting threshold is determined based on time information corresponding to the splitting. An upload module is used to determine the data volume and file processing strategy of the small file to be uploaded next time based on the upload efficiency indicated by the upload information, select a small file corresponding to the target data volume from the small files that have not been uploaded, and perform the next upload after executing the file processing strategy on the selected small file, wherein the upload efficiency is positively correlated with the target difference, and the target difference is used to characterize the difference between the target data volume and the data volume of the target small file, and the file processing strategy includes merging small files, splitting small files, and selecting a small file.
9. An electronic device, characterized in that: The electronic device includes: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The storage medium includes: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
File transmission method, device and mobile terminal
CN109150935A
File transmission method and device, electronic equipment and storage medium
CN114221954A
File uploading method and device
CN117955975A