Resource allocation method and related apparatus

By receiving the historical content traffic consumption duration information of the terminal, the content traffic consumption duration characteristics are determined, and the server load is dispersed according to the characteristics, which solves the problem of server load imbalance in audio and video services and improves the sustainability and robustness of the system.

WO2024187803A1PCT designated stage expired Publication Date: 2024-09-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/131414
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-14
Filing Date
2023-11-14
Publication Date
2024-09-19

AI Technical Summary

Technical Problem

The existing technology fails to fully consider the server load imbalance caused by users' behavioral habits in audio and video services, causing some servers to be overloaded due to long-term resource occupation, which may cause service interruption.

Method used

By receiving the traffic request message sent by the terminal, it carries the historical content traffic consumption duration information, determines the content traffic consumption duration characteristics, and obtains the server load condition based on the characteristics, and uses the server with the lightest load to process the traffic request, thereby spreading out the long time Occupied terminals to avoid server overload.

Benefits of technology

It effectively avoids service interruption problems caused by server overload due to multiple terminals that consume long content traffic being concentrated on certain servers, and improves the continuity and robustness of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023131414_19092024_PF_FP_ABST
    Figure CN2023131414_19092024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a resource allocation method and a related apparatus. The embodiments of the present application can be applied in the technical field of load balancing. Provided in the present application is a resource allocation method, which comprises: comparing content traffic consumption duration features corresponding to N pieces of historical content traffic consumption duration information of a first terminal with a historical content traffic consumption duration condition; if the content traffic consumption duration features meet the historical content traffic consumption duration condition, determining a first server having a minimum number of loads among K servers; and sending a traffic request message of the first terminal to the first server, so as to enable the first terminal to access the first server. By means of the method provided by the present application, terminals having long content traffic consumption durations are distributed across different servers, such that the problem of service interruptions caused by excessive server overload due to a plurality of terminals having long content traffic consumption durations being concentrated in certain servers is avoided, thereby improving the continuity and robustness of servers.
Need to check novelty before this filing date? Find Prior Art

Description

A resource allocation method and related device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 14, 2023, application number 202310291706.7, and application name “A Resource Allocation Method and Related Devices,” the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of cloud computing technology, and in particular to resource allocation technology. Background Art

[0003] With the continuous development of audio and video information technology, more and more audio and video services have emerged, such as short videos, live streaming, audio and video on demand, and audio and video calls. These services not only provide users with a better visual experience but also enrich their lives. Audio and video services primarily rely on network transmission services, making the transmission of audio and video data crucial.

[0004] When a user chooses to watch audio or video, the user terminal (referred to as the terminal) sends a traffic request message to the load balancer. The load balancer evenly maps the user's request to servers in different CDN (Content Delivery Network) clusters through round-robin or random methods. However, if multiple users occupy a server for a long time at the same time, the load on that server will be higher than that on other servers. This long-term resource occupation leads to uneven distribution of resources, which can easily cause service interruptions for overloaded servers.

[0005] Summary of the Invention

[0006] An embodiment of the present application provides a resource allocation method and related devices, which disperse terminals that consume content traffic for a long time in different servers to avoid the problem of server overload and service interruption caused by the concentration of multiple terminals that consume content traffic for a long time on certain servers.

[0007] One aspect of the present application provides a resource allocation method, which is executed by a computer device and includes:

[0008] Receive a traffic request message sent by the first terminal, wherein the traffic request message carries N historical content traffic consumption duration information, where N is an integer greater than 1;

[0009] Determining a content traffic consumption duration characteristic of the first terminal based on N pieces of historical content traffic consumption duration information;

[0010] If the content traffic consumption duration feature meets the historical content traffic consumption duration condition, then obtain the load quantity of each server in the K servers, where the load quantity of each server is the number of second terminals connected to the server, and the second terminal refers to a terminal whose traffic consumption duration connected to the server is greater than the first traffic duration threshold, and K is an integer greater than 1;

[0011] Determine the server with the least load among the K servers as the first server;

[0012] The traffic request message sent by the first terminal is sent to the first server.

[0013] Another aspect of the present application provides a resource allocation device, which is deployed on a computer device and includes:

[0014] A traffic request message receiving module, configured to receive a traffic request message sent by a first terminal, wherein the traffic request message carries N historical content traffic consumption duration information, where N is an integer greater than 1;

[0015] a traffic consumption duration average calculation module, configured to determine a content traffic consumption duration characteristic of the first terminal based on N pieces of historical content traffic consumption duration information;

[0016] A load quantity acquisition module is configured to obtain the load quantity of each of the K servers if the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, wherein the load quantity of each server is the number of second terminals connected to the server, where the second terminal refers to a terminal whose traffic consumption duration connected to the server is greater than the first traffic duration threshold, and K is an integer greater than 1;

[0017] A first server determination module, configured to determine the server with the least load among the K servers as the first server;

[0018] The traffic request message first forwarding module is used to send the traffic request message sent by the first terminal to the first server.

[0019] Another aspect of the present application provides a computer device, comprising:

[0020] memories, transceivers, processors, and bus systems;

[0021] Wherein, the memory is used to store computer programs;

[0022] The processor is used to execute the computer program in the memory, including executing the above-mentioned methods;

[0023] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

[0024] Another aspect of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.

[0025] Another aspect of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, so that the computer device performs the methods provided in the above aspects.

[0026] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0027] A traffic request message sent by a first terminal is received, wherein the traffic request message carries N historical content traffic consumption duration information. Next, based on the N historical content traffic consumption duration information in the traffic request message, a content traffic consumption duration characteristic corresponding to the terminal is determined. The content traffic consumption duration characteristic can reflect the traffic usage habits of the user corresponding to the first terminal, thereby determining whether the user is a long-term traffic user. If the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, it indicates that the user corresponding to the first terminal tends to use traffic for a long time, which may cause the first terminal to occupy server resources for a long time. Therefore, the load of each of K servers can be obtained, and the server with the least load among the K servers can be determined as the first server. The traffic request message sent by the first terminal is sent to the first server. Since the load is the number of second terminals connected to the server, and second terminals are terminals whose traffic consumption duration connected to the server is greater than a first traffic duration threshold, sending the traffic request message sent by the first terminal to the first server can disperse terminals with long content traffic consumption durations across different servers. Through the method provided in the embodiment of the present application, terminals with long content traffic consumption time are dispersed in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long content traffic consumption time on certain servers, thereby improving the continuity and robustness of the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] FIG1 is a schematic diagram of CDN server load balancing provided by an embodiment of the present application;

[0029] FIG2 is a schematic diagram of server load differentiation provided by an embodiment of the present application;

[0030] FIG3 is a schematic diagram of a resource allocation system provided in an embodiment of the present application;

[0031] FIG4 is a flow chart of a resource allocation method provided in an embodiment of the present application;

[0032] FIG5 is a flow chart of a resource allocation method provided by another embodiment of the present application;

[0033] FIG6 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0034] FIG7 is a schematic diagram of storing high-definition and low-definition resources on the same server according to an embodiment of the present application;

[0035] FIG8 is a schematic diagram of storing high-definition and low-definition resources on different servers according to an embodiment of the present application;

[0036] FIG9 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0037] FIG10 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0038] FIG11 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0039] FIG12 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0040] FIG13 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0041] FIG14 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0042] FIG15 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0043] FIG16 is a schematic diagram of a resource allocation method provided in another embodiment of the present application;

[0044] FIG17 is a flowchart of a resource allocation method provided by another embodiment of the present application;

[0045] FIG18 is a schematic diagram of data transmission between a server and a load balancer provided in an embodiment of the present application;

[0046] FIG19 is a schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;

[0047] FIG20 is a schematic diagram of the structure of a resource allocation device provided in another embodiment of the present application;

[0048] FIG21 is a schematic structural diagram of a resource allocation device provided in yet another embodiment of the present application;

[0049] Figure 22 is a schematic diagram of the server structure provided by an embodiment of the present application. DETAILED DESCRIPTION

[0050] An embodiment of the present application provides a resource allocation method, which disperses terminals with long content traffic consumption time across different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long content traffic consumption time on certain servers, thereby improving the sustainability and robustness of the server.

[0051] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or that are inherent to these processes, methods, products or devices. To facilitate understanding of the technical solutions provided in the embodiments of the present application, some key terms used in the embodiments of the present application are first explained here:

[0052] TCP (Transport Control Protocol): is a connection-oriented, reliable, byte stream-based transport layer communication protocol.

[0053] QUIC (Quick UDP Internet Connection): A low-latency Internet transport layer protocol based on UDP.

[0054] Quality of Experience (QoE): refers to a user's subjective perception of the quality and performance of a device, network, system, application, or service. QoE refers to the perceived ease or difficulty of completing a process.

[0055] QoS (Quality of Services) refers to a network's ability to leverage various underlying technologies to provide enhanced service for specified network communications. It serves as a network security mechanism and a technique used to address issues such as network latency and congestion. QoS guarantees are crucial for networks with limited capacity, especially for streaming multimedia applications such as Voice over Internet Protocol (VoIP) and Interactive Personality (IPTV), as these applications often require a fixed transmission rate and are sensitive to latency.

[0056] RTT (Round-Trip Time): It is an important performance indicator in computer networks, indicating the total delay from the start of data transmission at the sender to the receipt of confirmation from the receiver (the receiver sends confirmation immediately after receiving the data).

[0057] IP (Internet Protocol) is the network layer protocol in the TCP / IP architecture. IP was designed to improve network scalability: first, to solve Internet problems and enable interconnection between large-scale, heterogeneous networks; second, to decouple top-level network applications from underlying network technologies, facilitating their independent development. Based on end-to-end design principles, IP provides only a connectionless, unreliable, best-effort data packet transmission service for hosts.

[0058] DDoS (Distributed Denial of Service): A distributed denial of service attack can attack many computers at the same time, making the target computer unable to operate normally.

[0059] Load balancing is a key method for balancing the load across devices in a CDN cluster, preventing service interruptions caused by excessive overhead on individual devices, such as reduced traffic transmission performance or even device downtime. In related technologies, when user terminals send traffic request packets in a CDN cluster, the load balancer evenly maps these connection requests to different CDN servers, preventing service interruptions caused by excessive load on a single server responding to traffic requests, or even device downtime. Load balancers are a key method for improving system robustness and ensuring service continuity.

[0060] As shown in Figure 1, a CDN cluster accepts traffic acquisition requests from multiple user terminals. Before the formal traffic response, the load balancer selects a different CDN server for each connection request (to provide traffic transmission services). Specifically, the load balancer selects servers 2, 1, 4, and 3 for connections from clients 1, 2, n, and n-1, respectively, to create connections and subsequent traffic transmission. In this way, the servers in each CDN cluster can only provide services to a small number (rather than all) of user terminals, because even if there is a lot of concurrent traffic, each CDN server will not suffer service interruptions due to excessive load. The above-mentioned load balancer is also an important means of defending against various types of DDoS attacks, that is, it can "disperse" the attack traffic from different clients to avoid equipment failures caused by excessive load on a certain server.

[0061] A load balancer can be a single device or it can integrate load balancing functionality into an existing device (such as a gateway). Load balancing algorithms are mainly divided into the following categories:

[0062] (1) Round robin method, that is, mapping the connections to different servers in the order of their arrival. As shown in Figure 1, the load balancer receives connection requests from clients 2, 1, n, and n-1 in turn, and maps these four requests to servers 1, 2, 3, and 4 in a round robin manner.

[0063] (2) Random method, that is, the load balancer "randomly" selects a server from the CDN cluster to respond to the connection request of the user terminal for different client connection requests. As shown in Figure 1, for the connection requests of clients 1, 2, n-1 and n, the load balancer randomly selects servers 2, 1, 4 and 3 to respond to the client requests respectively.

[0064] (3) Hash method: After receiving connection requests from different user terminals, the load balancer performs a hash operation based on the client information and selects the corresponding CDN server based on the hash result. For example, the client address is src and the source port is port. When the load balancer receives a connection request from the client, it performs the calculation of formula (1) to obtain the server ID number (Server_ID); Server_ID = Hash(src||sport) (1)

[0065] The symbol “||” represents a concatenation operation.

[0066] The load balancing algorithm provided by the relevant technology fails to fully consider the differences in connection time, overhead, etc. caused by the user's behavioral habits, which makes the load balancing algorithm unable to achieve good load balancing between the servers. For example, if the user of a terminal prefers to watch a certain (some) live videos for a long time, and the video viewing time is longer (that is, there is rarely frequent switching of live content), then in this process, the connection between the user terminal and the server will survive for a long time, that is, the connection will occupy the resources of a certain server for a long time. If there are multiple connections occupying a certain server resource for a long time at the same time, then over time, the load of the server will become larger and larger than that of other servers. The reason for the above problem is that the load balancer provided by the relevant technology fails to fully consider the behavioral habits of the user of the terminal corresponding to the connection when performing the load balancing operation at the beginning of the connection, mainly the user's traffic usage habits, which easily leads to the phenomenon of long-term resource occupation.

[0067] As shown in Figure 2, after receiving connection requests from multiple user terminals (multiple user terminals constitute a user terminal group), the load balancer uses the methods provided by related technologies to distribute these requests to servers 1 and 2. However, since the user's behavioral habits are not taken into account in the above load balancing process, the following results may occur: the flow allocated to server 2 lasts for a long time, while the flow allocated to server 1 lasts for a short time. This will cause the load of server 1 to become very small after a short period of time; while server 2 will maintain a high load for a long time (for example, the terminal users of these streams watch the live broadcast for a long time, resulting in long-term consumption of server 2's resources). When a new connection request arrives, the load balancer again selects the corresponding server according to methods such as round-robin, hashing, and randomness. At this time, the load of server 2, which was originally very high, may become even higher with the arrival of the new connection request, and may even cause service interruption and other problems.

[0068] In order to solve the problem of different server loads caused by different content traffic consumption durations, the embodiments of the present application propose a resource allocation method based on load balancing of user audio and video viewing behavior habits, wherein the cloud server (data sending end) selects a suitable server to respond to user requests based on the historical session duration of the user terminal and the current server load when the connection is established, thereby avoiding the security risks such as multiple long flows occupying a certain server load for a long time and causing service interruption caused by the methods provided by related technologies. Compared with the indiscriminate load balancing methods of related technologies that do not consider the user's audio and video viewing behavior habits, the method provided by the embodiments of the present application can fully consider the historical information of terminal users, and evenly distribute the sessions of terminal users who tend to watch for a long time across various servers, thereby avoiding the problem of multiple long flows "clustering" on a certain server and causing excessive load on the server, which is conducive to improving the continuity and robustness of the CDN vendor's service capabilities.

[0069] For ease of understanding, please refer to Figure 3, which is an application environment diagram of the resource allocation method in the embodiment of the present application. As shown in Figure 3, the resource allocation method in the embodiment of the present application is applied to the resource allocation system. The resource allocation system includes: a server, a load balancer and a user terminal. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and the embodiment of the present application is not limited here.

[0070] The load balancer first receives a traffic request message sent by the first terminal. The traffic request message carries N historical content traffic consumption duration information, where N is an integer greater than 1. Secondly, the load balancer determines the content traffic consumption duration characteristics of the first terminal based on the N historical content traffic consumption duration information. Then, if the content traffic consumption duration characteristics meet the historical content traffic consumption duration conditions, the load balancer obtains the load quantity of each server in the K servers. The load quantity of each server is the number of second terminals connected to the server, and the second terminal refers to the terminal whose traffic consumption duration connected to the server is greater than the first traffic duration threshold, and K is an integer greater than 1. Then, the load balancer determines the server with the least load quantity among the K servers as the first server; finally, the load balancer sends the traffic request message sent by the first terminal to the first server.

[0071] The following will introduce the resource allocation method in this application from the perspective of the load balancer. Please refer to Figure 4. The resource allocation method provided in this embodiment includes: S110 to S135. Specifically:

[0072] S110: Receive a traffic request message sent by the first terminal.

[0073] The first terminal may be a terminal corresponding to any user, and when the user selects a content to play on the first terminal, the first terminal may send a traffic request message. In the embodiment of the present application, the content may be audio, video, etc., and the embodiment of the present application does not limit this.

[0074] A traffic request message may be a message for requesting that the user be provided with the traffic consumed by the corresponding content. The traffic request message carries N pieces of historical content traffic consumption duration information, where N is an integer greater than 1. Historical content may refer to content that has been played for the user before the traffic request message is sent this time; historical content traffic consumption duration information may be information used to reflect the duration of traffic consumed by playing historical content; N pieces of historical content traffic consumption duration information may refer to N pieces of information used to reflect the duration of traffic consumed by playing historical content. Among them, the historical content traffic consumption duration information may include historical content traffic consumption duration data, and the historical content traffic consumption duration data may be a specific value of the traffic consumption duration of playing historical content, such as 15 minutes, 30 minutes, etc.

[0075] In some cases, long-flow content is typically played on long content platforms, while short-flow content is typically played on short content platforms. For example, long videos are played on various long video platforms, while short videos are played on various short video platforms. In other words, the platform where historical content was played can, to a certain extent, roughly reflect the duration of data consumed by users playing historical content. Therefore, historical content data consumption duration information can include information about the platform where the historical content was played.

[0076] In one possible implementation, the historical content traffic consumption duration information may be obtained by encrypting the historical content traffic consumption duration data. It is understandable that when the first terminal starts the audio and video application, the first terminal may send a traffic request message, which carries N pieces of historical content traffic consumption duration information. The historical content traffic consumption duration information may refer to the encrypted information of the historical content traffic consumption duration data consumed by the user who recently watched the historical content using the first terminal, and the historical content traffic consumption duration information is stored in the first terminal. The load balancer receives the traffic request message sent by the first terminal.

[0077] S120: Determine a content traffic consumption duration feature of the first terminal based on N pieces of historical content traffic consumption duration information.

[0078] To address the technical issues of related technologies, embodiments of the present application can consider user behavior habits, namely, user traffic usage habits, so that load balancing can be performed based on traffic usage habits. Therefore, the load balancer can determine the content traffic consumption duration characteristics of the first terminal based on N historical content traffic consumption duration information. The content traffic consumption duration characteristics can reflect the traffic usage habits of the user corresponding to the first terminal, and then determine whether the user is a long-term traffic user based on the content traffic consumption duration characteristics.

[0079] In a possible implementation, the historical content traffic consumption duration information may include historical content traffic consumption duration data, so in S120 , N historical content traffic consumption duration data may be calculated to obtain content traffic consumption duration characteristics.

[0080] It should be noted that the embodiments of the present application do not limit the representation of the content traffic consumption duration characteristics, as long as they can represent the user's traffic usage habits. In one possible implementation, the content traffic consumption duration characteristics may be represented by a duration value. In this case, the content traffic consumption duration characteristics may be, for example, the content traffic consumption duration mean, the content traffic consumption duration variance value, the content traffic consumption duration maximum value, and the like. In some cases, since the historical content traffic consumption duration information may include the playback platform identifier of the historical content, in another possible implementation, the content traffic consumption duration characteristics may be represented by playback platform information.

[0081] The implementation of S120 may vary depending on how the content traffic consumption duration feature is represented. For example, when the content traffic consumption duration feature is the average content traffic consumption duration, the load balancer may calculate the average value of the historical content traffic consumption duration data included in the N historical content traffic consumption duration information to obtain the average content traffic consumption duration. For another example, when the content traffic consumption duration feature is the maximum content traffic consumption duration, the load balancer may select the maximum value from the historical content traffic consumption duration data included in the N historical content traffic consumption duration information to obtain the maximum content traffic consumption duration, and so on.

[0082] It can be understood that when the historical content traffic consumption time information is obtained by encrypting the historical content traffic consumption time data, and the content traffic consumption time characteristic is the average content traffic consumption time, the implementation method of S120 can be that the load balancer first decrypts the N historical content traffic consumption time information to obtain N historical content traffic consumption time data corresponding to the N historical content traffic consumption time information; then, calculates the average of the N historical content traffic consumption time data to obtain the content traffic consumption time characteristic.

[0083] S131. If the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, the load quantity of each server in the K servers is obtained.

[0084] The load of each server is the number of second terminals connected to the server. Second terminals may refer to terminals whose traffic consumption duration exceeds a first traffic duration threshold. Traffic consumption duration exceeding the first traffic duration threshold is considered long traffic. K is an integer greater than 1.

[0085] It should be noted that the historical content traffic consumption duration condition can be a condition that the user is a long-term traffic user. If the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, it indicates that the user of the first terminal is a long-term traffic user. Therefore, it is necessary to obtain the load of each of the K servers in order to select an appropriate server to provide services with longer content traffic consumption durations.

[0086] In an embodiment of the present application, the historical content traffic consumption duration condition may also be different depending on the different content traffic consumption duration characteristics. When the content traffic consumption duration characteristic is a duration value, the historical content traffic consumption duration condition may be a condition that limits the value range of the duration value. In one possible implementation, the value range of the duration value is limited to limit the duration value to be greater than a specific threshold. For example, the content traffic consumption duration characteristic is the average content traffic consumption duration. The historical content traffic consumption duration condition may be that the average content traffic consumption duration is greater than the historical content traffic consumption duration threshold (i.e., a specific threshold). When the content traffic consumption duration characteristic is playback platform information, the historical content traffic consumption duration condition may be a condition that limits the playback platform. In one possible implementation, limiting the playback platform may limit the playback platform to a long content playback platform. For example, the historical content traffic consumption duration condition may be that the playback platform indicated by the playback platform information is a long content playback platform.

[0087] It is understandable that if the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, it indicates that the user's behavioral habit for content (e.g., video) is to watch long videos (e.g., watch a certain video live for a long time), and their video viewing time is relatively long (i.e., they rarely frequently switch between live content). In this process, the connection between the user terminal and the server will survive for a long time, that is, the connection will occupy the resources of a certain server for a long time. The load balancer obtains the current load of each of the K servers to determine the current number of second terminals consuming long traffic on each server, that is, to determine the number of second terminals that have connected to each server and are watching long videos.

[0088] S133: Determine the server with the least load among the K servers as the first server.

[0089] It is understandable that the load balancer selects the server with the least load from the K loads corresponding to the K servers as the first server. At this time, the number of second terminals connected to the first server is small, that is, the long traffic occupied by the first server is small.

[0090] S135: Send the traffic request message sent by the first terminal to the first server.

[0091] It can be understood that the load balancer forwards the traffic request message sent by the first terminal to the first server to enable the terminal to access the first server.

[0092] For example, the content traffic consumption duration characteristic is the average content traffic consumption duration. The CDN cluster includes server A, server B, server C, and server D. Server A, server B, server C, and server D periodically send load quantity messages generated according to the current load quantity to the load balancer. Specifically, the load quantity of server A (the number of second terminals connected that consume long traffic) is 3; the load quantity of server B (the number of second terminals connected that consume long traffic) is 4; the load quantity of server C (the number of second terminals connected that consume long traffic) is 1; and the load quantity of server D (the number of second terminals connected that consume long traffic) is 2. The user has recently watched 5 audio and video (i.e., historical content), and the corresponding traffic consumption durations are 15 minutes, 30 minutes, 29 minutes, 25 minutes, and 6 minutes, respectively. The traffic consumption duration data of the 5 audio and video (i.e., historical content traffic consumption duration data) are encrypted to generate historical content traffic consumption duration information, which is stored in the first terminal. The user uses the first terminal to open an audio and video application. The first terminal sends a traffic request message carrying five historical content traffic consumption durations to the load balancer. After receiving the traffic request message sent by the first terminal, the load balancer calculates the average content traffic consumption duration of the first terminal; compares the average content traffic consumption duration of the first terminal with the historical content traffic consumption duration threshold, and obtains that the average content traffic consumption duration is greater than the historical content traffic consumption duration threshold. The load quantity of each of the four servers is obtained, and the load quantity of server C is the least. Server C is determined to be the first server, and the traffic request message sent by the first terminal is forwarded to the first server to connect the terminal to server C.

[0093] A certain embodiment of the present application provides a resource allocation method, which compares the content traffic consumption duration characteristics corresponding to the N historical content traffic consumption duration information of the first terminal with the historical content traffic consumption duration condition. If the content traffic consumption duration characteristics meet the historical content traffic consumption duration condition, the server with the smallest load among the K servers is determined to be the first server, and the traffic request message of the first terminal is sent to the first server to connect the first terminal to the first server. Through the method provided by the embodiment of the present application, terminals with longer content traffic consumption durations are dispersed in different servers, avoiding the problem of service interruption caused by excessive server overload caused by the concentration of multiple terminals with longer content traffic consumption durations on certain servers, thereby improving the continuity and robustness of the server.

[0094] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG4 of the present application, please refer to FIG5, the traffic request message also carries content identification information. The content identification information is used to indicate the pending content that the user wants to watch and the clarity of the pending content. S120 also includes S132 to S136. It should be noted that S131 to S135 and S132 to S136 are parallel steps. During specific execution, S131 to S135 or S132 to S136 are selected according to the conditions met. Specifically:

[0095] S132: If the content traffic consumption duration feature does not meet the historical content traffic consumption duration condition, then obtain the content stored in each of the K servers and the clarity of each content.

[0096] It is understandable that if the content traffic consumption time characteristic does not meet the historical content traffic consumption time condition, it means that the user is not a long-term traffic user, but is more likely to be a user who frequently switches content. For example, the behavioral habit of audio and video is to frequently switch videos (such as watching short videos), and the viewing time for each video is relatively short (i.e., frequently switch short videos). Then in this process, the duration of the session corresponding to each content of the first terminal is relatively short, that is, the user tends to pay more attention to whether the audio and video are smooth. In an embodiment of the present application, fluency can be reflected by the clarity of the content, and there is the following relationship between fluency and clarity: the higher the clarity, the lower the fluency; the lower the clarity, the higher the fluency. In a CDN server cluster, for the same content, content of different clarity is often encoded by an encoder and stored in the same or different servers.

[0097] Clarity refers to the clarity and distinctness of content. For video content, video clarity is determined by the image details and edge clarity. Video clarity requires that the outlines, textures, and details of objects can be clearly seen without blur or distortion. For audio content, audio clarity requires that the pitch, volume, and quality of the sound can be clearly heard without noise, interference, or interruptions.

[0098] It should be noted that the clarity of content can be represented by a variety of parameters, and these parameters may vary depending on the content. For video, clarity can be represented by at least one of parameters such as resolution, bitrate, frame rate, sharpness, and contrast. The embodiments of this application do not limit the parameters used to measure clarity. Resolution refers to the number of pixels in an image or video. Common resolutions include 720p (pixel), 1080p, 2K (2000 pixels), and 4K. Generally, higher resolutions indicate higher clarity. Bitrate refers to the number of bits transmitted per second in a video. Generally, higher bitrates increase video clarity. Frame rate refers to the number of frames played per second. Generally, higher frame rates result in smoother video playback, i.e., higher video clarity. Sharpness refers to the edge clarity of an image. Generally, higher sharpness results in higher video clarity. Contrast refers to the degree of contrast between light and dark in an image. Generally, higher contrast results in higher video clarity.

[0099] For audio, clarity can be represented by at least one of the parameters such as signal-to-noise ratio and bit rate. The embodiments of the present application do not limit the parameters for measuring clarity. Signal-to-noise ratio (SNR) can refer to the ratio between the voice signal and the background noise. When the signal-to-noise ratio is higher, it means that the voice signal is clearer, that is, the clarity is higher. Conversely, it means that the voice signal is subject to greater interference. Bit rate can refer to the amount of data per second in the audio, indicating the degree of compression of the audio and the data transmission rate, usually expressed in kbps (kilobits per second). Generally speaking, the higher the bit rate of the audio, the higher the quality of the audio, that is, the higher the clarity of the audio.

[0100] S134: Determine a second server from the K servers according to the content identification information.

[0101] The second server is a server storing content that is the same as the content to be processed indicated by the content identification information and has a clarity lower than a clarity threshold.

[0102] It can be understood that since the content identification information is used to indicate the content that the user wants to watch and the clarity of the corresponding content, the content stored in each server among the K servers and the clarity of each content can be compared with the content identification information to find the server that stores the same content to be processed as the content indicated by the content identification information but with lower clarity as the second server.

[0103] S136: Send the traffic request message sent by the first terminal to the second server.

[0104] It can be understood that the load balancer forwards the traffic request message sent by the terminal to the second server to enable the terminal to access the second server.

[0105] For example, the content can be a video, and the CDN cluster includes server A, server B, server C, and server D. Server A, server B, server C, and server D periodically generate messages based on the stored videos and the video clarity and send them to the load balancer. Specifically, server A stores high-definition video a, server B stores low-definition video a, server C stores both high-definition and low-definition video b, and server D stores both high-definition and low-definition video c. The user has recently watched 5 audio and video sessions, and the corresponding traffic consumption durations are 2 minutes, 3 minutes, 5 minutes, 4 minutes, and 6 minutes respectively. The traffic consumption duration data of the 5 audio and video sessions are encrypted to generate historical video traffic consumption duration information, which is stored in the first terminal. The user uses the first terminal to open the audio and video application, and the video the user wants to watch is low-definition video a. The terminal sends a traffic request message carrying 5 historical video traffic consumption duration information and content identification information to the load balancer. After the load balancer receives the traffic request message sent by the first terminal, it calculates the average historical video traffic consumption time of the first terminal; compares the average historical video traffic consumption time of the first terminal with the historical video traffic consumption time threshold, and obtains that the average historical video traffic consumption time is less than the historical video traffic consumption time threshold, then obtains the video stored in each of the four servers and the clarity of the video, and server B stores low-definition video a, then determines that server B is the second server, and forwards the traffic request message sent by the terminal to the second server to realize the terminal access to server B.

[0106] A certain embodiment of the present application provides a resource allocation method, which compares the content traffic consumption duration characteristics corresponding to the N historical content traffic consumption duration information of the terminal with the historical content traffic consumption duration condition. If the content traffic consumption duration characteristics meet the historical content traffic consumption duration condition, the first server with the smallest load among the K servers is determined, and the traffic request message of the first terminal is sent to the first server to connect the first terminal to the first server; if the content traffic consumption duration characteristics do not meet the historical content traffic consumption duration condition, the second server that stores the low-definition content to be processed among the K servers is determined, and the traffic request message of the first terminal is sent to the second server to connect the first terminal to the second server. Through the method provided by the embodiment of the present application, terminals with longer content traffic consumption duration are dispersed among different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer content traffic consumption duration on certain servers. By selecting a server with lower clarity and higher fluency for users who frequently switch content, the phenomenon of stuck segments caused by users frequently switching videos is avoided; the server to which the terminal is connected is determined based on the user's behavioral habits, thereby improving the continuity and robustness of the server.

[0107] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG5 of the present application, please refer to FIG6 , S136 further includes S1361 to S1363. It should be noted that S1362 and S1363 are parallel steps. During specific execution, S1362 or S1363 is selected for execution according to the execution conditions. Specifically:

[0108] S1361. Obtain the clarity of the content to be processed stored in the second server.

[0109] It is understood that each server generates a message based on its stored content and the clarity of the content and sends it to the load balancer. The second server stores the content to be processed and the clarity of the content to be processed, so the load balancer can determine the clarity of the content to be processed stored on the second server based on the message sent by the second server.

[0110] S1362: If the second server stores at least two to-be-processed contents with different definitions, add a definition mark to the traffic request message, and send the traffic request message carrying the definition mark to the second server.

[0111] The definition mark is added to instruct the second server to send the content to be processed whose definition is lower than the definition threshold to the first terminal. The embodiment of the present application does not limit the definition threshold, and the definition threshold can be set according to actual needs.

[0112] It is understandable that if the to-be-processed content stored in the second server includes high-definition and low-definition content, a definition mark is added to the traffic request message, and the marked traffic request message is forwarded to the second server.

[0113] S1363: If the clarity of all the to-be-processed contents stored in the second server is lower than the clarity threshold, the traffic request message sent by the first terminal is sent to the second server.

[0114] It is understandable that if all the to-be-processed contents stored in the second server are of low definition, the traffic request message is directly forwarded to the second server.

[0115] As shown in Figures 7 and 8, taking the content as audio and video as an example, Figure 7 is a schematic diagram of the embodiment of the present application providing two different definitions of the same audio and video stored in the same server; Figure 8 is a schematic diagram of the embodiment of the present application providing two different definitions of the same audio and video stored in different servers. In a CDN server cluster, for the same video, different definitions of the audio and video can be stored, and the different definitions of the audio and video are often stored in two ways: one is that after the audio and video are encoded by the encoder, the audio and video with high definition and the audio and video with low definition are stored on the same server (as shown in Figure 7); the other is that after the audio and video are encoded by the encoder, the audio and video with high definition and the audio and video with low definition are stored on different servers respectively (as shown in Figure 8). If the load balancer detects that the user's audio and video viewing behavior of the first terminal is to frequently switch viewing content, it chooses to obtain low-definition (i.e., smooth) audio and video to respond to the traffic request message; when the same audio and video in high definition and low definition are stored on the same server (as shown in Figure 7), the load balancer forwards the traffic request message from the first terminal to the server, wherein the load balancer adds an audio and video clarity identifier to the above traffic request message, denoted as Mark, wherein the identifier occupies 1 bit, and when the value is binary 1, it represents sending smooth (low-definition) audio and video to the first terminal; when the same audio and video in high definition and low definition are stored on different servers (as shown in Figure 8), the load balancer forwards the traffic request message from the first terminal to the server storing the low-definition audio and video (i.e., server 2).

[0116] An embodiment of the present application provides a resource allocation method, which avoids the stuck phenomenon caused by users frequently switching videos by selecting a server with lower clarity and higher fluency for users who frequently switch to watch videos, thereby improving the continuity and robustness of the server.

[0117] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG. 5 of the present application, S132 further includes S1321. Specifically:

[0118] S1321: If the content traffic consumption duration characteristic does not meet the historical content traffic consumption duration condition, periodically obtain the content stored in each of the K servers and the clarity of each content.

[0119] It is understandable that each of the K servers periodically generates a message based on the stored content and the clarity of the content and sends it to the load balancer. The load balancer periodically obtains the content stored by each of the K servers and the clarity of each content.

[0120] The resource allocation method provided in the embodiment of the present application periodically obtains the content stored on each server and the clarity of each content, and selects the server that stores the low-definition video to be processed as the second server, thereby avoiding the stuck phenomenon caused by the user frequently switching videos.

[0121] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG4 of the present application, please refer to FIG9 , the traffic request message also includes key information and message verification information; S120 further includes S121 to S122. Specifically:

[0122] S121. Verify N pieces of historical content traffic consumption duration information based on the key information and the message verification information.

[0123] It can be understood that the traffic request message is embedded with message verification information and N historical content traffic consumption duration information, and the message verification information is embedded with key information. Among them, the key information is the information required for encryption or decryption, and the message verification information is the information used to verify that the N historical content traffic consumption duration information has not been tampered with during the data transmission process. In one possible implementation method, the message verification information can be information in a numerical form. The embodiment of the present application does not limit the form of the message verification information. In some cases, the message verification information can also be information in the form of letters, symbols, etc. The data contained in the traffic request message Pkt_history is as follows: Pkt_history = {MAC_his, N, T_session_enc_1, ..., T_session_enc_N} (2);

[0124] Where Pkt_history is the traffic request message, MAC_his is the message verification information of the traffic request message Pkt_history, N is the number of historical content traffic consumption duration information, and T_session_enc_1, ..., T_session_enc_N represent N historical content traffic consumption duration information. MAC_his = MAC{K_share, N||T_session_enc_1||...||T_session_enc_N) (3);

[0125] Among them, MAC_his is the message authentication information of the traffic request message Pkt_history, K_share is the key information, and MAC{A,B} indicates that the message authentication information of data B is calculated using key A.

[0126] Based on the key information and message verification information, the N historical content traffic consumption duration information in the traffic request message is verified to ensure that the N historical content traffic consumption duration information has not been tampered with during the data transmission process. Specifically:

[0127] MAC_his (denoted as MAC_his_cpt_server) is calculated according to formula (3). The MAC_his calculated during the verification process can be called message authentication information.

[0128] If MAC_his_cpt_server=MAC_his, it indicates that the verification is passed and the N historical content traffic consumption duration information has not been tampered with during the data transmission process; if MAC_his_cpt_server≠MAC_his, it indicates that the verification is not passed and the N historical content traffic consumption duration information has been tampered with during the data transmission process.

[0129] S122: If the verification is successful, calculate the content traffic consumption duration characteristics based on the N historical content traffic consumption duration information.

[0130] It can be understood that if verification is passed and the content traffic consumption time characteristic is the average content traffic consumption time, the key information can be used to decrypt the N historical content traffic consumption time information to obtain N historical content traffic consumption time data; the average of the N historical content traffic consumption time data can be calculated to obtain the content traffic consumption time characteristic.

[0131] The resource allocation method provided in the embodiment of the present application embeds key information and message verification information in the traffic request message, and determines through the message verification information that the N historical content traffic consumption duration information in the transmission traffic request message has not been tampered with, thereby ensuring the accuracy of data during information transmission and improving data security during the transmission process.

[0132] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG9 of the present application, please refer to FIG10 , S121 further includes S1211 to S1213. It should be noted that S1212 and S1213 are parallel steps. During specific execution, S1212 or S1213 is selected based on the conditions met. Specifically:

[0133] S1211. Calculate message authentication information of N historical content traffic consumption duration information based on the key information.

[0134] S1212: If the message authentication information is the same as the message verification information, the verification is passed.

[0135] S1213. If the message authentication information is different from the message verification information, the verification fails.

[0136] It is understandable that, based on the key information and message verification information, the N historical content traffic consumption duration information in the traffic request message is verified to determine that the N historical content traffic consumption duration information has not been tampered with during the data transmission process. Specifically:

[0137] Calculate MAC_his (denoted as MAC_his_cpt_server) according to formula (3).

[0138] If MAC_his_cpt_server=MAC_his, it indicates that the verification is passed and the N historical content traffic consumption duration information has not been tampered with during the data transmission process; if MAC_his_cpt_server≠MAC_his, it indicates that the verification is not passed and the N historical content traffic consumption duration information has been tampered with during the data transmission process.

[0139] The resource allocation method provided in the embodiment of the present application embeds key information and message verification information in the traffic request message, and determines through the message verification information that the N historical content traffic consumption duration information in the transmission traffic request message has not been tampered with, thereby ensuring the accuracy of data during information transmission and improving data security during the transmission process.

[0140] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG. 9 of the present application, please refer to FIG. 11 , if the content traffic consumption duration characteristic is the average content traffic consumption duration, S122 includes S1221 to S1222. Specifically:

[0141] S1221. Decrypt N pieces of historical content traffic consumption duration information according to the key information to obtain N pieces of historical content traffic consumption duration data.

[0142] It can be understood that the load balancer decrypts the N historical content traffic consumption duration information T_session_enc_1, ..., T_session_enc_N using the key information K_share to obtain the N historical content traffic consumption duration data T_session_1, T_session_2, ..., T_session_N. The decryption process is as shown in formula (4): T_session_i = Dec{K_share, T_session_enc_i} (4);

[0143] Here, Dec{a,b} represents the decryption operation of the data T_session_enc_i using the key K_share. Without loss of generality, the smaller the parameter i in T_session_i, the closer it is to the current time.

[0144] S1222: Calculate the average of N historical content traffic consumption duration data to obtain content traffic consumption duration characteristics.

[0145] It can be understood that the load balancer calculates the average value T_session_avg of N historical content traffic consumption duration decryption data T_session_i, as shown in formula (5): T_session_avg = (T_session_1 + T_session_2 + ... + T_session_N) / N (5).

[0146] The resource allocation method provided in the embodiment of the present application decrypts the historical content traffic consumption time information through key information, calculates the average of the decrypted data of the historical content traffic consumption time obtained by decryption, and determines the user's behavior habits through the relationship between the average of the decrypted data of the historical content traffic consumption time and the historical content traffic consumption time threshold, and then determines the server to which the terminal is connected through the user's behavior habits, thereby improving the sustainability and robustness of the server.

[0147] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG9 of the present application, please refer to FIG12 , S121 is followed by S123 to S125. It should be noted that S122 and S123 to S125 are parallel steps. During specific execution, S122 or S123 to S125 is selected according to the execution conditions. Specifically:

[0148] S123: If the verification fails, the number of traffic request messages received by each of the K servers is obtained.

[0149] It can be understood that MAC_his (denoted as MAC_his_cpt_server) is calculated according to formula (3).

[0150] If MAC_his_cpt_server ≠ MAC_his, verification failed and the N historical content traffic consumption duration information was tampered with during data transmission. In this case, the N historical content traffic consumption duration information in the traffic request message cannot represent the user's actual historical data. In other words, the N historical content traffic consumption duration information cannot accurately predict the user's viewing habits.

[0151] S124: Determine the server with the least number of messages among the K servers as the third server.

[0152] It is understandable that in the above situation, regardless of the user's viewing habits, the server with the least number of access terminals among the K servers is selected through load balancing as the third server. The number of access terminals on each server is determined by obtaining the number of traffic request packets received by each of the K servers.

[0153] S125. Send the traffic request message sent by the first terminal to the third server.

[0154] It can be understood that the load balancer forwards the traffic request message sent by the first terminal to the third server, so as to connect the first terminal to the third server.

[0155] The resource allocation method provided in the embodiment of the present application connects the first terminal to the server with the least number of connected terminals when it is determined that the user's viewing habits cannot be predicted through historical content traffic consumption time information, thereby improving the sustainability and robustness of the server.

[0156] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG4 of the present application, please refer to FIG13 , S131 further includes S1311 to S1312. Specifically:

[0157] S1311. Receive a load quantity message sent by each of the K servers.

[0158] It is understood that each of the K servers generates a load quantity message based on the number of currently connected second terminals consuming long-duration data, and each of the K servers sends the generated load quantity message to the load balancer. The load balancer receives the load quantity message sent by each of the K servers. The load quantity message can be a message used to send the load quantity, and the load quantity message can include a header and a message body. The header can be used to indicate the sending end and the receiving end, and the message body can include the load quantity.

[0159] S1312: parse the load quantity message sent by each of the K servers to obtain the load quantity of each of the K servers.

[0160] It can be understood that the load balancer parses the load quantity message based on the load quantity message sent by each of the K servers received. For example, it can remove the header of the load quantity message and extract the load quantity from the message body to obtain the load quantity of each server in the K servers.

[0161] The resource allocation method provided in the embodiment of the present application is that the load balancer obtains the load quantity of each server based on the load quantity message sent by each server, laying the foundation for the subsequent determination of the first server with the least load quantity, and distributing terminals with longer video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0162] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to FIG4 of the present application, S131 further includes S1313. Specifically:

[0163] S1313: If the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition, periodically obtain the load quantity of each server in the K servers.

[0164] It is understood that each of the K servers periodically generates a load quantity message based on the number of currently connected second terminals consuming long-duration traffic, and each of the K servers sends the generated load quantity message to the load balancer. The load balancer periodically receives the load quantity message sent by each of the K servers, parses the load quantity message, and obtains the load quantity of each of the K servers.

[0165] The resource allocation method provided in the embodiment of the present application is that the load balancer obtains the load quantity of each server based on the load quantity message sent by each server, laying the foundation for the subsequent determination of the first server with the least load quantity, and distributing terminals with longer video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0166] In an optional embodiment of the resource allocation method provided in the embodiment corresponding to Figure 4 of the present application, the traffic request message includes a traffic request timestamp, which may refer to the timestamp of sending the traffic request message to request the playback of the content. It is understandable that the load balancer forwards the traffic request message sent by the first terminal to the first server to connect the first terminal to the first server. The first server receives the traffic request message carrying the traffic request timestamp. After sending the traffic request message sent by the first terminal to the first server, please refer to Figures 14 and 15, the resource allocation method also includes S210 to S250 and S310 to S332. It should be noted that the execution subject of S210 to S250 is the first server; the execution subject of S310 to S332 is the first terminal. Specifically:

[0167] S210: Receive a traffic shutdown message sent by the first terminal.

[0168] The flow-shutdown message carries a flow-shutdown timestamp.

[0169] It is understandable that when the user finishes watching the video and exits the audio and video application, the traffic closing timestamp may be the time when the content is stopped playing, and the first terminal may send a traffic closing message carrying the traffic closing timestamp to the first server.

[0170] S220: Calculate content traffic consumption duration data according to the traffic request timestamp and the traffic shutdown timestamp.

[0171] It is understood that the first server can calculate the duration based on the traffic request timestamp carried in the traffic request message and the traffic shutdown timestamp carried in the traffic shutdown message to obtain the content traffic consumption duration data. The content traffic consumption duration data can be a specific numerical value of the traffic consumption duration of the content played. For example, the content traffic consumption duration data can be obtained by subtracting the traffic shutdown timestamp from the traffic request timestamp.

[0172] S230: Encrypt the traffic consumption duration data according to the key information to obtain content traffic consumption duration information.

[0173] It is understandable that the first server obtains the key information and encrypts the traffic consumption duration data according to the key information as shown in formula (6) to obtain the content traffic consumption duration information. The content traffic consumption duration information can be information used to reflect the duration of traffic consumed by playing the content. T_session_enc = Enc{K_share, T_session} (6);

[0174] Among them, T_session_enc is the content traffic consumption duration information, K_share is the key information, T_session is the traffic consumption duration data, and Enc{a,b} means using key a to encrypt b.

[0175] S240: Generate a content traffic consumption duration message according to the content traffic consumption duration information and the key information.

[0176] It can be understood that the first server embeds the content traffic consumption duration information and the key information into the content traffic consumption duration message, so that the content traffic consumption duration message carries the content traffic consumption duration information and the key information.

[0177] S250: Send the content traffic consumption duration message to the first terminal, so that the first terminal verifies the content traffic consumption duration information according to the key information.

[0178] If the verification is passed, the content traffic consumption duration information and key information in the content traffic consumption duration message are stored; if the verification is not passed, the content traffic consumption duration message is deleted.

[0179] S310: Receive a content traffic consumption duration message sent by a first server.

[0180] Among them, the content traffic consumption duration message carries historical content traffic consumption duration information and key information.

[0181] S320: Verify the content traffic consumption duration information according to the key information.

[0182] S331: If the verification is successful, the content traffic consumption duration information and key information in the content traffic consumption duration message are stored.

[0183] S332: If the verification fails, the content traffic consumption time message is deleted.

[0184] It is understood that the first server sends the content traffic consumption duration message to the first terminal. The first terminal verifies the content traffic consumption duration information based on the key information. If the verification is successful, the first terminal stores the content traffic consumption duration information and the key information in the content traffic consumption duration message; if the verification is unsuccessful, the first terminal deletes the content traffic consumption duration message.

[0185] In the resource allocation method provided in the embodiment of the present application, the server calculates the content traffic consumption time data, encrypts the calculated content traffic consumption time data to generate a content traffic consumption time message, and sends it to the first terminal. After the first terminal receives the content traffic consumption time message, it verifies the content traffic consumption time information. If it is determined that the video traffic consumption time information has not been tampered with, the video traffic consumption time information and key information in the content traffic consumption time message are stored as information for generating the next traffic request message, thereby improving the security of data transmission and laying the foundation for distributing terminals with longer content traffic consumption time on different servers.

