Large file transmission method and device
By appropriately splitting or integrating small files that are not uploaded based on the upload efficiency and data volume of small files, the problems of low efficiency and poor stability of large files in the prior art are solved, and more efficient and stable large file transmission is achieved.
Patent Information
- Application Number
- CN202411828242.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-12
AI Technical Summary
The existing large file splitting method cannot ensure the smooth and efficient transmission of large files. It may not only cause frequent resource calls due to too many small files, but also may also cause the transmission stuttering due to too large data volume of small files.
By obtaining the upload information of the currently uploaded small files, the small files that have not been uploaded are further split, integrated or maintained according to the upload efficiency and data volume, ensuring that the small files transmitted each time can make full use of the resources provided, and avoiding the problem of too slow transmission caused by excessive file data volume.
It improves the transmission efficiency of large files, ensures the stability of the transmission process and the full utilization of resources, and reduces the probability of transmission failure.
Smart Images

Figure CN119788663A_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, the main method for uploading large files is to split the large file into several small files, and upload 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. Each 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 much data are prone to jamming during the transfer process, resulting in file transfer failure. It can be seen that the existing large file splitting method 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 smooth and efficient transmission of large files.
[0006] In order 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 a 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 prior art, the large file transmission method provided in the first aspect of the present application, after pre-splitting the large file into multiple small files, during the transmission of the small files, further splits, integrates or maintains the status quo of the small files that have not been transmitted afterwards according to the upload efficiency of the small files, thereby ensuring 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 implementation modes 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 upload, 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 upload, 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 efficiency of the target small file can be accurately determined by the upload time of the target small file, so as to accurately select the file amount for the next transmission process and improve the file transmission efficiency.
[0011] In some changed implementation modes 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 part of the target small file is uploaded, the uploaded time is obtained, and the complete upload time of the target small file is calculated based on the uploaded time of the target small file and the preset data volume. In this way, the upload time of the target small file can be accurately and quickly obtained before the upload of the target small file is completed, so that subsequent small files can be processed in advance based on the upload time, so that subsequent small files can be uploaded faster, improving the overall file upload efficiency.
[0013] In some changed implementation modes 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 upload, 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 upload, 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, so as to quickly determine the file size of the next transmission process and improve the file transmission efficiency.
[0015] In some changed implementation modes 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] The network trend when uploading the target small file is used to estimate the network transmission speed of the files uploaded thereafter. 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 transmissions, and can more accurately determine the file data volume for the next transmission, thereby improving the transmission efficiency of subsequent files.
[0017] In some changed implementation modes of the first aspect of the present application, before obtaining the upload information of the currently uploaded target small file, the method also includes: in response to receiving the large file to be uploaded, obtaining the current time information; obtaining the target splitting threshold corresponding to the current time information from a preset information table, the preset information table storing different time information and its corresponding splitting threshold; according to the target splitting threshold, splitting the large file to be uploaded into multiple small files.
[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 implementation modes 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 the multiple splitting thresholds, splitting the large file to be uploaded into multiple small files.
[0020] Since the network conditions on weekdays are generally more congested, file transmission will be increasingly limited due to resource constraints. Therefore, the data volume of the small files after the large files received on weekdays need to be reduced in turn. When subsequent transmission is limited, the number of times the file is split twice can be reduced, thereby improving the file transmission efficiency.
[0021] The second aspect of the present application provides a large file transmission device, the device comprising: an acquisition module, used to obtain upload information of a 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, and the small file is obtained by splitting the large file to be uploaded; an upload module, used to select a file corresponding to a target data volume from unuploaded small files for the next upload according to 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.
[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; and 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 the present 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] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. 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 The process diagram of the large file transmission method in the embodiment of the present application is as follows 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 The process diagram of the large file transmission method in the embodiment of the present application is as follows Figure 2 ;
[0029] Figure 4 The structure of the large file transmission device in the embodiment of the present application is shown as follows: Figure 1 ;
[0030] Figure 5 The structure of the large file transmission device in the embodiment of the present application is shown as follows: Figure 2 ;
[0031] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the 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. On the contrary, these embodiments are provided in order 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 terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.
[0034] At present, it is not easy to control the splitting of large files in large file transmission. Excessive splitting of large files will result in more small files, resulting in too many transmission times, which is prone to transmission failure due to frequent calls of transmission resources. If the number of small files split from a large file is small, the split small files will be too large, resulting in a long single transmission time and prone to transmission failure. It can be seen that the existing large file splitting method cannot guarantee the smooth and efficient transmission of large files.
[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, which can first split a large file into several small files, and then upload one or part of the small files to check the upload status of the small files, so as to integrate, split, or maintain the status quo of the small files to be uploaded next, and then upload the processed files in batches. In this way, the reprocessed files are more in line with the current network environment, can fully utilize the current resources, reduce the probability of transmission failure, and improve the transmission efficiency of large files as a whole.
[0036] It should be noted that the large files transmitted in the embodiments of the present application are all legal and compliant files. In addition, 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 The process diagram of the large file transmission method in the embodiment of the present application is as follows 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 part of a small file. The small file is obtained by splitting the large file to be uploaded. That is to say, when a large file needs to be uploaded, the large file will be split into multiple small files first, and then these small files will be uploaded in batches. In the process of uploading small files in batches, one of the batches uploaded is the target small file. When each batch of small files is uploaded, the number of small files uploaded in this batch will be determined based on the upload status of the previous batch of small files (detailed description will be given later). When the current batch of small files is uploaded smoothly, at least one small file can be uploaded in this batch, for example: one small file, two small files, and so on. When the current batch of small files is not uploaded smoothly, the current batch can upload part of a small file, for example: half of a small file, one third of a small file, and so on. In some instances, when multiple small files are uploaded in a batch, multiple small files can be merged and uploaded, that is, multiple small files need to be compressed or spliced into one 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 may include various information that can characterize the upload efficiency, such as: upload time, current network speed, and so on. 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 transmission, after a file is received, the file will be cached. When it is determined that the file needs to be transmitted, 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 transmit at one time. 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, it is determined that the file is a large file and needs to be split before transmission. When the data volume of a file is less than or equal to the preset data volume, it is determined that the file is a normal file and can be directly transmitted.
[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 that 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, one of the small files can be uploaded 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. After that, the second small file can be further split into multiple sub-files. You can upload a sub-file the next time you upload, and determine the strategy for the next upload based on the upload effect 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 at the same time. After that, 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 effect 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 you can continue to transfer it in this way. Then upload the second small file next time, and determine the strategy for the next upload based on the upload effect of the second small file.
[0046] The preset efficiency here can be a specific value or an interval value. The specific content of the preset efficiency is not limited here and can be determined according to 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 needs to determine the number of small files to be uploaded next time based on the results of the current 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 the first small file when uploading a file for the first time; for example, 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 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 merged from 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 small files that have not been uploaded for next upload.
[0050] Among them, 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 target small file data volume. It can be understood that: the higher the upload efficiency, the greater the difference between the target data volume and the target small file data volume; conversely, the lower the upload efficiency, the smaller the difference between the target data volume and the target small file data volume.
[0051] The difference between the target data volume and the target small file data volume is the result obtained by directly subtracting the target data volume from the target small file data volume, and the result may be a positive number, a negative number, or zero.
[0052] When the upload efficiency of the target small file is greater than the preset efficiency, it means that when the target small file is uploaded, more data can be uploaded at the same time without causing congestion in this upload. Therefore, the target data volume for the next upload can be predicted based on the current upload effect. At this time, the target data volume can be determined to be a value greater than the target small file data volume. The greater the gap between the upload efficiency and the preset efficiency, the more the target data volume exceeds the target small file data volume. As a result, the data volume of one or more small files selected for the next upload will be larger.
[0053] When the upload efficiency of the target small file is equal to the preset efficiency, it means that the data volume of the target small file uploaded this time is moderate, and the target data volume can be determined as the target small file data volume. Then the data volume of one or more small files selected for the next upload is the data volume of the target small file.
[0054] When the upload efficiency of the target small file is lower than the preset efficiency, it means that the data volume of the target small file being uploaded is large. At this time, the target data volume can be determined to be a value smaller than the data volume of the target small file. The larger the difference between the upload efficiency and the preset efficiency, the smaller the portion where the target data volume is smaller than the data volume of the target small file. As a result, the data volume of one or more small files selected for the next upload will be smaller.
[0055] In the embodiment of the present application, based on the upload efficiency of the currently uploaded target small file and the data volume of the target small file, the file to be uploaded next time can be obtained, but is not limited to, in the following manner:
[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: obtaining a first file with the same data volume as the target small file from the small files that have not been uploaded, and uploading the first file next time;
[0058] Step A3: obtaining a second file with a smaller data volume 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 whose data volume is 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 consumption of 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 faster. The amount of file data to be uploaded next time can be larger than the target small file to make full use of single transmission resources and reduce the number of transmissions.
[0061] When determining the file to be uploaded next time based on the data volume of the target small file, you can select a small file that is greater than, equal to, or less than the data volume of the target small file from the multiple small files that have not been uploaded, or you can select several small files in sequence according to the order of the multiple small files that have not been uploaded, or split the small file that is ranked first, and the total data volume of the selected small files (i.e., the target data volume) corresponds to being greater than, equal to, or less than the data volume of the target small file. When the target data volume for the next upload is determined, when the data volume of one or more selected small files cannot be completely consistent with 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 the above steps A1-A4 to determine the target data volume of the next file upload, the target data volume can also be determined in the following manner: calculated based on the upload efficiency indicated in the upload information and the data volume of the target small file through a preset data relationship, for example: y=ax+b. Wherein, y represents the target data volume, x represents the upload efficiency, b represents the data volume of the target small file, 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 of large file transmission in an embodiment of the present application. Assume that the large file is 10G and is divided into 5 small files of 2G, namely 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 the upload information of small file a is obtained. At this time, it is found that the upload efficiency indicated by the upload information of small file a is lower than the first efficiency. In the second upload, small file b is split into subfile b1 and subfile b2. Only subfile b1 is uploaded in the second upload. Then, the upload information of subfile b1 is obtained. At this time, it is found that the upload efficiency indicated by the upload information of subfile b1 is higher than the second efficiency. This situation may be that the network environment suddenly improves during the upload of subfile b1. In the third upload, subfile b2 can be merged with small file c and uploaded. Then, the upload information of subfile b2 and small file c is obtained. At this time, it is found that the upload efficiency indicated by the upload information of subfile b2 and small file c is still higher than the second efficiency. In the fourth upload, small file 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 process of small file transmission, according to the upload efficiency of the small files, the small files that have not been transmitted afterwards are further split, integrated or maintained in the current state, thereby ensuring 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, the embodiment of the present application also provides a large file transmission method.
[0066] Figure 3 The process diagram of the large file transmission method in the embodiment of the present application is as follows 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 status 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 period, such as a working day, a rest day, or a night, or a specific season, such as summer or winter. The specific content of the time information may be determined based on the actual network status change trend of large file transmission, 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] Among them, different time information and their corresponding splitting thresholds are stored in the preset information table. That is to say, the changing rules of network status at different times are counted in advance, and then different splitting thresholds are configured for different network statuses. In this way, different time information and their corresponding splitting thresholds are obtained. Therefore, different time information and their corresponding splitting thresholds are 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 of receiving the large file, the obtained time information can be searched 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 is located. Thus, the splitting threshold corresponding to the corresponding time information found is used as the target splitting threshold to be used currently.
[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 it is no longer possible to split based on the target splitting threshold, 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 then the large file is 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: a 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 the working day. If the match is successful, it is determined that the current time information indicates the working day. If the match fails, it is determined that the current time information does not indicate the working day. The time information corresponding to the working day can be determined according to the calendar and the specific holiday arrangement notification.
[0080] Step B2: Starting from the target splitting threshold, the splitting thresholds are gradually reduced to obtain multiple splitting thresholds.
[0081] When decreasing, you can decrease according to a certain fixed value. For example, if the target split threshold is 20M, and it decreases according to the fixed value, the multiple split thresholds obtained can be: 20M, 19M, 18M, 17M, 16M... You can also decrease randomly. For example, if the target split threshold is 20M, and it decreases according to the fixed value, the multiple split thresholds obtained can be: 20M, 18M, 17M, 15M...
[0082] The number of the obtained series of splitting thresholds may be positively correlated with the data volume of the large file. The larger the data volume of the large file, the more splitting thresholds are obtained. In this way, accurate splitting can be achieved for the entire large file, thereby improving the transmission efficiency of the large file.
[0083] Correspondingly, the above step S33 may include: splitting the large file to be uploaded into multiple small files according to multiple splitting thresholds.
[0084] In this way, the sizes of multiple small files obtained after splitting a large file are reduced in sequence. When the network is congested and unstable on weekdays, the number of times the file is split twice can be reduced, ensuring efficient transmission of large files.
[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 for transmission.
[0086] After a large file is split into multiple small files, one or part of the small files are uploaded first, and then the upload strategy for the next small file is determined based on the upload information of this or part of the small files, that is, uploading a single small file, merging multiple small files for upload, or uploading a single file after further splitting the small files.
[0087] Different specific upload information will affect the judgment of the current network status, and thus affect the subsequent upload strategy of small files. In order to ensure that subsequent small files can fully utilize the resources provided by the current network for efficient upload, the upload information can use the upload duration and the current network transmission speed. The following describes the determination of the subsequent upload strategy of small files from the two aspects of upload duration and current network transmission speed.
[0088] 1. Upload information includes upload time.
[0089] The upload duration can most directly and accurately represent the file upload status. In addition to obtaining the upload duration of the target small file after the target small file is uploaded, the upload duration of the target small file can also be obtained in advance during the upload process of the target small file. This enables the early acquisition of the upload duration of the target small file, avoiding the need to perform a separate step of obtaining the upload duration of the target small file after the target small file is uploaded and before judging the upload efficiency of the target small file, speeding up the determination of the subsequent small file transmission strategy, and thus improving the file transmission efficiency.
[0090] In order to ensure the accuracy of the target small file upload time during the upload process, it is necessary to ensure that the target small file upload reaches the preset data volume before calculating the target small file upload time. The specific size of the preset data volume is not limited here.
[0091] S34a: monitors the real-time data volume of the target small file upload.
[0092] S35a: Determine whether the real-time data volume reaches the preset data volume. If yes, execute S36a; if no, execute S34a.
[0093] Among them, the preset data amount is less than the total data amount of the target small file. In practical applications, the preset data amount can be more than half of the total data amount of the target small file. For example: the data amount of the target small file is 1G, and the preset data amount can be any data amount greater than or equal to 0.5G and less than 1G. The upload duration is 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 does not have a large data volume as a whole, the target small file can be regarded as a process of uniform upload. Therefore, after uploading a part of the target small file, the upload time of this part can be calculated in proportion to the total data volume of the target small file and the uploaded data volume.
[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 been uploaded more than half at this time, 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 that has been uploaded, 50M, is equal to the target data volume 50M, indicating that the target small file has been uploaded more than half at this time. From the start of uploading the target small file to time 2, the elapsed time, that is, the uploaded time is 3s, 3s×100M / 50M, the upload time of the target small file is 6s.
[0097] Then, according to the upload time and the data volume of the target small file, select the file corresponding to the target data volume from the unuploaded small files and upload it. Among them, the upload time is negatively correlated with the upload efficiency, and the upload efficiency is positively correlated with the target difference. The target difference is used to characterize the difference between the target data volume and the target small file. It can be understood that: the shorter the upload time, the higher the upload efficiency, and the greater the difference between the target data volume and the target small file; conversely, the longer the upload time, the lower the upload efficiency, and the smaller the difference between the target data volume and the target small file.
[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. When modifying specifically, a certain duration interval is used as the boundary, and within the duration interval, the target data volume is the data volume of the target small file that is not modified 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 not greater than the preset value, and in some examples, the preset value is not 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 it should not be greater than the value of the target small file data volume reduction when the duration is greater than the upper limit of the duration interval, or not greater than the value of the target small file data volume increase when the duration is less than the lower limit of the time interval. When the duration is greater than the upper limit of the duration interval, the longer the upload duration, the more the target small file data volume is reduced. When the duration is less than the lower limit of the duration interval, the shorter the upload duration, the more the target small file data volume increases. 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 shorter than the second duration.
[0101] That is to say, determine whether the upload duration of the target small file is in one of the three time intervals: 0-first duration (including the first duration), first duration-second duration (excluding the first duration and the second duration), 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 to be merged and uploaded.
[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 duration of the target small file is within the time interval of the second duration - +∞, 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] Among them, the multiple moments include the moment when the target small file starts to be uploaded and the moment when the upload is completed. That is to say, after the target small file starts to be uploaded, the network transmission speed at each moment is continuously obtained. For example: the target small file starts to be uploaded at moment 1 and the upload is completed 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 of the target small file to the completion of uploading of the target file 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 requirement 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 requirement 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 the network transmission trend based on the network transmission speeds at multiple moments.
[0111] S36b: Predict the future network transmission speed based on the network transmission trend and the network transmission speed corresponding to the time when the target small file is uploaded, and determine the future network transmission speed as the current network transmission speed.
[0112] That is, based on the trend of network transmission speed at multiple moments, the network transmission speed at the next moment is estimated. When the network transmission speed at multiple moments increases successively, it means that the network condition is getting better and the network transmission trend continues to improve. The network transmission speed at the next moment can continue to increase on this basis. When the network transmission speed at multiple moments decreases successively, it means that the network condition is getting worse and the network transmission trend continues to decline. The network transmission speed at the next moment can continue to decrease on this basis. When the network transmission speed at multiple moments fluctuates up and down, it means that the network condition is not stable and the network transmission trend fluctuates up and down. The network transmission speed at the next moment continues to fluctuate within this interval. The average value within this interval can be taken as the network transmission speed at the next moment.
[0113] Then, according to the network transmission speed and the data volume of the target small file, the file corresponding to the target data volume is selected from the unuploaded small files for uploading, wherein the network transmission speed is positively correlated with the upload efficiency, and 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 target small file data volume. It can be understood that: the higher the network transmission speed, the higher the upload efficiency, and the greater the difference between the target data volume and the target small file data volume; conversely, the lower the network transmission speed, the lower the upload efficiency, and the smaller the difference between the target data volume and the target small file data volume.
[0114] When determining the target data volume for the next upload based on the current network transmission speed and the data volume of the target small file, the data volume of the target small file can be modified directly based on the current network transmission speed to obtain the target data volume. When modifying specifically, a certain network transmission speed interval is used as the boundary. Within the speed interval, the target data volume is the data volume of the target small file that is not modified 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 not greater than the preset value. In some examples, the preset value is not 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 it should not be greater than the value of the increase in the target small file data volume when the speed is greater than the upper limit speed of the speed interval, or not greater than the value of the decrease in the target small file data volume when the speed is less than the lower limit speed of the speed interval. The higher the current network transmission speed is, the more the target small file data volume increases. The lower the current network transmission speed is, the more the target small file data volume decreases. 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 greater than the first speed and less than the second speed, execute S38; if less than or equal to the first speed, execute S39; if greater than or equal to the second speed, execute S310.
[0116] The first speed is lower than the second speed.
[0117] That is to say, it is determined whether the estimated future network transmission speed is in one of 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 means 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 in the future is moderate and the file upload efficiency is also moderate. The 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 better in the future, the file upload efficiency will be higher, more data can be uploaded at the same time, and subsequent small files can be considered to be merged for 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 method 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 embodiment 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 The structure of the large file transmission device in the embodiment of the present application is shown as follows: Figure 1 , see Figure 4 As shown, the device may include: an acquisition module 41 and an upload module 42.
[0128] The 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 files corresponding to the target data volume from the unuploaded small files for the next upload according to 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, the embodiment of the present application also provides a large file transmission device.
[0131] Figure 5 The structure of the large file transmission device in the embodiment of the present application is shown as follows: Figure 2 , see Figure 5 As shown, the device may include: a splitting module 51, an acquisition module 52, a judgment module 53, a first uploading module 54, a second uploading module 55 and a third uploading module 56.
[0132] The splitting module 51 includes: a time acquisition unit 511 , a threshold determination unit 512 , a first splitting unit 513 and a second splitting unit 514 .
[0133] The time acquisition unit 511 is used to acquire current time information in response to receiving a large file to be uploaded.
[0134] The threshold determination unit 512 is used to obtain the target splitting threshold corresponding to the current time information from the preset information table. The preset information table stores different time information and its corresponding splitting threshold.
[0135] The first splitting unit 513 is used to, if the current time information indicates a working day, start from the target splitting threshold and decrease in sequence to obtain multiple splitting thresholds; according to the multiple splitting thresholds, split the large file to be uploaded into multiple small files.
[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 it is not a working day.
[0137] In the case where 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 upload.
[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 according to the upload time and the data volume of the target small files, wherein 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 time points after the target small file starts to be uploaded, the multiple time points including the time point when the target small file starts to be uploaded and the time point when the upload is completed.
[0143] The trend prediction unit 522b is used to predict the network transmission trend based on the network transmission speed at multiple moments.
[0144] The network speed determination 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 time 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 for upload according to the network transmission speed and the data volume of the target small files, wherein the greater the network transmission speed, the higher the upload efficiency.
[0146] It should be noted here 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 the present application, please refer to the description of the method embodiment of the present 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 6 As 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 via the bus 63; the processor 61 is used to call program instructions in the memory 62 to execute the methods in one or more of the above embodiments.
[0149] It should be noted that the description of the above electronic 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 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 further 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 here 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 the present application, please refer to the description of the method embodiment of the present application for understanding.
[0152] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A large file transmission method, characterized in that: The method comprises: Obtaining 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, 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 a large file to be uploaded; 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 small files that have not been uploaded for 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.
2. The method according to claim 1, characterized in that: The uploading information includes the uploading duration; and the uploading of files corresponding to the target data volume from the unuploaded small files according to the uploading efficiency indicated by the uploading information and the data volume of the target small files, including: According to the upload time 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 time, 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, characterized in that: The upload information includes the current network transmission speed; and the uploading of files corresponding to the target data volume from the unuploaded small files according to 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 multiple 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 completes uploading, 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 thresholds; According to the target splitting threshold, the large file to be uploaded is split into multiple small files.
7. The method according to claim 6, characterized in that Before splitting the large file to be uploaded into a plurality of small files according to the target splitting threshold, the method further includes: If the current time information indicates a working day, then the target splitting threshold is sequentially decreased to obtain multiple splitting thresholds; 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, used for acquiring upload information of a target small file currently being uploaded, wherein the upload information is used for indicating the upload efficiency of the target small file, wherein the target small file is at least one small file among a plurality of small files or a partial file in a small file, and the small file is obtained by splitting a large file to be uploaded; An upload module is used to select a file corresponding to a target data volume from unuploaded small files for next upload according to 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.
9. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium comprises: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method as claimed in 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, device and system, storage medium and electronic equipment
CN114285838A
File uploading method and system, client device and server
CN115529307A
File transmission method and storage medium
CN117579573A
Cited By
File transmission method and device
CN121151389A
File reading method and device
CN121578930A