CN114884936A - Data processing method, device, equipment and medium for terminal equipment - Google Patents
Data processing method, device, equipment and medium for terminal equipment Download PDFInfo
- Publication number
- CN114884936A CN114884936A CN202210481669.1A CN202210481669A CN114884936A CN 114884936 A CN114884936 A CN 114884936A CN 202210481669 A CN202210481669 A CN 202210481669A CN 114884936 A CN114884936 A CN 114884936A
- Authority
- CN
- China
- Prior art keywords
- uploading
- fragments
- uploaded
- file
- server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 20
- 239000012634 fragment Substances 0.000 claims abstract description 302
- 238000000034 method Methods 0.000 claims abstract description 41
- 238000012545 processing Methods 0.000 claims abstract description 41
- 230000005540 biological transmission Effects 0.000 claims abstract description 30
- 238000013467 fragmentation Methods 0.000 claims description 13
- 238000006062 fragmentation reaction Methods 0.000 claims description 13
- 238000012163 sequencing technique Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 claims description 2
- 230000008569 process Effects 0.000 description 19
- 238000010586 diagram Methods 0.000 description 7
- 230000000903 blocking effect Effects 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 230000007474 system interaction Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application provides a data processing method, a device, equipment and a medium of terminal equipment. The method comprises the following steps: acquiring a file to be uploaded in a file list uploaded by a user; carrying out fragment segment processing on the file to be uploaded to obtain fragments of the file to be uploaded; and uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after adjusting according to the transmission result of the fragments with the target number until all the fragments are uploaded. The method can enable the number of the fragments uploaded to the server to be matched with the actual uploading bandwidth of the network, and can rapidly complete the uploading of all the fragments by the appropriate number of the fragments, so that the uploading efficiency is improved.
Description
Technical Field
The present application relates to the field of data processing, and in particular, to a method, an apparatus, a device, and a medium for processing data of a terminal device.
Background
With the development of internet technology, users often need to upload files to a server on the internet side for storage. If the file is large, the large file is generally fragmented in the prior art, and the file is uploaded in a fragmented uploading manner, so that the file uploading speed is increased.
In the prior art, when a fragment is uploaded, a terminal device firstly performs segmentation processing on a file to obtain the fragment of the file. Then, the terminal device sends the fragments to the server in a fixed number until the file is uploaded completely. However, sending the fragments to the server in a fixed number always results in that the fragment uploading process cannot be adapted to the actual uploading bandwidth of the network, so that problems such as timeout, blocking and the like easily occur in the file uploading process, or the uploading bandwidth is not sufficiently utilized, and the file uploading efficiency is low.
Therefore, a data processing scheme of the terminal device adapted to the network bandwidth is required.
Disclosure of Invention
The application provides a data processing method, a data processing device, a data processing apparatus and a data processing medium for a terminal device, which are used for solving the problem that the fragment uploading process cannot be matched with the actual uploading bandwidth of a network due to the fact that fragments are sent to a server in a fixed number in the prior art.
In a first aspect, the present application provides a data processing method for a terminal device, including:
acquiring a file to be uploaded in a file list uploaded by a user;
carrying out fragment segment processing on the file to be uploaded to obtain fragments of the file to be uploaded;
and uploading the fragments with the target number to a server, and uploading the number of the fragments to the server after adjusting according to the transmission result of the fragments with the target number until all the fragments are uploaded.
In a possible implementation manner, the uploading the number of shards to the server after the adjustment according to the transmission result of the target number of shards specifically includes:
judging whether all the fragments of the file to be uploaded are uploaded;
if yes, outputting a prompt message for completing file uploading;
if not, according to the transmission result of the target number of fragments within the first preset time length, the number of the fragments is uploaded to the server after adjustment.
In a possible implementation manner, the adjusting, according to the transmission result of the target number of fragments within the first preset time duration, the uploading the number of fragments to the server after the adjustment specifically includes:
judging whether the target number of fragments are completely transmitted within a first preset time length or not;
if so, taking the first number as a new target number, and re-executing the step of uploading the target number of fragments to the server, wherein the first number is greater than the target number;
and if not, taking the second number as a new target number, and re-executing the step of uploading the target number fragments to the server, wherein the second number is smaller than the target number.
In a possible implementation manner, when there are a plurality of files to be uploaded, the uploading the target number of fragments to the server specifically includes:
sequencing the fragments corresponding to the files to be uploaded according to the sequence of the files to be uploaded in the uploaded file list so as to construct a fragment uploading queue;
and uploading the fragments with the target number to a server according to the fragment uploading queue.
In a possible implementation manner, the uploading the target number of pieces to the server according to the piece uploading queue specifically includes:
judging whether the file size of each file to be uploaded is larger than or equal to the current uploading bandwidth or not;
if yes, sending a single channel establishing request to the server, wherein the single channel establishing request is used for indicating that an uploading single channel is established between the server and the terminal equipment; uploading fragments with a target number to the server according to the fragment uploading queue and the uploading single channel;
if not, determining the number of channels according to the file size of each file to be uploaded and the current uploading bandwidth, and sending a multi-channel establishing request to the server according to the number of channels, wherein the multi-channel establishing request is used for indicating that the number of uploading channels of the number of channels is established between the server and the terminal equipment; and uploading the fragments with the target number to the server according to the fragment uploading queue and the channel number uploading channels.
In a possible embodiment, the target number is obtained by:
judging whether the maximum simultaneous uploading fragment number exists when the user uploads the last fragment;
if yes, determining the target number according to the maximum simultaneous uploading fragmentation number;
and if not, the target number is a preset number corresponding to the user.
In one possible embodiment, the maximum number of simultaneous upload slices is obtained by:
determining a third number of fragments uploaded to the server in a current uploading period and a fourth number of fragments uploaded to the server in a last uploading period;
determining whether a difference between the third number and the fourth number is zero;
if the difference value is zero, judging whether the number of fragments uploaded in each uploading period in a second preset time length is the third number or the fourth number;
if so, taking the third number or the fourth number as the maximum number of the fragments uploaded by the user at the same time; if not, re-executing the step of judging whether the difference value between the third number and the fourth number is zero or not.
In a second aspect, the present application provides a data processing apparatus of a terminal device, including:
the acquisition module is used for acquiring a file to be uploaded in a file list uploaded by a user;
the fragmentation module is used for carrying out fragmentation and section processing on the file to be uploaded so as to obtain fragments of the file to be uploaded;
and the uploading module is used for uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after the adjustment according to the transmission result of the fragments with the target number until the uploading of all the fragments is completed.
In a third aspect, the present application provides a data processing device of a terminal device, including: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored by the memory to implement the methods described above.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer-executable instructions for implementing the above-mentioned method when executed by a processor.
According to the data processing method of the terminal equipment, the file to be uploaded in the file list uploaded by the user can be obtained; carrying out fragment segment processing on the file to be uploaded to obtain fragments of the file to be uploaded; and uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after adjusting according to the transmission result of the fragments with the target number until all the fragments are uploaded. According to the method, in the process of uploading the fragments to the server, the fragments with the fixed number are not uploaded any more, but the number of the fragments is uploaded to the server after the adjustment according to the transmission result of the fragments with the target number in the initial uploading process. Through the arrangement, the number of the fragments uploaded to the server can be matched with the actual uploading bandwidth of the network, so that the total size of the fragments uploaded each time can not exceed the uploading bandwidth, and the problems of network timeout, blockage and the like caused by the overlarge total size of the fragments uploaded are avoided; the uploading bandwidth can be fully utilized to the greatest extent, and the utilization rate of the uploading bandwidth is improved, so that the file uploading efficiency is improved, and the user experience is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is a system architecture diagram according to an embodiment of the present application
FIG. 2 is a schematic diagram of a system interaction according to an embodiment of the present application;
fig. 3 is a flowchart of a data processing method of a terminal device according to an embodiment of the present application;
fig. 4 is a flowchart of a data processing method of a terminal device according to another embodiment of the present application;
fig. 5 is a schematic structural diagram of a data processing apparatus of a terminal device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a data processing device of a terminal device according to an embodiment of the present application.
Reference numerals: 1. a terminal device; 2. and (4) a server.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terms referred to in the present application are explained first:
the upload bandwidth refers to a data transmission rate when the user terminal equipment sends information to the network side.
Users often need to upload files to a server on the internet side for storage. If the file is large, the large file is generally fragmented in the prior art, and the file is uploaded in a fragmented uploading manner, so that the file uploading speed is increased.
In the prior art, when a fragment is uploaded, a terminal device firstly performs segmentation processing on a file to be uploaded according to a certain size to obtain the fragment of the file. Then, the terminal device sends the fragments to the server in a fixed number until the file is uploaded completely. However, the fragments in the prior art are sent to the server according to a fixed number, and the fragments are sent to the server always according to the fixed number, which may cause that the fragment uploading process cannot be matched with the actual uploading bandwidth of the network. For users with poor network, the situation that the total size of a fixed number of fragments is larger than the actual uploading bandwidth may occur in the fragment uploading process, so that the problems of timeout, blocking and the like easily occur in the file uploading process. For example, the size of a fragment is 1M when the fragment is uploaded, 10 fragments are fixedly uploaded, and if the actual uploading bandwidth is 5M/s, the total size of the fragment is larger than the actual uploading bandwidth, the fragment will occupy the uploading bandwidth, and problems such as network timeout and jamming may occur, which affects the use effect of the user. In addition, for a user with a better network, the situation that the total size of a fixed number of fragments is smaller than the actual uploading bandwidth may also occur, so that the uploading bandwidth is not fully utilized in the fragment uploading process, and the file uploading efficiency is reduced. For example, the size of a fragment is 1M when the fragment is uploaded, 10 fragments are fixedly uploaded, if the actual uploading bandwidth is 20M/s, the total size of the fragment is smaller than the actual uploading bandwidth, the uploading bandwidth is not fully utilized in the fragment uploading process, and the file uploading efficiency is reduced to a certain extent.
The data processing method of the terminal device provided by the application aims to solve the technical problems in the prior art. According to the method, in the process of uploading the fragments to the server, the fragments with fixed number are not uploaded any more, but the number of the fragments is uploaded to the server after the adjustment according to the transmission result of the fragments with the target number in the initial uploading process. Through the arrangement, the number of the fragments uploaded to the server can be matched with the actual uploading bandwidth of the network, so that the total size of the fragments uploaded each time can not exceed the uploading bandwidth, and the problems of network timeout, blockage and the like caused by the overlarge total size of the fragments uploaded are avoided; the uploading bandwidth can be fully utilized as much as possible, the utilization rate of the uploading bandwidth is improved, the file uploading efficiency is improved, and the user experience is improved.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a system architecture diagram according to an embodiment of the present application, and as shown in fig. 1, 1 denotes a terminal device, and 2 denotes a server. The terminal device 1 may obtain a file to be uploaded in the file list uploaded by the user, and perform fragment segment processing on the file to be uploaded to obtain a fragment of the file to be uploaded. Then, the terminal device 1 uploads the number of fragments to the server 2, and uploads the number of fragments to the server 2 after adjustment according to the transmission result of the number of fragments to the server 2 until the uploading of all fragments is completed.
Fig. 2 is a schematic view of system interaction according to an embodiment of the present application, and as shown in fig. 2, after a terminal device obtains fragments of a file to be uploaded, the fragments of a target number are sent to a server when the file is uploaded for the first time. And the server feeds back the uploading result of the target number of fragments to the terminal equipment, and when uploading is carried out for the second time, the terminal equipment adjusts the number of the uploading fragments according to the result fed back by the server and sends the fragments with the adjusted number to the server. And the server feeds back the uploading result of the fragments after the number adjustment to the terminal equipment, and the process is circulated continuously until the uploading of all the fragments is completed.
Example one
Fig. 3 is a flowchart of a data processing method of a terminal device according to an embodiment of the present application, where an execution main body of the data processing method of the terminal device according to the embodiment of the present application may be a data processing apparatus of the terminal device, or may be a terminal device integrated with the data processing apparatus, and in this embodiment, the data processing method of the terminal device is described with the execution main body as the terminal device (for short, terminal device) integrated with the data processing apparatus. As shown in fig. 3, the data processing method of the terminal device may include the steps of:
s101: and acquiring the file to be uploaded in the file list uploaded by the user.
In this embodiment, when a user uploads a file, the file to be uploaded is suspended to generate an uploaded file list. And the terminal equipment can acquire the file to be uploaded after sensing the suspended file in the uploading file list.
In this embodiment, the terminal device includes but is not limited to: a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like, without limitation. The file referred to herein may be an image file, an audio file, a video file, a document, a compressed package, a database, or a data package, and may be a large file or a small file, which is not limited herein.
S102: and carrying out fragment segment processing on the file to be uploaded to obtain fragments of the file to be uploaded.
In this embodiment, the terminal device may perform fragment processing on the file to be uploaded according to a certain size, so as to obtain a fragment of the file to be uploaded. The size of the fragment can be flexibly set by those skilled in the art, and is not limited herein. For example, the file to be uploaded may be processed into fragments according to the size of 1M, and the file less than 1M may be individually marked as a fragment. For example, if a file size is 101.2M, the file may be divided into 102 slices.
In this embodiment, after the fragments of the file to be uploaded are obtained, each fragment may be cached, which is convenient for uploading subsequent fragments.
In this embodiment, since the size of the fragment is fixed, as long as the start position of the file extraction fragment to be uploaded is determined, one fragment can be extracted according to the size of the fragment. Vividly, a file to be uploaded can be regarded as a line segment, the length of the sub-line segment extracted each time is preset, and the sub-line segment can be extracted from the beginning of the line segment after the number of the required sub-line segments (namely the number of fragments) is determined.
S103: and uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after adjusting according to the transmission result of the fragments with the target number until all the fragments are uploaded.
In this embodiment, please refer to the second embodiment for the specific implementation manner of uploading the number of the fragments to the server after the adjustment of the transmission result according to the target number of the fragments in step S103.
In this embodiment, if there is one file to be uploaded, the uploading the target number of pieces to the server in step S103 may include: and sending a single channel establishing request to the server, wherein the single channel establishing request is used for indicating that an uploading single channel is established between the server and the terminal equipment, and sending the fragments with the target number to the server according to the uploading single channel. If there are multiple files to be uploaded, the specific implementation method of uploading the fragments of the target number to the server is described in detail in example two.
In this embodiment, when the fragments are uploaded to the server for the first time, fragments with a preset target number may be uploaded, and then the number of the uploaded fragments is adjusted according to the result of the first uploading, so that the number of the uploaded fragments to the server can be adapted to the actual uploading bandwidth of the network, and finally, the uploading of all the fragments of the file to be uploaded is completed with the appropriate number of the fragments.
In a possible embodiment, the target number in step S103 may be obtained by: judging whether the maximum simultaneous uploading fragment number exists when the user uploads the fragments last time; if yes, determining the target number according to the maximum number of simultaneously uploaded fragments; if not, the target number is the preset number corresponding to the user.
In this embodiment, the preset number corresponding to the user may be a default upload fragment number set by the user, or may also be a default upload fragment number provided by the terminal device itself, or may also be a fragment number corresponding to the user set by another method, which is not limited herein.
In this embodiment, the target number of the first time the fragments are uploaded to the server may be the maximum number of the simultaneous uploading fragments of the last time the user uploads the fragments in order to fit the network situation of the user and to make the maximum use of the uploading bandwidth. If the maximum number of simultaneously uploaded fragments in the last time of fragment uploading of the user cannot be found in the local storage, the default number of fragments corresponding to the user can be used as the target number.
In this embodiment, the maximum simultaneous upload segment number when the user uploads the segments last time may be considered as an optimal solution of the segment number corresponding to the upload bandwidth when the user uploads the segments last time, and the network condition of the user home generally does not change much, so that the maximum simultaneous upload segment number when the user uploads the segments last time may be used as the target number when the user uploads the segments to the server for the first time when the user uploads the segments this time. Through the setting, the target number can be adapted to the actual uploading bandwidth of the user as much as possible, so that the uploading bandwidth is utilized to the maximum extent, and the fragment uploading efficiency is improved.
In one possible embodiment, the maximum number of simultaneous upload slices may be obtained by: determining a third number of fragments uploaded to the server in a current uploading period and a fourth number of fragments uploaded to the server in a last uploading period; judging whether the difference value between the third number and the fourth number is zero; if the difference is zero, judging whether the number of the fragments uploaded in each uploading period in a second preset time length is a third number or a fourth number; if so, taking the third number or the fourth number as the maximum number of the fragments uploaded by the user at the same time; if not, the step of judging whether the difference value between the third number and the fourth number is zero is executed again.
In this embodiment, a certain number of fragments are used as a group, and one upload cycle is defined from the time when a group of fragments is uploaded to the server to the time when all the fragments are uploaded.
In this embodiment, the second preset duration may be a duration corresponding to several upload cycles, for example, the second preset duration may be a duration corresponding to three upload cycles, or may also be a duration corresponding to four upload cycles, and a specific second preset duration may be flexibly set by a person skilled in the art, which is not limited herein.
In this embodiment, if the difference between the third number and the fourth number is zero, that is, the number of fragments uploaded to the server in the current uploading period is the same as the number of fragments uploaded to the server in the last uploading period, it may be considered that the number of fragments uploaded in each period starts to be gradually stable. In order to determine whether the number of the uploaded fragments is stabilized at a certain value, it may be determined whether the number of the fragments uploaded in each uploading period within a second preset time period after the certain value (the current uploading period) is a third number or a fourth number, and if so, it is determined that the number of the fragments uploaded in each period is stabilized, and the number of the fragments at this time may not only maximally utilize the current uploading bandwidth, but also may not occupy the bandwidth to cause network timeout. Through the setting, the optimal solution of the number of the fragments corresponding to the uploading bandwidth when the user uploads the fragments at the time can be obtained, the number of the fragments can be used as the maximum uploading number of the fragments of the user at the same time, and the uploading number of the fragments is recorded in the local storage, so that the user can call the uploading number of the fragments at the next time.
In this embodiment, in the process of uploading the shards to the server, the shards with the fixed number are not uploaded any more, but the number of the shards may be uploaded to the server after being adjusted according to the transmission result of the target number of the shards at the time of the initial uploading. Through the arrangement, the number of the fragments uploaded to the server can be matched with the actual uploading bandwidth of the network, so that the total size of the fragments uploaded each time can not exceed the uploading bandwidth, and the problems of network timeout, blockage and the like caused by the overlarge total size of the fragments uploaded are avoided; the uploading bandwidth can be fully utilized to the greatest extent, and the utilization rate of the uploading bandwidth is improved, so that the file uploading efficiency is improved, and the user experience is improved.
A detailed description will be given below of a specific implementation manner of uploading the number of the fragments to the server after adjusting according to the transmission result of the target number of the fragments in step S103 of the first embodiment of the second embodiment.
Example two
Fig. 4 is a flowchart of a data processing method of a terminal device according to an embodiment of the present application, where an execution main body of the data processing method of the terminal device according to the embodiment of the present application may be a data processing apparatus of the terminal device, or may be a terminal device integrated with the data processing apparatus, and in this embodiment, the data processing method of the terminal device is described with the execution main body as the terminal device (for short, terminal device) integrated with the data processing apparatus. As shown in fig. 4, the data processing method of the terminal device may include the steps of:
s201: and judging whether all the fragments of the file to be uploaded finish uploading.
In this embodiment, when the file to be uploaded is smaller, the number of the corresponding fragments is smaller, and the whole file to be uploaded can be uploaded through one-time fragment uploading, so that the target number of next fragment uploading does not need to be determined.
Illustratively, there are 4 files in the uploaded file list of a certain user, and the file sizes are respectively: 0.5M, 0.8M, 1M and 1.5M, and the 1M fragmentation size can be divided into 1, 1 and 2 in turn, and 5 fragmentation is total. If the number of the targets when the fragments are uploaded to the server for the first time is 5, all the files to be uploaded in the uploaded file list can be completed at one time without uploading again or determining the number of the targets uploaded by the fragments at the next time.
S202: if yes, outputting a prompt message for completing file uploading.
In this embodiment, if all the fragments of the file to be uploaded are uploaded, that is, all the files to be uploaded in the uploaded file list are uploaded, the file upload completion prompt information may be used to prompt the user that the file is uploaded, so that subsequent operations may be performed.
S203: if not, the number of the fragments is uploaded to the server after adjustment according to the transmission result of the target number of the fragments in the first preset time length.
In this embodiment, if all the fragments of the file to be uploaded are not uploaded, the number of fragments to be uploaded later can be adjusted according to the transmission result of the fragments with the target number, so that the adjusted number of fragments can utilize the current uploading bandwidth to the maximum extent, and the bandwidth cannot be occupied to cause network timeout. Through the setting, the number of the fragments uploaded to the server at each time can be always matched with the actual uploading bandwidth of the network, so that the uploading bandwidth is utilized to the maximum extent, and the fragment uploading efficiency is improved.
In a possible embodiment, the adjusting and then uploading the number of the fragments to the server according to the transmission result of the target number of the fragments within the first preset time duration in step S203 may include the following steps:
s2031: and judging whether all the transmission of the target number of the fragments is completed within a first preset time length.
S2032: and if so, taking the first number as a new target number, and re-executing the step of uploading the fragments of the target number to the server, wherein the first number is larger than the target number.
S2033: and if not, taking the second number as a new target number, and re-executing the step of uploading the fragments of the target number to the server, wherein the second number is smaller than the target number.
In this embodiment, a person skilled in the art may set the first number flexibly according to experience, for example, the first number may be twice the target number, that is, the target number is doubled as a new target number, and the target number is doubled to increase the target number, so as to reduce the time for adapting the target number to the current upload bandwidth, and improve the efficiency. Of course, the first number may be the target number plus one, that is, if the target number is 4, the first number is 5, and the target number is gradually increased to be adapted to the current upload bandwidth.
Likewise, the second number may be set by a person skilled in the art flexibly according to experience, for example, the second number may be the target number minus one, i.e. if the target number is 4, the first number is 3, and the first number is ensured to make full use of the bandwidth by reducing the number one by one. Of course, the second number may also be half of the target number, and the time for adapting the target number to the current upload bandwidth is reduced by reducing the target number by half, so as to improve the efficiency.
In this embodiment, a person skilled in the art may flexibly set the first preset time period according to experience, for example, the first preset time period may be 1s or 2s, which is not limited herein.
Illustratively, taking the size of the fragment as 1M, the number of the targets as 4, and the first preset duration as 1s as an example, if the current upload bandwidth is 4M/s, the size of the 4 fragments is just adapted to the bandwidth, and the upload can be completed within 1 s. If the current uploading bandwidth is less than 4M/s, the time length for completing uploading of all 4 fragments is greater than 1s, and at the moment, the total size of the target number of fragments is greater than the bandwidth, so that the number of the fragments needs to be reduced. If the current uploading bandwidth is more than 4M/s, although the 4 fragments can also finish uploading within 1s, the total size of the fragments is smaller than the bandwidth, and the number of the fragments can be increased to fully utilize the bandwidth.
In this embodiment, it may be determined whether the uploading of the target number of fragments is adapted to the current uploading bandwidth by determining whether all the transmission of the target number of fragments is completed within the first preset time duration. If the transmission is not completed in the first preset time, it indicates that the total size of the target number of fragments is larger than the bandwidth, and the number of fragments needs to be reduced to avoid network timeout caused by bandwidth occupation. If all transmission is completed within the first preset time length, which indicates that the total size of the target number of fragments is less than or equal to the bandwidth, an attempt can be made to increase the number of fragments, so as to fully utilize the bandwidth and improve the fragment uploading efficiency.
In a possible embodiment, when there are a plurality of files to be uploaded, the uploading the target number of pieces to the server in step S203 may include: sequencing the fragments corresponding to the files to be uploaded according to the sequence of the files to be uploaded in the uploaded file list so as to construct a fragment uploading queue; and uploading the fragments with the target number to a server according to the fragment uploading queue.
In this embodiment, when there are multiple to-be-uploaded files, the fragments may be sorted according to the order of each to-be-uploaded file in the uploaded file list to construct a fragment upload queue, and fragments of the target number are uploaded to the server sequentially in groups according to the fragment upload queue. Through the arrangement, the fragments of the files to be uploaded can be uploaded in order, file uploading errors caused by fragment unordered uploading are avoided, and file uploading correctness is improved.
Illustratively, if A, B, C and D4 files to be uploaded are sequentially arranged in the uploaded file list of the user, wherein the file A is divided into 3 fragments of a1, a2 and a3, the file B is divided into 2 fragments of B1 and B2, the file C is divided into 4 fragments of C1, C2, C3 and C4, and the file D is divided into 5 fragments of D1, D2, D3, D4 and D5. The sub-slice upload queues are a1, a2, a3, b1, b2, c1, c2, c3, c4, d1, d2, d3, d4 and d 5.
In this embodiment, when there is one file to be uploaded, the file may be directly uploaded in sequence according to the generation sequence of the fragments without constructing the fragment upload queue.
In a possible embodiment, the uploading the target number of pieces to the server according to the piece uploading queue may include: judging whether the file size of each file to be uploaded is larger than or equal to the current uploading bandwidth or not; if yes, sending a single-channel establishing request to the server, wherein the single-channel establishing request is used for indicating that an uploading single channel is established between the server and the terminal equipment; uploading fragments of a target number to a server according to the fragment uploading queue and an uploading single channel; if not, determining the number of channels according to the file size of each file to be uploaded and the current uploading bandwidth, and sending a multi-channel establishment request to the server according to the number of channels, wherein the multi-channel establishment request is used for indicating that the number of uploading channels is established between the server and the terminal equipment; and uploading the fragments with the target number to a server according to the fragment uploading queue and the uploading channels with the number of channels.
Illustratively, with file a (2.5MB, slice a1, a2, a3), file B (2MB, slice B1, B2), file C (3.8MB, slice C1, C2, C3, C4), file D (5MB, slice D1, D2, D3, D4, D5), the current upload bandwidth is 2MB/s case, the size of each file is larger than the bandwidth, and only the upload single channel is established. According to the uploading single channel, fragment uploading queues a1, a2, a3, b1, b2, c1, c2, c3, c4, D1, D2, D3, D4 and D5 are sequentially uploaded, namely a1 and a2 are uploaded for the first time, and a3 and b1 are uploaded for the second time, so that uploading of files A, B, C and D is sequentially completed.
Illustratively, with file E (0.5MB, slice E), file F (1.2MB, slice F1, F2), file G (2.8MB, slice G1, G2, G3), file H (3.4MB, slices H1, H2, H3, H4), the current upload bandwidth is 4MB/s case, and the size of file E, F, G is smaller than the bandwidth, 3 upload channels can be established, and file E, F, G is uploaded at the same time. The sub-slice uploading queues are e, f1, f2, g1, g2, g3, h1, h2, h3 and h 4. When the file is uploaded for the first time, the channel 1 uploads the segment e, the channel 2 uploads the segments f1 and f2, and the channel 3 uploads the segment g1, so that the file E, F is uploaded. And in the second uploading process, the channel 1 uploads the fragment G2, the channel 2 uploads the fragment G3, and the channel 3 uploads the fragments h1 and h2, so that the uploading of the file G is completed. And in the third uploading process, the channel 1 uploads the fragment H3, the channel 2 uploads the fragment H4, and the channel 3 does not upload, so that the uploading of the file H is completed, and the uploading of all files is completed.
In this embodiment, when there are a plurality of files to be uploaded, it may be determined whether the file sizes of the files to be uploaded are all greater than or equal to the current uploading bandwidth, so as to determine the number of channels, thereby improving the uploading efficiency. When the file size of each file to be uploaded is larger than or equal to the current uploading bandwidth, the file to be uploaded is larger or the network speed is poorer, and the current uploading bandwidth can only allow one file to be uploaded quickly at most. At this time, if a plurality of channels are established to upload a plurality of files simultaneously, due to the limitation of bandwidth, the files will upload a part of fragments respectively, and will not be uploaded in a short time, so that the whole uploading time corresponding to all the files is very long, and after a long time, the uploading will be completed in succession, and in this process, the user cannot use the files to be uploaded. In order to shorten the uploading time corresponding to each file to be uploaded, only one uploading single channel can be established between the server and the terminal equipment at the moment, only one file is allowed to be uploaded at each time, so that the files are uploaded in sequence, the uploading time corresponding to each file is not long, the uploading efficiency of each file is improved, meanwhile, a user can also apply the files which are uploaded already according to requirements, and the user experience is improved.
When the file size of each file to be uploaded is not larger than or equal to the current uploading bandwidth, the file to be uploaded is small or the network speed is high, and the current uploading bandwidth can allow a plurality of files to be uploaded at the same time, so that the number of channels can be determined according to the file size of each file to be uploaded and the current uploading bandwidth, and the file uploading efficiency is improved through the multi-channel uploading fragmentation.
In this embodiment, after the target number of pieces are uploaded to the server for the first time, by determining whether all pieces of the file to be uploaded finish uploading, it can be determined that the file to be uploaded is smaller. In this case, the file to be uploaded is small, the number of the corresponding fragments is small, the whole file to be uploaded can be uploaded through one-time fragment uploading, and the target number of next fragment uploading does not need to be determined. If the fragments of the file to be uploaded are not completely uploaded, which indicates that the file to be uploaded is large, the number of fragments to be uploaded later can be adjusted according to the transmission result of the fragments with the target number, so that the adjusted number of fragments can utilize the current uploading bandwidth to the maximum extent, and the bandwidth cannot be occupied to cause network timeout. Through the setting, the number of the fragments uploaded to the server at each time can be always matched with the actual uploading bandwidth of the network, so that the uploading bandwidth is utilized to the maximum extent, and the fragment uploading efficiency is improved.
The following describes a data processing method of a terminal device according to the present application with a specific embodiment.
EXAMPLE III
In a specific embodiment, a user wants to upload 20 files, i.e. files 1 to 20, via a browser on a computer, and put the 20 files into an upload file list, the specific upload process is as follows:
in the first step, the computer obtains the 20 files to be uploaded in the file list uploaded by the user.
And secondly, the computer performs fragment segment processing on the 20 files according to the size of 1M to obtain fragments of each file, wherein the size of each file is 100MB, and each file corresponds to 100 fragments.
Thirdly, the computer sorts the fragments corresponding to the 20 files according to the sequence of the files in the uploading file list to construct a fragment uploading queue: 11. 12, 120; 21. 22, 220; ...; 201. 202, and 2020.
And fourthly, the computer determines that the current uploading bandwidth is 15MB/s, if the 20 files are all larger than the bandwidth, a single channel establishing request is sent to the server, and an uploading single channel is established between the server and the computer.
And fifthly, the computer determines that the maximum number of the uploaded fragments is 4 when the user uploads the fragments last time, and the computer sends 4 fragments of 11, 12, 13 and 14 to the server through the uploading single channel for the first time.
And sixthly, the computer judges that all the fragments of all the files are not completely uploaded, and if the 4 fragments are completely uploaded within 1s, the computer sends 8 fragments to the server according to the fragment uploading queue.
And seventhly, the computer judges that the 8 fragments are completely finished within 1s, and then the computer sends 16 fragments to the server according to the fragment uploading queue.
And eighthly, the computer judges that the 16 fragments are not completely finished within 1s, and then the computer sends 15 fragments to the server according to the fragment uploading queue.
And eighthly, the computer judges that the 15 fragments are completely uploaded within 1s, and then the computer sends the 15 fragments to the server each time according to the fragment uploading queue until all the 20 files are uploaded.
Fig. 5 is a schematic structural diagram of a data processing apparatus of a terminal device according to an embodiment of the present application, and as shown in fig. 5, the data processing apparatus of the terminal device includes: the device comprises an acquisition module, a fragmentation module and an uploading module. The acquisition module is used for acquiring files to be uploaded in the file uploading list of the user. The fragmentation module is used for carrying out fragmentation section processing on the file to be uploaded so as to obtain the fragmentation of the file to be uploaded. The uploading module is used for uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after the adjustment according to the transmission result of the fragments with the target number until all the fragments are uploaded. In an embodiment, the description of the specific implementation function of the data processing apparatus of the terminal device may refer to steps S101 to S103 in the first embodiment, which is not described herein again.
Fig. 6 is a schematic structural diagram of a data processing device of a terminal device according to an embodiment of the present application, and as shown in fig. 6, the data processing device of the terminal device includes: a processor 101, and a memory 102 communicatively coupled to the processor 101; the memory 102 stores computer-executable instructions; the processor 101 executes the computer execution instructions stored in the memory 102 to implement the steps of the data processing method of the terminal device in the above method embodiments.
The data processing device of the terminal device may be a stand-alone device or a part of the terminal device, and the processor 101 and the memory 102 may adopt existing hardware of the terminal device.
In the data processing device of the terminal device, the memory 102 and the processor 101 are directly or indirectly electrically connected to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines, such as a bus. The memory 102 stores computer-executable instructions for implementing the data access control method, including at least one software functional module that can be stored in the memory 102 in the form of software or firmware, and the processor 101 executes various functional applications and data processing by running software programs and modules stored in the memory 102.
The Memory 102 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 102 is used for storing programs, and the processor 101 executes the programs after receiving the execution instructions. Further, the software programs and modules within the memory 102 may also include an operating system, which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
The processor 101 may be an integrated circuit chip having signal processing capabilities. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and so on. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are executed by a processor to implement the steps of the method embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
Claims (10)
1. A data processing method of a terminal device is characterized by comprising the following steps:
acquiring a file to be uploaded in a file list uploaded by a user;
carrying out fragment segment processing on the file to be uploaded to obtain fragments of the file to be uploaded;
and uploading the fragments with the target number to a server, and uploading the number of the fragments to the server after adjusting according to the transmission result of the fragments with the target number until all the fragments are uploaded.
2. The method according to claim 1, wherein the uploading the number of fragments to the server after the adjustment according to the transmission result of the target number of fragments specifically comprises:
judging whether all the fragments of the file to be uploaded are uploaded;
if yes, outputting file uploading completion prompt information;
if not, according to the transmission result of the target number of fragments within the first preset time length, the number of the fragments is uploaded to the server after adjustment.
3. The method according to claim 2, wherein the adjusting, according to the transmission result of the target number of fragments within a first preset time duration, the uploading the number of fragments to the server after the adjustment specifically includes:
judging whether the target number of fragments are completely transmitted within a first preset time length or not;
if so, taking the first number as a new target number, and re-executing the step of uploading the target number of fragments to the server, wherein the first number is greater than the target number;
and if not, taking the second number as a new target number, and re-executing the step of uploading the target number fragments to the server, wherein the second number is smaller than the target number.
4. The method according to claim 3, wherein when there are a plurality of the files to be uploaded, the uploading the target number of the fragments to the server specifically includes:
sequencing the fragments corresponding to the files to be uploaded according to the sequence of the files to be uploaded in the uploaded file list so as to construct a fragment uploading queue;
and uploading the fragments with the target number to a server according to the fragment uploading queue.
5. The method according to claim 4, wherein uploading the target number of pieces to the server according to the piece uploading queue specifically includes:
judging whether the file size of each file to be uploaded is larger than or equal to the current uploading bandwidth or not;
if yes, sending a single channel establishing request to the server, wherein the single channel establishing request is used for indicating that an uploading single channel is established between the server and the terminal equipment; uploading fragments with a target number to the server according to the fragment uploading queue and the uploading single channel;
if not, determining the number of channels according to the file size of each file to be uploaded and the current uploading bandwidth, and sending a multi-channel establishing request to the server according to the number of channels, wherein the multi-channel establishing request is used for indicating that the number of uploading channels of the number of channels is established between the server and the terminal equipment; and uploading the fragments with the target number to the server according to the fragment uploading queue and the channel number uploading channels.
6. The method according to any of claims 1-5, wherein the target number is obtained by:
judging whether the maximum simultaneous uploading fragment number exists when the user uploads the last fragment;
if yes, determining the target number according to the maximum simultaneous uploading fragmentation number;
and if not, the target number is a preset number corresponding to the user.
7. The method of claim 6, wherein the maximum number of simultaneous upload slices is obtained by:
determining a third number of fragments uploaded to the server in a current uploading period and a fourth number of fragments uploaded to the server in a last uploading period;
determining whether a difference between the third number and the fourth number is zero;
if the difference value is zero, judging whether the number of fragments uploaded in each uploading period in a second preset time length is the third number or the fourth number;
if so, taking the third number or the fourth number as the maximum number of the fragments uploaded by the user at the same time; if not, re-executing the step of judging whether the difference value between the third number and the fourth number is zero or not.
8. A data processing apparatus of a terminal device, comprising:
the acquisition module is used for acquiring a file to be uploaded in a file list uploaded by a user;
the fragmentation module is used for carrying out fragmentation and section processing on the file to be uploaded so as to obtain fragments of the file to be uploaded;
and the uploading module is used for uploading the fragments with the target number to the server, and uploading the number of the fragments to the server after the adjustment according to the transmission result of the fragments with the target number until the uploading of all the fragments is completed.
9. A data processing device of a terminal device comprises a processor and a memory which is connected with the processor in a communication way;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1 to 7.
10. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210481669.1A CN114884936B (en) | 2022-05-05 | 2022-05-05 | Data processing method, device, equipment and medium of terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210481669.1A CN114884936B (en) | 2022-05-05 | 2022-05-05 | Data processing method, device, equipment and medium of terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114884936A true CN114884936A (en) | 2022-08-09 |
CN114884936B CN114884936B (en) | 2024-03-01 |
Family
ID=82674064
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210481669.1A Active CN114884936B (en) | 2022-05-05 | 2022-05-05 | Data processing method, device, equipment and medium of terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114884936B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115529307A (en) * | 2022-08-23 | 2022-12-27 | 北京奇艺世纪科技有限公司 | File uploading method and system, client device and server |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150163301A1 (en) * | 2013-12-06 | 2015-06-11 | Cellco Partnership D/B/A Verizon Wireless | System for and method for media upload multithreading for large file uploads |
CN107172131A (en) * | 2017-04-26 | 2017-09-15 | 腾讯科技(深圳)有限公司 | File uploading method and device |
CN108366112A (en) * | 2018-02-06 | 2018-08-03 | 杭州朗和科技有限公司 | Data transmission method and system, the medium and computing device of client |
-
2022
- 2022-05-05 CN CN202210481669.1A patent/CN114884936B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150163301A1 (en) * | 2013-12-06 | 2015-06-11 | Cellco Partnership D/B/A Verizon Wireless | System for and method for media upload multithreading for large file uploads |
CN107172131A (en) * | 2017-04-26 | 2017-09-15 | 腾讯科技(深圳)有限公司 | File uploading method and device |
CN108366112A (en) * | 2018-02-06 | 2018-08-03 | 杭州朗和科技有限公司 | Data transmission method and system, the medium and computing device of client |
Non-Patent Citations (1)
Title |
---|
陈善荣;赵跃龙;: "文件分块和动态副本管理机制的容错控制方法", 吉首大学学报(自然科学版), no. 03, 25 May 2008 (2008-05-25) * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115529307A (en) * | 2022-08-23 | 2022-12-27 | 北京奇艺世纪科技有限公司 | File uploading method and system, client device and server |
Also Published As
Publication number | Publication date |
---|---|
CN114884936B (en) | 2024-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109246229B (en) | Method and device for distributing resource acquisition request | |
CN110750341B (en) | Task scheduling method, device, system, terminal equipment and storage medium | |
CN110659151B (en) | Data verification method and device and storage medium | |
US8412864B2 (en) | Information processing apparatus and information processing method | |
CN108540568B (en) | Computing capacity sharing method and intelligent equipment | |
CN112416569A (en) | Cache memory adjusting method and device and computer equipment | |
US20210344584A1 (en) | Method for Measuring Network Speed, Computing Device, and Computer-Program Product | |
CN114884936A (en) | Data processing method, device, equipment and medium for terminal equipment | |
CN107784085B (en) | Data list exporting method and terminal thereof | |
CN110069533B (en) | Event subscription method and device based on blockchain | |
CN111736866A (en) | One-to-one and one-to-many compatible online upgrading method and terminal equipment | |
CN111104178A (en) | Dynamic library loading method, terminal device and storage medium | |
CN108337302B (en) | Wireless network caching method, device, equipment and medium based on communication scheduling | |
CN117076353B (en) | Descriptor configuration method and descriptor configuration device | |
CN110751045A (en) | Fault recording method, system and terminal equipment | |
CN111949470B (en) | Chip verification method and device, electronic equipment and storage medium | |
CN112291336B (en) | Multichannel parallel data loading method of ARINC429 network card | |
CN107301017B (en) | Data storage method and device | |
CN115905067A (en) | Data transmission control method, chip, device and storage medium | |
CN111489279A (en) | GPU acceleration optimization method and device and computer storage medium | |
CN106850953B (en) | Volume adjusting method, device and terminal | |
KR100754611B1 (en) | Data transmitting apparatus and method | |
CN112966005A (en) | Timing message sending method and device, computer equipment and storage medium | |
CN115002133B (en) | Data transmission determining method and device based on multiple interfaces | |
CN115883645B (en) | Communication configuration method, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |