CN111327695B - Resource downloading method and related device - Google Patents

Resource downloading method and related device Download PDF

Info

Publication number
CN111327695B
CN111327695B CN202010090305.1A CN202010090305A CN111327695B CN 111327695 B CN111327695 B CN 111327695B CN 202010090305 A CN202010090305 A CN 202010090305A CN 111327695 B CN111327695 B CN 111327695B
Authority
CN
China
Prior art keywords
resource
downloading
fragment
background
interval
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.)
Active
Application number
CN202010090305.1A
Other languages
Chinese (zh)
Other versions
CN111327695A (en
Inventor
王海亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010090305.1A priority Critical patent/CN111327695B/en
Publication of CN111327695A publication Critical patent/CN111327695A/en
Application granted granted Critical
Publication of CN111327695B publication Critical patent/CN111327695B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/108Resource delivery mechanisms characterised by resources being split in blocks or fragments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/1085Resource delivery mechanisms involving dynamic management of active down- or uploading connections
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a resource downloading method and a related device, aiming at the resource information of background resources determined by a resource downloading task, the size and the downloading interval of resource fragments can be determined according to the resource information, and the background resources are downloaded in a resource fragment mode through a fragment downloading request. Therefore, the downloading speed of the background resource is effectively limited from the downloading amount and the downloading interval each time, the high-efficiency flow control is realized, and the situation that the background resource downloading occupies too much bandwidth is avoided. Therefore, the resource downloading efficiency directly related to the resource downloading task is ensured, and the response speed to the network behavior is improved.

Description

Resource downloading method and related device
Technical Field
The present application relates to the field of data processing, and in particular, to a resource downloading method and a related apparatus.
Background
When a user uses software in the intelligent terminal to perform network behavior, the user can download required resources from the network. For example, when a user watches live broadcast through video software, the user needs to download live broadcast video stream resources, special effects and barrage resources, and when the user starts an online game client and an APP, the user needs to download data resources required for starting the client and special effect rendering textures.
That is, when downloading resources based on network behavior, in addition to downloading resources directly related to the behavior, i.e., whether the network behavior responds or not depends on the downloading speed of such resources, it is also necessary to download background resources like those described above, i.e., some resources that are not used immediately but may be about to be used based on the network behavior.
In the related art, the download bandwidth occupation of the background resource is not limited. The unlimited background flow downloading is caused to seriously seize the network bandwidth, the resource downloading directly related to the network behavior is slow, and the response of the intelligent terminal to the network behavior is directly caused to slow.
Disclosure of Invention
In order to solve the above technical problem, the present application provides a resource downloading method and a related apparatus, which can improve a response speed to a network behavior.
The embodiment of the application discloses the following technical scheme:
in one aspect, an embodiment of the present application provides a resource downloading method, where the method includes:
determining resource information of background resources according to the resource downloading task;
determining the size and the downloading interval of the resource fragment according to the resource information;
sending a fragmented download request for the background resource based on the download interval; the fragmentation download request identifies the size of the resource fragmentation;
and downloading the resource fragment returned according to the fragment downloading request, wherein the resource fragment is a part of the background resource.
On the other hand, an embodiment of the present application provides a resource downloading device, where the device includes a determining unit, a sending unit, and a downloading unit:
the determining unit is used for determining the resource information of the background resource according to the resource downloading task;
the determining unit is further configured to determine the size of the resource fragment and the download interval according to the resource information;
the sending unit is used for sending a fragmentation downloading request aiming at the background resource based on the downloading interval; the fragmentation download request identifies the size of the resource fragmentation;
and the downloading unit is used for downloading the resource fragment returned according to the fragment downloading request, wherein the resource fragment is a part of the background resource.
In another aspect, an embodiment of the present application provides an apparatus for resource downloading, where the apparatus includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method described in the above aspect according to instructions in the program code.
In another aspect, an embodiment of the present application provides a computer storage medium, which is used to store a computer program, where the computer program is used to execute the method described in the above aspect.
According to the technical scheme, the resource information of the background resource determined by the resource downloading task can be determined according to the resource information, the size of the resource fragment and the downloading interval can be determined, the background resource can be downloaded in a resource fragment mode through the fragment downloading request, the size of the resource fragment can identify the size of the resource fragment downloaded each time, and the downloading interval defines the time interval for downloading the adjacent resource fragments. Therefore, the downloading speed of the background resource is effectively limited from the downloading amount and the downloading interval each time, the high-efficiency flow control is realized, and the situation that the background resource downloading occupies too much bandwidth is avoided. Therefore, the resource downloading efficiency directly related to the resource downloading task is ensured, and the response speed to the network behavior is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic view of an application scenario of a resource downloading method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a resource downloading method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another resource downloading method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a heartbeat flow control assembly according to an embodiment of the present application;
fig. 5a is a schematic flow curve diagram illustrating resource downloading implemented in a speed-limitless manner according to an embodiment of the present application;
fig. 5b is a schematic flow curve diagram illustrating resource downloading implemented in a heartbeat flow control manner according to an embodiment of the present application;
fig. 6 is a schematic view of an application scenario of another resource downloading method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a resource downloading device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 9 is a block diagram of a partial structure related to a terminal according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
In order to control the download flow of the background resource, the embodiment of the application provides a resource downloading method, which downloads the background resource in a heartbeat flow control manner based on the size of the resource fragment and the download interval, so that the download speed of the background resource is effectively controlled, and the download efficiency of the application resource is improved.
The resource downloading method provided by the embodiment of the application can be applied to equipment with data processing capacity, such as terminal equipment or a server, the method can be independently executed through the terminal equipment, can also be independently executed through the server, can also be applied to a network scene of communication between the terminal equipment and the server, and can be executed through the cooperation between the terminal equipment and the server. The terminal equipment can be a mobile phone, a desktop computer, a portable computer and the like; the server may be understood as an application server or a Web server, and in actual deployment, the server may be an independent server or a cluster server. The resource downloading method provided by the present application is described below with a terminal as an execution subject.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of a resource downloading method according to an embodiment of the present application. In the scenario shown in fig. 1, a terminal 101 and a server 102 are included.
The terminal 101 may be a device for a user to execute a certain network behavior, and is configured to download resource data for a resource download task corresponding to the network behavior. And the server 102 is configured to receive and respond to the fragment downloading request sent by the terminal 101.
In the resource downloading process, the terminal 101 determines the size of the resource fragment and the downloading interval according to the resource information. The resource information refers to the total data amount of the background resource downloaded by the terminal 101, the size of the resource fragment refers to the data amount of the background resource downloaded by the terminal 101 at one time, and the download interval refers to the time interval between two times of downloading the resource fragment by the terminal 101.
After determining the size of the resource fragment and the download interval, the terminal 101 sends a fragment download request to the server 102, where the fragment download request identifies the size of the resource fragment and the data size of the background resource downloaded by the terminal 101. After the time passes the duration of the downloading interval, the terminal 101 sends the fragment downloading request to the server 102 again until the background resource is downloaded.
In the scenario shown in fig. 1, if the total amount of data of the background resource downloaded by the terminal 101 is 100M, that is, the resource information is 100M, the terminal 101 determines that the size of the resource fragment is 10M according to the resource information, and the download interval is 1 s.
Based on the above, the terminal 101 sends a fragment downloading request to the server, requesting to download the background resource with a data volume of 10M. The terminal 101 starts downloading at the beginning of one second (the head of line downloading time, for example, 300ms) with 1s as the downloading interval, and waits idle (the alignment idle time, for example, 700ms) after the resource fragment downloading is completed.
The terminal 101 starts downloading the resource, and after 1s, sends the fragment downloading request to the server 102 again to request to download the background resource with the data volume of 10M. After the terminal 101 requests downloading for 10 times, the background resource with the downloaded data volume of 100M is completed.
Based on the size of the resource fragment and the downloading interval, the terminal 101 realizes downloading the background resource in a heartbeat flow control manner. By monitoring the traffic in the process of downloading the background resource by the terminal 101, the traffic graph shown in fig. 1 can be obtained, where the horizontal axis represents time and the vertical axis represents the number of packets. Since the terminal 101 determines that the size of the resource fragment is 10M, the background resource data amount requested to be downloaded by the terminal 101 each time is identified as 10M by the fragment downloading request, and the background resource data amount requested to be downloaded by the terminal 101 each time is 10M. Based on this, the flow characteristics in the process of downloading the background resource by the terminal 101 are as a curve of the heartbeat, so this manner of downloading the background resource is called as heartbeat flow control. As can be seen from the above, the terminal 101 partitions the background resource, that is, partitions the background resource with a large data size into resource partitions with a small data size, and downloads the resource partitions in a quantitative manner for multiple times, thereby implementing the downloading of the entire background resource. Because the data volume of the resource fragments downloaded each time is fixed, the bandwidth occupied by the background resource in the downloading process is reduced, and meanwhile, the downloading time of the resource fragments is controlled by combining the downloading interval, the downloading speed of the background resource is effectively controlled, and therefore, the response speed to the network behavior is improved.
Referring to fig. 2, fig. 2 is a schematic flow chart of a resource downloading method provided in the embodiment of the present application, and the resource downloading method provided in the embodiment of the present application is described below. In fig. 2, the resource downloading method includes the following steps:
s201: and determining the resource information of the background resource according to the resource downloading task.
In practical application, the terminal may determine a resource downloading task corresponding to a network behavior when executing the network behavior. The resource downloading task can be understood as a task that the network behavior terminal needs to execute the downloading resource. Aiming at one network behavior, the corresponding resource downloading task comprises at least one resource downloading task. The resources that need to be downloaded for performing each resource download task include application resources and background resources. The application resource refers to a resource directly related to the response of the terminal to the network behavior, and the background resource refers to a resource which is not directly related to the network behavior realized by the terminal.
Take the example that the terminal opens the video software. In the process of opening the video software by the terminal, resources needing to be downloaded comprise a video home page interface and special effect rendering textures. The video home page interface is a resource directly related to video software opening, namely an application resource; and the special effect rendering texture is a resource which is not directly related to the opening of the video software, namely a background resource.
The resource information of the background resource determined by the terminal refers to the total data amount of the background resource downloaded by the terminal. For example, when the terminal opens the video software, the total amount of data required by the terminal to download the special effect rendering texture is 50M. In practical application, the terminal can establish connection with the server, and the server determines the resource information of the background resource to be downloaded.
S202: and determining the size and the downloading interval of the resource fragment according to the resource information.
Generally, the data size of the background resource far exceeds the data size of the application resource. Under the condition that downloading is not limited by flow, because the data transmission bandwidth is limited, in the process of downloading resources by the terminal, the background resources occupy too much bandwidth, so that the speed of downloading the application resources by the terminal is too slow, the response time of the terminal to network behaviors is longer, and the user experience is influenced.
The application provides a feasible implementation mode, namely the size and the downloading interval of each resource fragment are determined for the background according to the resource information of the background resources, and the background resources are downloaded in a heartbeat flow control mode.
The size of the resource fragment refers to the data amount of the background resource that can be downloaded by the terminal for each transmitted fragment download request. For example, if the size of the resource fragment is 1M, the amount of background resource data that can be downloaded by the terminal at one time is 1M.
The downloading interval refers to a time interval between two times of downloading the resource fragment by the terminal. For example, if the download interval is 1s, the terminal starts downloading at the beginning of one second, the terminal starts downloading the next time after the resource fragments are downloaded for 100ms, and the terminal waits for 900 ms.
The terminal controls the data volume of the background resource downloaded each time by determining the size of the resource fragment, thereby ensuring that the background resource occupies excessive bandwidth under the condition of limited bandwidth, and correspondingly, the bandwidth occupied by the application resource is increased. Meanwhile, the terminal controls the downloading speed of the whole background resource by combining the size of the resource fragment with the downloading interval of the resource fragment, and improves the downloading speed of the application resource, so that the response speed of the terminal to network behaviors is improved, and the user experience is improved.
S203: sending a fragmented download request for the background resource based on the download interval; the shard download request identifies a size of the resource shard.
And after determining the size and the downloading interval of the resource fragment, the terminal sends a fragment downloading request to the server based on the downloading interval. The fragment downloading request carries background resource information to be downloaded, and the size of the resource fragment downloaded by the terminal each time aiming at the background resource.
The background resource information to be downloaded in the fragmentation downloading request can identify the resource content for data transmission between the terminal and the server. The size of the resource fragment can identify the size of the data volume for data transmission between the terminal and the server.
Based on the size and the downloading interval of the resource fragment, the terminal firstly sends a fragment downloading request to the server, and the terminal starts to download the resource fragment after the server responds to the fragment downloading request. And after the downloading interval time passes, the terminal sends the next fragment downloading request to the server again.
For example, the size of the resource slice is 1M, and the download interval is 1 s. When the time begins, the terminal sends a first time fragment downloading request to the server, and the fragment downloading request marks that the size of the resource fragment is 1M. The server responds to the fragmentation download request after 100ms and distributes 1M background resources to the terminal. The terminal starts downloading in 100ms, and finishes downloading the resource fragment with the data volume of 1M after 400 ms. And after waiting for 500ms, the terminal sends a second sub-fragment downloading request to the server. And after 100ms, the terminal starts the second downloading until the background resource downloading is completed.
Based on the above, the terminal identifies the size of the resource fragment in the fragment downloading request, and fixes the data size of the background resource downloaded each time. Meanwhile, the background resource is downloaded in a heartbeat flow control mode through multiple times of fragment downloading in combination with the downloading interval, and the downloading speed of the background resource is effectively controlled.
The present application provides a feasible implementation manner, where a terminal may send an http protocol message to a server through an Access Point (AP) by using a hypertext transfer protocol (http), for example, http 1.1, and request the server to distribute a background resource with a fixed data size, that is, a resource fragment, by using a range field in a header of the http message to identify a background resource to be downloaded and a size of the resource fragment to be downloaded each time.
The AP may be used as a network extension, and may be connected to other APs or a master AP to extend a wireless coverage area. The http protocol can realize data transmission between the terminal and the server, is low in cost, and can reduce resource consumption in the data transmission process.
S204: and downloading the resource fragment returned according to the fragment downloading request, wherein the resource fragment is a part of the background resource.
The terminal can establish connection with a server through an AP and a Content Delivery Network (CDN), send a fragment downloading request to the server by using the AP, respond to the fragment downloading request by the server, and distribute a resource fragment identified by the fragment downloading request to the terminal by using the CDN, so that the terminal finishes downloading the resource fragment.
The CDN can avoid bottlenecks and links which possibly influence the data transmission speed and stability on the Internet as far as possible, so that the content transmission is faster and more stable, a user can obtain required content nearby, the network congestion condition is solved, and the response speed of the user for accessing a website is improved. In practical application, the data transmission network between the terminal and the server may also adopt other manners, which is not limited herein.
Further, after downloading the resource fragment each time, the terminal may cache the resource fragment for waiting processing. In a feasible implementation manner, the terminal may perform resource merging on the resource fragments according to the downloading order after downloading all the resource fragments, so as to obtain a complete background resource. In another feasible implementation manner, the terminal may merge the downloaded resource fragments in real time according to the downloading sequence after downloading each resource fragment, and when downloading of the resource fragments is completed, the merged background resource may be obtained in time.
The resource downloading method provided in the foregoing embodiment may determine the size of the resource fragment and the downloading interval according to the resource information, and download the background resource in the resource fragment manner through the fragment downloading request, where the size of the resource fragment may identify how large the resource fragment is downloaded each time, and the downloading interval specifies a time interval for downloading adjacent resource fragments. Therefore, the downloading speed of the background resource is effectively limited from the downloading amount and the downloading interval each time, the high-efficiency flow control is realized, and the situation that the background resource downloading occupies too much bandwidth is avoided. Therefore, the resource downloading efficiency directly related to the resource downloading task is ensured, and the response speed to the network behavior is improved.
It can be understood that, since the speed of the terminal responding to the network behavior is affected by the network environment, the embodiment of the present application further provides another resource downloading method for the case of the dynamic change of the network state.
Referring to fig. 3, fig. 3 is a schematic flowchart of another resource downloading method according to an embodiment of the present disclosure. As shown in fig. 3, the method includes the following S301-S307.
After the terminal starts to execute the network behavior, resource information of the background resource is determined according to the resource downloading task corresponding to the network behavior (S301).
Since data transmission between the terminal and the server is affected by dynamically changing network conditions, the present application provides a feasible implementation manner, that is, the terminal determines the size of the resource fragment and the download interval according to the resource information and the network download parameters. The network download parameter may include a data transmission bandwidth. When the network condition is good, the terminal determines that the resource fragment is large and the downloading interval is small; and when the network condition is not good, the resource fragment determined by the terminal is small, and the downloading interval is large.
The size and the downloading interval of the resource fragments determined based on the resource information and the network downloading parameters can be adapted to the network state in the actual data transmission process, the downloading speed of the background resources is controlled more effectively, and the response speed to the network behavior is improved.
Typically, the data volume of the background resource far exceeds the data volume of the application resource. The terminal can adaptively adjust the size and the downloading interval of the resource fragment after finishing the downloading of the application resource by controlling the downloading speed of the background resource, so that the terminal can more quickly finish the downloading of the background resource.
In a feasible implementation manner, after the terminal finishes downloading the ith resource fragment, the terminal determines the size of the (i + 1) th resource fragment and the (i + 1) th download interval according to the resource information and the current network download parameter (S302). Furthermore, after sending the fragment downloading request for the ith resource fragment, the terminal waits for the (i + 1) th downloading interval to send the fragment downloading request for the (i + 1) th resource fragment, wherein the fragment downloading request for the (i + 1) th resource fragment identifies the size of the (i + 1) th resource fragment.
Based on the (i + 1) th download interval, the terminal sends an (i + 1) th fragment download request to the server for the background resource, where the fragment download request identifies the size of the (i + 1) th resource fragment (S303). After the server responds to the fragment downloading request, the (i + 1) th resource fragment is downloaded (S304). After the (i + 1) th resource fragment is downloaded, the (i + 1) th resource fragment is cached and the resource merging is waited (S305). Further, the terminal determines whether the background resources are completely downloaded (S306), and determines whether the downloading needs to be continued. If not, continuing to execute S303 and sending the (i + 2) th fragment downloading request. If yes, the terminal performs resource merging on the cached resource fragments according to the downloading sequence to obtain background resources (S307).
Based on the size and the downloading interval of the resource fragments determined in real time, the terminal sends the fragment downloading request identification to the server each time, the sizes of the resource fragments of the fragment downloading request identification are different, and the time interval of sending the fragment downloading request to the server before and after the terminal is also dynamically changed. Based on the method, the terminal can change the size and the downloading interval of the resource fragment in real time according to the network state, dynamically control the downloading speed of the background resource and ensure the downloading efficiency of the application resource.
In practical applications, there may be abnormal conditions in the network state, such as network disconnection, network signal degradation, etc., which may cause that the terminal does not complete the current resource fragment when the current download interval is over, that is, the terminal fails to download the resource fragment, so that the resource fragment cannot be used.
Aiming at the abnormal situation of downloading the resource fragments, the application provides a feasible implementation manner, if the (i + 1) th downloading interval is finished, the terminal detects that the data downloading amount of the (i + 1) th resource fragment is different from the predetermined size of the (i + 1) th resource fragment, so that the situation that the (i + 1) th resource fragment is not successfully downloaded is determined, and the terminal can send a fragment downloading request aiming at the (i + 1) th resource fragment according to the (i + 1) th downloading interval again. Or, the terminal may re-determine the size and the download interval of the (i + 1) th resource fragment according to the resource information and the current network download parameter, and send a fragment download request according to the re-determined (i + 1) th download interval, where the fragment download request identifies the re-determined size of the (i + 1) th resource fragment.
When the terminal downloads the resource fragment and meets abnormal conditions, the terminal requests the resource fragment to be downloaded again by resending the fragment downloading request. Or, the size and the downloading interval of the resource fragment are determined again, and the background resource downloading parameters are adaptively adjusted according to the network state, so that the normal downloading of the resource fragment is ensured.
Next, with reference to fig. 4, a heartbeat flow control component structure for implementing the resource downloading method shown in fig. 3 is described. In the structure shown in fig. 4, a traffic controller, a fragment downloader, a task group, a single resource download task, a download thread, a fragment data transmission channel, a file processing thread, and a file are included.
Aiming at a single resource downloading task in a task group, after a terminal determines resource information of a background resource according to the resource downloading task, the terminal firstly determines the size of an ith resource fragment and an ith downloading interval according to the resource information and network downloading parameters by using a flow controller, and then sends a fragment downloading request aiming at the background resource to a server for the ith time, wherein the fragment downloading request marks the ith downloading interval.
And after the server responds to the fragment downloading request, the terminal enters a downloading thread and downloads the ith resource fragment by using the fragment downloader. And after the ith resource fragment is downloaded, entering a file processing thread through a fragment data transmission channel, and waiting for resource combination. Meanwhile, the terminal calculates the size of the (i + 1) th resource fragment and the (i + 1) th download interval by using the flow controller. And after the ith downloading interval is finished, the terminal sends a fragment downloading request to the server for the (i + 1) th time.
And the terminal downloads all the resource fragments by circularly calling the flow controller and the fragment downloader. And after the resource fragment downloading is finished, the terminal carries out resource combination on the resource fragments according to the downloading sequence to obtain a background resource file.
In the following, with reference to the accompanying drawings, a comparison between downloading resources in a non-rate-limiting manner and downloading resources in a heartbeat flow control manner is performed, so as to describe beneficial effects of the method for implementing resource downloading in a heartbeat flow control manner provided in the embodiment of the present application.
Referring to fig. 5a and 5b, fig. 5a is a schematic flow curve diagram for implementing resource downloading in a non-rate-limiting manner according to an embodiment of the present application, and fig. 5b is a schematic flow curve diagram for implementing resource downloading in a heartbeat flow control manner according to an embodiment of the present application. The horizontal axis represents time and the vertical axis represents resource download traffic.
And the terminal opens the app to test the two modes. In the testing process, the cache in the terminal app is emptied, and in the WIFI environment, in the process from the start of clicking the app to the finish of displaying the home page picture of the app, a network data acquisition and analysis tool (such as TcpLock) can be used for capturing the flow data packet cached by the terminal as a testing parameter.
Comparing the flow graphs shown in fig. 5a and fig. 5b, in the manner shown in fig. 5a, the background resource download occupies 96.9% of the flow in the app starting process from the time when the terminal clicks the app to the time when the app home page picture display is completed. In the manner shown in fig. 5b, the terminal starts clicking the app until the first page picture display of the app is completed, and the background resource download occupies 17.7% of the flow in the app starting process.
Based on the test result, in the process of downloading the resources in a speed-limit-free mode, a large amount of bandwidth is occupied by background resource downloading; compared with a non-speed-limiting mode, the background resource flow occupation is obviously reduced and the application resource downloading speed is higher in the process of downloading the resources in the heartbeat flow control mode. Based on this, the resource downloading method provided by the embodiment of the application can effectively control the downloading speed of the background resource and improve the response speed of the terminal to the network behavior.
Based on the above described resource downloading method, the embodiment of the present application provides an application scenario suitable for the resource downloading method. Referring to fig. 6, fig. 6 is a schematic view of an application scenario of another resource downloading method provided in the embodiment of the present application. In the scenario shown in fig. 6, a terminal 601, a terminal 602, and a server 603 are included.
The user executes a certain network behavior by using the terminal 601, and at least one resource downloading task is required to be executed to complete the network behavior. As shown in fig. 6, the terminal 601 executes a network behavior a, and its corresponding resource downloading Task TaskQueue includes Task1, Task2 and Task 3; the terminal 602 executes the network behavior B, and the corresponding resource downloading tasks TaskQueue include Task1 and Task 2. When the terminal executes different network behaviors, the corresponding resource downloading tasks have differences, and the resource downloading tasks are determined according to the actually executed network behaviors.
In the scenario shown in fig. 6, a terminal 601 and a terminal 602 establish a connection with a server 603 through an AP and a CDN.
The terminal 601 determines the resource information of the corresponding background resource according to the resource downloading tasks Task1, Task2 and Task3, and further determines the size and downloading interval of the resource fragment according to the resource information. The terminal 601 sends a request for downloading a piece of request CDN1, a request CDN2 and a request CDN3 to the server 603, and downloads corresponding background resources from the CDN1, the CDN2 and the CDN3 in a heartbeat flow control manner.
Similarly, the terminal 602 determines the resource information of the corresponding background resource according to the resource downloading tasks Task1 and Task2, respectively, and further determines the size of the resource fragment and the downloading interval according to the resource information. The terminal 602 downloads the corresponding background resource from the CDN3 in a heartbeat flow control manner by sending the request for fragmented download request CDN1 and the request CDN2 to the server 603.
It should be noted that different CDNs have different resource data, and therefore, the CDN may respond to the segment download request sent by the terminal 601 according to its own setting. The terminal requests the CDN to distribute the resource fragments by generating a fragment downloading request with an identifier of the CDN. In the application scenario shown in fig. 6, the CDN1 is configured with resource data corresponding to the resource download Task1, and may respond to the request CDN1 for the fragmented download. The CDN2 is configured with resource data corresponding to the resource download Task2, and may respond to the request CDN2 for the fragmented download. The CDN3 is configured with resource data corresponding to the resource download tasks Task1, Task2, and Task3, and may respond to the fragmented download requests request CDN1, request CDN2, and request CDN 3.
Aiming at the resource downloading method described above, the embodiment of the application also provides a corresponding resource downloading device.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a resource downloading device according to an embodiment of the present application. As shown in fig. 7, the resource downloading apparatus 700 includes a determining unit 701, a transmitting unit 702, and a downloading unit 703:
the determining unit 701 is configured to determine resource information of a background resource according to a resource downloading task;
the determining unit 701 is further configured to determine the size of the resource fragment and a download interval according to the resource information;
the sending unit 702 is configured to send a fragmented download request for the background resource based on the download interval; the fragmentation download request identifies the size of the resource fragmentation;
the downloading unit 703 is configured to download the resource fragment returned according to the fragment downloading request, where the resource fragment is a part of the background resource.
Optionally, the determining unit 701 is further configured to:
and determining the size and the downloading interval of the resource fragment according to the resource information and the network downloading parameters.
Optionally, the determining unit 701 is further configured to:
after downloading the ith resource fragment, determining the size of the (i + 1) th resource fragment and the (i + 1) th downloading interval according to the resource information and the network downloading parameters;
the sending a fragmented download request for the background resource based on the download interval comprises:
after sending a fragment downloading request aiming at the ith resource fragment, waiting for the (i + 1) th downloading interval to send the fragment downloading request aiming at the (i + 1) th resource fragment; the fragment downloading request aiming at the (i + 1) th resource fragment identifies the size of the (i + 1) th resource fragment.
Optionally, the sending unit 702 is further configured to:
and if the (i + 1) th resource fragment is not downloaded successfully, sending a fragment downloading request aiming at the (i + 1) th resource fragment again according to the (i + 1) th downloading interval.
Optionally, the resource downloading apparatus 700 further includes a merging unit:
and the merging unit is used for merging the resources according to the resource fragments downloaded in sequence, and obtaining the background resources through resource merging.
Optionally, the fragment downloading request is an http protocol message, and the size of the resource fragment is carried by a range field in a message header.
Optionally, the resource downloading apparatus 700 further includes an obtaining unit:
the acquisition unit is used for acquiring the resource downloading task when the software is opened; and the background resource is a special effect rendering texture corresponding to the resource downloading task.
The resource downloading device provided in the above embodiment may determine the size of the resource fragment and the downloading interval according to the resource information, and download the background resource in the resource fragment manner through the fragment downloading request, where the size of the resource fragment may identify how large the resource fragment is downloaded each time, and the downloading interval specifies a time interval for downloading adjacent resource fragments. Therefore, the downloading speed of the background resource is effectively limited from the downloading amount and the downloading interval each time, the high-efficiency flow control is realized, and the situation that the background resource downloading occupies too much bandwidth is avoided. Therefore, the resource downloading efficiency directly related to the resource downloading task is ensured, and the response speed to the network behavior is improved.
For the resource downloading method provided in the foregoing embodiment, the embodiment of the present application further provides a server and a terminal device for executing the resource downloading method, and the resource downloading device is described below with reference to the accompanying drawings.
Referring to fig. 8, fig. 8 is a schematic diagram of a server 1400 according to an embodiment of the present application, where the server 1400 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1422 (e.g., one or more processors) and a memory 1432, one or more storage media 1430 (e.g., one or more mass storage devices) for storing applications 1442 or data 1444. Memory 1432 and storage media 1430, among other things, may be transient or persistent storage. The program stored on storage medium 1430 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a server. Still further, a central processor 1422 may be disposed in communication with storage medium 1430 for executing a series of instruction operations on storage medium 1430 on server 1400.
The server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input-output interfaces 1458, and/or one or more operating systems 1441, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 8.
The CPU 1422 is configured to perform the following steps:
determining resource information of background resources according to the resource downloading task;
determining the size and the downloading interval of the resource fragment according to the resource information;
sending a fragmented download request for the background resource based on the download interval; the fragmentation download request identifies the size of the resource fragmentation;
and downloading the resource fragment returned according to the fragment downloading request, wherein the resource fragment is a part of the background resource.
Optionally, the CPU 1422 may further execute the method steps of any specific implementation manner of the resource downloading method in this embodiment.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present application. For convenience of explanation, only the parts related to the embodiments of the present application are shown, and details of the specific technology are not disclosed. The terminal device can be any terminal device including a mobile phone, a tablet computer, a Personal digital assistant (english general name: Personal digital assistant, english abbreviation: PDA), and the like:
fig. 9 is a block diagram illustrating a partial structure related to a terminal provided in an embodiment of the present application. Referring to fig. 9, the terminal includes: radio Frequency (RF) circuit 1510, memory 1520, input unit 1530, display unit 1540, sensor 1550, audio circuit 1560, wireless fidelity (WiFi) module 1570, processor 1580, and power 1590. Those skilled in the art will appreciate that the handset configuration shown in fig. 9 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 9:
the memory 1520 may be used to store software programs and modules, and the processor 1580 implements various functional applications of the terminal and data processing by operating the software programs and modules stored in the memory 1520. The memory 1520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1520 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The processor 1580 is a control center of the terminal, connects various parts of the entire tablet pc using various interfaces and lines, and performs various functions of the tablet pc and processes data by operating or executing software programs and/or modules stored in the memory 1520 and calling data stored in the memory 1520, thereby integrally monitoring the tablet pc. Optionally, the processor 1580 may include one or more processing units; preferably, the processor 1580 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, and the like, and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor may not be integrated within the processor 1580.
In the embodiment of the present application, the terminal includes a memory 1520 that can store the program code and transmit the program code to the processor.
The processor 1580 included in the terminal may execute the method for downloading the resource provided by the foregoing embodiment according to the instruction in the program code.
The embodiment of the present application further provides a computer-readable storage medium for storing a computer program, where the computer program is used to execute the resource downloading method provided by the foregoing embodiment.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium may be at least one of the following media: various media that can store program codes, such as read-only memory (ROM), RAM, magnetic disk, or optical disk.
It should be noted that, in the present specification, all the embodiments are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (6)

1. A method for resource downloading, the method comprising:
the method comprises the steps of obtaining a resource downloading task when software is opened, wherein the resource downloading task is a task which needs to execute downloading resources to realize network behaviors, the resources which need to be downloaded to execute the resource downloading task comprise application resources and background resources, the application resources are resources directly related to a terminal response network behavior, the background resources are resources which are not directly related to the terminal realization network behavior, and the background resources are special effect rendering textures corresponding to the resource downloading task;
determining resource information of background resources according to the resource downloading task;
determining the size and the downloading interval of the resource fragment according to the resource information, wherein the step comprises the following steps: determining the size and the downloading interval of the resource fragment according to the resource information and the network downloading parameters;
sending a fragment downloading request aiming at the background resource based on the downloading interval, wherein the fragment downloading request is an http protocol message, and identifying the background resource to be downloaded and the size of the resource fragment by using a range field in an http message header;
downloading the resource fragment returned according to the fragment downloading request, wherein the resource fragment is a part of the background resource;
after downloading the ith resource fragment, determining the size and the downloading interval of the resource fragment according to the resource information and the network downloading parameter includes:
determining the size of the (i + 1) th resource fragment and the (i + 1) th downloading interval according to the resource information and network downloading parameters, wherein the network downloading parameters comprise data transmission bandwidth;
the sending a fragmented download request for the background resource based on the download interval comprises:
after sending a fragment downloading request aiming at the ith resource fragment, waiting for the (i + 1) th downloading interval to send the fragment downloading request aiming at the (i + 1) th resource fragment; and identifying the size of the (i + 1) th resource fragment according to the fragment downloading request of the (i + 1) th resource fragment.
2. The method of claim 1, further comprising:
and if the (i + 1) th resource fragment is not downloaded successfully, sending a fragment downloading request aiming at the (i + 1) th resource fragment again according to the (i + 1) th downloading interval.
3. The method according to any one of claims 1-2, further comprising:
carrying out resource combination according to the sequentially downloaded resource fragments;
and obtaining the background resource through resource combination.
4. A resource downloading device is characterized by comprising an acquisition unit, a determination unit, a sending unit and a downloading unit:
the acquiring unit is used for acquiring a resource downloading task when software is opened, wherein the resource downloading task is a task which needs to execute a downloading resource for realizing a network behavior, the resource which needs to be downloaded for executing the resource downloading task comprises an application resource and a background resource, the application resource is a resource which is directly related to a terminal response network behavior, the background resource is a resource which is not directly related to the terminal realization network behavior, and the background resource is a special effect rendering texture corresponding to the resource downloading task;
the determining unit is used for determining the resource information of the background resource according to the resource downloading task;
the determining unit is further configured to determine the size of the resource fragment and the download interval according to the resource information;
the sending unit is used for sending a fragmentation downloading request aiming at the background resource based on the downloading interval, wherein the fragmentation downloading request is an http protocol message, and the size of the background resource to be downloaded and the size of the resource fragmentation are identified by using a range field in an http message header;
the downloading unit is configured to download the resource fragment returned according to the fragment downloading request, where the resource fragment is a part of the background resource;
the determining unit is further configured to determine the size of the resource fragment and the download interval according to the resource information and the network download parameter;
the determining unit is further configured to determine the size of the (i + 1) th resource fragment and the (i + 1) th download interval according to the resource information and a network download parameter after the ith resource fragment is downloaded, where the network download parameter includes a data transmission bandwidth;
the sending unit is further configured to wait for the (i + 1) th download interval to send a fragment download request for the (i + 1) th resource fragment after sending the fragment download request for the ith resource fragment; and identifying the size of the (i + 1) th resource fragment according to the fragment downloading request of the (i + 1) th resource fragment.
5. An apparatus for resource downloading, the apparatus comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of any of claims 1-3 according to instructions in the program code.
6. A computer-readable storage medium, characterized in that the computer-readable storage medium is used for storing a computer program, which is executed by a processor to implement the method of any of claims 1-3.
CN202010090305.1A 2020-02-13 2020-02-13 Resource downloading method and related device Active CN111327695B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010090305.1A CN111327695B (en) 2020-02-13 2020-02-13 Resource downloading method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010090305.1A CN111327695B (en) 2020-02-13 2020-02-13 Resource downloading method and related device

Publications (2)

Publication Number Publication Date
CN111327695A CN111327695A (en) 2020-06-23
CN111327695B true CN111327695B (en) 2022-08-02

Family

ID=71168847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010090305.1A Active CN111327695B (en) 2020-02-13 2020-02-13 Resource downloading method and related device

Country Status (1)

Country Link
CN (1) CN111327695B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104823215A (en) * 2012-12-28 2015-08-05 苹果公司 Sprite graphics rendering system
CN110147512A (en) * 2019-05-16 2019-08-20 腾讯科技(深圳)有限公司 Player preloading, operation method, device, equipment and medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504649B (en) * 2008-11-14 2011-11-30 北京搜狗科技发展有限公司 Page resource processing method and apparatus
CN105915489A (en) * 2015-11-09 2016-08-31 乐视致新电子科技(天津)有限公司 Optimization realization method for HLS protocol stack in network jittering and optimization realization device thereof
CN106254561B (en) * 2016-10-12 2019-12-17 上海安馨信息科技有限公司 real-time off-line downloading method and system for network resource file
CN107959700B (en) * 2016-10-18 2021-03-16 中国电信股份有限公司 Self-adaptive file downloading method and cloud storage gateway
CN110401691B (en) * 2019-05-09 2021-11-16 腾讯科技(深圳)有限公司 Resource downloading control method, device and terminal

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104823215A (en) * 2012-12-28 2015-08-05 苹果公司 Sprite graphics rendering system
CN110147512A (en) * 2019-05-16 2019-08-20 腾讯科技(深圳)有限公司 Player preloading, operation method, device, equipment and medium

Also Published As

Publication number Publication date
CN111327695A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
US8488661B2 (en) Systems and methods for data streaming
JP5450811B2 (en) Techniques for setting network communication parameters
US9814979B2 (en) Data provision system, provision apparatus, execution apparatus, control method, and recording medium
CN108848530B (en) Method and device for acquiring network resources and scheduling server
CN109088799B (en) Client access method, device, terminal and storage medium
WO2013140336A2 (en) System and method of managing servers for streaming desk top applications
US10506020B2 (en) Data transmission method, and terminal
US11889133B2 (en) Burst traffic processing method, computer device and readable storage medium
CN102624634B (en) Method and device for controlling network bandwidth on client side
CN111459690A (en) Data transmitting and receiving control method and device, mobile terminal and storage medium
US20240106891A1 (en) Peer-to-peer network scheduling method and system
CN107251529B (en) Method and apparatus for transmitting and receiving information between servers in content transmission network system
CN115834556B (en) Data transmission method, system, device, storage medium and program product
CN112511598A (en) Screen projection display method, intelligent terminal and storage medium
CN110856044A (en) Video image quality enhancement transmission method and related device
CN112968959A (en) Resource request method and terminal
JP6695980B2 (en) Using network-assisted protocols to improve network utilization
CN111698275B (en) Data processing method, device and equipment
CN106686635B (en) Data transmission method and device based on control and configuration protocol of wireless access point
CN112999651B (en) Data processing method based on cloud game and related equipment
CN111327695B (en) Resource downloading method and related device
CN111510761A (en) First frame equalization current limiting method and device, computer equipment and readable storage medium
CN106330504B (en) Method for realizing application and service controller
US9838492B2 (en) Data pushing method, apparatus, and system
CN111479137B (en) Method and device for providing line address, server 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40024192

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant