A load balancing method, device and electronic equipment

By analyzing the access information of the target file and the load of the seed server, the appropriate seed server is dynamically allocated to provide services for the terminal device, which solves the problem of unbalanced load of the tracker server in Internet TV and improves the overall efficiency and reliability of the system.

CN115695434BActive Publication Date: 2024-08-27JUHAOKAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211189039.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2024-08-27
Estimated Expiration
2042-09-28

AI Technical Summary

Technical Problem

In the field of Internet TV technology, as the number of seed data requests received by the gateway server gradually increases, the load imbalance problem of the tracker server causes some servers to be overloaded and some servers to be underloaded, affecting system efficiency.

Method used

By receiving the request information from the terminal device, it analyzes the number of accesses of the target file, the file type, the dispersion threshold, the total number of seed servers and the actual load value, and determines the appropriate seed server to provide services for the terminal device to achieve load balancing.

Benefits of technology

It effectively avoids the problem of overload or underload of some seed servers, improves the load balancing and efficiency of the system, and ensures the utilization of each seed server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115695434B
    Figure CN115695434B
Patent Text Reader

Abstract

The present disclosure provides a load balancing method, device and electronic device, which relates to the technical field of Internet TV, and solves the problem in the prior art that, as the number of requests for obtaining seed data received by the gateway server gradually increases, some tracker servers will be equipped with a large number of terminals, while some tracker servers will be equipped with a small number of terminals, resulting in an unbalanced load on the tracker server. The method includes: receiving request information sent by a terminal device for requesting to obtain a target file; determining the file type of the target file according to the number of accesses corresponding to the target file; determining the seed server that provides services to the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file; and sending a reply message carrying the address information to the terminal device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of Internet television, and in particular to a load balancing method, device and electronic device. Background Art

[0002] At present, in the field of Internet TV technology, a peer-to-peer (P2P) service is provided. P2P services usually consist of three parts, namely, a tracker server, a gateway server and a terminal. When the first terminal needs to obtain seed data, it can send a seed request to the gateway server. Afterwards, the gateway server sends the address information of the assigned tracker server to the first terminal. The first terminal requests seed data from the tracker server corresponding to the address information based on the address information sent by the gateway server. Afterwards, other terminals (such as the second terminal) share data with the first terminal through the tracker server. In some cases, as the number of requests for obtaining seed data received by the gateway server gradually increases, some tracker servers will be equipped with a large number of terminals, while some tracker servers will be equipped with a small number of terminals, resulting in an unbalanced load on the tracker server. Summary of the invention

[0003] In order to solve the above technical problems, the present disclosure provides a load balancing method, device and electronic device.

[0004] The technical solution of the present disclosure is as follows:

[0005] In a first aspect, the present disclosure provides a load balancing method, comprising: receiving request information sent by a terminal device for requesting to obtain a target file; determining the file type of the target file according to the number of accesses corresponding to the target file; determining the seed server providing services to the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file; sending a reply message carrying the address information to the terminal device; wherein the reply message is used to instruct the terminal device to obtain the target file through the seed server corresponding to the address information.

[0006] In a second aspect, the present disclosure provides a load balancing device, comprising: a receiving unit, for receiving request information sent by a terminal device for requesting to obtain a target file; a processing unit, for determining the file type of the target file according to the number of accesses corresponding to the target file received by the receiving unit; the processing unit, for determining the seed server providing services to the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file received by the receiving unit; the processing unit, for controlling the sending unit to send a reply message carrying the address information to the terminal device; wherein the reply message is used to instruct the terminal device to obtain the target file through the seed server corresponding to the address information.

[0007] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory being used to store a computer program; the processor being used to enable the electronic device to implement any load balancing method provided in the first aspect when executing the computer program.

[0008] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computing device, the computing device implements any load balancing method provided in the first aspect above.

[0009] In a fifth aspect, the present invention provides a computer program product. When the computer program product runs on a computer, the computer executes any load balancing method provided in the first aspect.

[0010] It should be noted that the above computer instructions may be stored in whole or in part on a first computer-readable storage medium, wherein the first computer-readable storage medium may be packaged together with the processor of the load balancing device, or may be packaged separately from the processor of the load balancing device, which is not limited in the present disclosure.

[0011] The description of the second, third, fourth and fifth aspects in the present disclosure can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.

[0012] In the present disclosure, the name of the load balancing device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of the present disclosure, they fall within the scope of the claims of the present disclosure and their equivalent technologies.

[0013] These and other aspects of the present disclosure will become more apparent from the following description.

[0014] Compared with the prior art, the technical solution provided by the present invention has the following advantages:

[0015] After receiving the request information sent by the terminal device for requesting to obtain the target file, the file type of the target file is determined by analyzing the number of accesses corresponding to the target file. Then, the seed server providing services for the terminal device and the address information of the seed server are determined according to the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and at least two of the hash value of the target file. For example:

[0016] In the case where the file type is a cold category, the seed server providing services for the terminal device and the address information of the seed server are determined according to the total number and the hash value of the target file. Alternatively, in the case where the file type is a hot category and the dispersion number threshold corresponding to the hot category is not 0, the average load value and the minimum actual load value are determined according to the total number of connected seed servers and the actual load value of each seed server; in the case where the actual load value is less than the average load value, the seed server providing services for the terminal device is determined to be the seed server corresponding to the minimum actual load value, and the address information corresponding to the seed server corresponding to the minimum actual load value. Alternatively, in the case where the file type is a hot category and the dispersion number threshold is 0, the seed server providing services for the terminal device and the address information of the seed server are determined according to the total number, the target value and the hash value of the target file. In this way, the aggregation of cold categories and the dispersion and aggregation of hot categories can be achieved. Afterwards, a reply message carrying the address information is sent to the terminal device. The terminal device obtains the target file through the seed server corresponding to the address information according to the received reply information. Thereby, the problem that some seed servers serve a large number of loads and some seed servers serve a small number of loads can be avoided. The invention solves the problem in the prior art that, as the number of requests for obtaining seed data received by the gateway server gradually increases, some tracker servers may be equipped with a large number of terminals, while some tracker servers may be equipped with a small number of terminals, resulting in an unbalanced load on the tracker servers. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0019] Figure 1 One of the flow charts of the load balancing method provided in the embodiment of the present application;