[0186] For ease of understanding, please refer to Figure 16, which is a schematic diagram of the resource allocation method provided in an embodiment of the present application. The process corresponding to arrow ① is: when a session ends, the server sends the duration and other data of the session (i.e., content traffic consumption duration data) to the terminal (e.g., the aforementioned first terminal) as the user's historical information (i.e., historical content traffic consumption duration information); the process corresponding to arrow ② is: when the terminal sends a traffic request message again, it carries the above-mentioned historical information from the server; the process corresponding to arrow ③ is: when the load balancer receives the traffic request message, it extracts the above-mentioned historical information and determines whether the user tends to watch a certain content for a long time or frequently switches between viewing contents; the process corresponding to arrow ④ is: if the user tends to watch a certain content for a long time, the load balancer selects a server with less long traffic as the response server for the session; if the user tends to frequently switch between viewing contents, the load balancer selects a server with higher fluency as the response server for the session (e.g., the aforementioned first server); the selected (or allocated) server transmits traffic data to the terminal and sends the historical information such as the session duration mentioned in ① above to the terminal at the end of the session.

[0187] Please refer to Figure 17, which is a flow chart of the resource allocation method provided in an embodiment of the present application. In the method provided in an embodiment of the present application, the load balancer allocates corresponding servers to sessions based on the user's historical behavior habits. Specifically, if the user tends to watch a certain audio or video content for a long time, a server with less long traffic is allocated to provide services for the user, thereby avoiding the problem of multiple long traffic flows being concentrated on a certain server (or several servers) and causing the load to be too high for a long time; if the user tends to frequently switch the audio or video content to watch, a server with better fluency is allocated to provide services for the user, thereby avoiding the QoE degradation phenomenon such as lag caused by the terminal during frequent switching.

[0188] The method provided in the embodiments of the present application is described below from four perspectives.

[0189] (1) When the session between the server and the terminal ends, the server sends the terminal information including the video traffic consumption duration of the terminal's most recent N sessions in an encrypted manner. The details are as follows:

[0190] 1.1) The end of a session between a server and a terminal is signaled by the terminal sending a close message (connection close message) to the server, or by the user terminal failing to respond (or provide feedback or acknowledge) to a server's traffic request message for an extended period of time. Each session consists of one traffic request message.

[0191] 1.2) When the session ends, the server calculates the current video traffic consumption duration data T_session and encrypts the video traffic consumption duration data T_session using the shared key information K_share between the server and the terminal to obtain the video traffic consumption duration information T_session_enc, as shown in the following formula (1.1): T_session_enc = Enc{K_share, T_session} (1.1);

[0192] Enc{a,b} indicates that key a is used to encrypt b.

[0193] 1.3) If multiple video traffic consumption duration data T_session of the terminal (in the previous period) are included, the multiple video traffic consumption duration data T_session are encrypted using the above formula (1.1) to obtain multiple video traffic consumption duration information T_session_enc.

[0194] 1.4) In an embodiment of the present application, the duration of the most recent N sessions includes N video traffic consumption duration data T_session, which are respectively recorded as T_session_1, T_session_2, ..., T_session_N. After encryption using the above formula, the video traffic consumption duration information T_session_enc_1, T_session_enc_2, ..., T_session_enc_N are obtained respectively.

[0195] 1.5) When the session ends, the server sends a video traffic consumption duration message Pkt_history embedded with historical information such as video traffic consumption duration to the terminal. The data contained in the message is as shown in formula (1.2): Pkt_history = {MAC_his, N, T_session_enc_1, ..., T_session_enc_N} (1.2);

[0196] Wherein, MAC_his is the message authentication information of the message Pkt_history, which can be calculated by the following formula (1.3): MAC_his=MAC{K_share,N||T_session_enc_1||…||T_session_enc_N) (1.3);

[0197] Among them, MAC{A,B} represents the message authentication information calculated using key A for data B.

[0198] 1.6) In an embodiment of the present application, the server does not store the historical video traffic consumption duration information for each terminal to avoid huge storage overhead and query overhead. The historical video traffic consumption duration information of the terminal is stored in the terminal. When the terminal sends a traffic request message, the traffic request message carries the historical video traffic consumption duration information of the terminal.

[0199] 1.7) In an embodiment of the present application, when the terminal receives the video traffic consumption duration message Pkt_history at the end of the session, it reads the message verification information MAC_his and recalculates MAC_his_cpt based on the above formula (1.3); if MAC_his_cpt = MAC_his, the message verification information MAC_his, N and N video traffic consumption duration information T_session_enc are stored locally; otherwise, the video traffic consumption duration message Pkt_history message is discarded.

[0200] 1.8) In the embodiment of the present application, the value of the number N of recent sessions can be configured by the administrator and reflected in the configuration file, with a default value of 10.

[0201] (2) When the terminal sends a traffic request message Pkt_req to the server next time, it also sends the message verification information MAC_his, N, and N video traffic consumption duration information T_session_enc previously received and stored locally to the server, as follows:

[0202] 2.1) In an embodiment of the present application, the above-mentioned message verification information MAC_his, N and N video traffic consumption time information T_session_enc can be embedded in the traffic request message Pkt_req, or can be sent to the server in a separate message Pkt_ctl.

[0203] 2.2) As in steps (1.1-1.6), the server does not store the duration of these N sessions, but obtains the video traffic consumption duration data of the user terminal's most recent N sessions through the traffic request message Pkt_req or Pkt_ctl containing the message verification information MAC_his, N and N video traffic consumption duration information T_session_enc.

[0204] (3) After receiving the connection request from the terminal, the load balancer of the CDN cluster extracts the message verification information MAC_his, N and the N video traffic consumption duration information T_session_enc carried in the above traffic request message Pkt_req or Pkt_ctl, and judges the historical behavior habits of the terminal based on this information, as follows:

[0205] 3.1) The load balancer calculates the message authentication information MAC_his_cpt_server according to formula (1.3).

[0206] 3.2) If the message authentication information is the same as the message verification information, that is, MAC_his_cpt_server = MAC_his, then execute the following step 3.3); otherwise, the user's historical behavior habits are not considered.

[0207] 3.3) The load balancer decrypts the historical video traffic consumption duration information T_session_enc_1, ..., T_session_enc_N using the key information K_share to obtain the most recent N historical video traffic consumption duration data T_session_1, T_session_2, ..., T_session_N. The decryption process is shown in the following formula: T_session_i = Dec{K_share, T_session_enc_i} (1.4);

[0208] Where Dec{a,b} represents the decryption operation of data b using the key K_share;

[0209] Without loss of generality, the smaller the parameter i in T_session_i is, the closer it is to the current time.

[0210] 3.4) The load balancer determines the historical behavior habits of the terminal user based on the decrypted historical video traffic consumption duration data T_session_i, as follows:

[0211] 3.4.1) The load balancer calculates the average value T_session_avg of N historical video traffic consumption duration data T_session_i, as shown in the following formula: T_session_avg = (T_session_1 + T_session_2 + ... + T_session_N) / N (1.5);

[0212] If the historical average video traffic consumption duration T_session_avg is greater than the historical video traffic consumption duration threshold T_session_upper, it means that the user of the terminal tends to watch a certain (or several) contents for a long time, that is, the session duration between the server and the terminal user may be relatively long, and then execute the following step 3.4.2); if the historical average video traffic consumption duration T_session_avg is less than or equal to the historical video traffic consumption duration threshold T_session_upper, it means that the user of the terminal tends to frequently switch the content to watch, that is, the session duration between the server and the terminal may be relatively short, and then the terminal user is more concerned about the smoothness of the audio and video, and then execute the following step 3.4.3);

[0213] 3.4.2) If a newly connected end user tends to watch a certain (or several) audio or video contents for a long time, the load balancer will sort the servers in the CDN cluster by the number of long flows (i.e., flows with a duration exceeding the first flow duration threshold T_session_upper) and assign (forward) the newly arrived connection request to the server with the least long flows. To achieve this, the load balancer periodically obtains the current load of long flows on each server in the CDN cluster, as follows:

[0214] 3.4.2.1) The K servers in the CDN cluster determine the size of their own traffic, where the size of the traffic is determined based on the duration of the flow. When the traffic consumption duration exceeds the first traffic duration threshold T_session_upper, the traffic can be considered as long traffic.

[0215] 3.4.2.2) Table 1 shows the statistical information of each server in the CDN cluster, where the flow identifier Flow_ID_i is the unique identifier of the flow (session); the server calculates the duration of the session based on the difference between the current time and the session start time.

[0216] Table 1

[0217] 3.4.2.3) Each server Server_i in the CDN periodically sends a payload quantity message Pkt_large_i containing its own long traffic to the load balancer. After receiving the payload quantity message Pkt_large_i, the load balancer sends an acknowledgment message Pkt_large_ack_i to the corresponding server Server_i, as shown in Figure 18.

[0218] 3.4.3) If a newly connected terminal user tends to frequently switch between the audio and video content they watch, the load balancer selects a server in the CDN cluster with better audio and video performance to serve the terminal user, as follows:

[0219] 3.4.3.1) In the embodiments of the present application, "smoothness" is reflected by the clarity of audio and video. The higher the clarity, the lower the smoothness; the lower the clarity, the higher the smoothness.

[0220] 3.4.3.2) In a CDN server cluster, the same video can be stored at different resolutions. These resolutions are typically stored in two ways: First, after the video is encoded, the high-resolution video and the low-resolution video are stored on the same server; second, after the video is encoded, the high-resolution video and the low-resolution video are stored on different servers.

[0221] 3.4.3.3) If the load balancer detects that the user's behavior habit is to frequently switch viewing content (i.e., T_session_avg is less than the threshold T_session_lower), it chooses to obtain low-definition (i.e., smooth) video to respond to the traffic request message.

