Data processing method, device, computer equipment and storage medium
By generating a high-priority first packet task for streaming media data download requests, the problem of long response time when multiple download tasks are solved, and the user experience and service quality are improved.
Patent Information
- Application Number
- CN202110881374.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-02
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-08-02
AI Technical Summary
In the case of multiple download tasks, the response time in the existing download method is long due to queuing, which can easily lead to network congestion and download lag, giving users a bad Internet experience.
By generating a high-priority first packet task for the download request of the target streaming media data, the first packet of data is returned first and placed in the task queue to speed up the response and reduce the user's waiting time.
It speeds up the response speed of user requests to download streaming media data, reduces lagging, and improves service quality.
Smart Images

Figure CN113612701B
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data processing method, apparatus, computer equipment and storage medium. Background Art
[0002] Among the many applications on the Internet, downloading is a common application. In the existing downloading methods, if the number of users is large, many users may apply to the same network node to download different files at the same time. Then the network node will return the corresponding download files to the user in the order of the download requests. However, it takes a long time for the network node to respond to each download request. In the case of multiple download tasks, this method of responding in order of requests is very slow, which seriously prolongs the response time for each download request, and easily leads to network congestion, download jams, and longer waiting time for users, which brings a bad Internet experience to users. Summary of the invention
[0003] In order to solve the technical problem of long response time due to queuing when performing multiple download tasks in the above technology, the present application provides a data processing method, apparatus, computer equipment and storage medium.
[0004] In a first aspect, the present application provides a data processing method, the method comprising:
[0005] Receiving a first request from a target terminal, wherein the first request is a request for downloading target streaming media data;
[0006] Generate a first task corresponding to the first request, wherein the first task is used to provide the target terminal with a first portion of data in the target streaming media data, and the first portion of data is the first packet of data returned in the process of the target terminal acquiring the target streaming media data;
[0007] Setting the priority of the first task to the first priority and then saving it to the task queue, wherein the first priority is higher than the second priority of the second task, the second task is generated before the first task and is used to provide the terminal with the second part of the data in the streaming media data, and the second part of the data is the data returned after the first packet of data in the process of the terminal obtaining the streaming media data;
[0008] Execute the first task in the task queue.
[0009] In a second aspect, the present application provides a data processing device, the device comprising:
[0010] A receiving module, configured to receive a first request from a target terminal, wherein the first request is a request for downloading target streaming media data;
[0011] A task generation module, used to generate a first task corresponding to the first request, wherein the first task is used to provide a first portion of data in the target streaming media data to the target terminal, and the first portion of data is the first packet of data returned in the process of the target terminal obtaining the target streaming media data;
[0012] A queue saving module, used for setting the priority of the first task to a first priority and then saving it to the task queue, wherein the first priority is higher than the second priority of the second task, the second task is generated before the first task and is used to provide the terminal with a second portion of data in the streaming media data, and the second portion of data is data returned after the first packet of data in the process of the terminal obtaining the streaming media data;
[0013] The task execution module is used to execute the first task in the task queue.
[0014] In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned data processing methods when executing the computer program.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above-mentioned data processing methods when the computer program is executed by a processor.
[0016] The beneficial effects of the above-mentioned data processing method, device, computer equipment and storage medium are as follows: This application first generates a first task with a processing priority higher than non-first packet tasks for each download request to return the corresponding first packet data to the terminal, and configures the data size and priority of the first packet data so that the first packet data is returned to the target terminal as lightweight data in priority. This first packet priority sending strategy speeds up the response speed of user requests to download streaming media data, reduces user waiting time, reduces the occurrence of freezes, and improves service quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 An application environment diagram of a data processing method in an embodiment;
[0020] Figure 2 is a flow chart of a data processing method in one embodiment;
[0021] Figure 3 is a structural block diagram of a data processing device in one embodiment;
[0022] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0024] Figure 1 FIG. 1 is an application environment diagram of a data processing method in an embodiment. Figure 1 , the data processing method is applied to a data processing system. The data processing system includes a terminal 110, a content node 120 and a server 130. The terminal 110, the content node 120 and the server 130 are connected through a network. The terminal 110 can be a desktop terminal or a mobile terminal, and the mobile terminal can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The content node 120 can be a CDN node or a home node. The home node is a router or a set-top box that uses idle bandwidth to provide download services for ordinary user families. The CDN node is a node in a content delivery network (Content Delivery Network, CDN network). The server 130 is used to store streaming media data. The server 130 can be implemented by an independent server or a server cluster composed of multiple servers. The content node 120 receives a first request from the terminal 110, generates a first task corresponding to the first request, sets the priority of the first task to the first priority and saves it to the task queue, executes the first task in the task queue, and obtains the corresponding streaming media data or part of the streaming media data from the server 130.
[0025] Figure 2 This is a flow chart of a data processing method in an embodiment. This embodiment mainly applies this method to the above Figure 1 Take the home node in the example as an example, refer to Figure 2 , the data processing method specifically includes the following steps:
[0026] S100: Receive a first request from a target terminal.
[0027] Specifically, the data processing method of this embodiment can be applied to a home node. The home node can be a router, a box, etc. that uses idle bandwidth to provide download services for a user's home. The target terminal is one of a mobile phone, a computer, a laptop, a tablet computer, etc. The first request is a download request for target streaming media data. More specifically, the first request is a download request sent by the target terminal to the home node to obtain the target streaming media data.
[0028] The home node may receive download requests for target streaming media data or other streaming media data sent by other terminals except the target terminal.
[0029] S200: Generate a first task corresponding to the first request.
[0030] Specifically, the first task is used to provide the target terminal with the first part of data in the target streaming media data, where the first part of data is the first packet of data returned in the process of the target terminal acquiring the target streaming media data.
[0031] Streaming media data is generally a kind of data with a certain data size, which is usually not very small. If the streaming media data is returned to the terminal at one time, there may be a long waiting time from the user sending a download request to the user receiving the streaming media data. Therefore, when providing the target streaming media data to the target terminal, the entire target streaming media data will not be transmitted to the target terminal at one time, but the target streaming media data will be provided to the target terminal in batches. In this way, the user can quickly get the response corresponding to the request without waiting for a long time, and a certain buffer time is given to the return of the remaining data. Each time part of the data of the target streaming media data is transmitted, it needs to be realized by executing the corresponding task. The first task is a task generated by providing the first part of the target streaming media data to the target terminal. The first part of the target streaming media data represents the first packet of the target streaming media data. When providing other terminals with streaming media data, the first packet of data will also be provided first. The first part of the data specifically refers to the first packet of the target streaming media data.
[0032] S300: Setting the priority of the first task to the first priority and saving the task to the task queue.
[0033] Specifically, the first priority is higher than the second priority of the second task. The second task is generated before the first task and is used to provide the second part of the streaming media data to the terminal. The second part of the data is the data returned after the first packet of data in the process of the terminal obtaining the streaming media data.
[0034] The first task corresponding to the received first request is saved in the task queue. The priority of the first task is higher than the priority of the second task in the task queue. The first task is used to indicate the processing task of the first packet data corresponding to the first request, and the second task is used to indicate the processing task corresponding to the non-first packet data in the task queue.
[0035] Before or at the same time as receiving the first request from the target terminal, the home node may have received other download requests for streaming media data sent by the terminal. The terminal may be the target terminal, that is, the target terminal may have sent other requests for other streaming media data before sending the first request. The terminal may also be other terminals other than the target terminal, and other terminals may request to download the target streaming media data or other streaming media data. The home node will also return the first packet data to the corresponding terminal first and then return the non-first packet data according to other download requests. Therefore, before generating the first task, the home node has generated the first packet task for returning the first packet data to the corresponding terminal and the second task for returning other non-first packet data except the first packet data according to other download requests. Non-first packet data refers to the data returned after the first time when the terminal obtains streaming media data, that is, the data returned after the first packet data. Each download request has corresponding first packet data and non-first packet data returned, and the non-first packet data must be returned after the corresponding first packet data. The first packet data generally includes a small amount of partial data in the streaming media data as much as possible.
[0036] The first task is a first-packet task. In addition to the first task, there may be other first-packet tasks in the task queue, and there may also be second tasks corresponding to other download requests for providing or returning non-first-packet data to the terminal. The second part of the data is the non-first-packet data corresponding to other download requests.
[0037] The priority of the first task in the task queue is the first priority, and the priority of the second task is the second priority, and the first priority is higher than the second priority. Therefore, even if the second task is generated before the first task, the first task is executed before the second task. This ensures that when the first task and the second task exist in the task queue at the same time, the first packet task of each download request is executed before other or its own non-first packet tasks.
[0038] S400: Execute the first task in the task queue.
[0039] Specifically, when the condition corresponding to the first priority is met, the first task is consumed and executed to return the first part of the target streaming media data, ie, the first packet of data, to the target terminal through the first packet task strategy.
[0040] The first packet of data generally includes a small amount of partial data in the streaming media data. Therefore, the first part of the data as the first packet of data will also include a small amount of partial data in the target streaming media data. The data size of the first part of the data is relatively small, so the response speed of the first task will be accelerated. Since the first priority of the first task is higher than the second priority of the second task, the response speed of the first task can be further accelerated. This embodiment configures the data size and priority of the first packet of data so that the first packet of data is preferentially returned to the target terminal as lightweight data, that is, a first packet of data is returned first for each download request, which speeds up the response speed of the user's request to download streaming media data, avoids occupying the download time on one download request and causing a long waiting process for other download requests, and also avoids a rush of downloads, reduces the user's waiting time, and improves the quality of service.
[0041] In one embodiment, generating a first task corresponding to a first request includes:
[0042] Generate a first data reading task corresponding to the first request;
[0043] When the first data reading task is completed, a first data sending task is generated.
[0044] Specifically, the first data reading task is used to read the first part of the target streaming media data, and the first task includes the first data reading task; the first data sending task is used to send the read first part of the data to the target terminal, and the first task includes the first data sending task.
[0045] The first task includes a first data reading task and a first data sending task. Data reading and sending are performed by different tasks, and for the same data, the data reading task is performed first and then the data sending task is performed. Moreover, the data reading task and the data sending task corresponding to the same data are not generated at the same time, but the corresponding data reading task is generated first, and then the corresponding data sending task is generated after the data reading task is completed. That is, the data reading task is generated first and then executed, and the data sending task is generated later and then executed.
[0046] This embodiment first executes steps S200-S400: generates a first data reading task corresponding to the first request, sets a priority for the first data reading task and saves it to a task queue, and executes the first data reading task to read the first portion of data from the target streaming media data.
[0047] This embodiment further executes steps S200-S400: generating a first data sending task corresponding to the first request, setting a priority for the first data sending task and saving it to a task queue, and executing the first data sending task to send the read first part of data to the target terminal.
[0048] In this embodiment, data reading and data sending are completed successively through different tasks. A data reading task is first generated to detect whether there is any unsent data. If there is unsent data, the corresponding data sending task will be generated only after the data is successfully read. If there is no unsent data, there is no need to generate additional data sending tasks, thereby avoiding the generation of invalid data sending tasks. In computer devices, the processing speed of processes or threads is limited. The generation of a large number of invalid tasks will affect or delay the execution of valid tasks to a certain extent. Therefore, this embodiment speeds up the execution of valid tasks by reducing the generation of invalid tasks, thereby speeding up the response speed of user requests and improving service quality.
[0049] In one embodiment, the second task includes a second data reading task for reading the second portion of data and a second data sending task for sending the second portion of data.
[0050] Specifically, the first task is the first packet task corresponding to the target streaming media data, and the second task is the non-first packet task of the streaming media data corresponding to other download requests. Both the first packet task and the non-first packet task have read and send operations, so each second task includes the corresponding second data reading task and second data sending task.
[0051] Step S300 specifically includes the following steps:
[0052] Saving the first data reading task to the data reading task queue;
[0053] The first data sending task is saved in the data sending task queue.
[0054] Specifically, the task queue includes a data reading task queue processed by a data reading thread, and the data reading thread has a higher processing priority for the first data reading task than the second data reading task; the task queue includes a data sending task queue processed by a data sending thread, and the data sending thread has a higher processing priority for the first data sending task than the second data sending task.
[0055] The first task generated in the previous embodiment includes a first data reading task and a first data sending task. The present embodiment further saves the first data reading task and the first data sending task to different task queues respectively. That is, the first data reading task is saved to the data reading task queue, and the first data sending task is saved to the data sending task queue. At the same time, the tasks in different task queues are executed by different threads. That is, the data reading task in the data reading task queue is processed by the data reading thread, and the data sending task in the data sending task queue is processed by the data sending thread. It is realized that the data reading task and the data sending task are saved in different task queues, and are executed by different threads. Then it is realized that the execution of the two different tasks does not interfere with each other to a certain extent, and the dual-thread task processing method can further improve the processing speed of tasks, speed up the response speed of user requests, and improve the quality of service.
[0056] In addition, this embodiment also ensures that in the same task queue, the processing priority of the first data reading task is higher than the priority of the second data reading task, and the processing priority of the first data sending task is higher than the priority of the second data sending task. That is, it is ensured that the data reading task in the first package task is higher than the data reading task of the non-first package task, and the data sending task in the first package task is higher than the data sending task of the non-first package task. Furthermore, to a certain extent, it is ensured that when receiving the user's download request, a small amount of the first package data is returned as quickly as possible to respond to the user's request, thereby reducing the user's waiting time.
[0057] In one embodiment, saving the first data reading task to a data reading task queue includes:
[0058] When there are multiple first-packet reading tasks, obtain timestamps in the download requests corresponding to the multiple first-packet reading tasks;
[0059] Starting from the head of the data reading task queue, multiple first packet reading tasks are saved in order from the earliest to the latest timestamp.
[0060] Specifically, a home node may receive multiple download requests, some of which may be before the first request, and some of which may be after the first request. Each download request has a corresponding first-packet task and a non-first-packet task, so there may be multiple first-packet tasks. Each first-packet task has a corresponding first-packet reading task and first-packet sending task, so there may be multiple first-packet reading tasks for first-packet data and multiple first-packet sending tasks for first-packet data. The first-packet reading task is used to read the first-packet data, and the first-packet sending task is used to send the first-packet data.
[0061] The first packet reading task belongs to the data reading task and will be saved in the data reading task queue. Therefore, it is necessary to sort all the first packet reading tasks in the data reading task according to the timestamp of the download request. The first packet reading task corresponding to the download request sent first, that is, the download request with an earlier timestamp, is ranked earlier, has a higher processing priority, and is processed more preferentially. Among them, multiple first packet reading tasks include a first data reading task, that is, the first data reading task belongs to one of the first packet reading tasks. In the case of the same first packet reading task, its priority needs to be determined according to the sorting of the timestamp of the corresponding first request, wherein the first request also belongs to a download request, which is one of multiple download requests. In this way, a small amount of first packet data corresponding to each download request can be returned to the user corresponding to each download request according to the principle of first request first processed, further reducing the user's waiting time.
[0062] In one embodiment, saving the first data sending task to a data sending task queue includes:
[0063] When there are multiple first-packet sending tasks, obtain timestamps in the download requests corresponding to the multiple first-packet sending tasks;
[0064] Starting from the head of the data sending task queue, multiple first packet sending tasks are saved in order from early to late according to the timestamps.
[0065] Specifically, the home node may receive multiple download requests, some of which may be before the first request, and some of which may be after the first request. Each download request has a corresponding first-packet task and a non-first-packet task, so there may be multiple first-packet tasks. Each first-packet task has a corresponding first-packet reading task and first-packet sending task, so there may be multiple first-packet reading tasks and multiple first-packet sending tasks for first-packet data.
[0066] The first packet sending task belongs to the data sending task and will be saved in the data sending task queue. Therefore, it is necessary to sort all the first packet sending tasks in the data sending task according to the timestamp of the download request. The first packet sending task corresponding to the download request sent first, that is, the download request with an earlier timestamp, is ranked earlier, has a higher processing priority, and is processed more preferentially. Among them, multiple first packet sending tasks include a first data sending task, that is, the first data sending task is one of the first packet sending tasks. In the case of the same first packet sending task, its priority needs to be determined according to the sorting of the timestamp of the corresponding first request, wherein the first request also belongs to a download request, which is one of multiple download requests. In this way, a small amount of first packet data corresponding to each download request can be returned to the user corresponding to each download request according to the principle of first request first processed, further reducing the user's waiting time.
[0067] In one embodiment, generating a first data reading task corresponding to a first request includes: determining a first portion of data to be read that is located at a header of target streaming media data and has a first data volume; generating a first data reading task for reading the first portion of data;
[0068] After generating a first data reading task corresponding to the first request, the method also includes: determining a third portion of data to be read that has not been read in the target streaming media data and is a second data volume; generating a third data reading task for reading the third portion of data, wherein the second data volume is greater than the first data volume.
[0069] Specifically, when generating the first data reading task, it is necessary to determine which part of the target streaming media data is to be read. Therefore, it is necessary to locate the position and size of the first part of the data in the target streaming media data. The first data volume represents the data size of the first part of the data to be read. In this embodiment, the first part of the data, i.e., the first packet of data corresponding to the first request, is determined as the part of the data located at the header of the target streaming media data and having a data size of the first data volume. The first data reading task is generated according to the acquired position and data size of the first part of the data. The first data reading task carries the position and data size of the first part of the data in the target streaming media data.
[0070] The first part of the data is the first packet of data corresponding to the target streaming media data. The target streaming media data also has other data besides the first part of the data, namely the third part of the data that needs to be read. The third part of the data is the non-first packet of data in the target streaming media data except the first part of the data (a first packet of data). The data size of the third part of the data is the second data amount. In order to ensure that the first packet of data is quickly returned to the user, the second data amount needs to be larger than the first data amount. The first packet of data is preferentially reduced to a small data size as much as possible. Reducing the first packet of data as much as possible, that is, the first part of the data of the first data amount is as small as possible, can be conducive to the rapid execution of the first packet task, and the user can obtain the first response to the download request as quickly as possible, reducing the user's waiting.
[0071] In the present application, the first package data and non-first package data corresponding to the same download request are executed at different times. Therefore, in order for the non-first package data of the target streaming media data, i.e., the third data, to be successfully returned to the target terminal, a corresponding third data reading task also needs to be generated. The third part of the data may be a part of the other parts of the target streaming media data except the first part of the data, or may be all of the other parts of the target streaming media data except the first part of the data. In the present embodiment, the data size of the third part of the data is determined to be the second data amount, and the position of the third part of the data is determined to be the data that has not been read in the target streaming media data, and a third data reading task is generated according to the position and data size of the acquired third part of the data. The third data reading task carries the position and data size of the third part of the data in the target streaming media data.
[0072] In one embodiment, after generating a third data reading task for reading the third portion of data, the method further includes:
[0073] Saving the third data reading task to the data reading task queue;
[0074] When the data reading thread completes executing the third data reading task, generating a third data sending task;
[0075] Saving the third data sending task to the data sending task queue;
[0076] The third data sending task is executed through the data sending thread.
[0077] Specifically, the data reading thread has a lower processing priority for the third data reading task than for the first data reading task; the third data sending task is used to send the read third part of data to the target terminal; the data sending thread has a lower processing priority for the third data sending task than for the first data sending task.
[0078] The third data reading task is a type of data reading task, and therefore needs to be saved in the data reading task queue. However, since the third data reading task is used to read non-first packet data in the target streaming media data, the processing priority of the third data reading task is lower than the processing priority of the first data reading task used to read the first part of the data (a type of first packet data).
[0079] In addition, the data reading task and the data sending task corresponding to the same data follow the rule of generating the data reading task first, generating the corresponding data sending task after executing the data reading task, and finally executing the data sending task; and the data reading task is executed by the data reading thread, and the data sending task is executed by the data sending thread. Therefore, the third data sending task will be generated only after the data reading thread executes the third data reading task. And the third data sending task will be saved in the data sending task queue, waiting for the execution of the data sending thread.
[0080] The first data sending task and the third data sending task are both saved in the same data sending task queue. The third data sending task is generated after the third data reading task, which is generated after the first data reading task. The first data sending task is generated after the first data reading task. This embodiment constrains the processing priority of the first data sending task to be higher than the processing priority of the third data sending task, thereby ensuring that the first task is executed as soon as possible, and then the first part of the data is returned to the target terminal as soon as possible, reducing the user's waiting time.
[0081] In one embodiment, saving the third data reading task to the data reading task queue includes:
[0082] When there are multiple non-first packet reading tasks, obtain timestamps in the download requests corresponding to the multiple non-first packet reading tasks;
[0083] Starting from the end of the data reading task queue, multiple non-first packet reading tasks are saved in order of timestamps from the latest to the earliest.
[0084] Specifically, the multiple non-first packet reading tasks include a third data reading task.
[0085] In the task queue, the tasks closer to the head of the queue are executed first, and the tasks at the end of the queue are executed later.
[0086] The home node may receive multiple download requests, some of which may be before the first request, and some may be after the first request. Each download request has a corresponding first-packet task and a non-first-packet task, so there may be multiple non-first-packet tasks.
[0087] The second task is a non-first package task, and the second task is a non-first package task corresponding to other download requests, and is used to return the non-first package data of the corresponding streaming media data to the corresponding terminal.
[0088] Each non-first packet task has a corresponding non-first packet reading task and non-first packet sending task. Therefore, there may be multiple non-first packet reading tasks for non-first packet data and multiple non-first packet sending tasks for non-first packet data. The non-first packet reading task is used to read non-first packet data, and the non-first packet sending task is used to send non-first packet data.
[0089] The non-first package reading task belongs to the data reading task, and the third data reading task also belongs to the non-first package reading task, and both will be saved in the data reading task queue. In the same data reading task queue, the non-first package reading task and the third data reading task corresponding to the second task are included, and these all belong to the non-first package reading tasks. Therefore, it is necessary to sort all the non-first package reading tasks in the data reading task according to the timestamp of the download request. The non-first package reading task corresponding to the download request sent first, that is, the download request with an earlier timestamp, is ranked earlier, has a higher processing priority, and is processed more preferentially. Among them, multiple non-first package reading tasks include the third data reading task, that is, the third data reading task is one of the non-first package reading tasks. In the case of all non-first package reading tasks, their priority needs to be determined according to the sorting of the timestamp of the corresponding first request, wherein the first request also belongs to a download request, which is one of multiple download requests.
[0090] In the above case where there are multiple non-first package reading tasks in the data reading task queue, the processing order of each non-first package reading task is saved in the order of the time corresponding to the download request is obtained. In this way, the corresponding non-first package data can be returned to the user corresponding to each download request according to the principle of first request first processed, further reducing the user's waiting time.
[0091] The above data processing method is derived by utilizing the unique technical features of the data processing method to achieve the beneficial effect of solving the technical problems raised in the background technology.
[0092] Figure 2 FIG. 1 is a flow chart of a data processing method in one embodiment. It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0093] In one embodiment, Figure 3 As shown, a data processing device is provided, the device comprising:
[0094] The receiving module 100 is used to receive a first request from a target terminal, wherein the first request is a request for downloading target streaming media data;
[0095] The task generation module 200 is used to generate a first task corresponding to the first request, wherein the first task is used to provide the target terminal with a first portion of data in the target streaming media data, and the first portion of data is the first packet of data returned in the process of the target terminal obtaining the target streaming media data;
[0096] A queue saving module 300 is used to set the priority of the first task to a first priority and then save it to the task queue, wherein the first priority is higher than the second priority of the second task, the second task is generated before the first task and is used to provide the terminal with a second portion of data in the streaming media data, and the second portion of data is data returned after the first packet of data in the process of the terminal obtaining the streaming media data;
[0097] The task execution module 400 is used to execute the first task in the task queue.
[0098] In one embodiment, the task generation module 200 specifically includes:
[0099] A reading task generating module, used for generating a first data reading task corresponding to the first request, wherein the first data reading task is used for reading a first part of data in the target streaming media data, and the first task includes the first data reading task;
[0100] The sending task generation module is used to generate a first data sending task when the first data reading task is executed, wherein the first data sending task is used to send the read first part of data to the target terminal, and the first task includes the first data sending task.
[0101] In one embodiment, the second task includes a second data reading task for reading the second portion of data and a second data sending task for sending the second portion of data.
[0102] The queue saving module 300 specifically includes:
[0103] A reading task saving module, used for saving the first data reading task to a data reading task queue, wherein the task queue includes a data reading task queue processed by a data reading thread, and the data reading thread has a higher processing priority for the first data reading task than for the second data reading task;
[0104] The sending task saving module is used to save the first data sending task to the data sending task queue, wherein the task queue includes a data sending task queue processed by a data sending thread, and the data sending thread has a higher processing priority for the first data sending task than for the second data sending task.
[0105] In one embodiment, the reading task saving module specifically includes:
[0106] A first timestamp acquisition module, used for acquiring timestamps in download requests corresponding to the multiple first-packet reading tasks when there are multiple first-packet reading tasks, wherein the multiple first-packet reading tasks include the first data reading task;
[0107] The first sorting and saving module is used to save multiple first-packet reading tasks in order from the earliest to the latest according to the timestamps, starting from the head of the data reading task queue.
[0108] In one embodiment, the reading task generation module specifically includes:
[0109] A first data locating unit, used for determining a first portion of data to be read which is located at the header of target streaming media data and is a first data volume;
[0110] The first reading task generating unit is used to generate a first data reading task for reading a first portion of data.
[0111] The read task generation module also includes:
[0112] A second data locating unit is used to determine a third portion of data to be read which has not been read and is a second data volume in the target streaming media data;
[0113] The second reading task generating unit is used to generate a third data reading task for reading a third portion of data, wherein the second data amount is greater than the first data amount.
[0114] In one embodiment, the reading task saving module is further used to save the third data reading task to the data reading task queue, wherein the processing priority of the data reading thread for the third data reading task is lower than the processing priority of the first data reading task;
[0115] The sending task generating module is further used to generate a third data sending task when the data reading thread completes executing the third data reading task, wherein the third data sending task is used to send the read third part of data to the target terminal;
[0116] The sending task saving module is further used to save the third data sending task to the data sending task queue, wherein the processing priority of the data sending thread for the third data sending task is lower than the processing priority of the first data sending task;
[0117] The second task execution module is used to execute the third data sending task through the data sending thread.
[0118] The task execution module of the present application includes a first task execution module and a second task execution module. The first task execution module is used to execute a data reading task. More specifically, the first task execution module is used to execute a data reading task in a data reading task queue through a data reading thread, such as executing a first data reading task, a third data reading task, and a data reading task corresponding to the second task.
[0119] The second task execution module is used to execute the data sending task. More specifically, the second task execution module is used to execute the data sending task in the data sending task queue through the data sending thread, such as executing the first data sending task, the third data sending task and the data sending task corresponding to the second task.
[0120] In one embodiment, the reading task saving module specifically includes:
[0121] A second timestamp acquisition module is used to acquire timestamps in download requests corresponding to the multiple non-first packet reading tasks when there are multiple non-first packet reading tasks, wherein the multiple non-first packet reading tasks include a third data reading task;
[0122] The second sorting and saving module is used to save multiple non-first packet reading tasks in the order of timestamps from the latest to the earliest, starting from the tail of the data reading task queue.
[0123] Figure 4 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The home node in . Figure 4 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a data processing method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a data processing method. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0124] Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0125] In one embodiment, the data processing device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 4 The computer device shown in the figure is run on the computer device. The memory of the computer device can store various program modules constituting the data processing device, such as: Figure 3 The receiving module 100, the task generating module 200, the saving queue module 300 and the task executing module 400 are shown. The computer program composed of various program modules enables the processor to execute the steps of the data processing method of each embodiment of the present application described in this specification.
[0126] Figure 4 The computer device shown can be Figure 3 The receiving module 100 in the data processing device shown executes the steps to receive the first request of the target terminal, wherein the first request is a download request for the target streaming media data. The computer device can execute the steps to generate the first task corresponding to the first request through the task generation module 200, wherein the first task is used to obtain the first part of the data in the target streaming media data for the target terminal, and the first part of the data is the first packet of data returned for the first time in the process of the target terminal obtaining the target streaming media data. The computer device can execute the steps to set the priority of the first task to the first priority and save it to the task queue through the saving queue module 300, wherein the first priority is higher than the second priority of the second task, and the second task is generated before the first task and is used to obtain the second part of the data in the streaming media data for the terminal, and the second part of the data is the data returned after the first time in the process of the terminal obtaining the streaming media data. The computer device can execute the steps to execute the first task in the task queue through the task execution module 400.
[0127] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data processing method described in any one of the above embodiments when executing the computer program.
[0128] More specifically, the processor performs the following steps when executing the computer program: receiving a first request from a target terminal, wherein the first request is a request to download target streaming media data; generating a first task corresponding to the first request, wherein the first task is used to obtain a first portion of data in the target streaming media data for the target terminal, and the first portion of data is the first packet of data returned for the first time in the process of the target terminal obtaining the target streaming media data; setting the priority of the first task to a first priority and saving it to a task queue, wherein the first priority is higher than the second priority of the second task, and the second task is generated before the first task and is used to obtain the second portion of data in the streaming media data for the terminal, and the second portion of data is the data returned after the first time in the process of the terminal obtaining the streaming media data; executing the first task in the task queue.
[0129] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data processing method described in any of the above embodiments is implemented.
[0130] More specifically, the computer program performs the following steps when executed by the processor: receiving a first request from a target terminal, wherein the first request is a request to download target streaming media data; generating a first task corresponding to the first request, wherein the first task is used to obtain a first portion of data in the target streaming media data for the target terminal, and the first portion of data is the first packet of data returned for the first time in the process of the target terminal obtaining the target streaming media data; setting the priority of the first task to a first priority and saving it to a task queue, wherein the first priority is higher than the second priority of the second task, and the second task is generated before the first task and is used to obtain the second portion of data in the streaming media data for the terminal, and the second portion of data is the data returned after the first time in the process of the terminal obtaining the streaming media data; executing the first task in the task queue.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0132] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0133] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data processing method, characterized in that: The method comprises: Receiving a first request from a target terminal, wherein the first request is a request for downloading target streaming media data; Generate a first task corresponding to the first request, wherein the first task is used to provide the target terminal with a first portion of data in the target streaming media data, and the first portion of data is a first packet of data returned in a process in which the target terminal obtains the target streaming media data; Setting the priority of the first task to a first priority and saving it to a task queue, wherein the first priority is higher than the second priority of a second task, the second task is generated before the first task and is used to provide the terminal with a second portion of data in the streaming media data, and the second portion of data is data returned after the first packet of data in the process of the terminal acquiring the streaming media data; Execute the first task in the task queue; The generating a first task corresponding to the first request includes: Generate a first data reading task corresponding to the first request, wherein the first data reading task is used to read the first part of the data in the target streaming media data, and the first task includes the first data reading task; When the first data reading task is executed, a first data sending task is generated, wherein the first data sending task is used to send the first part of the read data to the target terminal, and the first task includes the first data sending task.
2. The method according to claim 1, characterized in that The second task includes a second data reading task for reading the second part of data and a second data sending task for sending the second part of data, wherein setting the priority of the first task to the first priority and then saving it to the task queue includes: Saving the first data reading task to a data reading task queue, wherein the task queue includes the data reading task queue processed by a data reading thread, and the processing priority of the data reading thread for the first data reading task is higher than the processing priority of the second data reading task; The first data sending task is saved in a data sending task queue, wherein the task queue includes the data sending task queue processed by a data sending thread, and the data sending thread has a higher processing priority for the first data sending task than for the second data sending task.
3. The method according to claim 2, characterized in that The step of saving the first data reading task to a data reading task queue includes: In the case where there are multiple first-packet reading tasks, obtaining timestamps in the download requests corresponding to the multiple first-packet reading tasks, wherein the multiple first-packet reading tasks include the first data reading task; Starting from the head of the data reading task queue, the plurality of first packet reading tasks are saved in order of timestamps from earliest to latest.
4. The method according to claim 1, characterized in that The generating of the first data reading task corresponding to the first request includes: determining the first portion of data to be read which is located at the header of the target streaming media data and has a first data volume; generating the first data reading task for reading the first portion of data; After generating a first data reading task corresponding to the first request, the method further includes: determining a third portion of data to be read in the target streaming media data that has not been read and is a second data volume; generating a third data reading task for reading the third portion of data, wherein the second data volume is greater than the first data volume.
5. The method according to claim 4, characterized in that After generating a third data reading task for reading the third portion of data, the method further includes: Saving the third data reading task to a data reading task queue, wherein the processing priority of the data reading thread for the third data reading task is lower than the processing priority of the data reading thread for the first data reading task; When the data reading thread completes executing the third data reading task, generating a third data sending task, wherein the third data sending task is used to send the read third part of data to the target terminal; saving the third data sending task to a data sending task queue, wherein the processing priority of the data sending thread for the third data sending task is lower than the processing priority of the data sending task for the first data sending task; The third data sending task is executed through the data sending thread.
6. The method according to claim 4, characterized in that The step of saving the third data reading task to a data reading task queue includes: In the case where there are multiple non-first packet reading tasks, obtaining timestamps in the download requests corresponding to the multiple non-first packet reading tasks, wherein the multiple non-first packet reading tasks include the third data reading task; Starting from the tail of the data reading task queue, the plurality of non-first packet reading tasks are saved in order of timestamps from the latest to the earliest.
7. A data processing device, characterized in that: The device comprises: A receiving module, configured to receive a first request from a target terminal, wherein the first request is a request for downloading target streaming media data; A task generation module, used to generate a first task corresponding to the first request, wherein the first task is used to provide the target terminal with a first portion of data in the target streaming media data, and the first portion of data is the first packet of data returned in the process of the target terminal obtaining the target streaming media data; A save queue module, used for setting the priority of the first task to a first priority and then saving it to a task queue, wherein the first priority is higher than the second priority of a second task, the second task is generated before the first task and is used to provide the terminal with a second portion of data in the streaming media data, and the second portion of data is data returned after the first packet of data in the process of the terminal obtaining the streaming media data; A task execution module, used for executing the first task in the task queue; The task generation module specifically includes: A reading task generating module, used for generating a first data reading task corresponding to the first request, wherein the first data reading task is used for reading a first part of data in the target streaming media data, and the first task includes the first data reading task; The sending task generation module is used to generate a first data sending task when the first data reading task is executed, wherein the first data sending task is used to send the read first part of data to the target terminal, and the first task includes the first data sending task.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
