Resource allocation method and related device

By calculating the average historical content traffic consumption time and load quantity of the terminal, the target server with the least load is determined, and the traffic request is forwarded to the server. This solves the problem of server load imbalance in the existing technology and improves the sustainability and robustness of the system. Great sex.

CN118677903APending Publication Date: 2024-09-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310291706.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-14
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing load balancing technology fails to effectively consider the behavioral habits of end users, resulting in server load imbalance and possible service interruption.

Method used

By receiving the traffic request message sent by the terminal, the average value of historical content traffic consumption is calculated, and the most suitable target server is determined based on the average value and load quantity, and the traffic request is forwarded to the server with the least load to disperse the long-term traffic.

Benefits of technology

This effectively avoids server overload, improves system continuity and robustness, and prevents service interruptions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677903A
    Figure CN118677903A
Patent Text Reader

Abstract

The invention provides a resource allocation method and a related device. The embodiment of the invention can be applied to the technical field of load balancing. The invention provides a resource allocation method, which comprises the following steps of: comparing a historical content traffic consumption duration mean value corresponding to N pieces of historical content traffic consumption duration information of a terminal with a historical content traffic consumption duration threshold value; and if the content traffic consumption duration of the terminal is longer, determining a first target server with the minimum load number in the K servers, and sending the traffic request message of the terminal to the first target server, so as to access the terminal to the first target server. The problem of service interruption caused by overhigh server overload due to the fact that a plurality of terminals with long content traffic consumption time are concentrated in some servers is avoided, and the continuity and robustness of the servers are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a resource allocation method and related devices. Background Art

[0002] With the continuous development of audio and video information technology, more and more forms of audio and video services have emerged, such as short video services, online live broadcast services, audio and video on demand services, audio and video calls, etc., which not only bring visual experience to users but also enrich their lives. Audio and video services mainly rely on network transmission services, so the transmission process of audio and video data is crucial.

[0003] When a user chooses to watch audio or video, the user terminal sends a traffic request message to the load balancer, and 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 of the server will be higher than that of other servers. The uneven distribution of servers caused by long-term resource occupation can easily cause service interruptions for servers with excessive load. Summary of the invention

[0004] The embodiments of the present application provide 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 service interruption caused by excessive server overload caused by the concentration of multiple terminals that consume content traffic for a long time on certain servers.

[0005] One aspect of the present application provides a resource allocation method, comprising:

[0006] A flow request message sent by a receiving terminal is received, wherein the flow request message carries N historical content flow consumption duration information, where N is an integer greater than 1;

[0007] Determine the average value of the historical content traffic consumption duration corresponding to the terminal according to the N historical content traffic consumption duration information in the traffic request message;

[0008] If the average of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, then the load quantity of each server in the K servers is obtained, where the load quantity is the number of terminals consuming long traffic connected to the server, and long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1;

[0009] According to the K load quantities corresponding to the K servers, determine the first target server with the least load quantity;

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

[0011] Another aspect of the present application provides a resource allocation device, comprising:

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

[0013] The flow consumption duration average calculation module is used to determine the average of the historical content flow consumption duration corresponding to the terminal according to the N historical content flow consumption duration information in the flow request message;

[0014] A load quantity acquisition module, used for acquiring the load quantity of each server in K servers when the average value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, wherein the load quantity is the number of terminals consuming long traffic connected to the server, and long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1;

[0015] A first target server determination module, used to determine a first target server with the least load quantity according to the K load quantities corresponding to the K servers;

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

[0017] In another implementation of the embodiment of the present application, the traffic request message further carries target content identification information; and the resource allocation device further includes:

[0018] A content resource acquisition module, used to acquire the content resources stored in each server of the K servers and the clarity of each content resource when the average value of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold;

[0019] A second target server determination module, used to determine a second target server from the K servers according to the target content identification information, wherein the second target server is a server storing target content whose clarity is lower than a clarity threshold;

[0020] The second traffic request message forwarding module is used to send the traffic request message sent by the terminal to the second target server.

[0021] In another implementation of the embodiment of the present application, the second traffic request message forwarding module is further used to:

[0022] Acquire the clarity of the target content stored in the second target server;

[0023] If the second target server stores at least two target contents with different clarity, after adding a clarity mark in the traffic request message, the traffic request message is sent to the second target server, wherein the added clarity mark is used to instruct the second target server to send the target content with a clarity lower than a clarity threshold to the terminal;

[0024] If the second target server stores target content whose clarity is lower than the clarity threshold, the traffic request message sent by the terminal is sent to the second target server.

[0025] In another implementation of the embodiment of the present application, the content resource acquisition module is also used to periodically acquire the content resources stored in each of the K servers and the clarity of each content resource.

[0026] In another implementation of the embodiment of the present application, the traffic request message also includes key information and message verification information; the traffic consumption duration average calculation module is also used to:

[0027] Verify the N historical content traffic consumption duration information in the traffic request message according to the key information and the message verification information;

[0028] If the verification is passed, the average of the historical content traffic consumption duration is calculated based on the N historical content traffic consumption duration information.

[0029] In another implementation of the embodiment of the present application, the traffic consumption duration average calculation module is further used to:

[0030] Calculate the message authentication information of N historical content traffic consumption duration information according to the key information;

[0031] If the message authentication information is equal to the message verification information, the verification is passed;

[0032] If the message authentication information is not equal to the message verification information, verification fails.

[0033] In another implementation of the embodiment of the present application, the traffic consumption duration average calculation module is further used to:

[0034] Decrypt the N historical content traffic consumption duration information according to the key information to obtain the N historical content traffic consumption duration decrypted data;

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

[0036] In another implementation of the embodiment of the present application, the resource allocation device further includes:

[0037] A flow request message quantity acquisition module is used to obtain the number of flow request messages received by each server in the K servers when verification fails;

[0038] A third target server determination module, used to determine a third target server from the K servers, wherein the third target server is a server that receives the least number of traffic request messages among the K servers;

[0039] The third flow request message forwarding module is used to send the flow request message sent by the terminal to the third target server.

[0040] In another implementation of the embodiment of the present application, the load quantity acquisition module is further used to:

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

[0042] According to the load quantity message sent by each of the K servers, the load quantity of each of the K servers is obtained.

[0043] In another implementation of the embodiment of the present application, the traffic request message includes a traffic request timestamp; the resource allocation device further includes:

[0044] A flow shutdown message receiving module, used for receiving a flow shutdown message sent by a terminal, wherein the flow shutdown message carries a flow shutdown timestamp;

[0045] A flow consumption duration data calculation module is used to calculate the content flow consumption duration data according to the flow request timestamp and the flow closing timestamp;

[0046] An encryption module, used to encrypt the traffic consumption duration data according to the key information to obtain the content traffic consumption duration information;

[0047] A traffic consumption duration message generation module, used to generate a content traffic consumption duration message according to the content traffic consumption duration information and key information;

[0048] The traffic consumption duration information verification module is used to send the content traffic consumption duration message to the terminal so that the terminal verifies the content traffic consumption duration information according to the key information;

[0049] in,

[0050] If the verification is passed, the content flow consumption duration information and key information in the content flow consumption duration message are stored;

[0051] If the verification fails, the content traffic consumption time message is deleted.

[0052] In another implementation of the embodiment of the present application, the load quantity acquisition module is further used to:

[0053] Periodically obtain the load quantity of each of the K servers.

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

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

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

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

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

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

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

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

[0062] The present application provides a resource allocation method and related devices, the method comprising: first, receiving a traffic request message sent by a terminal, wherein the traffic request message carries N historical content traffic consumption duration information; second, determining the average historical content traffic consumption duration corresponding to the terminal according to the N historical content traffic consumption duration information in the traffic request message; then, if the average historical content traffic consumption duration is greater than a historical content traffic consumption duration threshold, obtaining the load quantity of each server in K servers, wherein the load quantity is the number of terminals consuming long traffic connected to the server, and long traffic refers to traffic with a traffic consumption duration greater than a first traffic duration threshold; then, determining a first target server with the least load quantity according to the K load quantities corresponding to the K servers; finally, sending the traffic request message sent by the terminal to the first target server. An embodiment of the present application provides a resource allocation method, by comparing the average of historical content traffic consumption durations corresponding to N historical content traffic consumption duration information of the terminal with a historical content traffic consumption duration threshold. If the average of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, the first target server with the smallest load among the K servers is determined, and the traffic request message of the terminal is sent to the first target server to connect the terminal to the first target server. Through the method provided in the embodiment of the present application, terminals with longer content traffic consumption durations are dispersed in different servers, thereby avoiding the problem of service interruption caused by excessive server overload due to the concentration of multiple terminals with longer content traffic consumption durations on certain servers, thereby improving the continuity and robustness of the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 A schematic diagram of CDN server load balancing provided in an embodiment of the present application;

[0064] Figure 2 A schematic diagram of server load differentiation provided for an embodiment of the present application;

[0065] Figure 3 A schematic diagram of a resource allocation system provided in an embodiment of the present application;

[0066] Figure 4 A flowchart of a resource allocation method provided in an embodiment of the present application;

[0067] Figure 5 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0068] Figure 6 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0069] Figure 7A schematic diagram of storing high-definition and low-definition resources on the same server provided in an embodiment of the present application;

[0070] Figure 8 A schematic diagram of storing high-definition and low-definition resources on different servers provided in an embodiment of the present application;

[0071] Fig. 9 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0072] Fig.10 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0073] Fig.11 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0074] Fig.12 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0075] Fig.13 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0076] Fig.14 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0077] Fig.15 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0078] Fig.16 A schematic diagram of a resource allocation method provided by another embodiment of the present application;

[0079] Fig.17 A flowchart of a resource allocation method provided in another embodiment of the present application;

[0080] Fig.18 A schematic diagram of data transmission between a server and a load balancer provided in an embodiment of the present application;

[0081] Fig.19 A schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;

[0082] Fig. 20 A schematic diagram of the structure of a resource allocation device provided in another embodiment of the present application;

[0083] Fig.21 A schematic diagram of the structure of a resource allocation device provided in another embodiment of the present application;

[0084] Fig. 22 A schematic diagram of a server structure provided for a certain embodiment of the present application. DETAILED DESCRIPTION

[0085] An embodiment of the present application provides a resource allocation method, which disperses terminals with long content traffic consumption time in different servers, avoids the problem of service interruption caused by server overload caused by multiple terminals with long content traffic consumption time being concentrated on certain servers, and improves the continuity and robustness of the server.

[0086] 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 sequence. 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 be implemented in an order other than those illustrated or described herein, for example. 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 inherent to these processes, methods, products or devices.

[0087] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources in a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which is used on demand and flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0088] Cloud computing refers to the delivery and use model of IT infrastructure, which means obtaining required resources through the network in an on-demand and easily scalable manner; in a broad sense, cloud computing refers to the delivery and use model of services, which means obtaining required services through the network in an on-demand and easily scalable manner. This service can be related to IT and software, the Internet, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.

[0089] With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model from a conceptual perspective.

[0090] 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 explained here:

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

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

[0093] QoE (Quality of Experience): refers to the user's subjective perception of the quality and performance of equipment, networks and systems, applications or services. QoE refers to the user's perceived ease of completing the entire process.

[0094] QoS (Quality of Services): refers to a network's ability to use various basic technologies to provide better service capabilities for specified network communications. It is a network security mechanism and a technology used to solve problems such as network delays and congestion. QoS guarantees are very important for networks with limited capacity, especially for streaming multimedia applications such as VoIP and IPTV, because these applications often require a fixed transmission rate and are also sensitive to delays.

[0095] RTT (Round-Trip Time): It is an important performance indicator in computer networks, indicating the total delay from the time the sender sends data to the time the sender receives confirmation from the receiver (the receiver sends confirmation immediately after receiving the data).

[0096] IP (Internet Protocol) is a network layer protocol in the TCP / IP system. The purpose of designing IP is to improve the scalability of the network: first, to solve Internet problems and realize the interconnection of large-scale, heterogeneous networks; second, to separate the coupling relationship between top-level network applications and bottom-level network technologies to facilitate the independent development of the two. Based on the end-to-end design principle, IP only provides a connectionless, unreliable, best-effort data packet transmission service for the host.

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

[0098] Load balancing is an important means to balance the load of each device in the CDN cluster and avoid service interruption caused by the degradation of traffic transmission performance or even device downtime due to excessive overhead of a single device. In the relevant technology, in the CDN cluster, when the user terminal sends a traffic request message, the role of the load balancer is to "evenly" map these connection requests to different CDN servers, avoiding the excessive load caused by a single server responding to traffic requests and even service interruption caused by device downtime. The load balancer is an important way to improve the robustness of the system and ensure service continuity.

[0099] like Figure 1As shown, the 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 to create connections and subsequent traffic transmission. In this way, the servers in each CDN cluster can only provide services for a few (rather than all) user terminals, because even if there are a lot of concurrent traffic, each CDN server will not cause service interruption due to excessive load. The above load balancer is also an important means to resist 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.