[0020] Figure 2 One of the structural schematic diagrams of the display device in the load balancing method provided in the embodiment of the present application;

[0021] Figure 3 The second structural diagram of the display device in the load balancing method provided in the embodiment of the present application;

[0022] Figure 4 One of the flow charts of the load balancing method provided in the embodiment of the present application;

[0023] Figure 5 A second flow chart of the load balancing method provided in the embodiment of the present application;

[0024] Figure 6 The third flowchart of the load balancing method provided in the embodiment of the present application;

[0025] Figure 7 A schematic diagram of the allocation between the server 400, the terminal device and the seed server of the load balancing method provided in an embodiment of the present application;

[0026] Figure 8 A fourth flowchart of the load balancing method provided in an embodiment of the present application;

[0027] Fig. 9 A schematic diagram of the structure of a server provided in an embodiment of the present application;

[0028] Fig.10 The second schematic diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0031] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0032] Figure 1 is a schematic diagram of an operation scenario between a display device and a control device according to one or more embodiments of the present application, such as Figure 1 As shown, the user can operate the display device 200 through the mobile terminal 300 and the control device 100. The control device 100 can be a remote controller, and the communication between the remote controller and the display device includes infrared protocol communication, Bluetooth protocol communication, wireless or other wired methods to control the display device 200. The user can input user instructions through buttons on the remote controller, voice input, control panel input, etc. to control the display device 200. In some embodiments, a mobile terminal, a tablet computer, a computer, a laptop computer, and other smart devices can also be used to control the display device 200.

[0033] In some embodiments, the mobile terminal 300 can install software applications with the display device 200, and realize connection communication through the network communication protocol to achieve the purpose of one-to-one control operation and data communication. The audio and video content displayed on the mobile terminal 300 can also be transmitted to the display device 200 to realize the synchronous display function. The display device 200 also communicates data with the display device 200 through various communication methods. The display device 200 can be allowed to communicate and connect through a local area network (LAN), a wireless local area network (WLAN) and other networks. The display device 200 can provide various content and interactions to the display device 200. The display device 200 can be a liquid crystal display, an OLED display, or a projection display device. In addition to providing a broadcast receiving television function, the display device 200 can also provide an intelligent network TV function that provides a computer support function.

[0034] In some embodiments, after the tracker server is deployed, it will send registration information to the gateway server. After receiving the registration information sent by the tracker server, the gateway server establishes a communication connection with the tracker server and updates the contact relationship table for establishing a connection with the gateway server. After that, the tracker server periodically sends a heartbeat message to the gateway server. After that, when the user watches the target file (such as a movie, a TV series, or news, etc.) through the display device 200, since the target file is not stored in the memory of the display 200, the display device 200 needs to send a request message for requesting to obtain the target file to the gateway server. After receiving the request information sent by the display device 200, the gateway server determines the file type of the target file by analyzing the number of accesses corresponding to the target file. After that, the gateway server determines the seed server that provides services to the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses, and the hash value of the target file. For example, when the file type is a cold category, the seed server providing services to the terminal device and the address information of the seed server are determined according to the total number and the hash value of the target file. Alternatively, when the file type is a hot category and the dispersion number threshold corresponding to the hot category is not 0, the average load value and the minimum actual load value are determined according to the total number of connected seed servers and the actual load value of each seed server; when the actual load value is less than the average load value, the seed server providing services to the terminal device is determined to be the seed server corresponding to the minimum actual load value, and the address information corresponding to the seed server corresponding to the minimum actual load value. Alternatively, when the file type is a hot category and the dispersion number threshold is 0, the seed server providing services to the terminal device and the address information of the seed server are determined according to the total number, the target value and the hash value of the target file. In this way, the aggregation of cold categories and the dispersion and aggregation of hot categories can be achieved. Afterwards, the gateway server sends a reply message carrying the address information to the display device 200. According to the reply message sent by the gateway server, the display device 200 obtains the target file through the tracker server corresponding to the address information. Afterwards, the display device 200 assembles the target file obtained from the tracker server to generate a download file. Then, the display device 200 can play the target file according to the download file. In the process of obtaining the target file from the tracker server corresponding to the address information, the display device 200 needs to periodically send heartbeat information to the tracker server.When the user quits viewing the target file, or the target file is downloaded completely, the display device 200 sends an end message to the tracker server to end obtaining the target file through the tracker server.

[0035] Figure 2 FIG. 2 shows a hardware configuration block diagram of a display device 200 according to an exemplary embodiment. Figure 2 The display device 200 shown includes at least one of a tuner 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and a user interface 280. The controller includes a central processing unit, a video processor, an audio processor, a graphics processor, a RAM, a ROM, and a first interface to an nth interface for input / output. The display 260 can be a display with a touch function, such as a touch display. The tuner 210 receives broadcast television signals by wired or wireless reception, and demodulates audio and video signals from multiple wireless or wired broadcast television signals, such as and EPG data signals. The detector 230 is used to collect signals of the external environment or interact with the outside. The controller 250 and the tuner 210 can be located in different split devices, that is, the tuner 210 can also be in an external device of the main device where the controller 250 is located, such as an external set-top box.

[0036] In some embodiments, the controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in the memory. The controller 250 controls the overall operation of the display device 200.

[0037] In some examples, the display device 200 of one or more embodiments is a TV set 1, and the operating system of the TV set 1 is an Android system. Figure 3 As shown, the television 1 can be logically divided into an application layer (Applications) (referred to as "application layer") 21, an application framework layer (Application Framework) (referred to as "framework layer") 22, an Android runtime (Android runtime) and system library layer (referred to as "system runtime library layer") 23, and a kernel layer 24.

[0038] Among them, the application layer 21 includes one or more applications. The application can be a system application or a third-party application. For example, the application layer 21 includes a first application, which can provide a service for viewing a target file. The framework layer 22 provides an application programming interface (API) and a programming framework for the application of the application layer 21. The system runtime layer 23 provides support for the upper layer, namely the framework layer 22. When the framework layer 22 is used, the Android operating system will run the C / C++ library contained in the system runtime layer 23 to implement the functions to be implemented by the framework layer 22. The kernel layer 24 serves as a software middleware between the hardware layer and the application layer 21, and is used to manage and control hardware and software resources.

[0039] After the display device 200 is turned on, the software development tools (SDK) communication module for providing P2P in the display device 200 establishes a communication connection with the server 400. Afterwards, after the first application is started, the display device 200 responds to the user's selection operation of the target file provided by the first application, and calls the SDK communication module to send a request message for requesting to obtain the target file to the gateway server 400. After the receiving unit 200 of the gateway server receives the request message sent by the display device 200, the processing unit 201 of the gateway server determines the file type of the target file by analyzing the number of accesses corresponding to the target file received by the receiving unit 200. Afterwards, the processing unit 201 of the gateway server determines the seed server that provides services for the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses, and the hash value of the target file received by the receiving unit 200. Afterwards, the processing unit 201 of the gateway server controls the sending unit 202 to send a reply message carrying the address information to the display device 200. The display device 200 obtains the target file through the tracker server corresponding to the address information according to the reply message sent by the gateway server. Afterwards, the display device 200 assembles the target file obtained by the tracker server by calling the SDK download module for providing download services, thereby generating a download file. Furthermore, the first application of the display device 200 can play the target file according to the downloaded file. Among them, in the process of obtaining the target file through the tracker server corresponding to the address information, the display device 200 needs to periodically send heartbeat information to the tracker server.

[0040] Specifically, the storage unit 203 of the server 400 stores a contact relationship table of the tracker server connected to the gateway server, and an application program of the operating system of the server 400 .

[0041] Specifically, the electronic device provided in the embodiment of the present disclosure may be the above-mentioned server 400, which is not limited here.

[0042] The target files involved in this application can all be data authorized by the user or fully authorized by all parties.

[0043] In the following embodiments, the execution subject of a load balancing method provided by an embodiment of the present disclosure is the above-mentioned server 400, and the terminal device can be the above-mentioned TV 1 as an example to illustrate the method of the embodiment of the present application.

[0044] The present application embodiment provides a load balancing method, such as Figure 4 As shown, the load balancing method may include S11-S14.

[0045] S11 . Receive request information sent by the television 1 for requesting to obtain a target file.

[0046] S12. Determine the file type of the target file according to the number of accesses corresponding to the target file.

[0047] In some examples, the number of accesses may be the total number of times all televisions 1 access the target file in the previous cycle, or the number of accesses may be the total number of times all televisions 1 access the target file in the current cycle. When the server 400 determines the file type of the target file according to the number of accesses corresponding to the target file, it may determine the file type of the target file according to the relationship between the number of accesses and the threshold number.

[0048] In some examples, the file type includes at least one hot category and at least one unpopular category. One hot category corresponds to one dispersion count threshold. For example, when the file type includes only one hot category and one unpopular category, when the server 400 determines that the number of accesses is greater than or equal to the threshold number, the file type of the target file is directly determined to be a hot category. When the server 400 determines that the number of accesses is less than the threshold number, the file type of the target file is directly determined to be an unpopular category. In this way, each hot file corresponds to the same dispersion count threshold.

[0049] Alternatively, the file type includes multiple popular categories (such as: the file type includes 3 popular categories, namely popular category 1, popular category 2 and popular category 3) and 1 unpopular category. Among them, the dispersion count threshold 1 corresponding to popular category 1, the dispersion count threshold 2 corresponding to popular category 2 and the dispersion count threshold 3 corresponding to popular category 3 are all different, or, the dispersion count threshold 1 and the dispersion count threshold 2 are the same, and the dispersion count threshold 1 and the dispersion count threshold 2 are both different from the dispersion count threshold 3. Alternatively, the dispersion count threshold 1 and the dispersion count threshold 3 are the same, and the dispersion count threshold 1 and the dispersion count threshold 3 are both different from the dispersion count threshold 2. Alternatively, the dispersion count threshold 2 and the dispersion count threshold 3 are the same, and the dispersion count threshold 2 and the dispersion count threshold 3 are both different from the dispersion count threshold 1. In this way, different load balancing strategies can be adopted for different popular categories to achieve differentiated load balancing.

[0050] S13. Determine the seed server providing service for the TV 1 and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file.

[0051] In some examples, the memory of the server 400 pre-stores the correspondence between the target identifier and the address information of each seed server that has established a communication connection with the server 400 and maintains a heartbeat. Afterwards, when the address information of the seed server is needed, the server 400 can query the correspondence according to the target identifier corresponding to the seed server, thereby obtaining the address information corresponding to the seed server.

[0052] Specifically, the seed server may provide target files of popular categories or target files of unpopular categories.

[0053] S14, sending a reply message carrying the address information to the TV 1. The reply message is used to instruct the TV 1 to obtain the target file through the seed server corresponding to the address information.

[0054] In some examples, while the TV 1 obtains the target file through the seed server corresponding to the address information, the TV 1 can also share the files stored in the memory of the TV 1 with other TVs 1. For example, the P2P communication module of the TV 1 interacts with the tracker server corresponding to the address information to obtain the network information reported to the tracker server by the P2P communication modules of other terminal devices. The network information at least includes the public Internet Protocol (Internet Protocol, ip) and port, the intranet network address translation (Network Address Translation, nat) ip and port, the intranet ip and port, the P2P hole punching between the P2P communication modules of different terminal devices, the point-to-point transmission of the User Datagram Protocol (User Datagram Protocol, UDP) data packets, and the SDK download module of the terminal device assembles the UDP data packets into download files. Among them, the P2P communication module of each terminal device needs to maintain a heartbeat with the tracker server during the data transmission process.

[0055] As can be seen from the above, the load balancing method provided by the embodiment of the present disclosure can determine the file type of the target file by analyzing the number of accesses corresponding to the target file. Further, according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file, the seed server providing services for the TV 1 and the address information of the seed server are determined. Since the total number of seed servers and the hash value of the target file are fixed, the server 400 can select a suitable seed server to provide services for the TV 1 in real time according to the actual load value and the number of accesses of each seed server, thereby avoiding the problem that when multiple TVs 1 access target files of popular categories at the same time, because multiple TVs 1 obtain the target files through the seed server, the TV 1 cannot obtain the target files through the seed server in time.

[0056] In some feasible examples, the file type includes a popular category; Figure 4 ,like Figure 5 As shown, the above S13 can be specifically implemented through the following S130 and S131.

[0057] S130: When the file type is a hot category and the dispersion count threshold corresponding to the hot category is not 0, determine the average load value and the minimum actual load value according to the total number of connected seed servers and the actual load value of each seed server.

[0058] In some examples, the server 400 will continuously distribute new TV sets 1 to the seed server, and go to the seed server to obtain the target file. In this case, the load value carried by the seed server at each time of reporting the heartbeat information cannot accurately reflect the actual load situation of the seed server. At this time, the server 400 accumulates the load value reported by the seed server (the total number of terminal devices that have established a communication connection and keep the heartbeat) and the total number of loads currently distributed by the server 400 to the seed server, thereby obtaining the actual load value of each seed server. Afterwards, when the seed server sends a heartbeat message to the server 400 next time, the server 400 synchronizes the actual load value with the seed server, so that the actual load situation of each seed server can be more accurately counted.

[0059] In some examples, the average load value is equal to the ratio of the sum of the actual load values ​​of each seed server that establishes a communication connection with the server 400 and maintains a heartbeat to the total. The minimum actual load value is the minimum value of the actual load values ​​of each seed server that establishes a communication connection with the server 400 and maintains a heartbeat.

[0060] S131. When the actual load value is less than the target threshold, determine that the seed server providing service for TV 1 is the seed server corresponding to the smallest actual load value, and the address information corresponding to the seed server corresponding to the smallest actual load value; wherein the target threshold is obtained by one or more of the average load value and the total number.

[0061] In some examples, the target threshold is equal to the average load value, or the target threshold is equal to the total number, or the target threshold is equal to the sum of the average load value and the total number, or the target threshold is equal to the difference between the average load value and the total number. When the actual load value is less than the target threshold, it means that the seed server corresponding to the actual load value currently carries less load. In order to ensure the utilization rate of the seed server, the TV set 1 can be instructed to obtain the target file through the seed server, so that the total number of loads carried by the seed server can be increased.

[0062] Exemplarily, assuming that the target threshold is equal to the difference between the average load value and the total number, there are four seed servers that establish communication connection with server 400, namely seed server 0, seed server 1, seed server 2 and seed server 3, the actual load value corresponding to seed server 0 is 20, the actual load value corresponding to seed server 1 is 30, the actual load value corresponding to seed server 2 is 15, and the actual load value corresponding to seed server 3 is 25. According to the actual load value of each seed server, the average load value is determined to be 23 (rounded up when it is not an integer). The actual load value of each seed server is sorted, and the minimum actual load value is determined to be 15, that is, seed server 2. Since 15 is less than 23-4, the TV can be instructed to obtain the target file through seed server 2.

[0063] As the load assigned to seed server 2 gradually increases, the actual load value of seed server 2 will also gradually increase, which will change the ranking of seed server 2. In this way, it can be ensured that the seed server corresponding to each minimum actual load value can have enough load to attach, ensuring the utilization rate of the seed server.

[0064] In some feasible examples, one seed server corresponds to one target identifier, combined with Figure 4 ,like Figure 5 As shown, the load balancing method provided in the embodiment of the present disclosure further includes S132 and S133.

[0065] S132: When the actual load value is greater than or equal to the target threshold, determine a first value according to the total number, the hash value of the target file, the number of accesses, and the dispersion number threshold.

[0066] In some examples, the sum of the hash value, the number of accesses, and the dispersion number threshold of the target file can be modulo the total number to determine a first value (rounded down when the first value is not 0). Alternatively, when the actual load value is greater than or equal to the average load value, the first ratio is determined based on the ratio of the number of accesses to the dispersion number threshold. The first ratio is modulo the total number to determine a first remainder. The hash value of the target file is modulo the total number to determine a second remainder. The sum of remainders is determined based on the sum of the first remainder and the second remainder. The sum of remainders is modulo the total number to determine a third remainder. The first value is determined to be the third remainder based on the third remainder.

[0067] S133. According to the target identifier corresponding to the seed server, determine that the seed server providing service for the TV 1 is the seed server corresponding to the target identifier equal to the first value, and the address information of the seed server corresponding to the target identifier equal to the first value.

[0068] In some examples, the target identifier may be an initial sequence number, such as: for each seed server that establishes a communication connection with the server 400 and maintains a heartbeat, the server 400 assigns an initial sequence number in sequence according to the order in which the communication connection is established. Afterwards, when the actual load value is greater than or equal to the average load value, the server 400 determines the first value according to the total number, the Hash value of the target file, the number of accesses, and the dispersion number threshold. Afterwards, according to the first value, the initial sequence number equal to the first value is searched in the initial sequence number. Afterwards, the TV set 1 is instructed to obtain the target file through the seed server corresponding to the initial sequence number. As the number of accesses to the target file gradually increases, the first value will also change at this time, so that the TV sets 1 that access the target file can be dispersed on different seed servers, thereby achieving load balancing of the TV sets 1 that access the target files of the hot categories, ensuring the utilization rate of each seed server, and preventing multiple TV sets 1 from accessing the target files of the hot categories at the same time. Because multiple TV sets 1 obtain the target files through the seed server, the problem that the TV set 1 cannot obtain the target files through the seed server in time.

[0069] In some possible implementation examples, combined with Figure 5 ,like Figure 6 As shown, the above S132 can be specifically implemented through the following S1320-S1325.

[0070] S1320: When the actual load value is greater than or equal to the target threshold, determine a first ratio according to a ratio of the number of accesses to the number of dispersion thresholds.

[0071] In some examples, when the first ratio is not 0, it may be rounded down. Alternatively, when the first ratio is not 0, it may be rounded up, which is not limited here.

[0072] S1321. Calculate the modulus of the first ratio to the total number to determine a first remainder.

[0073] S1322. Calculate the modulus of the total number of the hash value of the target file to determine a second remainder.

[0074] S1323. Determine a total remainder according to the sum of the first remainder and the second remainder.

[0075] S1324. Take the sum of the remainders modulo the total number to determine the third remainder.

[0076] S1325. Determine, based on the third remainder, that the first value is the third remainder.

[0077] In some examples, combined with the example given in S131 above, assuming that the target file is accessed 102 times, the threshold of the dispersion times of the popular categories corresponding to the target file is 3, and the hash value of the target file is 6, when the first ratio is not 0, it can be rounded down. At this time, according to the ratio of the access times 102 and the dispersion times threshold 3, the first ratio can be determined to be 34. Afterwards, the first ratio 34 is modulo the total number 4, and the first remainder is determined to be 2. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 2 and the second remainder 2, the total sum of the remainders is determined to be 4. Afterwards, the total sum of the remainders 4 is modulo the total number 4, and the third remainder is determined to be 0. Therefore, it can be determined that the first value is 0. At this time, if Figure 7 As shown, the terminal device 1 can be instructed to obtain the target file through the seed server 0.

[0078] Afterwards, when the number of accesses to the target file becomes 103, at this time, according to the ratio of the number of accesses 103 and the dispersion number threshold 3, it can be determined that the first ratio is 34. Afterwards, the first ratio 34 is modulo the total number 4, and the first remainder is determined to be 2. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 2 and the second remainder 2, the total remainder is determined to be 4. Afterwards, the total remainder 4 is modulo the total number 4, and the third remainder is determined to be 0. Therefore, it can be determined that the first value is 0. At this time, if Figure 7 As shown, the terminal device 2 can be instructed to obtain the target file through the seed server 0.

[0079] Afterwards, when the number of accesses to the target file becomes 104, at this time, according to the ratio of the number of accesses 104 to the dispersion number threshold 3, it can be determined that the first ratio is 34. Afterwards, the first ratio 34 is modulo the total number 4, and the first remainder is determined to be 2. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 2 and the second remainder 2, the total remainder is determined to be 4. Afterwards, the total remainder 4 is modulo the total number 4, and the third remainder is determined to be 0. Therefore, it can be determined that the first value is 0. At this time, if Figure 7 As shown, the terminal device 3 can be instructed to obtain the target file through the seed server 0.

[0080] Afterwards, when the number of accesses to the target file becomes 105, at this time, according to the ratio of the number of accesses 105 and the dispersion number threshold 3, it can be determined that the first ratio is 35. Afterwards, the first ratio 35 is modulo the total number 4, and the first remainder is determined to be 3. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 3 and the second remainder 2, the total remainder is determined to be 5. Afterwards, the total remainder 5 is modulo the total number 4, and the third remainder is determined to be 1. Therefore, it can be determined that the first value is 1. At this time, if Figure 7As shown, the terminal device 4 can be instructed to obtain the target file through the seed server 1.

[0081] Afterwards, when the number of accesses to the target file becomes 106, at this time, according to the ratio of the number of accesses 106 to the dispersion number threshold 3, it can be determined that the first ratio is 35. Afterwards, the first ratio 35 is modulo the total number 4, and the first remainder is determined to be 3. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 3 and the second remainder 2, the total remainder is determined to be 5. Afterwards, the total remainder 5 is modulo the total number 4, and the third remainder is determined to be 1. Therefore, it can be determined that the first value is 1. At this time, if Figure 7 As shown, the terminal device 5 can be instructed to obtain the target file through the seed server 1.

[0082] Afterwards, when the number of accesses to the target file becomes 107, at this time, according to the ratio of the number of accesses 107 to the dispersion number threshold 3, it can be determined that the first ratio is 35. Afterwards, the first ratio 35 is modulo the total number 4, and the first remainder is determined to be 3. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 3 and the second remainder 2, the total remainder is determined to be 5. Afterwards, the total remainder 5 is modulo the total number 4, and the third remainder is determined to be 1. Therefore, it can be determined that the first value is 1. At this time, if Figure 7 As shown, the terminal device 6 can be instructed to obtain the target file through the seed server 1.

[0083] Afterwards, when the number of accesses to the target file becomes 108, at this time, according to the ratio of the number of accesses 108 to the dispersion number threshold 3, it can be determined that the first ratio is 36. Afterwards, the first ratio 36 is modulo the total number 4, and the first remainder is determined to be 0. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 0 and the second remainder 2, the total remainder is determined to be 2. Afterwards, the total remainder 2 is modulo the total number 4, and the third remainder is determined to be 2. Therefore, it can be determined that the first value is 2. At this time, if Figure 7 As shown, the terminal device 7 can be instructed to obtain the target file through the seed server 2.

[0084] Afterwards, when the number of accesses to the target file becomes 109, at this time, according to the ratio of the number of accesses 109 and the dispersion number threshold 3, it can be determined that the first ratio is 36. Afterwards, the first ratio 36 is modulo the total number 4, and the first remainder is determined to be 0. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 0 and the second remainder 2, the total remainder is determined to be 2. Afterwards, the total remainder 2 is modulo the total number 4, and the third remainder is determined to be 2. Therefore, it can be determined that the first value is 2. At this time, if Figure 7As shown, the terminal device 8 can be instructed to obtain the target file through the seed server 2.

[0085] Afterwards, when the number of accesses to the target file becomes 110, at this time, according to the ratio of the number of accesses 110 and the dispersion number threshold 3, it can be determined that the first ratio is 36. Afterwards, the first ratio 36 is modulo the total number 4, and the first remainder is determined to be 0. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 0 and the second remainder 2, the total remainder is determined to be 2. Afterwards, the total remainder 2 is modulo the total number 4, and the third remainder is determined to be 2. Therefore, it can be determined that the first value is 2. At this time, if Figure 7 As shown, the terminal device 9 can be instructed to obtain the target file through the seed server 2.

[0086] Afterwards, when the number of accesses to the target file becomes 111, at this time, according to the ratio of the number of accesses 111 to the dispersion number threshold 3, it can be determined that the first ratio is 37. Afterwards, the first ratio 37 is modulo the total number 4, and the first remainder is determined to be 1. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 1 and the second remainder 2, the total remainder is determined to be 3. Afterwards, the total remainder 3 is modulo the total number 4, and the third remainder is determined to be 3. Therefore, it can be determined that the first value is 3. At this time, if Figure 7 As shown, the terminal device 10 can be instructed to obtain the target file through the seed server 3.

[0087] Afterwards, when the number of accesses to the target file becomes 112, at this time, according to the ratio of the number of accesses 112 to the dispersion number threshold 3, it can be determined that the first ratio is 37. Afterwards, the first ratio 37 is modulo the total number 4, and the first remainder is determined to be 1. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 1 and the second remainder 2, the total remainder is determined to be 3. Afterwards, the total remainder 3 is modulo the total number 4, and the third remainder is determined to be 3. Therefore, it can be determined that the first value is 3. At this time, if Figure 7 As shown, the terminal device 11 can be instructed to obtain the target file through the seed server 3.