[0222] When high-definition and low-definition videos are stored on the same server (as shown in Figure 5), the load balancer forwards the connection request from the terminal to the server, where the load balancer adds a content clarity identifier Mark to the above connection traffic request message, where the identifier occupies 1 bit. When the value is binary 1, it means that smooth (low-definition) video traffic is sent to the terminal.

[0223] When high-definition and low-definition videos are stored on different servers, the load balancer forwards the traffic request message from the terminal to the server storing the low-definition video.

[0224] 3.4.3.4) The servers in the CDN cluster periodically feed back the videos stored on the servers and their resolutions to the load balancer, so that the load balancer can find low-resolution videos when responding to terminal requests that frequently switch audio and video content.

[0225] (4) When the server receives the traffic request message forwarded by the load balancer, it checks whether there is a Mark identifier in the traffic request message. If it exists and the value is binary 1, it sends low-definition video to the terminal; otherwise, it responds to the interrupted user's request in the normal traffic transmission method.

[0226] The method provided in the embodiment of the present application allocates corresponding servers to sessions based on the user's historical behavior habits. Specifically, if the terminal user tends to watch a certain audio and video content for a long time, a server with fewer long streams is allocated to provide services for it, so as to avoid the problem of multiple long streams being clustered on a certain (or several) servers causing a long-term high load; if the terminal user tends to frequently switch the audio and video content to watch, a server with better fluency is allocated to provide services for it, so as to avoid the QoE degradation phenomenon such as freezes caused by the frequent switching of the user terminal. The embodiment of the present application is designed to perform load balancing operations based on the user's historical behavior habits, so as to avoid the problem of multiple long streams being clustered on a certain (or several) servers causing a long-term high load; at the same time, for users who frequently switch audio and video resources and do not pay much attention to the audio and video clarity, the present application can select audio and video resources with higher fluency for these users. Under cost constraints, it can greatly improve the client's business experience and is conducive to improving the sustainability and robustness of the CDN manufacturer's service capabilities.

[0227] The resource allocation device in the present application is described in detail below, with reference to Figure 19. Figure 19 is a schematic diagram of an embodiment of a resource allocation device 10 in the present application, and the resource allocation device 10 includes:

[0228] The traffic request message receiving module 110 is configured to receive a traffic request message sent by the first terminal, wherein the traffic request message carries N historical content traffic consumption duration information, where N is an integer greater than 1;

[0229] The traffic consumption duration average calculation module 120 is configured to determine a content traffic consumption duration feature of the first terminal based on N pieces of historical content traffic consumption duration information.

[0230] The load quantity acquisition module 131 is configured to acquire the load quantity of each of the K servers if the content traffic consumption duration characteristic meets the historical content traffic consumption duration condition.

[0231] Among them, the load quantity of each server is the number of second terminals accessed by the server, and the second terminal refers to a terminal whose traffic consumption duration accessed by the server is greater than the first traffic duration threshold, and K is an integer greater than 1.

[0232] The first server determination module 133 is configured to determine the server with the least load among the K servers as the first server.

[0233] The traffic request message first forwarding module 135 is configured to send the traffic request message sent by the first terminal to the first server.

[0234] A certain embodiment of the present application provides a resource allocation device, which compares the content traffic consumption duration characteristics corresponding to the N historical content traffic consumption duration information of the first terminal with the historical content traffic consumption duration condition. If the content traffic consumption duration characteristics meet the historical content traffic consumption duration condition, the server with the smallest load among the K servers is determined to be the first server, and the traffic request message of the first terminal is sent to the first server to connect the first terminal to the first server. Through the method provided in the embodiment of the present application, terminals with longer content traffic consumption duration are dispersed in different servers, avoiding the problem of service interruption caused by excessive server overload caused by multiple terminals with longer content traffic consumption duration being concentrated on certain servers, thereby improving the continuity and robustness of the server.

[0235] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, refer to FIG. 20 , the traffic request message also carries content identification information. The resource allocation device further includes:

[0236] The content acquisition module 132 is configured to acquire the content stored in each of the K servers and the clarity of each content if the content traffic consumption duration characteristic does not meet the historical content traffic consumption duration condition.

[0237] The second server determination module 134 is configured to determine a second server from the K servers according to the content identification information.

[0238] The second server is a server storing content that is the same as the content to be processed indicated by the content identification information and has a clarity lower than a clarity threshold.

[0239] The traffic request message second forwarding module 136 is configured to send the traffic request message sent by the first terminal to the second server.

[0240] A certain embodiment of the present application provides a resource allocation device, which compares the content traffic consumption duration characteristics corresponding to the N historical content traffic consumption duration information of the terminal with the historical content traffic consumption duration condition. If the content traffic consumption duration characteristics meet the historical content traffic consumption duration condition, the first server with the smallest load among the K servers is determined, and the traffic request message of the first terminal is sent to the first server to connect the first terminal to the first server; if the content traffic consumption duration characteristics do not meet the historical content traffic consumption duration condition, the second server that stores the to-be-processed content with low clarity among the K servers is determined, and the traffic request message of the first terminal is sent to the second server to connect the first terminal to the second server. Through the method provided in the embodiment of the present application, terminals with longer content traffic consumption duration are dispersed among different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer content traffic consumption duration on certain servers. By selecting a server with lower clarity and higher fluency for users who frequently switch content, the phenomenon of stuck segments caused by users frequently switching videos is avoided; the server to which the terminal is connected is determined based on the user's behavioral habits, thereby improving the continuity and robustness of the server.

[0241] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 20 of the present application, the traffic request message second forwarding module 136 is further configured to:

[0242] The clarity of the to-be-processed content stored in the second server is obtained.

[0243] If the second server stores at least two to-be-processed contents with different definitions, a definition mark is added to the traffic request message, and the traffic request message carrying the definition mark is sent to the second server.

[0244] The definition mark is added to instruct the second server to send the to-be-processed content with a definition lower than a definition threshold to the first terminal.

[0245] If the clarity of all the to-be-processed contents stored in the second server is lower than the clarity threshold, the traffic request message sent by the first terminal is sent to the second server.

[0246] An embodiment of the present application provides a resource allocation device that selects a server with lower clarity and higher fluency for users who frequently switch to watch videos, thereby avoiding the stuck phenomenon caused by users frequently switching videos and improving the continuity and robustness of the server.

[0247] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 20 of the present application, the content acquisition module 132 is further configured to periodically acquire the content stored in each of the K servers and the clarity of each content.

[0248] The resource allocation device provided in the embodiment of the present application periodically obtains the video resources stored on each server and the clarity of each video resource, and selects the server that stores the target video with low clarity as the second server, thereby avoiding the stuck phenomenon caused by the user frequently switching videos.

[0249] In an optional embodiment, the content traffic consumption duration characteristic is the average content traffic consumption duration, and the historical content traffic consumption duration condition is that the average content traffic consumption duration is greater than the historical content traffic consumption duration threshold.

[0250] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG19 of the present application, the traffic request message also includes key information and message verification information. The traffic consumption duration average calculation module 120 is further used to:

[0251] Based on the key information and message verification information, the N historical content traffic consumption duration information is verified.

[0252] If the verification is passed, the content traffic consumption duration characteristics are calculated based on the N historical content traffic consumption duration information.

[0253] The resource allocation device provided in the embodiment of the present application embeds key information and message verification information in the traffic request message, and determines through the message verification information that the N historical video traffic consumption duration information in the transmission traffic request message has not been tampered with, thereby ensuring the accuracy of data during information transmission and improving data security during transmission.

[0254] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, the traffic consumption duration average calculation module 120 is further configured to:

[0255] Calculate the message authentication information of N historical content traffic consumption duration information based on the key information.

[0256] If the message authentication information is the same as the message verification information, the verification is successful.

[0257] If the message authentication information is different from the message verification information, the verification fails.

[0258] The resource allocation device provided in the embodiment of the present application embeds key information and message verification information in the traffic request message, and determines through the message verification information that the N historical video traffic consumption duration information in the transmission traffic request message has not been tampered with, thereby ensuring the accuracy of data during information transmission and improving data security during transmission.

[0259] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, if the content traffic consumption duration feature is the average content traffic consumption duration, the traffic consumption duration average calculation module 120 is further configured to:

[0260] The N historical content traffic consumption duration information is decrypted according to the key information to obtain the N historical content traffic consumption duration data.

[0261] Calculate the average of N historical content traffic consumption duration data to obtain the content traffic consumption duration characteristics.

[0262] The resource allocation device provided in the embodiment of the present application decrypts the historical video traffic consumption time information through key information, calculates the average of the decrypted historical video traffic consumption time data, determines the user's behavior habits through the relationship between the average of the historical video traffic consumption time data and the historical video traffic consumption time threshold, and then determines the server to which the terminal is connected through the user's behavior habits, thereby improving the sustainability and robustness of the server.

[0263] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, the traffic consumption duration average calculation module 120 further includes:

[0264] The flow request message quantity acquisition module 123 is used to acquire the message quantity of the flow request messages received by each server in the K servers when the verification fails.

[0265] The third server determining module 124 is configured to determine the server with the least number of messages among the K servers as the third server.

[0266] The traffic request message third forwarding module 125 is configured to send the traffic request message sent by the first terminal to the third server.

[0267] The resource allocation device provided in the embodiment of the present application connects the terminal to the server with the least number of connected terminals when it is determined that the user's viewing habits cannot be predicted through historical video traffic consumption time information, thereby improving the sustainability and robustness of the server.

[0268] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, the load quantity acquisition module 131 is further configured to:

[0269] Receive the load quantity message sent by each of the K servers;