[0100] A load balancer can be a single device or it can integrate load balancing functions into existing devices (such as gateways). Load balancing algorithms are mainly divided into the following categories:

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

[0102] (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 according to the connection request of different clients, such as Figure 1 As shown, for connection requests from 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.

[0103] (3) Hash method, that is, 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 sport. When the load balancer receives a connection request from the client, it performs the calculation of formula (1) to obtain the server ID (Server_ID);

[0104] Server_ID = Hash(src||sport) (1)

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

[0106] The existing load balancing algorithms fail to fully consider the differences in connection duration, overhead, etc. caused by the behavioral habits of the client, which makes the existing load balancing algorithms unable to achieve good load balancing between the servers. For example, if a terminal user prefers to watch a certain (some) live video 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 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 when the existing load balancer performs the load balancing operation at the beginning of the connection, it fails to fully consider the behavioral habits of the terminal user corresponding to the connection, which easily causes the phenomenon of long-term resource occupation.

[0107] like Figure 2 As shown, after receiving connection requests from multiple user terminals, the load balancer uses existing methods to distribute these requests to servers 1 and 2. However, since the user's behavior habits are not taken into account in the above load balancing process, the following results may occur: the duration of the stream allocated to server 2 is long, while the duration of the stream allocated to server 1 is short, which 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, causing long-term consumption of the resources of server 2). When a new connection request arrives, the load balancer selects the corresponding server again according to round-robin, hash, random and other methods. At this time, the load of server 2, which was originally very high, may become higher with the arrival of new connection requests, and may even cause service interruption and other problems.

[0108] In order to solve the problem of different server load occupancy caused by different session durations, the embodiment of the present application proposes 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 streams occupying a certain server load for a long time and causing service interruption caused by the existing method. Compared with the existing indiscriminate load balancing method that does not consider the user's audio and video viewing behavior habits, the method provided by the embodiment of the present application can fully consider the historical information of the terminal users, and evenly distribute the sessions of the terminal users who tend to watch for a long time among the servers, thereby avoiding the problem of multiple long streams "clustering" on a certain server causing the server to be overloaded, which is conducive to improving the continuity and robustness of the CDN manufacturer's service capabilities.

[0109] For easier understanding, see Figure 3 , Figure 3 FIG. 1 is an application environment diagram of the resource allocation method in the embodiment of the present application, such as Figure 3 As shown, 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, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a 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 embodiments of the present application are not limited here.

[0110] The load balancer first receives a traffic request message sent by the 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 average historical content traffic consumption duration corresponding to the terminal based on the N historical content traffic consumption duration information in the traffic request message. Then, if the average historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, the load balancer obtains the load quantity of each server in the K servers. Among them, the load quantity is the number of terminals that consume long traffic connected to the server, and long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1. Then, the load balancer determines the first target server with the least load quantity based on the K load quantities corresponding to the K servers; finally, the load balancer sends the traffic request message sent by the terminal to the first target server.

[0111] The following is an introduction to the resource allocation method in this application from the perspective of the load balancer. Figure 4 The resource allocation method provided in the embodiment of the present application includes: step S110 to step S135. Specifically:

[0112] S110: Receive a flow request message sent by a terminal.

[0113] The traffic request message carries N pieces of historical content traffic consumption duration information, where N is an integer greater than 1.

[0114] It is understandable that when a terminal starts an audio or video application, the terminal sends a traffic request message, which carries N historical content traffic consumption duration information. The historical content traffic consumption duration information refers to the encrypted information of the traffic duration data consumed by the audio or video recently watched by the user using the terminal. The historical content traffic consumption duration information is stored in the user terminal. The load balancer receives the traffic request message sent by the terminal.

[0115] S120: Determine an average value of the historical content traffic consumption duration corresponding to the terminal according to N pieces of historical content traffic consumption duration information in the traffic request message.

[0116] It can be understood that the load balancer first decrypts the N historical content traffic consumption time information to obtain N historical content traffic consumption time decrypted data corresponding to the N historical content traffic consumption time information; then, calculates the average based on the N historical content traffic consumption time decrypted data to obtain the average historical content traffic consumption time.

[0117] S131. If the average value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, the load quantity of each server in the K servers is obtained.

[0118] Among them, the load quantity is the number of terminals consuming long traffic connected to the server, long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1.

[0119] It is understandable that if the mean value of the historical content traffic consumption time is greater than the historical content traffic consumption time threshold, it means that the user's behavior habit for audio and video is to watch long videos (for example, watching a certain (some) video live broadcasts for a long time), and the video viewing time is relatively long (that is, there is rarely frequent switching of live content). In this process, the connection between the user terminal and the server survives 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 quantity of each server in the K servers to determine the current number of terminals consuming long traffic of each server, that is, to determine the number of terminals that have been connected to each server and are watching long videos.

[0120] S133. Determine the first target server with the least load quantity according to the K load quantities corresponding to the K servers.

[0121] It can be understood that the load balancer selects the server with the least load quantity from the K load quantities corresponding to the K servers as the first target server.

[0122] S135. Send the traffic request message sent by the terminal to the first target server.

[0123] It can be understood that the load balancer forwards the traffic request message sent by the terminal to the first target server to connect the terminal to the first target server.

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

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

[0126] In this application Figure 4 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Figure 5The traffic request message also carries target content identification information. The target content identification information is used to indicate the target content that the user wants to watch and the definition of the target content. Step S120 also includes steps S132 to S136. It should be noted that steps S131 to S135 and steps S132 to S136 are parallel steps. When executing, steps S131 to S135 or steps S132 to S136 are selected according to the conditions. Specifically:

[0127] S132: If the average value of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold, the content resources stored in each of the K servers and the clarity of each content resource are obtained.

[0128] It is understandable that if the average of the historical content traffic consumption time is greater than the historical content traffic consumption time threshold, it means that the user's behavior habit for audio and video is to frequently switch videos (for example, watching short videos), and the viewing time for each video is short (i.e., frequently switching short videos). Then in this process, the duration of the session corresponding to each video of the user terminal is relatively short, that is, the user tends to pay more attention to whether the audio and video are smooth. In the embodiment of the present application, the fluency is reflected by the clarity of the video, and there is the following relationship between the fluency and the clarity: the higher the clarity, the lower the fluency; the lower the clarity, the higher the fluency. In the CDN server cluster, for the same video resource, resources with different audio and video clarity are often encoded by the encoder and stored in the same or different servers.

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

[0130] The second target server is a server storing target content whose clarity is lower than a clarity threshold.

[0131] It can be understood that, by comparing the content resources stored in each server among the K servers and the definition of each content resource with the target content identification information, a server storing target content with lower definition is found as the second server.

[0132] S136. Send the traffic request message sent by the terminal to the second target server.

[0133] It can be understood that the load balancer forwards the traffic request message sent by the terminal to the second target server to achieve access of the terminal to the second target server.

[0134] For example, 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 definition 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, and the corresponding traffic consumption durations are 2min, 3min, 5min, 4min, and 6min respectively. The traffic consumption durations of the 5 audio and video are encrypted to generate historical video traffic consumption duration information, which is stored in the terminal. The user uses the terminal to open the audio and video application, and the target video the user wants to watch is video a. The terminal sends a traffic request message carrying 6 historical video traffic consumption duration information and target video identification information to the load balancer. After the load balancer receives the traffic request message sent by the terminal, it calculates the average historical video traffic consumption time corresponding to the terminal; compares the average historical video traffic consumption time corresponding to the 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, and obtains the videos stored in each of the four servers and the clarity of the videos. Server B stores a low-definition target video, and determines that server B is the second target server. The traffic request message sent by the terminal is forwarded to the second target server to connect the terminal to server B.

[0135] A certain embodiment of the present application provides a resource allocation method, by comparing the mean value of the historical content traffic consumption duration corresponding to the N historical content traffic consumption duration information of the terminal with the historical content traffic consumption duration threshold, if the mean value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, then determine the first target server with the smallest load among the K servers, and send the terminal's traffic request message to the first target server to connect the terminal to the first target server; if the mean value of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold, then determine the second target server that stores the target content with low clarity among the K servers, and send the terminal's traffic request message to the second target server to connect the terminal to the second target server. Through the method provided by the embodiment of the present application, terminals with long video traffic consumption duration are dispersed in different servers, avoiding the problem of service interruption caused by excessive server overload caused by multiple terminals with long video traffic consumption duration being concentrated on certain servers, and avoiding the stuck phenomenon caused by users frequently switching videos by selecting servers with lower clarity and higher fluency for users who frequently switch to watch videos; determine the server connected to the terminal according to the user's behavioral habits, and improve the continuity and robustness of the server.

[0136] In this application Figure 5 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Figure 6 , step S136 further includes sub-steps S1361 to S1363. It should be noted that sub-steps S1362 and S1363 are parallel steps. When executing, sub-step S1362 or sub-step S1363 is selected according to the execution conditions. Specifically:

[0137] S1361. Obtain the clarity of the target content stored in the second target server.

[0138] It is understandable that each server generates a message based on the content stored therein and the clarity of the content and sends it to the load balancer. The load balancer determines the clarity of the target content stored in the second target server based on the message sent by the second target server.

[0139] S1362: If the second target server stores at least two target contents with different definitions, a definition mark is added to the traffic request message, and the traffic request message is sent to the second target server.

[0140] The definition mark is added to instruct the second target server to send the target content whose definition is lower than the definition threshold to the terminal.

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

[0142] S1363: If the second target server stores target content whose clarity is lower than the clarity threshold, the traffic request message sent by the terminal is sent to the second target server.

[0143] It is understandable that if the target content stored in the second target server is of low definition, the traffic request message is directly forwarded to the second target server.

[0144] like Figure 7 and Figure 8 As shown, Figure 7 A schematic diagram of storing two different resolutions of the same audio or video in the same server provided in an embodiment of the present application; Figure 8 A schematic diagram of storing two different resolutions of the same audio and video in different servers provided in the embodiment of the present application. In a CDN server cluster, for the same video resource, resources with different audio and video resolutions are often stored in two ways: one is to store the high-resolution resource and the low-resolution resource on the same server after the audio and video are encoded by the encoder (such as Figure 7 ); the other is that after the audio and video are encoded by the audio and video encoder, the high-definition resources and the low-definition resources are stored in different servers (such as Figure 8 ). If the load balancer detects that the user's audio and video viewing behavior of the terminal is to frequently switch viewing content, it will choose to obtain low-definition (i.e. smooth) audio and video resources to respond to the user request; when high-definition and low-definition resources are stored on the same server (such as Figure 7 As shown), the load balancer forwards the traffic request message from the user terminal to the server, wherein the load balancer adds the audio and video clarity mark Mark to the above traffic request message, wherein the mark occupies 1 bit, and when the value is binary 1, it means that smooth (low-definition) audio and video traffic is sent to the terminal user; when high-definition and low-definition resources are stored on different servers (such as Figure 8 As shown), the load balancer forwards the traffic request message from the user terminal to the server storing the low-definition (ie, server 2).

[0145] A certain embodiment of the present application provides a resource allocation method, which improves the sustainability and robustness of the server by selecting 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.

[0146] In this application Figure 5 In an optional embodiment of the resource allocation method provided by the corresponding embodiment, step S132 further includes sub-step S1321. Specifically:

[0147] S1321: If the average value of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold, periodically obtain the content resources stored in each of the K servers and the clarity of each content resource.

[0148] It is understandable that each of the K servers periodically generates a message based on the stored video and the definition of the video and sends it to the load balancer. The load balancer periodically obtains the video resources stored by each of the K servers and the definition of each video resource.

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

[0150] In this application Figure 4 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Fig. 9The traffic request message also includes key information and message verification information; step S120 further includes sub-steps S121 to S122. Specifically:

[0151] S121. Verify the N historical content traffic consumption duration information in the traffic request message according to the key information and the message verification information.

[0152] It can be understood that the traffic request message is embedded with message verification information and N historical content traffic consumption duration information for verification, and the message verification information is embedded with key information. The data contained in the traffic request message Pkt_history is as follows:

[0153] Pkt_history = {MAC_his,N,T_session_enc_1,…,T_session_enc_N} (2);

[0154] Among them, 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.

[0155] MAC_his=MAC{K_share,N||T_session_enc_1||…||T_session_enc_N)(3);

[0156] 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.

[0157] According to 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:

[0158] MAC_his (denoted as MAC_his_cpt_server) is calculated according to formula (3).

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

[0160] S122: If the verification is passed, the average of the historical content traffic consumption duration is calculated based on the N historical content traffic consumption duration information.

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

[0162] 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.

[0163] In this application Fig. 9 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Fig.10 , sub-step S121 further includes sub-steps S1211 to S1213. It should be noted that sub-steps S1212 and S1213 are parallel steps. When executing, sub-step S1212 or S1213 is selected according to the conditions. Specifically:

[0164] S1211. Calculate message authentication information of N historical content traffic consumption duration information according to the key information.

[0165] S1212. If the message authentication information is equal to the message verification information, the verification is passed.

[0166] S1213. If the message authentication information is not equal to the message verification information, the verification fails.

[0167] It is understandable that, based on the key information and the 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:

[0168] MAC_his (denoted as MAC_his_cpt_server) is calculated according to formula (3).

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

[0170] 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.

[0171] In this application Fig. 9 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Fig.11 , sub-step S122 includes sub-steps S1221 to S1222. Specifically:

[0172] S1221. Decrypt N historical content traffic consumption duration information according to the key information to obtain N historical content traffic consumption duration decrypted data.

[0173] 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 through the key information K_share to obtain the N historical content traffic consumption duration decrypted data T_session_1, T_session_2, ..., T_session_N. The decryption process is as shown in formula (3):

[0174] T_session_i = Dec{K_share,T_session_enc_i} (4);

[0175] Where 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 is, the closer it is to the current time.

[0176] S1222. Calculate the average of N historical content traffic consumption duration decrypted data to obtain the average of historical content traffic consumption duration.

[0177] It can be understood that the load balancer calculates the average value T_session_avg of the N historical content traffic consumption time decryption data T_session_i, as shown in formula (4):

[0178] T_session_avg=(T_session_1+T_session_2+...+T_session_N) / N(4).

[0179] 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 mean of the decrypted data of the historical content traffic consumption time, determines the user's behavior habits through the relationship between the mean 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.

[0180] In this application Fig. 9 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Fig.12 , sub-step S121 also includes sub-steps S123 to S125. It should be noted that sub-step S122 and sub-steps S123 to S125 are parallel steps. When executing, sub-step S122 or sub-steps S123 to S125 are selected according to the execution conditions. Specifically:

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

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

[0183] If MAC_his_cpt_server≠MAC_his, it means that the verification has not been passed and the N historical content traffic consumption duration information has been tampered with during the data transmission process. At this time, the N historical content traffic consumption duration information in the traffic request message cannot represent the user's real historical data, that is, the user's viewing habits cannot be accurately predicted through the N historical content traffic consumption duration information.

[0184] S124. Determine a third target server from the K servers.

[0185] The third target server is the server that receives the least number of traffic request messages among the K servers.

[0186] It is understandable that, in the above case, the viewing habits of users are not considered, but the server with the least number of access terminals among the K servers is selected through load balancing as the third target server. The number of access terminals of each server is determined by obtaining the number of traffic request messages received by each server among the K servers.

[0187] S125. Send the traffic request message sent by the terminal to the third target server.

[0188] It can be understood that the load balancer forwards the traffic request message sent by the terminal to the third target server to achieve access of the terminal to the third target server.

[0189] The resource allocation method 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 content traffic consumption time information, thereby improving the sustainability and robustness of the server.

[0190] In this application Figure 4 In an optional embodiment of the resource allocation method provided in the corresponding embodiment, please refer to Fig.13 , step S131 further includes sub-steps S1311 to S1312. Specifically:

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

[0192] It is understandable that each of the K servers generates a load quantity message according to the number of currently connected terminals consuming long traffic, 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.

[0193] S1312. Obtain the load quantity of each server among the K servers according to the load quantity message sent by each server among the K servers.

[0194] It can be understood that the load balancer parses the load quantity message according to the received load quantity message sent by each server in the K servers to obtain the load quantity of each server in the K servers.

[0195] In the resource allocation method 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, thereby laying the foundation for subsequently determining the first target server with the least load quantity, and distributing terminals with long video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0196] In this application Figure 4 In an optional embodiment of the resource allocation method provided by the corresponding embodiment, step S131 further includes sub-step S1313. Specifically:

[0197] S1313: If the average value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, periodically obtain the load quantity of each server in the K servers.

[0198] It can be understood that each of the K servers periodically generates a load quantity message according to the number of currently connected terminals consuming long 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.

[0199] In the resource allocation method 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, thereby laying the foundation for subsequently determining the first target server with the least load quantity, and distributing terminals with long video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0200] In this application Figure 4 In an optional embodiment of the resource allocation method provided by the corresponding embodiment, the traffic request message includes a traffic request timestamp. It can be understood that the load balancer forwards the traffic request message sent by the terminal to the first target server to connect the terminal to the first target server. The first target server receives the traffic request message carrying the traffic request timestamp. Fig.14 and Fig.15 The resource allocation method further includes steps S210 to S250 and steps S310 to S332. It should be noted that the execution subject of steps S210 to S250 is the first target server; the execution subject of steps S310 to S332 is the terminal. Specifically:

[0201] S210: Receive a flow closing message sent by a terminal.

[0202] The flow closing message carries a flow closing timestamp.

[0203] It is understandable that when the user finishes watching the video and exits the audio and video application, the terminal sends a flow closing message carrying a flow closing timestamp to the first target server.

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

[0205] It can be understood that the first target server calculates the duration according to the traffic request timestamp carried in the traffic request message and the traffic closing timestamp carried in the traffic closing message to obtain the content traffic consumption duration data.

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