[0088] Afterwards, when the number of accesses to the target file becomes 113, at this time, according to the ratio of the number of accesses 113 and the dispersion number threshold 3, it can be determined that the first ratio is 37. Afterwards, the first ratio 37 is modulo the total number 4, and the first remainder is determined to be 1. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 1 and the second remainder 2, the total remainder is determined to be 3. Afterwards, the total remainder 3 is modulo the total number 4, and the third remainder is determined to be 3. Therefore, it can be determined that the first value is 3. At this time, if Figure 7As shown, the terminal device 12 can be instructed to obtain the target file through the seed server 3.

[0089] Afterwards, when the number of accesses to the target file becomes 114, at this time, according to the ratio of the number of accesses 111 and the dispersion number threshold 3, it can be determined that the first ratio is 38. Afterwards, the first ratio 38 is modulo the total number 4, and the first remainder is determined to be 2. Afterwards, the hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. According to the sum of the first remainder 2 and the second remainder 2, the total remainder is determined to be 4. Afterwards, the total remainder 4 is modulo the total number 4, and the third remainder is determined to be 0. Therefore, it can be determined that the first value is 0. At this time, if Figure 7 As shown, the terminal device 13 can be instructed to obtain the target file through the seed server 0.

[0090] Specifically, the load balancing method provided by the embodiment of the present disclosure can control the total number of televisions 1 accessing the target file carried by each single seed server by assigning a value of the dispersion number threshold. The larger the value of the dispersion number threshold, the larger the total number of televisions 1 accessing the target file carried by a single seed server.

[0091] It can be seen that as the number of accesses to the target file gradually increases, the first value will also change, even if the seed server 0 is still able to continue to provide services for the load (such as continuing to provide services for the terminal device 7). At this time, the server 400 will also instruct the subsequent terminal device 7 to obtain the target file through the seed server 1. After that, the terminal device 7 no longer obtains the target file through the seed server 0, but obtains the target file through the seed server 1, so that the terminal devices accessing the target file can be dispersed on different seed servers, thereby achieving load balancing for the terminal devices accessing the target files of the popular categories, ensuring the utilization rate of each seed server, and preventing multiple terminal devices from simultaneously accessing the target files of the popular categories. Because multiple terminal devices obtain the target files through the seed server, the terminal devices cannot obtain the target files through the seed server in time.

[0092] In some feasible examples, the file type also includes unpopular categories; Figure 4 ,like Figure 8 As shown, the above S12 can be specifically implemented through the following S120 and S121.

[0093] S120: When the number of accesses corresponding to the target file is greater than or equal to the threshold number, determine that the file type of the target file is a hot category.

[0094] In some examples, the threshold number is equal to the ratio of the historical access times of the target file to the historical statistical days, or the threshold number is provided by a third party through analysis of the target file, or the threshold number is determined based on the average threshold number of historical popular categories.

[0095] S121. When the number of accesses corresponding to the target file is less than the threshold number, determine that the file type of the target file is a less popular category.

[0096] In some feasible examples, the file type includes a popular category; Figure 4 ,like Figure 5 As shown, the above S130 can be specifically implemented through the following S134.

[0097] S134. When the file type is a popular category and the dispersion times threshold is 0, determine the seed server providing services to the TV 1 and the address information of the seed server according to the total number, the target value and the hash value of the target file.

[0098] In some examples, the target value is a random number (rand). The target identifier can be an initial sequence number, such as: for each seed server that establishes a communication connection with the server 400 and maintains a heartbeat, the server 400 assigns an initial sequence number in the order in which the communication connection is established. Afterwards, when the file type is a popular category and the threshold of the number of dispersion times is 0, the server 400 determines the second value based on the total number, the target value, and the hash value of the target file. Afterwards, based on the second value, the initial sequence number equal to the second value is searched in the initial sequence number. Afterwards, the TV 1 is instructed to obtain the target file through the seed server corresponding to the initial sequence number.

[0099] Exemplarily, the server 400 may obtain a second value by taking the modulus of the total sum of the target value and the hash value of the target file. Wherein, when the second value is not 0, the second data may be rounded down. Alternatively, the server 400 takes the modulus of the total sum of the hash value of the target file to determine a second remainder. The sum of the second remainder and the target value is taken the modulus of the total sum to determine a fourth remainder. According to the target identifier corresponding to the seed server, it is determined that the seed server providing service to the TV 1 is the seed server corresponding to the target identifier identical to the fourth remainder, as well as the address information of the seed server.

[0100] In some feasible examples, one seed server corresponds to one target identifier; Figure 5 ,like Figure 6 As shown, the above S134 can be specifically implemented through the following S1340-S1342.

[0101] S1340: When the file type is a popular category and the scattering times threshold is 0, the hash value of the target file is modulo the total number to determine a second remainder.

[0102] S1341. Take the sum of the second remainder and the target value modulo the total to determine the fourth remainder.

[0103] S1342: According to the target identifier corresponding to the seed server, determine that the seed server providing service for the TV 1 is the seed server corresponding to the target identifier identical to the fourth remainder, and the address information of the seed server.

[0104] In some examples, combined with the example given in S1325, if the hash value of the target file is assumed to be 6, the target value is a random number, and the random number is 2, then the hash value 6 of the target file and the random number 2 are summed to obtain the modulus of the total 4, and the second remainder is determined to be 0. At this time, the current TV 1 can be instructed to obtain the target file through the seed server 0. The next time, when a request information for obtaining the target file comes, the target value is a random number, so the target value will change at this time. For example, when the random number is 5, the hash value 6 of the target file and the random number 5 are summed to obtain the modulus of the total 4, and the second remainder is determined to be 3. At this time, the next TV 1 can be instructed to obtain the target file through the seed server 3.

[0105] It can be seen that when the file type is a popular category and the dispersion number threshold is 0, the TV 1 requesting to obtain the target file will be allocated to each seed server, thereby avoiding the problem that when the same seed server provides the target file to the terminal device, the seed server cannot provide the target file to the terminal device in time due to the large number of terminal devices accessing the seed server.