[0270] The load quantity message sent by each of the K servers is parsed to obtain the load quantity of each of the K servers.

[0271] In the resource allocation device provided in the embodiment of the present application, the load balancer obtains the load quantity of each server based on the load quantity message sent by each server, laying the foundation for the subsequent determination of the first server with the least load quantity, and distributing terminals with longer video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0272] In an optional embodiment of the resource allocation device provided by the embodiment corresponding to FIG. 19 of the present application, the load quantity acquisition module 131 is further used to periodically acquire the load quantity of each of the K servers.

[0273] In the resource allocation device provided in the embodiment of the present application, the load balancer obtains the load quantity of each server based on the load quantity message sent by each server, laying the foundation for the subsequent determination of the first server with the least load quantity, and distributing terminals with longer video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with longer video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0274] In an optional embodiment of the resource allocation device provided in the embodiment corresponding to FIG. 19 of the present application, refer to FIG. 21 , the flow request message includes a flow request timestamp. The resource allocation device 10 further includes:

[0275] The flow closing message receiving module 210 is configured to receive a flow closing message sent by the first terminal.

[0276] The flow-shutdown message carries a flow-shutdown timestamp.

[0277] The traffic consumption duration data calculation module 220 is used to calculate the content traffic consumption duration data according to the traffic request timestamp and the traffic closing timestamp.

[0278] The encryption module 230 is used to encrypt the traffic consumption duration data according to the key information to obtain the content traffic consumption duration information.

[0279] The traffic consumption duration message generation module 240 is configured to generate a content traffic consumption duration message according to the content traffic consumption duration information and the key information.

[0280] The traffic consumption duration information verification module 250 is configured to send the content traffic consumption duration message to the first terminal, so that the first terminal verifies the content traffic consumption duration information according to the key information.

[0281] If the verification is passed, the content traffic consumption duration information and key information in the content traffic consumption duration message are stored; if the verification is not passed, the content traffic consumption duration message is deleted.

[0282] In the resource allocation device provided in the embodiment of the present application, the server calculates the content traffic consumption duration data, encrypts the calculated data, generates a content traffic consumption duration message, and sends it to the first terminal. After receiving the content traffic consumption duration message, the first terminal verifies the content traffic consumption duration information. If it is determined that the content traffic consumption duration information has not been tampered with, the content traffic consumption duration information and key information in the content traffic consumption duration message are stored as information for generating the next traffic request message, thereby improving the security of data transmission and laying the foundation for distributing terminals with longer content traffic consumption durations on different servers.

[0283] Figure 22 is a schematic diagram of a server structure provided in an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 322 (for example, one or more processors) and memories 332, and one or more storage media 330 (for example, one or more mass storage devices) for storing application programs 342 or data 344. Among them, the memories 332 and the storage media 330 may be temporary storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.

[0284] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2003 or Windows Server 2003R. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0285] The steps executed by the server in the above embodiment can be based on the server structure shown in Figure 22.

[0286] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0287] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0288] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0289] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0290] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0291] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A resource allocation method, the method being executed by a computer device, comprising: Receive a traffic request message sent by the first terminal, wherein the traffic request message carries N historical content traffic consumption duration information, where N is an integer greater than 1; Determine a content traffic consumption duration feature of the first terminal according to the N historical content traffic consumption duration information; If the content traffic consumption duration feature meets the historical content traffic consumption duration condition, then the load quantity of each server in the K servers is obtained, wherein the load quantity of each server is the number of second terminals connected to the server, and the second terminal refers to a terminal whose traffic consumption duration connected to the server is greater than the first traffic duration threshold, and K is an integer greater than 1; Determine the server with the least load among the K servers as the first server; The traffic request message sent by the first terminal is sent to the first server.

2. The resource allocation method according to claim 1, wherein the traffic request message further carries content identification information; After determining the content traffic consumption duration feature of the first terminal according to the N historical content traffic consumption duration information, the method further includes: If the content traffic consumption duration feature does not meet the historical content traffic consumption duration condition, then obtaining the content stored in each of the K servers and the clarity of each content; Determining a second server from the K servers according to the content identification information, wherein the second server is a server storing content that is the same as the content to be processed indicated by the content identification information and has a clarity lower than a clarity threshold; The traffic request message sent by the first terminal is sent to the second server.

3. The resource allocation method according to claim 2, wherein sending the traffic request message to the second server comprises: Acquire the clarity of the content to be processed stored in the second server; If the second server stores at least two to-be-processed contents with different clarity, after adding a clarity mark in the traffic request message, the traffic request message carrying the clarity mark is sent to the second server, wherein the added clarity mark is used to instruct the second server to send the to-be-processed contents with a clarity lower than a clarity threshold to the first terminal; If the clarity of all the to-be-processed contents stored in the second server is lower than the clarity threshold, the traffic request message sent by the first terminal is sent to the second server.

4. The resource allocation method according to claim 2 or 3, wherein obtaining the content stored in each of the K servers and the definition of each content comprises: Periodically obtain the content stored in each of the K servers and the clarity of each content.

5. According to the resource allocation method as described in any one of claims 1-4, the content traffic consumption duration characteristic is the average content traffic consumption duration, and the historical content traffic consumption duration condition is that the average content traffic consumption duration is greater than the historical content traffic consumption duration threshold.

6. The resource allocation method according to any one of claims 1 to 5, wherein the traffic request message further includes key information and message verification information; The determining, according to the N pieces of historical content traffic consumption duration information, a content traffic consumption duration feature of the first terminal includes: Verifying the N historical content traffic consumption duration information according to the key information and the message verification information; If the verification is passed, the content traffic consumption duration characteristics are calculated based on the N historical content traffic consumption duration information.

7. The resource allocation method according to claim 6, wherein the verification of the N historical content traffic consumption duration information according to the key information and the message verification information comprises: Calculate the message authentication information of the N historical content traffic consumption duration information according to the key information; If the message authentication information is the same as the message verification information, the verification is passed; If the message authentication information is different from the message verification information, the verification fails.

8. The resource allocation method according to claim 6 or 7, if the content traffic consumption duration feature is a mean content traffic consumption duration, the content traffic consumption duration feature is calculated based on the N historical content traffic consumption duration information, comprising: Decrypt the N historical content traffic consumption duration information according to the key information to obtain N historical content traffic consumption duration data; Calculate the average of the N historical content traffic consumption duration data to obtain the content traffic consumption duration feature.

9. The resource allocation method according to any one of claims 6 to 8, after verifying the N historical content traffic consumption duration information according to the key information and the message verification information, further comprising: If the verification fails, the number of traffic request messages received by each of the K servers is obtained; Determine the server with the least number of messages among the K servers as the third server; The traffic request message sent by the first terminal is sent to the third server.

10. The resource allocation method according to any one of claims 1 to 9, wherein obtaining the load quantity of each server in the K servers comprises: Receiving a load quantity message sent by each of the K servers; The load quantity message sent by each of the K servers is parsed to obtain the load quantity of each of the K servers.

11. The resource allocation method according to any one of claims 1 to 10, wherein the flow request message comprises a flow request timestamp; After sending the traffic request message sent by the first terminal to the first server, the method further includes: Receiving a flow shutdown message sent by the first terminal, wherein the flow shutdown message carries a flow shutdown timestamp; Calculate content traffic consumption duration data according to the traffic request timestamp and the traffic shutdown timestamp; Encrypting the traffic consumption duration data according to the key information to obtain content traffic consumption duration information; Generate a content traffic consumption duration message according to the content traffic consumption duration information and the key information; The content traffic consumption duration message is sent to the first terminal, so that the first terminal verifies the content traffic consumption duration information according to the key information; if the verification is passed, the content traffic consumption duration information and the key information in the content traffic consumption duration message are stored; if the verification is not passed, the content traffic consumption duration message is deleted.

12. The resource allocation method according to any one of claims 1 to 11, wherein obtaining the load quantity of each server in the K servers comprises: The load quantity of each server in the K servers is periodically obtained.

13. A resource allocation device, the device being deployed on a computer device, comprising: A flow request message receiving module, used to receive a flow request message sent by the first terminal, wherein the flow request message carries N historical content flow consumption duration information, where N is an integer greater than 1; A traffic consumption duration average calculation module, configured to determine a content traffic consumption duration feature of the first terminal according to the N historical content traffic consumption duration information; A load quantity acquisition module, used for acquiring the load quantity of each server in K servers if the content traffic consumption duration feature meets the historical content traffic consumption duration condition, wherein the load quantity of each server is the number of second terminals connected to the server, and the second terminal refers to a terminal whose traffic consumption duration connected to the server is greater than the first traffic duration threshold, and K is an integer greater than 1; A first server determination module, configured to determine a server with the least load among the K servers as a first server; The flow request message first forwarding module is used to send the flow request message sent by the first terminal to the first server.

14. A computer device comprising: memories, transceivers, processors, and bus systems; Wherein, the memory is used to store computer programs; The processor is used to execute the computer program in the memory, including executing the resource allocation method according to any one of claims 1 to 12; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

15. A computer-readable storage medium comprising a computer program, which, when executed on a computer, enables the computer to execute the resource allocation method according to any one of claims 1 to 12.

16. A computer program product, comprising a computer program, wherein the resource allocation method according to any one of claims 1 to 12 is executed by a processor through the computer program.

Citation Information

Patent Citations

  • Load balancing method and system

    CN109819057A

  • Audio and video stream load balancing method and device

    CN111193788A

  • Load balancing method and system for streaming media server

    CN111654526A

  • Video watching time length prediction method and device, storage medium and terminal

    CN113132803A

  • Method for providing content caching service in adapted streaming service and local caching device thereof

    KR1020180090967A