[0207] It can be understood that the first target server obtains the shared key, such as formula (6), and encrypts the traffic consumption duration data according to the key information to obtain the content traffic consumption duration information.

[0208] T_session_enc = Enc{K_share,T_session} (6);

[0209] 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.

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

[0211] It can be understood that the first target 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.

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

[0213] 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.

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

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

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

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

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

[0219] It is understandable that the first target server sends the content traffic consumption duration message to the terminal. The terminal verifies the content traffic consumption duration information according to the key information. If the verification is passed, the terminal stores the content traffic consumption duration information and the key information in the content traffic consumption duration message; if the verification is not passed, the terminal deletes the content traffic consumption duration message.

[0220] In the resource allocation method provided in the embodiment of the present application, the server calculates the video traffic consumption duration data, encrypts the calculated data and generates a video traffic consumption duration message, which is sent to the terminal. After the terminal receives the video traffic consumption duration message, it verifies the video traffic consumption duration information. If it is determined that the video traffic consumption duration information has not been tampered with, the video traffic consumption duration information and key information in the video 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 video traffic consumption durations on different servers.

[0221] For easier understanding, see Fig.16 , Fig.16 Schematic diagram of the resource allocation method provided in the embodiment of the present application. The process corresponding to arrow ① is: when a session ends, the server sends the duration of this session and other data to the terminal as the historical information of the user; the process corresponding to arrow ② is: when the terminal sends a traffic request message again, it carries the above historical information from the server; the process corresponding to arrow ③ is: when the load balancer receives the request message, it extracts the above historical information and determines whether the user tends to watch a certain content for a long time or frequently switches the viewing content; 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 flow as the response server for the session; if the user tends to frequently switch the viewing content, the load balancer selects a server with higher fluency as the response server for the session; the selected (or allocated) server transmits traffic data to the user terminal, and sends the historical information such as the session duration mentioned in ① above to the user terminal at the end of the session.