[0106] In some feasible examples, the file type also includes unpopular categories; Figure 4 ,like Figure 5 As shown, the above S13 can be specifically implemented through the following S135.

[0107] S135 . When the file type is a less popular category, determine the seed server providing services to the TV 1 and the address information of the seed server according to the total number and the hash value of the target file.

[0108] In some examples, the target identifier may be an initial sequence number, such as: for each seed server that establishes a communication connection with the server 400 and maintains a heartbeat, the server 400 assigns an initial sequence number in sequence according to the order in which the communication connection is established. Afterwards, when the file type is a cold category, the server 400 determines a third value based on the total number and the hash value of the target file. Afterwards, based on the third value, an initial sequence number equal to the third value is searched in the initial sequence number. Afterwards, the TV 1 is instructed to obtain the target file through the seed server corresponding to the initial sequence number.

[0109] Exemplarily, the server 400 may determine the third value based on the sum of the total number and the hash value of the target file. Alternatively, the server 400 modulo the total number of the hash value of the target file to obtain a second remainder. Based on the second remainder, it is determined that the third value is equal to the second remainder.

[0110] In some feasible examples, one seed server corresponds to one target identifier; Figure 5 ,like Figure 6 As shown, the above S135 can be specifically implemented through the following S1322 and S1350.

[0111] S1322: When the file type is a less popular category, take the hash value of the target file modulo the total number to obtain a second remainder.

[0112] In some examples, combined with the example given in S1325, when the Hash value of the target file is assumed to be 6 at the previous time, the Hash value 6 of the target file is modulo the total number 4, and the second remainder is determined to be 2. At this time, the current TV set 1 can be instructed to obtain the target file through the seed server 2. Next time, when a request information for obtaining the target file comes, since the Hash value of the target file has not changed, the next TV set 1 can be instructed to continue to obtain the target file through the seed server 2.

[0113] S1350: According to the target identifier corresponding to the seed server, determine that the seed server providing service for the TV 1 is the seed server corresponding to the target identifier identical to the second remainder, and the address information of the seed server.

[0114] It can be seen that when the file type of the target file is a cold category, the target file can be provided by a seed server. As the number of accesses to the target file gradually increases, and the number of accesses is greater than the threshold number, the file type of the target file will change from a cold category to a hot category. Thus, the server 400 can select a suitable load balancing method according to the number of accesses to the target file, allocate seed servers, and ensure load balancing of each seed server in the distributed cluster.

[0115] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0116] The embodiment of the present application can divide the functional modules of the load balancing device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0117] like Fig. 9 As shown, an embodiment of the present application provides a structural diagram of a server 400 , which includes a communicator 101 and a processor 102 .

[0118] The communicator 101 is used to receive a request message sent by a terminal device for requesting to obtain a target file; the processor 102 is used to determine the file type of the target file according to the number of accesses corresponding to the target file received by the communicator 101; the processor 102 is also used to determine the seed server providing services for the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file received by the communicator 101; the processor 102 is also used to control the communicator 101 to send a reply message carrying the address information to the terminal device; wherein the reply message is used to instruct the terminal device to obtain the target file through the seed server corresponding to the address information.

[0119] In some implementable examples, the file type includes a hot category; the processor 102 is specifically used to determine the average load value and the minimum actual load value according to the total number of connected seed servers and the actual load value of each seed server when the file type is a hot category and the dispersion number threshold corresponding to the hot category is not 0; the processor 102 is specifically used to determine that the seed server providing services to the terminal device is the seed server corresponding to the minimum actual load value, and the address information corresponding to the seed server corresponding to the minimum actual load value when the actual load value is less than the target threshold. The target threshold is obtained by one or more of the average load value and the total number.

[0120] In some feasible examples, one seed server corresponds to one target identifier, and the processor 102 is further used to determine a first value based on the total number, the hash value of the target file received by the communicator 101, the number of accesses and the dispersion number threshold when the actual load value is greater than or equal to the target threshold; the processor 102 is also used to determine, based on the target identifier corresponding to the seed server, that the seed server providing services to the terminal device is the seed server corresponding to the target identifier equal to the first value, as well as the address information of the seed server corresponding to the target identifier equal to the first value.

[0121] In some implementable examples, the processor 102 is specifically used to determine a first ratio according to the ratio of the access count and the dispersion count threshold when the actual load value is greater than or equal to the average load value; the processor 102 is specifically used to determine a first remainder by taking the modulus of the first ratio with the total number; the processor 102 is specifically used to determine a second remainder by taking the modulus of the hash value of the target file received by the communicator 101 with the total number; the processor 102 is specifically used to determine a total remainder according to the sum of the first remainder and the second remainder; the processor 102 is specifically used to determine a third remainder by taking the modulus of the total number of remainders; the processor 102 is specifically used to determine that the first value is a third remainder according to the third remainder.

[0122] In some feasible examples, the file type also includes unpopular categories; the processor 102 is specifically used to determine that the file type of the target file is a popular category when the number of accesses corresponding to the target file is greater than or equal to a threshold number; the processor 102 is specifically used to determine that the file type of the target file is a unpopular category when the number of accesses corresponding to the target file is less than a threshold number.

[0123] In some feasible examples, the file type includes a popular category; the processor 102 is specifically used to determine the seed server providing services to the terminal device and the address information of the seed server according to the total number, the target value and the hash value of the target file received by the communicator 101 when the file type is a popular category and the dispersion number threshold is 0.

[0124] In some feasible examples, one seed server corresponds to one target identifier; the processor 102 is specifically used to determine a second remainder by taking the modulus of the total number of the hash value of the target file received by the communicator 101 when the actual load value is greater than or equal to the target threshold; the processor 102 is specifically used to determine a fourth remainder by taking the modulus of the total number of the sum of the second remainder and the target value; the processor 102 is specifically used to determine, based on the target identifier corresponding to the seed server, that the seed server providing services to the terminal device is the seed server corresponding to the target identifier identical to the fourth remainder, as well as the address information of the seed server.

[0125] In some feasible examples, the file type also includes unpopular categories; the processor 102 is specifically used to determine the seed server providing services to the terminal device and the address information of the seed server according to the total number and the hash value of the target file received by the communicator 101 when the file type is an unpopular category.

