Method, apparatus and computer device for processing media data, and storage medium
By inserting client attribute information into the seed list through hashing and full reporting, and determining the popularity of media data based on media identifiers, the problem of low media data processing efficiency under high concurrency access is solved, achieving efficient media data processing and ensuring the quality of service of seed nodes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-11-12
- Publication Date
- 2026-06-12
AI Technical Summary
Under high concurrency access, existing media data processing methods result in low processing efficiency, and the service quality of seed nodes is difficult to guarantee.
Client attribute information is inserted into the seed node of the seed linked list through hash reporting and full reporting methods. The media data is determined to be popular media data based on the media identifier. Seed node information is stored in a linked list and the target seed node is found in response to seed query requests.
To reduce media data processing time under high concurrency access, improve processing efficiency, and avoid service quality issues caused by the average distribution of seed nodes, thus ensuring the service quality of seed nodes.
Smart Images

Figure CN116132450B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for processing media data. Background Technology
[0002] With the development of computer and internet technologies, media data playback based on P2P (Peer-to-Peer) technology has been applied in various business scenarios, making various types of media data widely known to the public.
[0003] However, in current media data processing methods, as the number of users watching media data increases, under high concurrency access, the server needs to handle a large number of client node requests simultaneously, which leads to low media data processing efficiency. Summary of the Invention
[0004] Therefore, it is necessary to provide a media data processing method, apparatus, computer equipment, and storage medium that can effectively improve the processing efficiency of media data, addressing the aforementioned technical problems.
[0005] A method for processing media data includes: receiving media playback requests carrying media identifiers from various clients; when it is determined from the media identifier that the media data to be played belongs to popular media data, reporting the attribute information corresponding to each client to a target server in a seed service cluster via a hash reporting method, so that the target server inserts the attribute information into a seed node in a seed list based on the media identifier; when it is determined from the media identifier that the media data to be played does not belong to the popular media data, reporting the attribute information corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster inserts the attribute information into a seed node in a seed list based on the media identifier; responding to seed lookup requests sent by other clients, searching for target seed nodes in the seed list based on the media identifier in the seed lookup request; when at least two target seed nodes are found, feeding back the target seed nodes to the other clients, so that the other clients download the media data from the client corresponding to the target seed node.
[0006] A media data processing apparatus, comprising: a receiving module for receiving media playback requests carrying media identifiers sent by various clients; a reporting module for, when determining that the media data to be played belongs to popular media data based on the media identifier, reporting the attribute information corresponding to each client to a target server in a seed service cluster via a hash reporting method, so that the target server inserts the attribute information into a seed node in a seed list based on the media identifier; and when determining that the media data to be played does not belong to popular media data based on the media identifier, reporting the attribute information corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster inserts the attribute information into a seed node in a seed list based on the media identifier; a searching module for, in response to seed search requests sent by other clients, searching for a target seed node in the seed list based on the media identifier in the seed search request; and a feedback module for, when at least two target seed nodes are found, feeding back the target seed nodes to the other clients, so that the other clients download the media data from the client corresponding to the target seed node.
[0007] In one embodiment, the apparatus further includes: an acquisition module, configured to acquire a network address based on the media playback request; and acquire network service provider information based on the network address. The search module is further configured to search for a matching service provider sub-chain within the seed list corresponding to the media identifier, based on the network service provider information. The reporting module is further configured to insert the attribute information into the seed node of the service provider sub-chain.
[0008] In one embodiment, the device further includes: a scanning module, configured to perform node scanning at preset time intervals, starting from the head node of the seed list, until the tail node of the seed list is reached, to obtain the failed nodes in the seed list; a deletion module, configured to delete the failed nodes in the seed list; and an update module, configured to update the connection relationships of various child nodes in the seed list after deleting the failed nodes.
[0009] In one embodiment, the apparatus further includes: a locking processing module, configured to lock each service sub-chain in the seed list; and a deletion module, configured to, when a target thread executes a deletion task, acquire the sub-chain lock of the service sub-chain containing the failed node in the seed list through the target thread, and delete the failed node in the service sub-chain containing the failed node.
[0010] In one embodiment, the locking processing module is further configured to lock the seed nodes of each service sub-chain in the seed linked list; the deletion module is further configured to, when the target thread executes the deletion task, acquire the node lock of the failed node through the target thread and delete the failed node in the seed linked list.
[0011] In one embodiment, the scanning module is further configured to perform node scanning based on a preset upper limit length in the seed list corresponding to the media identifier in the seed query request, and mark the seed node corresponding to the end of the current scan; and continue scanning from the marked seed node as the starting point until all target seed nodes that meet the seed query request are found.
[0012] In one embodiment, the acquisition module is further configured to acquire address translation information or bandwidth information corresponding to the other clients based on the seed query request; the scanning module is further configured to continue scanning starting from the marked seed node; at the end of each scan, among the various child nodes scanned, a matching target seed node is found based on the acquired address translation information; or, a seed node whose bandwidth information reaches a preset bandwidth value is used as a target seed node with priority; wherein, the priority is used to indicate that the target seed node is preferentially fed back to the other clients.
[0013] In one embodiment, the scanning module is further configured to continue scanning from the marked seed node as the starting point; the search module is further configured to, if the network type of the other client is a wireless local area network, at the end of each scan, search for a target seed node with upload and download functions among the various sub-nodes scanned; if the network type of the other client is a mobile communication network, at the end of each scan, search for a target seed node with download functions among the various sub-nodes scanned.
[0014] In one embodiment, the apparatus further includes: a response module, configured to respond to heartbeat requests sent by each client; and a sending module, configured to, when the media data corresponding to the media identifier in the heartbeat request belongs to the popular media data, send the network status corresponding to each client to the target server in the seed service cluster via a hash update method, so that the target server updates the status of the corresponding seed nodes in the seed list based on the network status; and when the media data corresponding to the media identifier in the heartbeat request does not belong to the popular media data, send the network status corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster updates the status of the corresponding seed nodes in the seed list based on the network status.
[0015] In one embodiment, the acquisition module is further configured to acquire the search frequency for the media data to be played; the device further includes: a determination module, configured to determine that the media data to be played belongs to the popular media data when the search frequency is greater than a preset frequency; and to determine that the media data to be played does not belong to the popular media data when the search frequency is less than or equal to the preset frequency.
[0016] A computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: receiving media playback requests carrying media identifiers from various clients; when it is determined that the media data to be played belongs to popular media data based on the media identifier, reporting the attribute information corresponding to each client to a target server in a seed service cluster via a hash reporting method, so that the target server inserts the attribute information into a seed node in a seed list based on the media identifier; when it is determined that the media data to be played does not belong to popular media data based on the media identifier, reporting the attribute information corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster inserts the attribute information into a seed node in a seed list based on the media identifier; responding to seed lookup requests sent by other clients, searching for target seed nodes in the seed list based on the media identifier in the seed lookup request; when at least two target seed nodes are found, feeding back the target seed nodes to the other clients, so that the other clients download the media data from the client corresponding to the target seed node.
[0017] A computer-readable storage medium storing a computer program, which, when executed by a processor, performs the following steps: receiving media playback requests carrying media identifiers from various clients; when it is determined, based on the media identifier, that the media data to be played belongs to popular media data, reporting the attribute information corresponding to each client to a target server in a seed service cluster via a hash reporting method, so that the target server inserts the attribute information into a seed node in a seed list based on the media identifier; when it is determined, based on the media identifier, that the media data to be played does not belong to the popular media data, reporting the attribute information corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster inserts the attribute information into a seed node in a seed list based on the media identifier; responding to seed lookup requests sent by other clients, searching for target seed nodes in the seed list based on the media identifier in the seed lookup request; when at least two target seed nodes are found, feeding back the target seed nodes to the other clients, so that the other clients download the media data from the client corresponding to the target seed node.
[0018] The aforementioned media data processing method, apparatus, computer equipment, and storage medium receive media playback requests carrying media identifiers from various clients. When the media data to be played is determined to be popular media data based on the media identifier, the attribute information corresponding to each client is reported to the target server in the seed service cluster via hash reporting, so that the target server inserts the attribute information into the seed node in the seed list based on the media identifier. When the media data to be played is determined not to be popular media data based on the media identifier, the attribute information corresponding to each client is reported to the seed service cluster via full reporting, so that the seed service cluster inserts the attribute information into the seed node in the seed list based on the media identifier. In response to seed lookup requests sent by other clients, the target seed node is searched from the seed list based on the media identifier in the seed lookup request. When at least two target seed nodes are found, the target seed nodes are fed back to other clients, so that other clients can download the media data from the client corresponding to the target seed node. Because seed node information is stored using a linked list, operations on seed nodes in the linked list ensure that adding a seed node has a constant time complexity. Therefore, even under high concurrency, this significantly reduces media data processing time, effectively improving processing efficiency. Furthermore, determining whether the media data to be played belongs to the popular media categories based on media identifiers effectively avoids service quality issues caused by the even distribution of seed nodes, thus ensuring the quality of seed node service. Attached Figure Description
[0019] Figure 1 This is an application environment diagram of a media data processing method in one embodiment;
[0020] Figure 2 This is a flowchart illustrating a media data processing method in one embodiment;
[0021] Figure 3 This is a flowchart illustrating the steps in one embodiment of reporting attribute information corresponding to each client to the target server in the seed service cluster, so that the target server inserts the attribute information into the seed node in the seed linked list according to the media identifier.
[0022] Figure 4 This is a schematic diagram of a seed linked list structure in one embodiment;
[0023] Figure 5 This is a schematic diagram of a seed list structure for updating the connection relationships of various child nodes in a seed list for deleting invalid nodes, as shown in one embodiment.
[0024] Figure 6 This is a flowchart illustrating the steps in one embodiment of responding to heartbeat requests sent by each client;
[0025] Figure 7 This is a flowchart illustrating the step of determining whether the media data to be played belongs to popular media data in one embodiment;
[0026] Figure 8 A timing flowchart for seed service in one embodiment;
[0027] Figure 9 A structural block diagram of a media data processing apparatus in one embodiment;
[0028] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0030] The media data processing method provided in this application can be applied to, for example... Figure 1 The application environment shown. For example... Figure 1As shown, the application environment includes terminal 102, scheduling server 104, seed service cluster 106, and other terminals 108. The application environment can be an environment where terminal 102, other terminals 108, and scheduling server 104 interact, and where scheduling server 104 interacts with seed service cluster 106. Specifically, terminal 102 communicates with scheduling server 104 via a network, and scheduling server 104 communicates with seed service cluster 106 via a network. The scheduling server 104 can receive media playback requests carrying media identifiers sent by each terminal 102. When the scheduling server 104 determines that the media data to be played is popular media data based on the media identifier, the scheduling server 104 reports the attribute information corresponding to each terminal 102 to the target server in the seed service cluster 106 through hash reporting, so that the target server inserts the attribute information as a seed node into the seed list corresponding to the media identifier. When the scheduling server 104 determines that the media data to be played is not popular media data based on the media identifier, the scheduling server 104 reports the attribute information corresponding to each client 102 to the seed service cluster 106 through full reporting, so that the seed service cluster 106 inserts the attribute information as a seed node into the seed list corresponding to the media identifier. Furthermore, in response to seed lookup requests sent by other terminals 108, the scheduling server 104 searches for target seed nodes in the seed list based on the media identifier in the seed lookup request. When the scheduling server 104 finds at least two target seed nodes, it sends the target seed nodes back to the other terminals 108, enabling the other terminals 108 to download media data from the terminals corresponding to the target seed nodes. The terminals 102 and other terminals 108 can be, but are not limited to, various laptops, smartphones, tablets, desktop computers, portable wearable devices, smart voice interaction devices, smart home appliances, and in-vehicle terminals, etc. These terminals can have clients, such as video clients or browser clients. The scheduling server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, and the seed service cluster 106 can be implemented using a distributed server cluster composed of multiple servers. It is understood that the scheduling server 104 provided in this application embodiment can also be a service node in a blockchain system. The service nodes in the blockchain system form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol that runs on top of the Transmission Control Protocol (TCP).
[0031] In one embodiment, such as Figure 2 As shown, a method for processing media data is provided, which can be applied to... Figure 1 Taking the scheduling server in the example, the following steps are included:
[0032] Step 202: Receive media playback requests carrying media identifiers from each client.
[0033] The client can be an application running on a terminal, corresponding to the server, providing local services to the user, including video clients, browser clients, DNS clients, and game clients. Except for some applications that run only locally, they are generally installed on ordinary client machines and need to cooperate with the server to run. In this embodiment, the client can be a client user in a Peer-to-Peer (P2P) network, meaning each client can be considered a seed node in the peer-to-peer network, allowing other clients to connect and download media data; a Peer is a seed node. P2P stands for Peer-to-Peer download, as opposed to traditional peer-to-server (Peer-to-Server) downloads.
[0034] A media playback request refers to a playback request initiated by a user on different streaming media playback systems based on their own needs, corresponding to the media data to be played. Media playback requests can include at least one of various types, such as live video playback requests, live program playback requests, live shopping playback requests, and enterprise meeting playback requests. Streaming media playback systems can include at least one of various types of streaming media platforms or streaming media applications, such as at least one of P2P streaming media applications and P2P video calling applications.
[0035] A media identifier is the identification information corresponding to the media data to be played, carried in a media playback request. The media identifier is used to uniquely identify the media data.
[0036] Specifically, the scheduling server can receive media playback requests carrying media identifiers from various clients. This scheduling server can be a server for various streaming media playback platforms, or it can be a server for applications such as video conferencing. For example, a user can launch a specific streaming media playback application by clicking on its home screen on a mobile device, or they can directly log in to a specific streaming media platform. Users can then select the appropriate video streaming scenario based on their needs and initiate a media playback request by clicking the play button. For instance, a user can log in to different streaming media playback systems or cloud platforms using an account and password, and initiate a media playback request by clicking the play button.
[0037] In addition, users can also utilize different types of intelligent mobile office platforms to conduct video conferencing and other operations. For example, users can register on different intelligent mobile office platforms by filling in information such as company name, industry type, number of employees, management password, and contact person's name. Administrators can import the company's employee address book in the management backend, and employees will receive an activation SMS. After completing the real name entry and mobile phone number verification, employees can log in and use the system's video conferencing and other functions. Each employee client in the company can send a media playback request carrying a media identifier to the scheduling server. For example, each employee client can send a media playback request carrying the company's live conference identifier to the scheduling server, so that the scheduling server can receive the media playback requests carrying the company's live conference identifier sent by each client.
[0038] Step 204: When it is determined that the media data to be played belongs to popular media data based on the media identifier, the attribute information corresponding to each client is reported to the target server in the seed service cluster through hash reporting, so that the target server inserts the attribute information into the seed node in the seed chain list according to the media identifier.
[0039] Media data, also known as streaming media data, can include various types of data, such as video data, audio data, etc. In this embodiment, the media data can be at least one of P2P streaming media data, P2P video call data, etc.
[0040] Popular media data refers to media data whose number of user queries exceeds the preset number of queries within a preset time period. For example, during a certain period, the popularity of the Spring Festival Gala live broadcast is definitely greater than that of other live broadcasts. In other words, the scheduling server can determine whether the Spring Festival Gala live broadcast belongs to popular media data based on the number of user queries for the Spring Festival Gala live broadcast within the preset time period.
[0041] Hash reporting refers to reporting data sent by the client to the corresponding target machine based on a hash algorithm. Here, "machine" refers to each machine in the seed service cluster; that is, each server in the seed service cluster can be a target machine. For example, each machine in the seed service cluster can be pre-mapped onto a ring using a hash algorithm. Adding a new machine to a distributed seed service cluster using consistent hashing works by using the same hash algorithm as for object storage to map the machine onto the ring. Typically, the hash calculation for a machine uses its IP address, and then calculates clockwise, storing all objects on the machine closest to it.
[0042] Attribute information refers to the attribute information corresponding to each client. Attribute information may include at least one of the following: client IP address, client port information, client bandwidth information, client NAT (Network Address Translation) information, etc. It should be noted that the client attribute information, network status, and user information stored in each node involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0043] A seed service cluster refers to a P2P (Peer-to-Peer) server cluster. A P2P server cluster can provide different seed node information so that clients can download media data from the clients corresponding to various child nodes.
[0044] The target server refers to the target machine in the seed service cluster. For example, if the seed service cluster includes three machines A1, A2 and A3, then the target server can be server A1 and server A2 in the seed service cluster.
[0045] A seed list is a linked list that stores seed node information. The seed list can be created based on media identifiers, meaning different media identifiers correspond to different seed lists. For example, the seed list for live channel A is called seed list A, and the seed list for live channel B is called seed list B. Furthermore, the seed list can be of various types, such as at least one of doubly linked lists and singly linked lists. Since linked lists are more suitable for storing linear node information, a doubly linked list can be used as the seed list to store different seed node information in this embodiment.
[0046] Seed nodes refer to the information of each seed node contained in the seed linked list. For example, the initialized seed linked list can contain multiple seed nodes. Each initialized seed node may not store any seed node information, so each initialized seed node may be an empty node.
[0047] Specifically, after the scheduling server receives media playback requests carrying media identifiers from each client, when the scheduling server determines that the media data to be played belongs to popular media data based on the media identifier, the scheduling server reports the attribute information corresponding to each client to the target server in the seed service cluster through a hash reporting method, so that the target server inserts the attribute information into the seed node in the seed linked list corresponding to the media identifier that it maintains.
[0048] For example, after receiving a media playback request carrying media identifier A1 from client A, the scheduling server can use media identifier A1 to query the number of times the media data to be played has been queried within a preset time period, and determine whether the media data to be played belongs to popular media data based on the number of queries. For example, the scheduling server can determine whether the number of queries for the media data to be played is greater than a preset number of queries; if it is greater than the preset number of queries, the scheduling server determines that the media data to be played belongs to popular media data.
[0049] Furthermore, when the scheduling server determines that the media data to be played belongs to popular media data based on media identifier A1, the scheduling server can report the attribute information A corresponding to client A to the target server A in the seed service cluster through hash reporting. This allows the target server A to insert the attribute information A into the seed node in the seed linked list corresponding to media identifier A1. Specifically, the target server A is determined by the scheduling server from a preset hash table based on the client's identifier information A. The scheduling server then routes the attribute information A corresponding to client A to the corresponding storage machine, i.e., server A, so that server A can receive the request from client A, while other servers in the seed service cluster will not receive the request from client A.
[0050] Step 206: When it is determined that the media data to be played does not belong to popular media data based on the media identifier, the attribute information corresponding to each client is reported to the seed service cluster through the full reporting method, so that the seed service cluster inserts the attribute information into the seed node in the seed chain list according to the media identifier.
[0051] The full-data reporting method refers to reporting the data sent by the client to all machines in the full data reporting table at once. Here, "machine" refers to each machine in the seed server cluster, i.e., each server in the seed server cluster. For example, the scheduling server reports the data sent by the client to all servers in the seed server cluster at once.
[0052] Specifically, after the scheduling server receives media playback requests carrying media identifiers from each client, when the scheduling server determines that the media data to be played is not popular media data based on the media identifier, the scheduling server reports the attribute information corresponding to each client to the seed service cluster through a full reporting method, so that each server in the seed service cluster inserts the attribute information into the seed node in the seed linked list corresponding to the media identifier based on the media identifier.
[0053] For example, after receiving a media playback request carrying media identifier B1 from client B, the scheduling server can use media identifier B1 to query the number of queries for the media data to be played within a preset time period, and determine whether the media data to be played belongs to popular media data based on the number of queries. For example, the scheduling server can determine whether the number of queries for the media data to be played is greater than a preset number of queries; if it is less than or equal to the preset number of queries, the scheduling server determines that the media data to be played does not belong to popular media data.
[0054] Furthermore, when the scheduling server determines that the media data to be played does not belong to popular media data based on the media identifier B1, the scheduling server can report the attribute information B corresponding to client B to the seed service cluster through a full reporting method. This allows each server in the seed service cluster to insert the attribute information B into the seed node in the seed linked list corresponding to the media identifier B1 that it maintains, based on the media identifier B1.
[0055] Step 208: In response to seed query requests sent by other clients, search for the target seed node from the seed list based on the media identifier in the seed query request.
[0056] In this context, "other clients" refers to clients distinct from those sending media playback requests. The terms "other clients" and "client" are used only to differentiate one client from another. For example, without departing from the scope of this application, the first client may be referred to as the second client, and similarly, the second client may be referred to as the first client. Both the first client and the second client are clients, but they are not the same client.
[0057] A seed query request is a request sent by a client to query seed nodes. The request may carry attribute information of the target seed node, such as at least one of the following: NAT information, bandwidth information, and network type information. The target seed node is the seed node that matches the seed query request.
[0058] Specifically, after receiving media playback requests carrying media identifiers from various clients, the scheduling server responds to seed lookup requests sent by other clients by searching for target seed nodes in the seed list based on the media identifier in the seed lookup request. That is, the scheduling server can search for at least two target seed nodes matching the seed lookup request from the seed list corresponding to that media identifier.
[0059] For example, assuming that the NAT information corresponding to client A and client B is S05, after the scheduling server receives the media playback request carrying the media identifier M sent by client A and client B, the scheduling server inserts the attribute information of client A into the seed node ISP1 in the seed list corresponding to the media identifier M; and the scheduling server inserts the attribute information of client B into the seed node ISP2 in the seed list corresponding to the media identifier M.
[0060] Furthermore, in response to a seed query request C sent by another client C, assuming that the target media identifier carried in the seed query request C is M, and the NAT information of the target seed node carried in the seed query request C is S05, the scheduling server can search for the target seed node information that matches the NAT information S05 in the seed list corresponding to the media identifier M in the seed query request C. Since the NAT information corresponding to clients A and B is S05, the scheduling server can search for the target seed node information ISP1 and ISP2 that match the NAT information S05 in the seed list corresponding to the media identifier M. The scheduling server then uses seed nodes ISP1 and ISP2 as the two target seed nodes that meet the seed query request.
[0061] Step 210: When at least two target seed nodes are found, the target seed nodes are fed back to other clients so that the other clients can download media data from the client corresponding to the target seed node.
[0062] The client corresponding to the target seed node refers to the client whose information corresponds to the target seed node. For example, the client corresponding to the target seed node ISP1 is client A.
[0063] Specifically, after the scheduling server responds to the seed query request sent by other clients and searches for the target seed node in the seed list based on the media identifier in the seed query request, when the scheduling server finds at least two target seed nodes, the scheduling server can send the found target seed nodes back to other clients so that other clients can download media data from the client corresponding to the target seed node.
[0064] For example, when a seed query request C is sent by another client C, assuming the target media identifier M and the NAT information S05 of the target seed node carried in the seed query request C are both present, the scheduling server can search for target seed node information matching NAT information S05 in the seed list corresponding to media identifier M. Since the NAT information corresponding to clients A and B is also S05, the scheduling server can search for target seed node information ISP1 and ISP2 that match NAT information S05 in the seed list corresponding to media identifier M. The scheduling server then uses seed nodes ISP1 and ISP2 as the two target seed nodes that match the seed query request. The scheduling server can then send the found target seed nodes ISP1 and ISP2 back to client C, so that client C can download media data from client A corresponding to target seed node ISP1 and client B corresponding to target seed node ISP2.
[0065] Furthermore, after the scheduling server returns the found target seed nodes ISP1 and ISP2 to client C, client C can select one of the clients corresponding to the two target seed nodes to download media data based on its own business needs. It can be understood that there are no specific limitations on the method for further selecting the target client from the target seed nodes to download media data.
[0066] In the above media data processing method, the process involves receiving media playback requests carrying media identifiers from various clients; when the media data to be played is determined to be popular media data based on the media identifier, the attribute information corresponding to each client is reported to the target server in the seed service cluster via hash reporting, so that the target server inserts the attribute information into the seed node in the seed list based on the media identifier; when the media data to be played is determined not to be popular media data based on the media identifier, the attribute information corresponding to each client is reported to the seed service cluster via full reporting, so that the seed service cluster inserts the attribute information into the seed node in the seed list based on the media identifier; responding to seed lookup requests sent by other clients, the target seed node is searched from the seed list based on the media identifier in the seed lookup request; when at least two target seed nodes are found, the target seed nodes are fed back to other clients, so that other clients can download the media data from the client corresponding to the target seed node. Because seed node information is stored using a linked list, operations on seed nodes in the linked list ensure that adding a seed node has a constant time complexity. Therefore, even under high concurrency, this significantly reduces media data processing time, effectively improving processing efficiency. Furthermore, determining whether the media data to be played belongs to the popular media categories based on media identifiers effectively avoids service quality issues caused by the even distribution of seed nodes, thus ensuring the quality of seed node service.
[0067] In one embodiment, such as Figure 3 As shown, the steps of reporting the attribute information corresponding to each client to the target server in the seed service cluster, so that the target server inserts the attribute information into the seed node in the seed linked list according to the media identifier, include:
[0068] Step 302: Obtain the network address based on the media playback request.
[0069] Step 304: Obtain network service provider information based on network address.
[0070] Step 306: In the seed chain corresponding to the media identifier, find the matching service provider sub-chain based on the network service provider information.
[0071] Step 308: Insert the attribute information into the seed node of the service subchain.
[0072] The network address refers to the network address corresponding to the client that sent the media playback request. The network address can include the client's IP (Internet Protocol) address. The network service provider information refers to the information of the Internet Service Provider (ISP), such as China Telecom, China Mobile, and China Unicom.
[0073] A service provider subchain refers to a subchain in the seed chain list. The seed chain list can include multiple service provider subchains. For example, the seed chain list can include three service provider subchains, namely ISP1 subchain, ISP2 subchain and ISP3 subchain.
[0074] Specifically, when the scheduling server determines that the media data to be played belongs to popular media data based on the media identifier, the scheduling server can report the attribute information corresponding to each client to the target server in the seed service cluster through hash reporting. The target server can then obtain the network address based on the media playback request and obtain the network service provider information based on the network address. Furthermore, the target server can search for a matching service provider subchain in the seed list corresponding to the media identifier based on the network service provider information, and insert the attribute information corresponding to each client reported by the scheduling server into the seed node of the found service provider subchain.
[0075] For example, such as Figure 4 The diagram shown is a schematic of the seed linked list structure. Figure 4 In this context, `fileid` represents the media identifier, which is a unique identifier for the media data that the client is watching. Each media identifier's linked list can contain multiple sub-links, for example: Figure 4 In the ISP1, it can represent the mobile operator subchain, ISP2 can represent the China Unicom operator subchain, ISP3 can represent the China Telecom operator subchain and the unknown operator subchain. Figure 4 In this context, uin1, uin2, uin3, and NULL all represent seed nodes, with NULL indicating an unknown node. Each seed node can store attribute information for different clients, for example... Figure 4 The information stored in node uin2 in the ISP3 subchain includes: fileid, client_ip, client_port, nat, bandwidth, and uin_ptr. Figure 4 In this context, fileid represents the media identifier, client_ip represents the client's IP address, client_port represents the client's port information, nat represents the client's NAT type, bandwidth represents the client's bandwidth information, and uin_ptr represents pointer information.
[0076] When the scheduling server receives a media playback request A from client A carrying media identifier A1, and determines that the media data to be played belongs to popular media data based on the media identifier A1, the scheduling server can report the attribute information corresponding to each client A to the target server A in the seed service cluster through hash reporting. Then, the target server A can obtain the IP address A01 corresponding to client A based on the media playback request A, and obtain the network service provider information as ISP102 based on the IP address A01.
[0077] Furthermore, assuming the service provider information is ISP102 representing China Unicom Guangdong and ISP1 representing China Unicom, then target server A can find the matching service provider sub-chain ISP1 in the seed list M corresponding to media identifier A1, based on the network service provider information ISP102. Target server A then inserts the attribute information A corresponding to client A reported by the scheduling server into the seed node ISP102 of the service provider sub-chain ISP1 in its own maintained seed list M. This solves the problem of low media data processing efficiency caused by the inability to scale on a single machine under high client concurrency. It also allows determining whether media data belongs to popular media based on the media identifier. If it is popular media, a hot / cold traffic splitting strategy is used to route the seed node information to the designated target server, thus preventing the problem of evenly distributing seeds from affecting service quality. This effectively ensures the number of returned seed nodes and the quality of seed node services.
[0078] In one embodiment, the step of reporting the attribute information corresponding to each client to the seed service cluster, so that the seed service cluster inserts the attribute information into the seed node in the seed linked list according to the media identifier, includes:
[0079] Obtain the network address based on the media playback request;
[0080] Obtain network service provider information based on network address;
[0081] Within the seed chain corresponding to the media identifier, search for the matching service provider sub-chain based on the network service provider information;
[0082] Insert the attribute information into the seed node of the service provider's subchain.
[0083] Specifically, when the scheduling server determines, based on the media identifier, that the media data to be played does not belong to popular media data, the scheduling server can report the attribute information corresponding to each client to the seed service cluster through a full reporting method. Each server in the seed service cluster can then obtain the network address based on the media playback request and retrieve the network service provider information based on the network address. Furthermore, each server in the seed service cluster can search for a matching service provider sub-chain within the seed list corresponding to the media identifier, based on the network service provider information, and insert the attribute information corresponding to each client reported by the scheduling server into the seed node of the found service provider sub-chain.
[0084] For example, when the scheduling server receives a media playback request B from client B carrying a media identifier B1, and the scheduling server determines based on the media identifier B1 that the media data to be played is not popular media data, the scheduling server can report the attribute information corresponding to each client to the seed service cluster through a full reporting method. Each server in the seed service cluster can obtain the IP address B01 corresponding to client B based on the media playback request B, and obtain the network service provider information as ISP302 based on the IP address B01.
[0085] Furthermore, assuming the service provider information is ISP302 representing China Mobile Guangdong and ISP3 representing China Mobile, each server in the seed service cluster can find the matching service provider sub-chain ISP3 in the seed list M corresponding to media identifier B1, based on the network service provider information ISP302. Each server in the seed service cluster then inserts the attribute information B corresponding to client B reported by the scheduling server into the seed node ISP302 of the service provider sub-chain ISP3 in its own maintained seed list M. This solves the problem of low media data processing efficiency caused by the inability to scale with a single machine under high client concurrency. It also allows determining whether media data belongs to popular media based on the media identifier. If it is not popular media, a hot / cold traffic splitting strategy is used to report all seed node information to the seed service cluster, effectively ensuring the number of returned seed nodes and the quality of seed node services.
[0086] In one embodiment, the method further includes the step of updating the connection relationships of various child nodes in the seed list where the failed node is deleted, specifically including:
[0087] According to the preset time interval, the node scan starts from the head node of the seed list and continues until the tail node of the seed list is reached, thus obtaining the invalid nodes in the seed list.
[0088] Remove invalid nodes from the seed list;
[0089] Update the connection relationships of various child nodes in the seed list after deleting the invalid node.
[0090] In this context, the head node of the seed linked list refers to the first node in each sub-link of the seed linked list. For example, ... Figure 4 The head nodes of the three sub-chains shown are ISP1, ISP2, and ISP3, respectively.
[0091] A failed node is a seed node in the seed list that has expired. An expired seed node is one that has gone out of service and cannot be connected to. For example, if client A's attribute information is stored in the ISP102 node in the seed list corresponding to media identifier M, then when client A logs out, the ISP102 node in the seed list corresponding to media identifier M becomes a failed node.
[0092] Specifically, each server in the seed service cluster can scan nodes at preset time intervals, starting from the head node of the seed list and continuing until the tail node is reached, thus identifying and deleting invalid nodes from the seed list. Simultaneously, each server in the seed service cluster can update the connection relationships of various child nodes in the seed list after deleting invalid nodes.
[0093] For example, assuming the preset time interval is 5 minutes, each server in the seed service cluster can perform a node scan every 5 minutes according to the preset time interval. Figure 4 As shown, when server A performs node scanning in the seed service cluster, server A uses... Figure 4 Starting with the head node ISP1 in the seed list shown, a node scan is performed until the tail node null is encountered. This process identifies the invalid nodes in the seed list. Assume server A starts from... Figure 4 The node scan starts from the head node ISP1 in the seed linked list shown and continues until the tail node null is reached. The scan reveals the invalid node is node uin2 in the sub-link ISP1. Server A can then delete the invalid node uin2 from the seed linked list and update the connection relationships of all child nodes. That is, after deleting the invalid node uin2, server A will... Figure 5 The diagram shows the structure of a seed linked list used to update the connection relationships of various child nodes after deleting a failed node. Server A can connect the node before the failed node uin2 (uin1) to the node after the failed node uin2 (uin3), thus obtaining the updated connection relationship of various child nodes as uin1→uin3, while the original connection relationship was uin1→uin2→uin3.
[0094] In this embodiment, since seed node information is stored in a linked list, the time complexity of deleting a seed node is constant when deleting seed node information in the seed linked list. Therefore, even under high concurrency access, the processing time of media data can be greatly shortened, thereby effectively improving the processing efficiency of media data.
[0095] In one embodiment, the method further includes a step of locking each service sub-chain in the seed list, specifically including:
[0096] Locking is applied to each service sub-chain in the seed list;
[0097] Remove invalid nodes from the seed list, including:
[0098] When the target thread executes the deletion task, it acquires the subchain lock of the service subchain containing the failed node in the seed linked list, and deletes the failed node in the service subchain containing the failed node.
[0099] Locking refers to the operation of locking each service sub-chain. When a method or a code block is locked, at most one thread can execute that code at any given time. Locking can employ various methods. For example, based on the functionalities of the Java language, locking each service sub-chain in the seed list can be achieved using either the `synchronized` keyword or the `Lock` function.
[0100] Subchain locks are the processing logic used to lock each service subchain in the seed chain. For example, after locking a service subchain using the Lock function, the Lock function can ensure that when one thread is in the critical section of the code, another thread cannot enter the critical section. If other threads attempt to enter the locked code, they will be in a waiting state (i.e., blocked) until the object is released.
[0101] Specifically, when each seed server in the seed service cluster deletes an invalid node from the seed linked list, the seed server needs to lock each sub-chain of the service provider in the seed linked list. Since the seed linked list is broken during the deletion operation, deletion is unsafe in a multi-threaded environment; therefore, locking is required during deletion. It is understood that the locking operations in this embodiment include, but are not limited to, synchronized and Lock functions, and other locking methods are also possible.
[0102] When a seed server in the seed service cluster deletes a failed node from the seed list (i.e., when the target thread executes a deletion task), the seed server can acquire a sub-chain lock of the service sub-chain containing the failed node through the target thread. If acquiring the sub-chain lock is successful, the seed server can perform the deletion operation; that is, the seed server can delete the failed node from the service sub-chain containing the failed node. If acquiring the sub-chain lock fails, the seed server cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the sub-chain lock of the service sub-chain containing the failed node is released. In other words, after the seed server locks each service sub-chain in the seed list, when target thread A executes the deletion task, it needs to check if other threads are running the lock object of this service sub-chain containing the failed node. If other threads are running this lock object, target thread A cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the lock object of this service sub-chain containing the failed node is released.
[0103] For example, assuming the service sub-chain ISP1 in seed list A is already locked, when each seed server in the seed service cluster deletes a failed node from the seed list, the seed server can acquire the lock of the service sub-chain ISP1 containing the failed node by calling the Lock function. If the seed server successfully acquires the lock of the service sub-chain ISP1 containing the failed node, it can delete the failed node from the service sub-chain ISP1. If the seed server fails to acquire the lock of the service sub-chain ISP1, it cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the lock of the service sub-chain ISP1 is released.
[0104] In this embodiment, since the seed linked list is broken during the deletion operation, deletion is an unsafe operation in a multi-threaded environment. Therefore, locking is required during deletion. This significantly reduces the processing time of media data under high concurrency, effectively improving processing efficiency while ensuring the safety of the deletion operation.
[0105] In one embodiment, the method further includes a step of locking the seed nodes of each service sub-chain in the seed linked list, specifically including:
[0106] Lock the seed nodes of each service subchain in the seed list;
[0107] Remove invalid nodes from the seed list, including:
[0108] When the target thread executes the deletion task, it acquires the lock object of the failed node and deletes the failed node from the seed linked list.
[0109] Among them, the node lock is the processing logic used to lock the seed nodes in the sub-chains of each service provider in the seed linked list.
[0110] Specifically, when each seed server in the seed service cluster deletes an invalid node from the seed list, the seed server needs to lock the seed nodes of each service sub-chain in the seed list.
[0111] When a seed server in the seed service cluster deletes a failed node from the seed list (i.e., when the target thread executes a deletion task), the seed server can acquire the node lock of the failed node through the target thread. If acquiring the node lock is successful, the seed server can perform the deletion operation, meaning it can delete the failed node from the seed list. If acquiring the node lock fails, the seed server cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the node lock of the failed node is released. In other words, after the seed server locks the seed nodes of each service sub-chain in the seed list, when the target thread A executes the deletion task, it needs to check if other threads are running the lock object of this failed node. If other threads are running this lock object, the target thread A cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the lock object of the failed node is released.
[0112] For example, assuming the seed node ISP102 in the service subchain ISP1 of seed list A is locked, when each seed server in the seed service cluster deletes a failed node from the seed list, the seed server can acquire the lock of seed node ISP102 by calling the Lock function. If the seed server successfully acquires the lock, it can delete the failed node ISP102 from the seed list. If the seed server fails to acquire the lock, it cannot perform the deletion operation and will remain in a waiting state (i.e., blocked) until the lock of seed node ISP102 is released. This effectively improves the processing efficiency of media data while ensuring the security of deletion operations. Furthermore, by reducing the granularity of locks in the seed list structure from the service subchain to the seed node level—meaning that when modifying a seed node, only the nodes before and after the node to be modified need to be locked—the concurrency of the service can be further increased, effectively improving the processing efficiency of media data.
[0113] In one embodiment, the step of searching for the target seed node from the seed list based on the media identifier in the seed query request includes:
[0114] In the seed list corresponding to the media identifier in the seed query request, the nodes are scanned based on the preset upper limit length of the scan, and the corresponding seed nodes are marked when the current scan ends.
[0115] The scanning continues from the marked seed node until all target seed nodes matching the seed query request are found.
[0116] The preset scan upper limit length refers to the maximum scan length set in advance for each scan. For example, the preset scan upper limit length can be 6553 bytes, or the preset scan upper limit length can be at least one of 6553 strings.
[0117] Specifically, in response to seed lookup requests sent by other clients, the scheduling server can search for the target seed node from the seed list based on the media identifier in the seed lookup request. That is, based on the media identifier in the seed lookup request, the scheduling server scans the corresponding seed list within the seed list according to a preset upper limit for the scan length, and marks the seed node corresponding to the end of this scan. When the scheduling server scans this list again, it continues scanning from the marked seed node as the starting point until all target seed nodes matching the seed lookup request are found.
[0118] For example, assuming the preset scan limit is 6553 bytes, when the scheduling server responds to a seed query request C sent by another client C, it can search for at least two target seed nodes from the seed list M based on the media identifier M in the seed query request C. That is, the scheduling server can scan the corresponding seed list M within the preset scan limit of 6553 bytes, based on the media identifier M in the seed query request C. When the scheduling server finishes this scan, it marks the corresponding seed node ISP206. When the scheduling server scans this list (seed list M) again, it continues scanning from the marked seed node ISP206 as the starting point until all target seed nodes matching the seed query request C are found. It is understandable that when the scheduling server finishes this scan, it can mark the corresponding seed node ISP206 as the termination node of this scan. When scanning this linked list again, the scheduling server can continue to perform seed lookup scans on the seed node ISP206 marked as the termination node. In this way, all seed nodes in the seed linked list are returned to the client evenly, and the quality of the nodes returned based on the seed lookup request is also effectively guaranteed.
[0119] In one embodiment, the various child nodes of the seed list include address translation information and bandwidth information. The method further includes a step of obtaining address translation information or bandwidth information corresponding to other clients based on the seed query request, specifically including:
[0120] Based on the seed query request, obtain the address translation information or bandwidth information corresponding to other clients;
[0121] Starting from the marked seed node, continue scanning until all target seed nodes matching the seed query request are found, including:
[0122] Continue scanning from the marked seed node;
[0123] At the end of each scan, among the various child nodes scanned, a matching target seed node is found based on the acquired address translation information; or, seed nodes whose bandwidth information reaches a preset bandwidth value are designated as target seed nodes with priority; where priority is used to indicate that the target seed node is preferentially fed back to other clients.
[0124] Address translation information refers to Network Address Translation (NAT), also known as network masking or IP masquerading. It's a technique that rewrites the source or destination IP address of IP packets as they pass through routers or firewalls. Address translation information can include different types of NAT, such as Full Cone NAT, Address-Restricted Cone NAT, Port-Restricted Cone NAT, and Symmetric NAT.
[0125] Bandwidth information refers to network bandwidth, short for Bandwidth. Bandwidth refers to the amount of data that can pass through a link per unit of time. Network bandwidth is the amount of data that can be transmitted per unit of time (usually 1 second), usually expressed in bps, which is the number of bits that can be transmitted per second. Bandwidth has many applications; it can be used to identify the data transmission capacity of signal transmission and the amount of data passing through a link per unit of time.
[0126] Specifically, in response to seeding requests sent by other clients, the scheduling server can obtain address translation information or bandwidth information corresponding to those clients based on the seeding requests. In addition to carrying the media identifier, each seeding request can also carry different attribute information corresponding to different clients. This client-specific attribute information can include various types of attribute information, such as address translation information and bandwidth information.
[0127] Furthermore, the scheduling server can scan the seed list corresponding to the media identifier in the seed query request, based on a preset upper limit for the scan length, and mark the seed nodes corresponding to the end of the current scan. When the scheduling server scans the list again, it continues scanning from the marked seed nodes. At the end of each scan, the scheduling server searches for a matching target seed node among the scanned child nodes based on the acquired address translation information. Alternatively, the scheduling server can prioritize seed nodes whose bandwidth information reaches a preset bandwidth value. The priority indicates that the target seed node is preferentially reported to other clients.
[0128] For example, suppose the address translation information for other client C is symmetric NAT and the bandwidth information is 10 Mbit / s. When the scheduling server responds to the seed query request C sent by other client C, the scheduling server can obtain the address translation information for other client C as symmetric NAT and the bandwidth information as 10 Mbit / s based on the seed query request C.
[0129] Furthermore, the scheduling server can scan nodes in the seed list M corresponding to the media identifier M in the seed request C, based on a preset upper limit of the scan length. When the scheduling server finishes the current scan, it marks the corresponding seed node ISP206. When the scheduling server scans the same list (seed list M) again, it continues scanning from the marked seed node ISP206. At the end of each scan, the scheduling server searches for a matching target seed node among the scanned child nodes based on the obtained address translation information (symmetric NAT). That is, the scheduling server searches for a target seed node in seed list M that matches the symmetric NAT. Assuming that the NAT type corresponding to seed node ISP305 in seed list M is also symmetric NAT, the scheduling server can find the target seed node ISP305 in seed list M that matches the symmetric NAT.
[0130] Simultaneously, at the end of each scan, the scheduling server searches for a matching target seed node among the scanned child nodes, based on the acquired bandwidth information of 10 Mbit / s. The seed node whose bandwidth information reaches the preset bandwidth value is designated as the priority target seed node. Assuming that the bandwidth information corresponding to seed node ISP102 in seed list M is 12 Mbit / s, and the bandwidth information corresponding to seed node ISP103 in seed list M is 9 Mbit / s, since 12 Mbit / s > 10 Mbit / s, the scheduling server designates seed node ISP102, whose bandwidth information reaches the preset bandwidth value, as the priority target seed node, thus prioritizing its feedback to other clients C. If, at some point, the scheduling server detects that target seed node ISP102 has expired, it can use the scanned seed node ISP103 as the target seed node to feed back to other clients C. This effectively avoids service quality issues caused by the average distribution of seed nodes, effectively ensures the number of nodes returned based on the seed query request, and also effectively guarantees the quality of seed node service.
[0131] In one embodiment, the attribute information further includes the network type. The step of continuing the scan from the marked seed node as the starting point until all target seed nodes matching the seeding request are found includes:
[0132] Continue scanning from the marked seed node;
[0133] If the network type of other clients is wireless LAN, at the end of each scan, find the target seed node with upload and download functions among the various child nodes scanned;
[0134] If the network type of other clients is a mobile communication network, at the end of each scan, search for the target seed node with download function among the various sub-nodes scanned.
[0135] Network type refers to the classification of networks from different perspectives, resulting in different network categories. Each network name has a specific meaning, and combinations of names or names with parameters further reveal the network's characteristics. For example, Gigabit Ethernet indicates a bus-type network with a transmission rate of up to gigabits per second. Network types can also be classified according to geographical location, such as Local Area Networks (LANs) and Metropolitan Area Networks (MANs); or according to transmission medium, such as wired networks, fiber optic networks, and wireless networks. Wireless LANs can be Wi-Fi, and mobile communication networks can be 3G, 4G, and 5G, etc.
[0136] Specifically, in response to seeding requests sent by other clients, the scheduling server can obtain the network type corresponding to each client based on the seeding request. In addition to carrying the media identifier, each seeding request can also carry different attribute information corresponding to different clients. This client-specific attribute information can include various types of attribute information, such as address translation information, bandwidth information, and network type.
[0137] Furthermore, the scheduling server can scan the corresponding seed list based on the media identifier in the seed query request, according to a preset upper limit for the scanning length, and mark the seed node corresponding to the end of the current scan. When the scheduling server scans this list again, it continues scanning from the marked seed node. If the network type of other clients is wireless LAN, at the end of each scan, the scheduling server searches for the target seed node with upload and download functions among the various sub-nodes scanned. If the network type of other clients is mobile communication network, at the end of each scan, the scheduling server searches for the target seed node with download function among the various sub-nodes scanned.
[0138] For example, assuming that the network type corresponding to other client C is a 4G mobile communication network, the scheduling server responds to the seed query request C sent by other client C, and the scheduling server can obtain the information that the network type corresponding to other client C is a 4G mobile communication network based on the seed query request C.
[0139] Furthermore, the scheduling server can scan nodes in the seed list M corresponding to the media identifier M in the seed request C, based on a preset upper limit. When the scheduling server finishes this scan, it marks the corresponding seed node ISP206. When the scheduling server scans the same list (seed list M) again, it continues scanning from the marked seed node ISP206. Since the network type of other clients C is a 4G mobile communication network, at the end of each scan, the scheduling server searches for target seed nodes with download functionality among the scanned sub-nodes. That is, the scheduling server filters the online seed nodes in seed list M to obtain at least two target seed nodes that only support download. It can be understood that due to the limited traffic of mobile communication networks, when the client's network type is a mobile communication network, it only supports connecting to target seed nodes with download functionality, and does not support connecting to seed nodes with upload functionality. When the client's network type is a wireless LAN, it can support connecting to seed nodes with both upload and download functionality. This effectively avoids service quality issues caused by the average distribution of seed nodes, effectively guarantees the number of nodes returned based on seed query requests, and also effectively guarantees the quality of seed node services.
[0140] In one embodiment, such as Figure 6 As shown, after receiving media playback requests carrying media identifiers from each client, the method further includes:
[0141] Step 602, responding to heartbeat requests sent by each client;
[0142] Step 604: When the media data corresponding to the media identifier in the heartbeat request belongs to popular media data, the network status of each client is sent to the target server in the seed service cluster through hash update, so that the target server updates the status of the corresponding seed node in the seed chain based on the network status.
[0143] Step 606: When the media data corresponding to the media identifier in the heartbeat request does not belong to popular media data, the network status of each client is sent to the seed service cluster through full reporting, so that the seed service cluster can update the status of the corresponding seed nodes in the seed chain based on the network status.
[0144] Among them, the heartbeat request is used to update the client's network status.
[0145] Specifically, since the network of user nodes can change at any time, the client and the scheduling server update their latest network status when sending heartbeats. In response to heartbeat requests from each client, the scheduling server can query the number of times the media data corresponding to that media identifier has been queried within a preset time period, based on the media identifier in the heartbeat request, and determine whether the media data corresponding to the media identifier in the heartbeat request belongs to popular media data based on this query count.
[0146] When the scheduling server determines that the media data corresponding to the media identifier in the heartbeat request belongs to popular media data, the scheduling server can send the network status of each client to the target server in the seed service cluster through hash update, so that the target server can update the status of the corresponding seed node in the seed list according to the network status; where the aforementioned seed list refers to the seed list in the target server.
[0147] When the scheduling server determines that the media data corresponding to the media identifier in the heartbeat request does not belong to popular media data, the scheduling server can send the network status of each client to the seed service cluster through a full report method. This allows the seed service cluster to update the status of the corresponding seed nodes in the seed list based on the network status. The aforementioned seed list refers to the seed list within each server of the seed service cluster.
[0148] In this embodiment, since seed node information is stored in a linked list, the time complexity of updating a seed node is constant when updating the seed node information in the seed linked list. Therefore, even under high concurrency access, the processing time of media data can be greatly shortened, thereby effectively improving the processing efficiency of media data.
[0149] In one embodiment, such as Figure 7 As shown, after receiving media playback requests carrying media identifiers from each client, the method further includes:
[0150] Step 702: Obtain the frequency of seeding for the media data to be played;
[0151] Step 704: When the search frequency is greater than the preset frequency, determine that the media data to be played belongs to popular media data;
[0152] Step 706: When the search frequency is less than or equal to the preset frequency, determine that the media data to be played does not belong to popular media data.
[0153] Among them, the frequency of seeding refers to the number of times seeding is searched within a preset time period, that is, the seeding volume. The seeding volume can reflect the number of times the media data corresponding to the media identifier is queried by users.
[0154] Specifically, after receiving media playback requests carrying media identifiers from each client, the scheduling server can obtain the search frequency for the media data to be played based on the media identifiers. When the search frequency is greater than a preset frequency, the scheduling server determines that the media data to be played belongs to popular media data; when the search frequency is less than or equal to the preset frequency, the scheduling server determines that the media data to be played does not belong to popular media data.
[0155] For example, assuming a preset frequency of 100,000, after the scheduling server receives media playback requests carrying media identifier A1 from each client A, the scheduling server can determine the seeding frequency of the media data to be played as 90,000 based on the media identifier A1. Since 90,000 < 100,000, the scheduling server determines that the media data to be played is not popular media data. This solves the problem of low media data processing efficiency caused by the inability to scale on a single machine under high client concurrency. It also allows for determining whether media data belongs to popular media based on the media identifier, and uses different reporting methods for seed node information, i.e., a hot / cold splitting strategy, routing seed node information to designated target servers. This avoids the problem of evenly distributing seeds, which might affect service quality, thus effectively ensuring the number of seed nodes returned and the quality of seed node service.
[0156] This application also provides an application scenario in which the above-described media data processing method is applied. Specifically, the media data processing method is applied in this scenario as follows:
[0157] When users need to watch P2P streaming media or make P2P video calls, the aforementioned media data processing method can be used. Users can log into the cloud platform (P2P server) via a client. Upon the client's first login, the P2P server obtains the client's carrier information based on the client's requested IP address. Furthermore, based on the streaming media data identifier or video call identifier carried in the request, the P2P server inserts the client's user information into the seed node of the seed list corresponding to that identifier. Additionally, when users need to query P2P streaming media programs or P2P video channels, they can initiate a seed query request through the client. The scheduling server responds to this request by searching for at least two target seed nodes in the seed list corresponding to the P2P streaming media program identifier or target P2P video channel identifier in the query request. The found target seed nodes are then sent back to the client, allowing the client to download the corresponding media data from the target seed node. The cloud platform can be implemented using a P2P server cluster composed of multiple P2P servers.
[0158] When users need to watch P2P streaming media or make P2P video calls, the cloud platform can activate the system's automatic target seed node query function. For example, by launching an application to query target seed nodes, the system can automatically find target seed nodes that match the user's query request and return the found target seed nodes to the client's display interface, allowing the user to directly view the list of target seed nodes that match the query request in the client's display interface.
[0159] The method provided in this application embodiment can be applied to P2P live streaming scenarios. The following uses P2P live streaming or P2P video-on-demand scenarios as examples to illustrate the media data processing method provided in this application embodiment, including the following steps:
[0160] In traditional media data processing, in order to ensure the availability and quality of the seeds returned based on seed lookup requests, the selected seed storage structure usually has a large time complexity. For example, if the seed storage structure is a map and a set, the time complexity of adding a seed node is O(logN). Moreover, map and set read and write operations require locking, which is very time-consuming under high client access concurrency and can easily lead to the problem of single-machine scalability.
[0161] In traditional media data processing, to address the issue of parallel server scaling when a large number of users access the platform, a common approach is to add a login server in front of the P2P management server. Client requests must first pass through this login server, which has load balancing capabilities. All P2P management servers periodically report their load to the login server, and the login server ultimately selects one to return to the client for login. However, this login service distributes P2P management servers evenly based on the load of each machine. This can lead to fewer seeds available to clients for the same live stream, compromising the quality of service after parallel scaling.
[0162] Therefore, to address the two aforementioned issues—namely, the low processing efficiency of media data due to the inability to scale a single machine under high client concurrency, and the quality of service (QoS) issues after scaling—this embodiment proposes an optimized method for audio / video live streaming P2P seed storage and retrieval strategies. Specifically, this method includes:
[0163] On the technical side, this embodiment uses a linked list approach to address the high time complexity of seed operations. It also employs a hot / cold stream splitting strategy to mitigate the potential impact on service quality from evenly distributing seeds. Since the linked list approach used in this embodiment has an O(1) time complexity, which is constant time complexity, any operation on the seed linked list is independent of the number of nodes or the number of user requests. This means that operating on the seed linked list is constant regardless of the circumstances. Therefore, even under high concurrency, it can significantly shorten the processing time of media data, thereby effectively improving the processing efficiency of media data. The hot / cold stream splitting strategy used in this embodiment refers to the popularity of a program or video. For example, the Spring Festival Gala livestream is more popular than other livestreams, or a popular drama series within a certain period will definitely have more views than other ordinary dramas. Streaming Media refers to a technology that compresses a series of media data and transmits it in segments over a network in a streaming manner, enabling real-time transmission of audio and video for viewing. Streaming media refers to a new media delivery method, which can include audio streams, video streams, text streams, image streams, animation streams, etc. Popular media data is called "hot stream," and less popular media data is called "cold stream." The hot / cold stream splitting strategy adopted in this application example classifies live programs or on-demand video programs and determines whether the media data to be played belongs to popular media data. Based on the hot / cold stream splitting strategy, this solves the problem that evenly distributing seeds may affect service quality, thus effectively ensuring service quality. Therefore, this embodiment proposes an optimized method for audio and video live streaming P2P seed storage and seed retrieval strategy, the specific steps of which are as follows:
[0164] 1) Receive media playback requests carrying media identifiers from each client; when it is determined from the media identifier that the media data to be played belongs to popular media data, report the attribute information corresponding to each client to the target server in the seed service cluster through hash reporting, so that the target server inserts the attribute information into the seed node in the seed list according to the media identifier; when it is determined from the media identifier that the media data to be played does not belong to popular media data, report the attribute information corresponding to each client to the seed service cluster through full reporting, so that the seed service cluster inserts the attribute information into the seed node in the seed list according to the media identifier.
[0165] Specifically, the system can store seeds using a doubly linked list. Each program identifier's linked list includes multiple user nodes, and each user node contains a user identifier (id), a previous pointer, and a next pointer. The previous and next pointers in the doubly linked list represent the connection relationship between nodes; if the list has both a previous and a next pointer, it's a doubly linked list; if it only has a next pointer, it's a singly linked list. The structure storing user information in each node can use a local cache database.
[0166] In this embodiment, a doubly linked list is used to make adding seed nodes more convenient and faster, thus reducing processing time. The linked list structure is also more suitable for storing linear node information. It can be understood that in certain specific scenarios, a singly linked list can also be used to store the information in the seed nodes.
[0167] like Figure 4 As shown, Figure 4 In this context, `fileid` can represent a program ID, which is a unique identifier for the video the client is watching. Each program ID's corresponding linked list can include multiple sub-chains, such as: mobile operator sub-chain, China Unicom operator sub-chain, China Telecom operator sub-chain, and unknown operator sub-chain.
[0168] When the server operates on the seed list, common operations can be categorized into four types: adding seed nodes, deleting seed nodes, searching for seed nodes, and modifying seed nodes. When a client first logs into the P2P server (seed service), the P2P server can obtain the client's corresponding carrier and region information based on the client's requesting IP address. For example, the carrier information is China Mobile, and the region information is Guangdong Province. Further, the P2P server inserts the client's corresponding user information into the seed list corresponding to that program ID, based on the program ID carried in the request. For example, the P2P server can insert the client's user information into the head of the seed list corresponding to that program ID. Each IP address is used to uniquely identify the geographical location and carrier information; therefore, the P2P server can query the database for the carrier and region information corresponding to the client based on the client's IP address. The P2P server can search for a struct in sync.Map based on the program ID carried in the client request. This struct stores the head nodes of the linked lists of each operator. The P2P server can then insert new nodes into the head nodes of the linked lists of each operator.
[0169] Furthermore, the seed service includes timed logic to cyclically scan and eliminate expired seed nodes. Each P2P server in the seed service can start scanning from the head node of the seed list until it reaches the tail. The entire scanning process can be preset to occur every 5 minutes, with the specific scanning cycle adjustable according to business needs. The time complexity of the scanning operation is O(n), and the time complexity of the deletion operation is O(1). When a P2P server encounters an expired seed node, it can delete the expired seed node and reconnect its preceding and following nodes to achieve the deletion operation. Under high concurrency, the seed list may break during a deletion operation by the target thread. Deletion in a multi-threaded environment is unsafe, therefore locking is necessary. The lock granularity should be as small as possible. In this embodiment, the lock granularity can be set to the sub-chain level. Sub-chain level means that each program ID's seed list contains multiple operator sub-chains. Therefore, the lock granularity can be set to the operator sub-chain within each program ID's seed list. Sub-chain locks are more efficient than node locks. However, in certain specific scenarios, the lock granularity can also be set to the node level.
[0170] 2) In response to seed lookup requests sent by other clients, search for at least two target seed nodes in the seed list based on the media identifier in the seed lookup request; and send the target seed nodes back to other clients so that other clients can download media data from the client corresponding to the target seed node.
[0171] Specifically, in response to seed lookup requests from other clients, the P2P server scans each node in the seed list to select a suitable target seed node. The maximum scan length for each scan can be preset based on business needs. After each scan, the P2P server records the ending node so that subsequent scans of the same list will resume from that node. This ensures that all nodes are returned to the client evenly, effectively guaranteeing node quality.
[0172] Furthermore, the network of each user node is constantly changing, and the client updates its own latest network status when the client and server heartbeat together. When the server updates the network status of each seed node, it only needs to update the user status information based on the user identifier, and the time complexity of the above update operation is also O(1).
[0173] Because traditional methods cannot support the high concurrency requests from clients for all program IDs using a single machine, this embodiment addresses the issue of parallel scaling by employing a full program ID model for each P2P server. This model stores seed list information for all program IDs on each server, but the seed node information in the seed list for each program ID may differ between machines. Since the popularity of each program ID varies, identical seed node information in the seed list for each program ID on each server would lead to uneven load distribution across machines. Therefore, this embodiment uses a full program ID model to implement a hot / cold content distribution strategy. The server can determine whether a program ID is popular based on the number of requests it receives. Specifically, the server determines popularity based on the number of requests for each program ID; more requests indicate higher popularity, and fewer requests indicate lower popularity. For example, a threshold of 100,000 requests per minute can be pre-set. Programs with more than 100,000 requests are considered popular, while those with fewer than or equal to 100,000 requests are considered less popular. In essence, the number of queries reflects the number of times a program ID is queried. The more queries a program receives, the more popular it is. Popular programs require hash reporting, while less popular programs require full reporting. Specifically, the seed node information in the seed list corresponding to each program ID on each server is determined by whether the program ID belongs to a popular or ordinary program. When the server determines that the program ID in the client request belongs to an ordinary program, it fully reports the seed node information to all machines in the seed service cluster in real time. When the server determines that the program ID in the client request belongs to a popular program, it routes the seed node information to the target server machine in the seed service cluster using hash reporting. Only the target server machine receives the client's request; popular seeds are not fully synchronized to all machines. This avoids the problem of a single machine being unable to handle the pressure of all seed node information, and also avoids the problem of seed nodes being evenly distributed, which could affect service quality.
[0174] like Figure 8 The diagram shows the timing flow chart for seed services. Figure 8The access scheduling service refers to the access scheduling server, the number allocation service refers to the number allocation server, and the seed service refers to the seed service cluster. The number allocation server avoids performance limitations of a single machine and requires multi-machine deployment, but duplicate number allocations are prohibited. A user's identifier is a 32-bit unsigned int, with 2 bits representing the machine identifier, 15 bits representing the timestamp, and the remaining 15 bits being incremented. The access scheduling server responds to login requests from clients by returning number allocation response information corresponding to each client based on the timestamp information of the login request. This response information carries the client's unique identifier, i.e., each user's unique identifier. Therefore, a maximum of 2 numbers can be allocated per second. 15 If the request response time exceeds the limit, the client will be prompted to retry. Figure 8 The access scheduling server can determine the specific routing method based on the client's request type and content. The scheduling process can utilize the North Star technology, which features service registration, service routing, and service load balancing. The access scheduling server can also determine the operation to be performed on a request based on the command words in the client's request protocol. For example, the access scheduling server determines the request type and content based on the command words carried in the client's request, and then performs routing scheduling corresponding to the request type and content. For instance, command word 1 indicates a login request, command word 2 indicates a heartbeat request, and command word 3 indicates a reporting request, etc. Figure 8 As shown, when the access scheduling server receives a reporting request from a client, it can determine whether to report the entire request or a hash-based request to the seed service cluster based on the program identifier carried in the request. When the access scheduling server receives a heartbeat request from a client, it can determine whether to update the user information in full or by hashing based on the program identifier carried in the heartbeat request. When the access scheduling server receives a seed lookup request from a client, it can randomly route a query from the seed service cluster based on the program identifier carried in the lookup request and return the list of seeds matching the lookup request to the corresponding client. In addition, when a user logs out, the access scheduling server responds to the logout requests of each client by instructing the seed service cluster to update the seed node information corresponding to the offline client and returning the response result to the corresponding client, so that the client can complete the logout operation, i.e., the client logs out successfully.
[0175] like Figure 8Steps 5 and 7, as shown, determine whether a program identifier (program ID) is a popular program based on the number of seed queries. This influences whether a hash update or a full update is used when making the heartbeat request in step 5. When the number of downstream storage service machines changes (i.e., when automatic scaling occurs), using the hash update method would significantly alter the hash path. Therefore, consistent hashing should be considered here to minimize the impact.
[0176] In this embodiment, the processing time of the service is optimized by nearly 10 times, greatly improving the processing efficiency of media data. Simultaneously, after adopting the seed node storage strategy optimized in this embodiment, the increased centralized amount of seed nodes significantly improves the metrics for returning seed nodes, thus effectively ensuring the quality of node services.
[0177] It is understandable that the local cache database mentioned in this embodiment can be replaced with other components such as Redis. The granularity of the lock in the seed linked list structure is also reduced from the operator sub-chain to the seed node level. That is, when modifying a seed node, it is only necessary to lock the nodes before and after the current node to be modified, which can further improve the service concurrency. The seed storage strategy can also adopt a cold and hot stream splitting strategy, separating multiple dimensions of live channel types and applying different storage strategies to different types of live channels.
[0178] It should be understood that, although Figure 1-8 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1-8 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0179] In one embodiment, such as Figure 9 As shown, a media data processing apparatus is provided. This apparatus can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the apparatus includes: a receiving module 902, a reporting module 904, a searching module 906, and a feedback module 908, wherein:
[0180] The receiving module 902 is used to receive media playback requests carrying media identifiers sent by each client.
[0181] The reporting module 904 is used to report the attribute information corresponding to each client to the target server in the seed service cluster through hash reporting when it is determined that the media data to be played belongs to popular media data based on the media identifier. This allows the target server to insert the attribute information into the seed node in the seed linked list based on the media identifier. When it is determined that the media data to be played does not belong to popular media data based on the media identifier, the module reports the attribute information corresponding to each client to the seed service cluster through full reporting. This allows the seed service cluster to insert the attribute information into the seed node in the seed linked list based on the media identifier.
[0182] The search module 906 is used to respond to seed search requests sent by other clients and search for at least two target seed nodes from the seed list based on the media identifier in the seed search request.
[0183] Feedback module 908 is used to send the target seed node back to other clients, enabling them to download media data from the client corresponding to the target seed node. Because seed node information is stored in a linked list, operations on the seed node information in the seed list ensure that adding a seed node has a constant time complexity. Therefore, even under high concurrency, this significantly reduces media data processing time, effectively improving processing efficiency. Furthermore, determining whether the media data to be played belongs to popular media based on the media identifier effectively avoids service quality issues caused by the even distribution of seed nodes, thus ensuring the quality of seed node service.
[0184] In one embodiment, the apparatus further includes: an acquisition module, configured to acquire a network address based on the media playback request; and acquire network service provider information based on the network address. The search module is further configured to search for a matching service provider sub-chain within the seed list corresponding to the media identifier, based on the network service provider information. The reporting module is further configured to report the attribute information corresponding to each client to a target server in the seed service cluster, so that the target server inserts the attribute information into the seed node of the service provider sub-chain. This solves the problem of low media data processing efficiency caused by the inability to scale on a single machine under high client concurrency. It also determines whether the media data belongs to popular media based on the media identifier. If it does, a hot / cold traffic splitting strategy is used to route the seed node information to a designated target server, thus preventing the problem of evenly distributing seeds from affecting service quality. This effectively ensures the number of returned seed nodes and the quality of seed node services.
[0185] In one embodiment, the device further includes: a scanning module, configured to scan nodes at preset time intervals, starting from the head node of the seed linked list, until the tail node of the seed linked list is reached, thereby obtaining the failed nodes in the seed linked list; a deletion module, configured to delete the failed nodes from the seed linked list; and an update module, configured to update the connection relationships of various child nodes in the seed linked list after deleting the failed nodes. Because seed node information is stored in a linked list, the time complexity of deleting a seed node is constant, ensuring that even under high concurrency, the processing time of media data can be greatly reduced, thus effectively improving the processing efficiency of media data.
[0186] In one embodiment, the apparatus further includes: a locking module for locking each service sub-chain in the seed list; and a deletion module for, when a target thread executes a deletion task, acquiring the lock object of the service sub-chain containing the failed node in the seed list through the target thread, and deleting the failed node from the service sub-chain containing the failed node. Since the seed list is disconnected during the deletion operation, deletion is unsafe in a multi-threaded environment, therefore locking is necessary during deletion. This significantly reduces the processing time of media data under high concurrency, effectively improving the efficiency of media data processing while ensuring the security of the deletion operation.
[0187] In one embodiment, the locking module is further configured to lock the seed nodes of each service sub-chain in the seed linked list; the deletion module is further configured to, when the target thread executes a deletion task, acquire the lock object of the failed node through the target thread and delete the failed node from the seed linked list. This effectively improves the processing efficiency of media data while ensuring the security of the deletion operation. Furthermore, by reducing the granularity of locks in the seed linked list structure from the service sub-chain to the seed node level, i.e., when modifying a seed node, only the nodes before and after the currently modified node need to be locked, which further increases the concurrency of the service and effectively improves the processing efficiency of media data.
[0188] In one embodiment, the scanning module is further configured to perform node scanning in the seed list corresponding to the media identifier in the seed query request, based on a preset upper limit scanning length, and mark the seed nodes corresponding to the end of the current scan; the scanning continues from the marked seed nodes as the starting point until all target seed nodes matching the seed query request are found. This ensures that all seed nodes in the seed list are returned to the client evenly, and also effectively guarantees the quality of the nodes returned based on the seed query request.
[0189] In one embodiment, the acquisition module is further configured to acquire address translation information or bandwidth information corresponding to the other clients based on the seed query request; the scanning module is further configured to continue scanning starting from the marked seed node; at the end of each scan, among the various child nodes scanned, a matching target seed node is found based on the acquired address translation information; or, seed nodes whose bandwidth information reaches a preset bandwidth value are designated as priority target seed nodes; wherein, the priority is used to indicate that the target seed node is preferentially fed back to the other clients. This effectively avoids service quality issues caused by the average distribution of seed nodes, effectively ensures the number of nodes returned based on the seed query request, and also effectively ensures the quality of seed node services.
[0190] In one embodiment, the scanning module is further configured to continue scanning from the marked seed node as the starting point; the search module is further configured to, if the network type of the other client is a wireless LAN, search for a target seed node with upload and download functions among the various sub-nodes scanned at the end of each scan; if the network type of the other client is a mobile communication network, search for a target seed node with download functions among the various sub-nodes scanned at the end of each scan. This effectively avoids the service quality problems caused by the even distribution of seed nodes, effectively guarantees the number of nodes returned based on the seed query request, and also effectively guarantees the quality of seed node service.
[0191] In one embodiment, the apparatus further includes: a response module, configured to respond to heartbeat requests sent by each client; and a sending module, configured to, when the media data corresponding to the media identifier in the heartbeat request belongs to the popular media data, send the network status corresponding to each client to the target server in the seed service cluster via a hash update method, so that the target server updates the status of the corresponding seed nodes in the seed linked list according to the network status; and when the media data corresponding to the media identifier in the heartbeat request does not belong to the popular media data, send the network status corresponding to each client to the seed service cluster via a full reporting method, so that the seed service cluster updates the status of the corresponding seed nodes in the seed linked list according to the network status. Because seed node information is stored in a linked list, updating the seed node information in the seed linked list ensures that the time complexity of updating a seed node is constant. Therefore, even under high concurrency access, the processing time of media data can be greatly shortened, thereby effectively improving the processing efficiency of media data.
[0192] In one embodiment, the acquisition module is further configured to acquire the seeding frequency of the media data to be played; the device further includes: a determination module, configured to determine that the media data to be played belongs to the popular media data when the seeding frequency is greater than a preset frequency; and to determine that the media data to be played does not belong to the popular media data when the seeding frequency is less than or equal to the preset frequency. This allows the solution to the problem of low media data processing efficiency caused by the inability to scale on a single machine under high client concurrency. It also enables the determination of whether media data belongs to popular media data based on media identifiers, and the adoption of different reporting methods for seed node information, i.e., based on a hot / cold splitting strategy, routing seed node information to a designated target server to resolve the issue that evenly distributing seeds may affect service quality, thereby effectively ensuring the number of returned seed nodes and the quality of seed node service.
[0193] Specific limitations regarding the media data processing device can be found in the limitations of the media data processing method described above, and will not be repeated here. Each module in the aforementioned media data processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0194] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores processing data for media data. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for processing media data.
[0195] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0196] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0197] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0198] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0199] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0200] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0201] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for processing media data, characterized in that, The method includes: Receive media playback requests carrying media identifiers from each client; When it is determined that the media data to be played belongs to popular media data based on the media identifier, the attribute information corresponding to each client is reported to the target server in the seed service cluster through hash reporting, so that the target server inserts the attribute information into the seed node in the seed linked list according to the media identifier; When it is determined that the media data to be played does not belong to the popular media data according to the media identifier, the attribute information corresponding to each client is reported to the seed service cluster through a full reporting method, so that the seed service cluster inserts the attribute information into the seed node in the seed chain according to the media identifier. In response to seed lookup requests sent by other clients, the target seed node is searched from the seed list based on the media identifier in the seed lookup request; When at least two target seed nodes are found, the target seed nodes are fed back to the other clients so that the other clients can download the media data from the client corresponding to the target seed node.
2. The method according to claim 1, characterized in that, The step of inserting the attribute information into the seed node in the seed linked list according to the media identifier includes: Obtain the network address based on the media playback request; Obtain network service provider information based on the network address; Within the seed chain corresponding to the media identifier, a matching service provider sub-chain is searched based on the network service provider information. The attribute information is inserted into the seed node of the service subchain.
3. The method according to claim 1, characterized in that, The method further includes: According to a preset time interval, a node scan is performed starting from the head node of the seed chain until the tail node of the seed chain is reached, thereby obtaining the invalid nodes in the seed chain. Delete the invalid node from the seed list; Update the connection relationships of various child nodes in the seed list after deleting the failed node.
4. The method according to claim 3, characterized in that, The method further includes: Locking is applied to each service sub-chain in the seed list; Deleting the invalid node from the seed list includes: When the target thread executes the deletion task, it acquires the subchain lock of the service subchain containing the failed node in the seed linked list, and deletes the failed node in the service subchain containing the failed node.
5. The method according to claim 3, characterized in that, The method further includes: The seed nodes of each service subchain in the seed list are locked. Deleting the invalid node from the seed list includes: When the target thread executes the deletion task, it acquires the node lock of the failed node and deletes the failed node from the seed list.
6. The method according to claim 1, characterized in that, Based on the media identifier in the seed query request, the target seed node is located from the seed list, including: In the seed list corresponding to the media identifier in the seed query request, the nodes are scanned based on the preset upper limit length of the scan, and the corresponding seed nodes are marked when the current scan ends. The scanning continues from the marked seed node as the starting point until all target seed nodes that match the seed search request are found.
7. The method according to claim 6, characterized in that, The seed linked list includes address translation information and bandwidth information in its various child nodes; the method further includes: Based on the seed query request, obtain the address translation information or bandwidth information corresponding to the other clients; The scanning continues from the marked seed node as the starting point until all target seed nodes matching the seed search request are found, including: Continue scanning from the marked seed node; At the end of each scan, among the various child nodes scanned, a matching target seed node is found based on the acquired address translation information; or, seed nodes whose bandwidth information reaches a preset bandwidth value are designated as target seed nodes with priority; wherein, the priority is used to indicate that the target seed node is preferentially fed back to the other clients.
8. The method according to claim 6, characterized in that, The attribute information also includes network type; The scanning continues from the marked seed node as the starting point until all target seed nodes matching the seed search request are found, including: Continue scanning from the marked seed node; If the network type of the other clients is wireless LAN, at the end of each scan, find the target seed node with upload and download functions among the various sub-nodes scanned; If the network type of the other clients is a mobile communication network, at the end of each scan, the target seed node with download function is searched among the various sub-nodes scanned.
9. The method according to claim 1, characterized in that, The method further includes: Responding to heartbeat requests sent by each of the aforementioned clients; When the media data corresponding to the media identifier in the heartbeat request belongs to the popular media data, the network status corresponding to each client is sent to the target server in the seed service cluster through a hash update method, so that the target server updates the status of the corresponding seed node in the seed chain based on the network status. When the media data corresponding to the media identifier in the heartbeat request does not belong to the popular media data, the network status of each client is sent to the seed service cluster through a full reporting method, so that the seed service cluster updates the status of the corresponding seed nodes in the seed chain based on the network status.
10. The method according to claim 1, characterized in that, After receiving media playback requests carrying media identifiers from each client, the method further includes: Obtain the frequency of seeding for the media data to be played; When the search frequency is greater than the preset frequency, it is determined that the media data to be played belongs to the popular media data; When the search frequency is less than or equal to the preset frequency, it is determined that the media data to be played does not belong to the popular media data.
11. A media data processing apparatus, characterized in that, The device includes: The receiving module is used to receive media playback requests carrying media identifiers sent by each client; The reporting module is used to report the attribute information corresponding to each client to the target server in the seed service cluster through a hash reporting method when it is determined that the media data to be played belongs to popular media data based on the media identifier, so that the target server inserts the attribute information into the seed node in the seed linked list according to the media identifier; when it is determined that the media data to be played does not belong to popular media data based on the media identifier, it reports the attribute information corresponding to each client to the seed service cluster through a full reporting method, so that the seed service cluster inserts the attribute information into the seed node in the seed linked list according to the media identifier. The search module is used to respond to seed search requests sent by other clients and search for the target seed node from the seed list based on the media identifier in the seed search request; The feedback module is used to send the target seed nodes back to the other clients when at least two target seed nodes are found, so that the other clients can download the media data from the client corresponding to the target seed node.
12. The media data processing apparatus according to claim 11, characterized in that, The device further includes: The acquisition module is used to acquire a network address based on the media playback request; acquire network service provider information based on the network address; the search module is also used to search for a matching service provider sub-chain in the seed chain corresponding to the media identifier based on the network service provider information; the reporting module is also used to insert the attribute information into the seed node of the service provider sub-chain.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.
14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.