[0222] See also Fig.17 , Fig.17 A flow chart of a resource allocation method provided in an embodiment of the present application. In the method provided in an embodiment of the present application, a load balancer allocates corresponding servers to sessions based on the user's historical behavior habits. Specifically, if a terminal user tends to watch a certain audio or video content for a long time, a server with fewer long streams is allocated to provide services for it, thereby avoiding the problem of multiple long streams being clustered on a certain (or several) server and causing the load to be too high for a long time; if a terminal user tends to frequently switch the audio or video content to watch, a server with better fluency is allocated to provide services for it, thereby avoiding QoE degradation such as freezes caused by frequent switching of the user terminal.

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

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

[0225] 1.1) The end of the session between the server and the terminal is marked by: the terminal sends a flow closing message (close (connection closing) message) to the server, or the user terminal fails to respond (or feedback, confirm) the flow message from the server for a long time.

[0226] 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 through 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):

[0227] T_session_enc=Enc{K_share,T_session}(1.1);

[0228] Among them, Enc{a,b} means using key a to encrypt b.

[0229] 1.3) If multiple video traffic consumption duration data T_session of the terminal (in the previous period of time) 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.

[0230] 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.

[0231] 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 information to the terminal. The data contained in the message is as shown in formula (1.2):

[0232] Pkt_history={MAC_his,N,T_session_enc_1,...,T_session_enc_N}(1.2);

[0233] Among them, MAC_his is the message verification information of the message Pkt_history, which can be calculated by the following formula (1.3):

[0234] MAC_his=MAC{K_share,N||T_session_enc_1||...||T_session_enc_N)(1.3);

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

[0236] 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.

[0237] 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.

[0238] 1.8) In the embodiment of the present application, the value of the number N of recent sessions is configured by the administrator and reflected in the configuration file, and the default value is 10.

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

[0240] 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.

[0241] 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.

[0242] (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 time information T_session_enc carried in the above traffic request message Pkt_req or Pkt_ctl, and determines the historical behavior habits of the terminal based on this information, as follows:

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

[0244] 3.2) If the message authentication information is equal to the message verification information, that is, MAC_his_cpt_server=MAC_his, then execute the following step 3.3); otherwise, the historical behavior habits of the terminal user are not considered.

[0245] 3.3) The load balancer decrypts the historical video traffic consumption duration information T_session_enc_1, ..., T_session_enc_N through the key information K_share, and obtains the decrypted data T_session_1, T_session_2, ..., T_session_N of the most recent N historical video traffic consumption durations. The decryption process is shown in the following formula:

[0246] T_session_i=Dec{K_share,T_session_enc_i}(1.4);

[0247] Where Dec{a,b} means using the key K_share to decrypt data b;

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

[0249] 3.4) The load balancer determines the historical behavior habits of the user of the current terminal according to the decrypted historical video traffic consumption time decryption data T_session_i, as follows:

[0250] 3.4.1) The load balancer calculates the average value T_session_avg of the N historical video traffic consumption time decryption data T_session_i, as shown in the following formula:

[0251] T_session_avg=(T_session_1+T_session_2+…+T_session_N) / N(1.5);

[0252] If the historical video traffic consumption time average T_session_avg is greater than the historical video traffic consumption time threshold T_session_upper, it means that the user of the terminal tends to watch a certain (or several) content for a long time, that is, the session duration between the server and the terminal user may be relatively long, and the following step 3.4.2) is executed at this time; if the historical video traffic consumption time average T_session_avg is less than or equal to the historical video traffic consumption time 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 the terminal user is more concerned about the fluency of audio and video, as shown in the following step 3.4.3);

[0253] 3.4.2) If the newly connected terminal user tends to watch a certain (or several audio and video contents) for a long time, the load balancer will sort the servers in the CDN cluster according to the number of long flows (i.e., flows whose flow consumption time exceeds the first flow time threshold T_session_upper), and distribute (forward) the newly arrived connection request to the server with the smallest number of long flows. To achieve the above function, the load balancer periodically obtains the number of long flow loads currently contained by each server in the CDN cluster, as follows:

[0254] 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.

[0255] 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 start time of the session.

[0256] Table 1

[0257] Flow ID Start time Duration Flow_ID_1 Time_start_1 T_session_1 … … … Flow_ID_n Time_start_n T_session_n

[0258] 3.4.2.3) Each server Server_i in the CDN periodically sends a load quantity message Pkt_large_i containing its own long traffic to the load balancer; after receiving the load quantity message Pkt_large_i, the load balancer sends a message confirmation message Pkt_large_ack_i to the corresponding server Server_i. Fig.18 shown.

[0259] 3.4.3) If the user of the newly connected terminal tends to frequently switch the audio and video content to watch, the load balancer selects a server from the servers with better audio and video fluency in the CDN cluster to provide services for the terminal user, as follows:

[0260] 3.4.3.1) In the embodiment of the present application, "smoothness" is reflected by the clarity of audio and video. If the clarity is higher, the smoothness is lower; if the clarity is lower, the smoothness is higher.

[0261] 3.4.3.2) In a CDN server cluster, for the same video resource, resources with different audio and video resolutions are often stored in two ways: one is to store high-resolution resources and low-resolution resources on the same server after the audio and video are encoded by the encoder; the other is to store high-resolution resources and low-resolution resources on different servers after the audio and video are encoded by the audio and video encoder.

[0262] 3.4.3.3) If the load balancer detects that the terminal user's behavior habit is to frequently switch viewing content (ie, T_session_avg is less than the threshold T_session_lower), it chooses to obtain low-definition (ie, smooth) audio and video resources to respond to the user request.

[0263] When high-definition and low-definition resources are stored on the same server (such as Figure 5 As shown), the load balancer forwards the connection request from the user terminal to the server, wherein the load balancer adds an audio and video clarity identifier Mark to the above connection request message, wherein the identifier occupies 1 bit, and when the value is binary 1, it represents sending smooth (low-definition) audio and video traffic to the terminal user.

[0264] When high-definition and low-definition resources are stored in different servers, the load balancer forwards the connection request from the user terminal to the server storing the low-definition resources.

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

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

[0267] The method provided in the embodiment of the present application allocates corresponding servers to sessions based on the historical behavior habits of users. 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 and causing the load to be too high for a long time; 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 freezing 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 historical behavior habits of users, so as to avoid the problem of multiple long streams being clustered on a certain (or several) servers and causing the load to be too high for a long time; 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, which can greatly improve the service experience of the client under cost constraints, and is conducive to improving the sustainability and robustness of the service capabilities of CDN manufacturers.