[0126] In some feasible examples, one seed server corresponds to one target identifier; the processor 102 is specifically used to take the hash value of the target file received by the communicator 101 modulo the total number to obtain a second remainder when the file type is a rare category; the processor 102 is specifically used to determine, based on the target identifier corresponding to the seed server, that the seed server providing services to the terminal device is the seed server corresponding to the target identifier identical to the second remainder, as well as the address information of the seed server.

[0127] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and its role will not be repeated here.

[0128] Of course, the server 400 provided in the embodiment of the present application includes but is not limited to the above modules, for example, the server 400 may also include a memory 103. The memory 103 may be used to store the program code of the server 400, and may also be used to store data generated by the server 400 during operation, such as data in a write request.

[0129] As an example, combining Figure 3 The functions implemented by the receiving unit 200 and the sending unit 202 in the server 400 are the same as the functions of the communicator 101, the functions implemented by the processing unit 201 are the same as the functions of the processor 102, and the functions implemented by the storage unit 203 are the same as the functions of the memory 103.

[0130] like Fig.10As shown, an embodiment of the present application also provides a chip system, which can be applied to the server 400 in the aforementioned embodiment. The chip system includes at least one processor 1501 and at least one interface circuit 1502. The processor 1501 can be the processor in the above-mentioned server 400. The processor 1501 and the interface circuit 1502 can be interconnected through a line. The processor 1501 can receive and execute computer instructions from the memory of the above-mentioned server 400 through the interface circuit 1502. When the computer instructions are executed by the processor 1501, the server 400 can execute the various steps performed by the server 400 in the above-mentioned embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0131] The embodiment of the present application also provides a computer-readable storage medium for storing computer instructions executed by the above-mentioned server 400.

[0132] The embodiment of the present application also provides a computer program product, including computer instructions executed by the above-mentioned server 400.

[0133] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A load balancing method, characterized in that: include: Receiving request information sent by a terminal device for requesting to obtain a target file; Determining the file type of the target file according to the number of accesses corresponding to the target file; Determine the seed server providing service for the terminal device and the address information of the seed server according to at least two items of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the number of accesses and the hash value of the target file; wherein, when the file type is a popular category and the dispersion number threshold corresponding to the popular category is not 0, determine the average load value and the minimum actual load value according to the total number of connected seed servers and the actual load value of each seed server; In a case where the actual load value is greater than or equal to the target threshold, determining a first value according to the total number, the hash value of the target file, the number of accesses, and the dispersion number threshold; According to the target identifier corresponding to the seed server, determining that the seed server providing service for the terminal device is the seed server corresponding to the target identifier equal to the first value, and the address information of the seed server corresponding to the target identifier equal to the first value; Sending a reply message carrying the address information to the terminal device; wherein the reply message is used to instruct the terminal device to obtain the target file through the seed server corresponding to the address information.

2. The load balancing method according to claim 1, characterized in that: The determining of the seed server providing service for the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the access number and the hash value of the target file includes: When the file type is a hot category and the dispersion number threshold corresponding to the hot category is not 0, determining an average load value and a minimum actual load value according to the total number of connected seed servers and the actual load value of each seed server; When the actual load value is less than the target threshold, the seed server providing service to the terminal device is determined to be the seed server corresponding to the minimum actual load value, and the address information corresponding to the seed server corresponding to the minimum actual load value; wherein the target threshold is obtained by one or more of the average load value and the total number.

3. The load balancing method according to claim 1, characterized in that: When the actual load value is greater than or equal to the target threshold, determining a first value according to the total number, the hash value of the target file, the number of accesses, and the dispersion number threshold includes: In a case where the actual load value is greater than or equal to the target threshold, determining a first ratio according to a ratio of the number of accesses to the number of dispersion thresholds; Taking the first ratio modulo the total number to determine a first remainder; Taking the hash value of the target file modulo the total number to determine a second remainder; Determine the sum of remainders according to the sum of the first remainder and the second remainder; Taking the remainder sum modulo the total number to determine a third remainder; According to the third remainder, the first value is determined to be the third remainder.

4. The load balancing method according to any one of claims 1 to 3, characterized in that: The file types also include unpopular categories; The determining the file type of the target file according to the number of accesses corresponding to the target file includes: When the number of accesses corresponding to the target file is greater than or equal to the threshold number, determining that the file type of the target file is a hot category; When the number of accesses corresponding to the target file is less than the threshold number, it is determined that the file type of the target file is a less popular category.

5. The load balancing method according to claim 1, characterized in that: The determining of the seed server providing service for the terminal device and the address information of the seed server according to at least two of the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the access number and the hash value of the target file includes: When the file type is a popular category and the dispersion number threshold is 0, the seed server providing services to the terminal device and the address information of the seed server are determined according to the total number, the target value and the hash value of the target file.

6. The load balancing method according to claim 5, characterized in that: One seed server corresponds to one target identifier; When the file type is a popular category and the dispersion number threshold is 0, determining the seed server providing services for the terminal device and the address information of the seed server according to the total number, the target value and the hash value of the target file includes: When the file type is a popular category and the dispersion number threshold is 0, the hash value of the target file is modulo the total number to determine a second remainder; Taking the sum of the second remainder and the target value modulo the total number to determine a fourth remainder; According to the target identifier corresponding to the seed server, it is determined that the seed server providing service for the terminal device is the seed server corresponding to the target identifier identical to the fourth remainder, and the address information of the seed server.

7. The load balancing method according to claim 1, characterized in that: The file types also include unpopular categories; The step of determining the seed server providing service for the terminal device according to the file type, the dispersion number threshold corresponding to the file type, the total number of connected seed servers, the actual load value of each seed server, the access number and at least two of the hash value of the target file, and the address information of the seed server includes: In the case that the file type is a less popular category, a seed server providing services to the terminal device and address information of the seed server are determined according to the total number and the hash value of the target file.

8. The load balancing method according to claim 7, characterized in that: One seed server corresponds to one target identifier; In the case where the file type is a less popular category, determining a seed server providing services for the terminal device and address information of the seed server according to the total number and the hash value of the target file includes: When the file type is a rare category, taking the hash value of the target file modulo the total number to obtain a second remainder; According to the target identifier corresponding to the seed server, it is determined that the seed server providing service for the terminal device is the seed server corresponding to the target identifier identical to the second remainder, and the address information of the seed server.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the load balancing method described in any one of claims 1 to 8 when executing the computer program.