[0268] The resource allocation device in this application is described in detail below. Fig.19 . Fig.19 This is a schematic diagram of an embodiment of a resource allocation device 10 in an embodiment of the present application. The resource allocation device 10 includes:

[0269] The flow request message receiving module 110 is used to receive the flow request message sent by the terminal, wherein the flow request message carries N historical content flow consumption duration information, where N is an integer greater than 1;

[0270] The traffic consumption duration average calculation module 120 is used to determine the average of the historical content traffic consumption duration corresponding to the terminal according to the N historical content traffic consumption duration information in the traffic request message.

[0271] The load quantity acquisition module 131 is used to acquire the load quantity of each server in the K servers when the average value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold.

[0272] Among them, the load quantity is the number of terminals consuming long traffic connected to the server, long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1.

[0273] The first target server determination module 133 is used to determine the first target server with the least load quantity according to the K load quantities corresponding to the K servers.

[0274] The flow request message first forwarding module 135 is used to send the flow request message sent by the terminal to the first target server.

[0275] An embodiment of the present application provides a resource allocation device, which compares the average value of historical content traffic consumption duration corresponding to N historical content traffic consumption duration information of the terminal with a historical content traffic consumption duration threshold. If the average value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, the first target server with the smallest load among K servers is determined, and the traffic request message of the terminal is sent to the first target server to connect the terminal to the first target server. Through the method provided in the embodiment of the present application, terminals with longer video traffic consumption duration are dispersed in different servers, thereby avoiding the problem of service interruption caused by excessive server overload due to the concentration of multiple terminals with longer video traffic consumption duration on certain servers, thereby improving the continuity and robustness of the server.

[0276] In this application Fig.19 In an optional embodiment of the resource allocation device provided in the corresponding embodiment, please refer to Fig. 20 The traffic request message also carries target content identification information. The resource allocation device also includes:

[0277] The content resource acquisition module 132 is used to acquire the content resources stored in each server of the K servers and the clarity of each content resource when the average value of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold.

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

[0279] The second target server is a server storing target content whose clarity is lower than the clarity threshold.

[0280] The flow request message second forwarding module 136 is used to send the flow request message sent by the terminal to the second target server.

[0281] A certain embodiment of the present application provides a resource allocation device, which compares the mean value of the historical content traffic consumption time corresponding to the N historical content traffic consumption time information of the terminal with the historical content traffic consumption time threshold. If the mean value of the historical content traffic consumption time is greater than the historical content traffic consumption time threshold, the first target server with the smallest load among the K servers is determined, and the terminal's traffic request message is sent to the first target server to connect the terminal to the first target server; if the mean value of the historical content traffic consumption time is less than or equal to the historical content traffic consumption time threshold, the second target server storing the target content with low clarity among the K servers is determined, and the terminal's traffic request message is sent to the second target server to connect the terminal to the second target server. Through the method provided by the embodiment of the present application, terminals with long video traffic consumption time are dispersed in different servers to avoid the problem of service interruption caused by excessive server overload caused by multiple terminals with long video traffic consumption time being concentrated on certain servers. By selecting a server with lower clarity and higher fluency for users who frequently switch to watch videos, the stuck phenomenon caused by users in the process of frequently switching videos is avoided; the server connected to the terminal is determined according to the user's behavioral habits to improve the continuity and robustness of the server.

[0282] In this application Fig. 20 In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the traffic request message second forwarding module 136 is further used to:

[0283] The clarity of the target content stored in the second target server is obtained.

[0284] If the second target server stores at least two target contents with different definitions, a definition mark is added to the traffic request message, and then the traffic request message is sent to the second target server.

[0285] The definition mark is added to instruct the second target server to send the target content whose definition is lower than the definition threshold to the terminal.

[0286] If the second target server stores target content whose clarity is lower than the clarity threshold, the traffic request message sent by the terminal is sent to the second target server.

[0287] A certain embodiment of the present application provides a resource allocation device, which improves the sustainability and robustness of the server by selecting 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.

[0288] In this application Fig. 20In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the content resource acquisition module 132 is further used to periodically acquire the content resources stored in each of the K servers and the clarity of each content resource.

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

[0290] In this application Fig.19 In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the traffic request message also includes key information and message verification information. The traffic consumption duration average calculation module 120 is also used to:

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

[0292] If the verification is passed, the average of the historical content traffic consumption duration is calculated based on the N historical content traffic consumption duration information.

[0293] 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 the transmission process.

[0294] In this application Fig.19 In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the traffic consumption duration average calculation module 120 is further used to:

[0295] Calculate the message authentication information of N historical content traffic consumption duration information according to the key information.

[0296] If the message authentication information is equal to the message verification information, the verification is successful.

[0297] If the message authentication information is not equal to the message verification information, verification fails.

[0298] 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 the transmission process.

[0299] In this application Fig.19In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the traffic consumption duration average calculation module 120 is further used to:

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

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

[0302] 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 mean of the decrypted data of the historical video traffic consumption time, determines the user's behavior habits through the relationship between the mean of the decrypted data of the historical video traffic consumption time and the historical video traffic consumption time threshold, and then determines the server connected to the terminal through the user's behavior habits, thereby improving the sustainability and robustness of the server.

[0303] In this application Fig.19 In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the traffic consumption duration average calculation module 120 further includes:

[0304] The flow request message quantity acquisition module is used to obtain the quantity of flow request messages received by each server among the K servers when verification fails.

[0305] The third target server determination module is used to determine the third target server from the K servers.

[0306] The third target server is the server that receives the least number of traffic request messages among the K servers.

[0307] The third flow request message forwarding module is used to send the flow request message sent by the terminal to the third target server.

[0308] 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.

[0309] In this application Fig.19 In an optional embodiment of the resource allocation device provided by the corresponding embodiment, the load quantity acquisition module 131 is further used to:

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

[0311] According to the load quantity message sent by each of the K servers, the load quantity of each of the K servers is obtained.

[0312] 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, thereby laying a foundation for subsequently determining the first target server with the least load quantity, and distributing terminals with long video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

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

[0314] 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, thereby laying a foundation for subsequently determining the first target server with the least load quantity, and distributing terminals with long video traffic consumption time in different servers, avoiding the problem of server overload and service interruption caused by the concentration of multiple terminals with long video traffic consumption time on certain servers, thereby improving the continuity and robustness of the server.

[0315] In this application Fig.19 In an optional embodiment of the resource allocation device provided in the corresponding embodiment, please refer to Fig.21 , the flow request message includes a flow request timestamp. The resource allocation device 10 also includes:

[0316] The flow closing message receiving module 210 is used to receive a flow closing message sent by a terminal.

[0317] The flow closing message carries a flow closing timestamp.

[0318] 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.

[0319] 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.

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

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

[0322] 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.

[0323] In the resource allocation device provided in the embodiment of the present application, the server calculates the content traffic consumption time data, encrypts the calculated data and generates a content traffic consumption time message, which is sent to the terminal. After receiving the content traffic consumption time message, the terminal verifies the content traffic consumption time information. If it is determined that the content traffic consumption time information has not been tampered with, the content 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.

[0324] Fig. 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 (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term 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 in the server. Furthermore, the central processing unit 322 can 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.

[0325] 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 2000. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0326] The steps performed by the server in the above embodiment can be based on the Fig. 22The server structure shown.

[0327] Those skilled in the art can 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.

[0328] In the several embodiments provided in the present 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 only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, 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 interfaces, devices or units, which can be electrical, mechanical or other forms.

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

[0330] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0331] 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 a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.

[0332] 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 aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein by equivalents. 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, It is characterized in that include: A flow request message sent by a receiving terminal is carried by the flow request message, wherein the flow request message carries N historical content flow consumption duration information, where N is an integer greater than 1; Determine the average value of the historical content traffic consumption duration corresponding to the terminal according to the N historical content traffic consumption duration information in the traffic request message; If the mean value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, the load quantity of each server in the K servers is obtained, wherein the load quantity is the number of terminals consuming long traffic connected to the server, and the long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1; Determine a first target server with the least load quantity according to the K load quantities corresponding to the K servers; The traffic request message sent by the terminal is sent to the first target server.

2. The resource allocation method according to claim 1, It is characterized in that The traffic request message also carries target content identification information; After determining the average value of the historical content traffic consumption duration corresponding to the terminal according to the N historical content traffic consumption duration information in the traffic request message, the method further includes: If the average of the historical content traffic consumption duration is less than or equal to the historical content traffic consumption duration threshold, then obtaining the content resources stored in each of the K servers and the clarity of each content resource; Determining a second target server from the K servers according to the target content identification information, wherein the second target server is a server storing target content whose clarity is lower than a clarity threshold; The traffic request message sent by the terminal is sent to the second target server.

3. The resource allocation method according to claim 2, It is characterized in that The sending the traffic request message sent by the terminal to the second target server includes: Acquire the clarity of the target content stored in the second target server; If the second target server stores at least two target contents with different clarity, after adding a clarity mark in the traffic request message, the traffic request message is sent to the second target server, wherein the added clarity mark is used to instruct the second target server to send the target content with a clarity lower than a clarity threshold to the terminal; If the second target server stores target content whose clarity is lower than the clarity threshold, the traffic request message sent by the terminal is sent to the second target server.

4. The resource allocation method according to claim 2, It is characterized in that The obtaining of the content resources stored in each of the K servers and the clarity of each content resource includes: Periodically obtain the content resources stored in each of the K servers and the clarity of each content resource.

5. The resource allocation method according to claim 1, It is characterized in that The traffic request message also includes key information and message verification information; The determining, according to the N pieces of historical content traffic consumption duration information in the traffic request message, an average of the historical content traffic consumption duration corresponding to the terminal includes: Verify the N historical content traffic consumption duration information in the traffic request message according to the key information and the message verification information; If the verification is passed, the average value of the historical content traffic consumption duration is calculated based on the N historical content traffic consumption duration information.

6. The resource allocation method according to claim 5, It is characterized in that The verifying, according to the key information and the message verification information, the N historical content traffic consumption duration information in the traffic request message includes: 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 equal to the message verification information, the verification is passed; If the message authentication information is not equal to the message verification information, the verification fails.

7. The resource allocation method according to claim 5, It is characterized in that The calculating, based on the N pieces of historical content traffic consumption duration information, to obtain an average of the historical content traffic consumption durations includes: Decrypt the N historical content traffic consumption duration information according to the key information to obtain N historical content traffic consumption duration decrypted data; Calculate the average of the N historical content traffic consumption duration decrypted data to obtain the average historical content traffic consumption duration.

8. The resource allocation method according to claim 5, It is characterized in that After verifying the N historical content traffic consumption duration information in the traffic request message according to the key information and the message verification information, the method further includes: If the verification fails, the number of traffic request messages received by each of the K servers is obtained; Determine a third target server from the K servers, wherein the third target server is a server that receives the least number of traffic request messages among the K servers; The traffic request message sent by the terminal is sent to the third target server.

9. The resource allocation method according to claim 1, It is characterized in that The step of obtaining the load quantity of each server in the K servers includes: Receiving a load quantity message sent by each of the K servers; The load quantity of each server in the K servers is obtained according to the load quantity message sent by each server in the K servers.

10. The resource allocation method according to any one of claims 1 to 9, It is characterized in that The flow request message includes a flow request timestamp; the method further includes: A flow shutdown message sent by a receiving terminal is received, 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; Sending the content traffic consumption duration message to the terminal, so that the terminal verifies the content traffic consumption duration information according to the key information; in, If the verification is passed, the content flow consumption duration information and the key information in the content flow consumption duration message are stored; If the verification fails, the content traffic consumption time message is deleted.

11. The resource allocation method according to claim 1, It is characterized in that The step of obtaining the load quantity of each server in the K servers includes: Periodically obtain the load quantity of each of the K servers.

12. A resource allocation device, It is characterized in that include: A flow request message receiving module, used to receive a flow request message sent by a terminal, wherein the flow request message carries N historical content flow consumption duration information, where N is an integer greater than 1; A flow consumption duration average calculation module, used to determine the average of the historical content flow consumption duration corresponding to the terminal according to the N historical content flow consumption duration information in the flow request message; A load quantity acquisition module, used for acquiring the load quantity of each server in K servers when the mean value of the historical content traffic consumption duration is greater than the historical content traffic consumption duration threshold, wherein the load quantity is the number of terminals consuming long traffic connected to the server, the long traffic refers to traffic with a traffic consumption duration greater than the first traffic duration threshold, and K is an integer greater than 1; A first target server determination module, used to determine a first target server with the least load quantity according to the K load quantities corresponding to the K servers; The first traffic request message forwarding module is used to send the traffic request message sent by the terminal to the first target server.

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

14. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to execute the resource allocation method according to any one of claims 1 to 11.

15. A computer program product comprising a computer program, It is characterized in that The computer program is executed by a processor to implement the resource allocation method according to any one of claims 1 to 11.

Citation Information

Cited By

  • Resource management method and device, equipment, medium and program product

    CN119718684A