Load balancing method and related equipment

文档序号:7334 发布日期:2021-09-17 浏览:49次 中文

1. A load balancing method is applied to a current partition server, and is characterized by comprising the following steps:

receiving a target service request sent by user equipment based on an HTTP (hyper text transport protocol);

processing the target service request or redirecting a partitioned server based on an HTTP protocol based on a current load state;

and if the partition server is redirected based on the HTTP protocol, feeding back corresponding redirection information so that the user equipment sends the target service request based on the redirection information.

2. The method of claim 1, wherein processing the target service request or redirecting the partitioned server based on the HTTP protocol based on the current load status comprises any one of:

acquiring current load-related information, and processing the target service request when the load state is determined to be moderate load based on the information;

and obtaining current load-related information, and redirecting the partitioned server based on the HTTP when the load state is determined to be low load or high load based on the information.

3. The method according to claim 2, wherein the HTTP based redirection partition server comprises any one of the following:

when the load state is high load, initiating a task of expanding the partition server, and redirecting to a next partition server based on an HTTP (hyper text transport protocol);

and when the load state is low load, executing the task of merging the current partition server and other partition servers, and redirecting to the previous partition server based on the HTTP.

4. The method of claim 3, wherein the merging with other partitioned servers comprises at least one of:

setting a virtual identifier; the virtual identifier is used for being combined with other partition servers and then redirected to the last partition server based on the virtual identifier when a service request is received;

when merging with other partition servers, determining that the current load reaches a preset threshold value, and if a service request is not received within a preset time period, executing a task of destroying the current partition server;

when the partition server is merged with other partition servers or after the task of destroying the current partition server is executed, when a service request sent based on redirection information is received, the partition server corresponding to the service request is redirected to the previous partition server;

when merging with other partition servers and receiving tasks of the extended partition servers, stopping merging;

and after the task of destroying the current partition server is executed and the task of the expanded partition server is received, executing the task of rebuilding the partition server to continuously process the service request or redirect the partition server.

5. The method of claim 1, further comprising:

and if the target service request is processed, feeding back corresponding request success information so as to receive a service request sent by the user equipment next time.

6. A load balancing method applied to user equipment is characterized by comprising the following steps:

for a target service request sent based on an HTTP protocol, the following steps are repeatedly executed until request success information is obtained:

receiving response information fed back by the partition server based on the current load state; the response information comprises request success information corresponding to the target service request or redirection information corresponding to a redirection partition server based on an HTTP (hyper text transport protocol);

upon receiving the redirection information, sending the target service request based on the redirection information.

7. The method of claim 6, wherein the target service request carries a preset partition identifier or a partition identifier corresponding to a partition server that successfully responds to a previous service request; the method further comprises the following steps:

when the request success information is received, storing a partition identifier corresponding to a partition server for processing the target service request;

the request success information comprises a state code fed back by the target service request processed by the partition server or reminding information generated when the information fed back by the partition server is not received within a preset time length.

8. The method of claim 6, wherein the redirection information comprises a next zone identifier corresponding to a high load state or a last zone identifier corresponding to a low load state; the resending the target service request based on the redirection information includes any one of:

resending the target service request based on the next partition identification;

resending the target service request based on the last partition identification.

9. A load balancing device applied to a current partition server is characterized by comprising:

the receiving module is used for receiving a target service request sent by user equipment based on an HTTP (hyper text transport protocol);

the processing module is used for processing the target service request or redirecting the partitioned server based on the HTTP based on the current load state;

and the feedback module is used for feeding back corresponding redirection information if the partition server is redirected based on the HTTP protocol so that the user equipment sends the target service request based on the redirection information.

10. A load balancing device applied to User Equipment (UE) is characterized by comprising:

the loop module is used for repeatedly executing the following steps aiming at a target service request sent based on an HTTP protocol until request success information is obtained:

receiving response information fed back by the partition server based on the current load state; the response information comprises request success information corresponding to the target service request or redirection information corresponding to a redirection partition server based on an HTTP (hyper text transport protocol);

upon receiving the redirection information, sending the target service request based on the redirection information.

11. An electronic device, comprising:

one or more processors;

a memory;

one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: performing the method of load balancing according to any one of claims 1 to 5 or 6 to 8.

12. A computer readable storage medium storing at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement a method of load balancing according to any one of claims 1 to 5 or 6 to 8.

Background

In a plurality of services implemented based on the internet, due to the limitation of service characteristics, unlimited expansion of user scale cannot be supported, for example, when the number of online users of a large game is large, a single server cannot be adopted to support all service requests, a plurality of partitions need to be arranged for operation, and the whole user is divided and then provided with services by adopting servers of different partitions, so that the pressure of the servers is effectively shared.

In the prior art, when a plurality of partitions are provided, users generally select the partitions actively or count people by means of a real-time online people counting system to perform user partitioning. However, the active selection of the partition by the user not only results in poor user experience but also results in unbalanced load of each partition server; when the system is used for user partition based on real-time online people counting, although the system is relatively friendly to users, the implementation complexity is high, the system is easy to break down depending on the operation of the system, and the operation stability is low.

Disclosure of Invention

The present application provides a load balancing method and related device, which can solve at least one of the above technical problems. The technical scheme is as follows:

in a first aspect, a load balancing method is provided, which is applied to a current partition server, and includes: receiving a target service request sent by user equipment based on an HTTP (hyper text transport protocol);

processing the target service request or redirecting a partitioned server based on an HTTP protocol based on a current load state;

and if the partition server is redirected based on the HTTP protocol, feeding back corresponding redirection information so that the user equipment sends the target service request based on the redirection information.

With reference to the first aspect, in a first implementation manner of the first aspect, the processing the target service request or redirecting the partitioned server based on the HTTP protocol based on the current load status includes any one of:

acquiring current load-related information, and processing the target service request when the load state is determined to be moderate load based on the information;

and obtaining current load-related information, and redirecting the partitioned server based on the HTTP when the load state is determined to be low load or high load based on the information.

With reference to the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the HTTP protocol-based redirection partition server includes any one of:

when the load state is high load, initiating a task of expanding the partition server, and redirecting to a next partition server based on an HTTP (hyper text transport protocol);

and when the load state is low load, executing the task of merging the current partition server and other partition servers, and redirecting to the previous partition server based on the HTTP.

With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the merging with other partitioned servers includes at least one of:

setting a virtual identifier; the virtual identifier is used for being combined with other partition servers and then redirected to the last partition server based on the virtual identifier when a service request is received;

when merging with other partition servers, determining that the current load reaches a preset threshold value, and if a service request is not received within a preset time period, executing a task of destroying the current partition server;

when the partition server is merged with other partition servers or after the task of destroying the current partition server is executed, when a service request sent based on redirection information is received, the partition server corresponding to the service request is redirected to the previous partition server;

when merging with other partition servers and receiving tasks of the extended partition servers, stopping merging;

and after the task of destroying the current partition server is executed and the task of the expanded partition server is received, executing the task of rebuilding the partition server to continuously process the service request or redirect the partition server.

With reference to the first aspect, in a fourth implementation manner of the first aspect, the method further includes:

and if the target service request is processed, feeding back corresponding request success information so as to receive a service request sent by the user equipment next time.

In a second aspect, a load balancing method is provided, which is applied to a user equipment, and includes: for a target service request sent based on an HTTP protocol, the following steps are repeatedly executed until request success information is obtained:

receiving response information fed back by the partition server based on the current load state; the response information comprises request success information corresponding to the target service request or redirection information corresponding to a redirection partition server based on an HTTP (hyper text transport protocol);

upon receiving the redirection information, sending the target service request based on the redirection information.

With reference to the second aspect, in a first implementation manner of the second aspect, the target service request carries a preset partition identifier or a partition identifier corresponding to a partition server that successfully responds to a previous service request; the method further comprises the following steps:

when the request success information is received, storing a partition identifier corresponding to a partition server for processing the target service request;

the request success information comprises a state code fed back by the target service request processed by the partition server or reminding information generated when the information fed back by the partition server is not received within a preset time length.

With reference to the second aspect, in a second implementation manner of the second aspect, the redirection information includes a next partition identifier corresponding to a high load state or a last partition identifier corresponding to a low load state; the resending the target service request based on the redirection information includes any one of:

resending the target service request based on the next partition identification;

resending the target service request based on the last partition identification.

In a third aspect, a load balancing apparatus is provided, including:

the receiving module is used for receiving a target service request sent by user equipment based on an HTTP (hyper text transport protocol);

the processing module is used for processing the target service request or redirecting the partitioned server based on the HTTP based on the current load state;

and the feedback module is used for feeding back corresponding redirection information if the partition server is redirected so that the user equipment sends the target service request based on the redirection information.

With reference to the third aspect, in a first implementation manner of the third aspect, the processing module includes any one of the following units:

the processing unit is used for acquiring current information related to the load and processing the target service request when the load state is determined to be moderate load based on the information;

and the redirection unit is used for acquiring the current information related to the load, and redirecting the partitioned server based on the HTTP when the load state is determined to be low load or high load based on the information.

With reference to the first implementation manner of the third aspect, in a second implementation manner of the third aspect, the redirection unit includes any one of the following sub-units:

the first redirection subunit is used for initiating a task of expanding the partition server when the load state is high load and redirecting to the next partition server;

and the second redirection subunit is used for merging with other partitioned servers and redirecting to the previous partitioned server when the load state is low load.

With reference to the second implementation manner of the third aspect, in a third implementation manner of the third aspect, the second redirecting subunit is further configured to perform at least one of:

setting a virtual identifier; the virtual identifier is used for being combined with other partition servers and then redirected to the last partition server based on the virtual identifier when a service request is received;

when merging with other partition servers, determining that the current load reaches a preset threshold value, and if a service request is not received within a preset time period, executing a task of destroying the current partition server;

when the partition server is merged with other partition servers or after the task of destroying the current partition server is executed, when a service request sent based on redirection information is received, the partition server corresponding to the service request is redirected to the previous partition server;

when merging with other partition servers and receiving tasks of the extended partition servers, stopping merging;

and after the task of destroying the current partition server is executed and the task of the expanded partition server is received, executing the task of rebuilding the partition server to continuously process the service request or redirect the partition server.

With reference to the third aspect, in a fourth implementation manner of the third aspect, the apparatus further includes a success feedback module: and the server is used for feeding back corresponding request success information if the target service request is processed so as to receive the service request sent by the user equipment next time.

In a fourth aspect, a load balancing apparatus is provided, including: the loop module is used for repeatedly executing the following steps aiming at a target service request sent based on an HTTP protocol until request success information is obtained:

receiving response information fed back based on the current load state; the response information comprises request success information corresponding to the target service request or redirection information corresponding to a redirection partition server based on an HTTP (hyper text transport protocol);

upon receiving the redirection information, resending the target service request based on the redirection information.

With reference to the fourth aspect, in a first implementation manner of the fourth aspect, the target service request carries a preset partition identifier or a partition identifier corresponding to a partition server that successfully responds to a previous service request; the device also comprises a storage module used for storing the partition identification corresponding to the partition server for processing the target service request when the request success information is received;

the request success information comprises a state code fed back by the target service request processed by the partition server or reminding information generated when the information fed back by the partition server is not received within a preset time length.

With reference to the fourth aspect, in a second implementation manner of the fourth aspect, the redirection information includes a next partition identifier corresponding to a high load state or a last partition identifier corresponding to a low load state; the circulation module comprises any one of the following units:

a first sending unit, configured to resend the target service request based on the next partition identifier;

a second sending unit, configured to resend the target service request based on the last partition identifier.

In a fifth aspect, an electronic device is provided, comprising: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the load balancing method according to the first aspect and any one of the second aspect and any one of the embodiments thereof is performed.

In a sixth aspect, there is provided a computer readable storage medium storing at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the load balancing method of the first aspect and any of the aspects and any of the embodiments thereof.

The beneficial effect that technical scheme that this application provided brought is:

compared with the prior art, the method provided by the application processes a target service request or redirects a partitioned server based on an HTTP (hyper text transport protocol) protocol based on the current load state when receiving the target service request sent by user equipment based on the HTTP protocol; and if the partition server is redirected based on the HTTP protocol, feeding back corresponding redirection information so that the user equipment sends a target service request based on the redirection information. According to the application, the server can be used for acquiring the load capacity of the server and the redirection capacity of the HTTP, so that the user group can be automatically and separately served in different zones, the effect of load balancing of the server is achieved, the user does not need to select the zones, the implementation complexity is reduced, and the operation stability is improved.

Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.

FIG. 1 is a block diagram of an automatic partition scheme based on a real-time online people counting system in the prior art;

fig. 2 is a schematic flowchart of a load balancing method according to an embodiment of the present application;

fig. 3 is a schematic flowchart of another load balancing method according to an embodiment of the present application;

fig. 4 is a schematic flowchart of a load balancing method according to an embodiment of the present application;

fig. 5 is a schematic view of an operating environment of a load balancing method according to an embodiment of the present application;

fig. 6 is a schematic structural diagram of a load balancing apparatus according to an embodiment of the present application

Fig. 7 is a schematic structural diagram of another load balancing apparatus according to an embodiment of the present application;

fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.

As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.

To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

The following is a description of terms and related technologies that may be involved in embodiments of the present application:

cloud technology (Cloud technology) is based on a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.

Cloud computing (cloud computing) refers to a delivery and use mode of an IT infrastructure, and refers to obtaining required resources in an on-demand and easily-extensible manner through a network; the generalized cloud computing refers to a delivery and use mode of a service, and refers to obtaining a required service in an on-demand and easily-extensible manner through a network. Such services may be IT and software, internet related, or other services. Cloud Computing is a product of development and fusion of traditional computers and Network Technologies, such as Grid Computing (Grid Computing), distributed Computing (distributed Computing), Parallel Computing (Parallel Computing), Utility Computing (Utility Computing), Network Storage (Network Storage Technologies), Virtualization (Virtualization), Load balancing (Load Balance), and the like. With the development of diversification of internet, real-time data stream and connecting equipment and the promotion of demands of search service, social network, mobile commerce, open collaboration and the like, cloud computing is rapidly developed. Different from the prior parallel distributed computing, the generation of cloud computing can promote the revolutionary change of the whole internet mode and the enterprise management mode in concept.

The user: a user under a certain internet service.

The user equipment: an electronic device adopted by a user.

And partitioning, namely partitioning the user into different service partitions, such as the east China, the north China, the south China, the middle China and the like based on the geographic position.

And (3) district clothing: and the background server provides services for all the user equipment under a certain partition. The zone service may be a distributed cluster or a single machine. The application can regard a district uniform as a whole.

New partition (extended partition): when the load is high due to more user equipment under a certain partition, the partition is newly built, so that part of users under the partition are dispatched to the newly built partition.

Merging partitions (merging regions): when there are fewer user devices under a partition, the partition is merged into another partition.

A partition management module: and controlling the newly-built partition or the combined partition according to the state of the partition.

Real-time online people counting system: the system capable of counting the number of people online in real time generally uses big data analysis tools such as Storm and Spark to count the access logs of the user equipment to obtain results.

A monitoring module: for monitoring the load. The real-time online people counting system belongs to a monitoring module.

A gateway: uniformly receiving a service request sent by user equipment based on an HTTP (Hypertext Transfer Protocol), and forwarding the request of the user equipment to different servers; traffic scheduling, session maintenance, load balancing may be implemented in the gateway.

In the prior art, a manual operation scheme is provided for a situation that in a plurality of services implemented based on the internet, due to the limitation of service characteristics, the user scale cannot be supported to be infinitely enlarged, and a plurality of partitions need to be set for operation, and generally manual operation is adopted, so that when a plurality of users exist, the user actively selects one partition from the plurality of currently set partitions; when the number of users is small, partitions are artificially combined, so that the number of partitions selectable by the users is reduced, and the purpose of combining the partitions (such as reducing resource waste) is achieved. The following description of the manual operation scheme in a certain online game scenario specifically includes the following steps:

(1) firstly, dividing regions according to the online activity of the number of people in each region, and arranging region clothes;

(2) when a user logs in a game, the user is guided to select a partition, and the user can enter the game only after selecting a certain partition;

(3) when the number of users on the online game is reduced or the number of online people in certain subareas is reduced, the step (1) is called back to reduce partial subareas.

(4) When the number of users on the online game is increased or the number of online users in certain partitions is too large, namely the partition load is about to exceed, the process returns to the step (1) to increase some partitions.

The above-mentioned manual operation scheme is usually required to cooperate with the announcement to the user when changing the partition, or to merge the partitions when the user calls for them, so as to maintain the activity of the partition users, and to make the service continue to operate well. Therefore, by adopting the manual operation scheme, the generated product has low user-friendly degree, such as the requirement that a user selects the partition by himself or the requirement that the user sends a request for changing the partition. In order to solve the problem, in the prior art, an automatic partitioning scheme based on a real-time online people counting system is provided, the real-time online people counting system is adopted, the online people counted in real time is fed back to a partition management module in charge of partitioning areas, and the partition management module controls new partitions or merging partitions so as to schedule users in the adaptive partitions.

Specifically, compared with a manual operation scheme, the automatic partitioning scheme based on the real-time online people counting system saves the operation of manual operation partitioning and area combination, and can intelligently partition and combine areas by means of a computer. The real-time online people counting system is crucial in the scheme, the system can count the total online people and the online people of each subarea, and then whether the subareas are newly built and combined is determined according to the online people. The product resulting from this solution, which is mainly composed of several modules as shown in fig. 1, is described below with reference to fig. 1, and specifically, the solution comprises the following steps:

1. automatically partitioning user equipment into partitions according to a certain schedule; the system records the relation between the user equipment and the partitions;

2. and the access log is generated by the access behavior of the user equipment, and the real-time online people counting system senses the access log of the user equipment in real time and feeds the access log back to the partition management module.

3. The real-time online people counting system feeds back the load of each subarea to the subarea management module, and the subarea management module carries out newly-built subareas or processing of merging subareas according to a set strategy.

Therefore, the automatic partition scheme based on the real-time online people counting system does not need to allow users to select partitions, and compared with a manual operation scheme, the user experience degree is higher. However, in some scenarios with backward infrastructure, the automatic partitioning scheme based on the real-time online people counting system may require manual operation and maintenance to deploy partitions, and thus still requires manual intervention. In addition, the real-time online people counting system is generally completed by big data processing cluster kits such as Kafka, ZooKeeper, Storm, Spark and the like, and the cost is very high; or the load level is judged by counting the service load of each partition, such as the number of connections, the CPU utilization, and other indicators, but a complex monitoring module is still required to provide support to monitor the load level of each partition and the load of the whole partition.

In order to solve the above problems, the present application provides a load balancing method, which can obtain the load capacity of the service based on the server without introducing a complex monitoring module, and achieve the effect of automatically enabling the user group to be served in different areas by combining the redirection capacity of the HTTP.

The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.

The load balancing method provided in the embodiment of the present application is applied to a server, and may be specifically executed by an electronic device provided in the embodiment of the present application, and specifically, the electronic device may be a server, and the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and a big data and artificial intelligence platform, but is not limited thereto. As shown in fig. 2, the load balancing method provided in the embodiment of the present application includes the following steps S201 to S203:

step S201: and receiving a target service request sent by the user equipment based on the HTTP.

In particular, the target service request may be a request initiated by the user device based on a service provided by the internet, for example a request initiated based on a need to change game equipment when the user logs in to a certain online game. In the embodiment of the present application, the target service request may be sent using an HTTP protocol, or may be sent using an HTTPs protocol. The HTTP protocol is an application layer protocol for distributed, collaborative and hypermedia information systems; the HTTPS protocol is a network protocol that is constructed by ssl (secure Sockets layer) + HTTP protocol and can perform encryption transmission and identity authentication. Optionally, the operations of data transmission, redirection, and the like performed based on the HTTP protocol according to the embodiment of the present application may also be performed in accordance with the HTTPs protocol.

Optionally, the target service request may be an initial request of the user, or a subsequent request of the user; when the target service request is a user initial request, the application scenario may adapt to that when the user equipment initially initiates the service request (the user is a new user), the target service request is initiated to the corresponding partition server based on the default partition identifier or the random partition identifier. When the target service request is a user relay request, the application scenario may adapt to an existing request history of the user equipment (the user is an old user), and based on an identifier of a partition server that successfully responds to a previous service request, the target service request is initiated to the corresponding partition server.

Step S202: based on the current load state, the target service request is processed or the partitioned server is redirected based on the HTTP protocol.

In particular, load (load) may be understood as the average number of threads in a running queue over a particular time interval; if the load is too high, the partition server may not be able to process the request and/or operation. The current load status may be determined by the average load of the last 1 minute, 5 minutes, and/or 15 minutes (the above time is only an example, and the embodiment of the present application is not limited thereto). The current load state can be determined by the partition server, for example, the partition server determines the load state of the partition server according to the current throughput, the connection number, the CPU or memory utilization rate and other index information. If the partition server measures the load state of the partition server based on CPU (Central processing Unit) use, memory use and IO (input/output) consumption, when any one of the partition servers is detected to be excessively used (exceeds a first set threshold value within specific time), the partition server is determined to be in a high load state; when the indexes are detected to be used less (exceeding a second set threshold value within a specific time), the load is determined to be low. The first set threshold and the second set threshold may be set according to the configuration of the partition server, for example, the partition server operated by the single-core CPU may set the first set threshold to 0.7, and when the load value is not less than 0.7, it is determined that the current load is high (overloaded); the second set threshold may be set to 0.1 or 0, and when the load value is not greater than the second set threshold, it is determined that the current load is low, and it may be considered to destroy the partition server. In addition, when the load value is between the first set threshold and the second set threshold, it may be determined that the current load state is of a medium load, and the current partition server may provide the service normally, and process the service request of the user equipment.

In a feasible embodiment, the current load state may also be determined by the management platform and sent to the partition server after the partition server acquires the index information of itself and uploads the index information to the management platform (which may be a cloud computing platform).

Optionally, in step 202, when the partition servers are in different load states, the corresponding result is different, and if the current load state of the partition servers belongs to a medium load (can provide services), the target service request is processed; otherwise, the partition server will redirect the partition server based on the HTTP protocol. The specific process of processing a target service request or redirecting a partition server based on the HTTP protocol based on the current load status by the partition server will be described in detail in the following embodiments.

Step S203: and if the partition server is redirected based on the HTTP protocol, feeding back corresponding redirection information so that the user equipment sends a target service request based on the redirection information.

In particular, embodiments of the present application are implemented based on the HTTP protocol, where redirection operations are triggered by the partition server by sending special responses (e.g., redirects). In the HTTP protocol, the status code of the redirect response may be denoted as 3XX (e.g., 302). In step S203, the redirection partition server may be understood as that the partition server sends out a redirection response, and the redirection information fed back by the partition server may include a status code corresponding to the redirection response and information provided by the redirection response, which may be embodied as a partition identifier corresponding to the determined redirection partition server in this embodiment of the application. When the user equipment receives a redirection response (such as a received 302 status code), the target server request is retransmitted to the partition server determined by redirection according to the partition identifier corresponding to the partition server characterized in the information provided by the redirection response. As shown in fig. 4, for example: the user equipment sends a service request (http:// a. com/service/g0/joinxxx) to the partition server 0, when the partition server 0 determines that the load is high based on the current load state of the user equipment, the partition server 0 feeds redirection information back to the user equipment (302http:// a. com/service/g 1/joinxpand ═ 1; wherein 302 is a state code), and at this time, the user equipment receives the state code 302 and the URL address, and can know the partition server g1 determined by redirection in the URL address, so that the user equipment sends the service request (http:// a. com/service/group-1/joinxpand ═ 1) to the partition server 1 based on the redirection information.

Optionally, in this application, the redirection may be a temporary redirection, and the corresponding status code is 302. The method can be applied to the scene that the current partition server can not provide service for the user and sends out the redirection response.

In the present application, the user equipment may be understood as an HTTP client/terminal, and the partition server may be understood as an HTTP server; a service request is initiated by the user equipment to create a TCP connection to a designated port of the partitioned server. The partition server listens for the service request of the user equipment at the port. Upon receiving the service request, the partition server returns a status to the user device, such as "200OK" when the partition server successfully processes the service request, and related content, such as a file, error message, or other information requested by the user device.

In an embodiment, the load balancing method provided by the present application may further include step S204: and when the target service request is processed, feeding back corresponding request success information so as to receive the service request sent by the user equipment next time.

Specifically, when the server can currently provide the service to the user equipment, the server will process the target service request and feed back corresponding request success information and/or request content to the user equipment. After the user equipment determines that the current target service request is processed, the user equipment may be considered as being divided into the current partition server, and when a next service request is initiated by the same user equipment subsequently, the service request is sent to the current partition server.

The foregoing embodiments describe the load balancing method provided by the present application, and mainly implement that the server adaptively partitions the user equipment in different partition servers by using the redirection capability of the HTTP based on the current load state, so as to achieve the effect of load balancing for each server. Specifically, the self-adaptation means that when the user equipment is divided based on the load state of the partition server, if the current load state of the current partition server belongs to a medium load, the user equipment is divided into the current partition server (embodied as the current partition server processing a service request sent by the user equipment); if the current load state of the current partition server belongs to high load, initiating a task of expanding the partition server, and indicating that the user equipment is divided into the partition servers (next partition servers) obtained by expansion (embodied as that the partition servers obtained by expansion process service requests sent by the user equipment); and if the current load state of the current partition server belongs to low load, executing a merging task of the current partition server and the last partition server, and indicating to divide the user equipment into the last partition server (embodied as that the last partition server processes a service request sent by the user equipment). When the redirection operation is executed, the user cannot perceive, and the whole redirection process is embodied in that the user equipment sends out the target service request to other servers again based on the partition identification corresponding to the partition server corresponding to the redirection.

The following description will be made in conjunction with the accompanying drawings and embodiments for a specific process of processing a target service request or redirecting a partition server based on an HTTP protocol based on a current load status in the present application.

Specifically, step S202, based on the current load status, processes the target service request or redirects the partitioned server, including any of the following steps A1-A2:

step A1: information currently associated with the load is obtained, and the target service request is processed when the load state is determined to be moderate load based on the information.

Step A2: and obtaining current load-related information, and redirecting the partitioned server based on the HTTP when the load state is determined to be low load or high load based on the information.

Specifically, the load status is used to measure how busy the server is; the information related to the load may be index information such as throughput, number of connections, CPU or memory usage. The load state may be determined based on the number of processes in an operable state (runnable state) and an uninterruptible state (uninterruptible state); optionally, the load status determined based on the load-related information includes the following three cases:

(1) the load state is moderate load: at this point it can be understood that the resources of the server CPU can process the target service request.

In the load state, the server may process the target service request, such as response 200, i.e., successfully process the request; as another example, response 202, the server accepts the request for processing but remains unprocessed.

(2) The load state is high load: it can be understood that the resources of the server cannot provide services; for example, a high load caused by insufficient CPU resources: when the server has only one CPU, it takes 1s to process each process, but if two processes need to process at the same time in the 1s, one process corresponding to each 1s cannot process the process, the load of the corresponding server will increase continuously, and finally the service request cannot be processed in time. Also as high load due to CPU utilization, for example: when a server receives a large number of read requests, IO may become a bottleneck, and a process to be processed is in an untenable state while waiting for IO, so that when a server load is calculated, a high load is finally presented.

(3) The load state is low load: it will be appreciated that the processes currently required to be handled by a server are very few and that very few user requests may be received, and that destruction of the server may be considered to avoid wasting network resources. If the number of processes currently required to be processed by the server is only 2, scheduling the process to another partition server for processing does not affect the capability of the original processing process of the partition server, so that it may be considered to destroy the partition server with a low load state.

When the load state is at high or low load, the server will issue a redirect response (e.g., response 302).

In one embodiment, the load state can be distinguished by setting a load value, and if the full load is 1, the load is considered to be a high load if the load exceeds 1; if the load is less than 0.1, it can be regarded as a low load. The above numerical values are only used as examples, and in practical applications, the numerical values may be set according to practical application scenarios, which is not limited in this application.

Optionally, redirecting the partition server based on the HTTP protocol in step a2 includes at least one of the following steps a21-a 22:

step A21: and when the load state is high load, initiating a task of expanding the partition server, and redirecting to the next partition server based on the HTTP.

Specifically, when initiating a task of expanding a partition server, it may be understood that the server determines that a new partition needs to be created, and at this time, a partition is created in the whole operating system of the product and a partition server providing a service is configured accordingly. For example, the following steps are carried out: assuming that the identification of the partition where the current partition server is located is N, when initiating the task of extending the partition servers, a partition identified as N +1 will be created in the whole runtime environment and configured with the corresponding partition server.

Alternatively, redirecting to the next partition server may be understood as the server providing the partition identifier corresponding to the next partition server to the user equipment when issuing the redirection response.

Through the implementation of the step a21, the characteristic of high load of the service is utilized, and the jump redirection capability of the HTTP is matched to achieve the purpose of adding the user equipment into the newly-built partition in a divided manner. The following is a description of a specific process for merging partitions when the adaptive partition is low in load.

Step A22: and when the load state is low load, executing the task of merging the current partition server and other partition servers, and redirecting to the previous partition server based on the HTTP.

When the partition server is merged with other partition servers, it can be understood that the current partition server determines that partitions need to be merged, and at this time, the whole operating system of the product at least comprises two partitions and is respectively configured with corresponding zone servers. When the partition merging is executed, the current partition server is merged with other partition servers, where the other partition servers may be any partition servers in the whole running system except the current partition server, or may be a partition server previous to the current partition server (e.g., a partition server indicating to expand the current partition server). Optionally, when the merging of the partitions is performed, the method further includes redirecting all the user equipment served by the current partition server to the previous partition server.

Specifically, redirecting to the previous partition server may be understood as that the server provides the partition identifier corresponding to the previous partition server to the user equipment when issuing the redirection response.

Optionally, the merging with other partition servers in step a22 may include at least one of the following steps a221-a 225:

step A221: setting a virtual identifier; and the virtual identifier is used for being combined with other partition servers and then redirected to the upper partition server based on the virtual identifier when a service request is received.

Specifically, assuming that the partition identifier corresponding to the current partition server is N, when the load of the server is very low and it is determined that the merged partition task needs to be executed, the partition server sets a virtual identifier, and when the partition server receives a service request re-sent by the current user equipment or receives a service request sent based on redirection information, based on the current virtual identifier, the partition server directly sends a redirection response, and redirects the service request re-sent correspondingly to the partition identifier N-1 corresponding to the previous partition server. By setting the virtual identifier, the network resource determined by the partition server for redirection can be effectively saved.

Alternatively, the virtual identifier may be set for a server resource utilization condition, for example, an identifier 0 or 1 is set for the partition server, where the identifier 0 (virtual identifier) represents that the current partition server needs to be merged with other partition servers (embodied as that the current partition server no longer processes a service request), and the identifier 1 represents that a load state of the current partition server is of a medium load (embodied as that the service request can be normally processed).

Step A222: when the server is merged with other partition servers, when the current load is determined to reach a preset threshold value, if a service request is not received within a preset time period, the task of destroying the current partition server is executed.

Specifically, in the whole running system of the product, when a service request on the user equipment is processed by the current partition server, the next service request initiated by the user equipment is still sent to the current partition server; and possibly, subsequent partitions converge to a partition corresponding to the current partition server (for example, when the current partition server N is merged with the previous partition server N-1, the next partition server N +1 requests to be merged with the current partition server N), the method and the device are not directly executed when determining to execute the task of merging the partitions, but when determining that the load of the device reaches a preset threshold (for example, the load value is reduced to 0) after redirecting all user equipment served by the current partition server to other partition servers, wait for a certain time duration (the time duration can be determined based on a preset time period), and execute the task of destroying the partition server if any service request is not received in the waiting process.

Step A223: when the service request is received and sent based on the redirection information, the partition server corresponding to the service request is redirected to the previous partition server when the service request is merged with other partition servers or after the task of destroying the current partition server is executed.

Specifically, assume that the current entire operating system includes three partitions, partitions 0, 1, and 2, when the partition server corresponding to partition 1 determines to merge (or merge, that is, after destruction), and partition 2 still exists, and when the partition server corresponding to partition 2 determines to merge, the partition server corresponding to partition 1 receives a service request a sent to the partition server corresponding to partition 1 based on a redirection response sent by the partition server corresponding to partition 2, and at this time, because the partition server corresponding to partition 1 no longer processes the service request, a redirection response is sent (the partition server may perform a redirection operation with the parameter reduce equal to 1), and the partition server corresponding to partition 1 redirects the partition server corresponding to the service request a to the partition server corresponding to partition 0.

Step A224: when merging with other partition servers, and when receiving the task of the extended partition server, stopping merging.

Specifically, for example, assuming that the current entire running system includes three partitions, partitions 0, 1, and 2, when the partition server corresponding to partition 2 determines that the partition server corresponding to partition 1 merges, the user equipment included in partition 2 is scheduled to partition 1 in the merging process, and when an instruction of an extended partition server sent by another partition server or a management platform is received in the merging process (for example, when the partition server corresponding to current partition 1 is in a high load state again, an instruction including a parameter expand ═ 1 is received), the partition server corresponding to partition 2 stops executing the merging operation, so as to reserve partition 2 and the partition server corresponding to partition 2 to provide services for the user.

Step A225: and after the task of destroying the current partition server is executed and the task of the expanded partition server is received, executing the task of rebuilding the partition server to continuously process the service request or redirect the partition server.

Specifically, for example, assume that the current whole operating system includes three partitions, partition 0, 1, and 2; after the partition server corresponding to the partition 1 executes the task of destroying the current partition server, the server releases the occupied resources, the corresponding partition 1 is presented as a virtual partition (the corresponding state may be determined by querying a database, etc.), at this time, if the task of expanding the partition server is received (if a request that expand is 1 is received), the partition 1 that has been destroyed at present is reconstructed (including configuring the corresponding partition server), and a function scenario corresponding to the original partition 1 is obtained (if a service can be provided for the user equipment or a redirection operation is performed).

In the implementation process of the above embodiment, the user using the electronic device cannot perceive the specific situation of the partition, and the whole process (including the redirection operation) can be recorded by the application program of the client.

The embodiment of the present application further provides a load balancing method that can be executed by a user device, which can be specifically executed by the electronic device provided in the embodiment of the present application, and specifically, the electronic device may be a client or a web server, and the client may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart camera, a robot, or the like, but is not limited thereto. As shown in fig. 3, the load balancing method provided in the embodiment of the present application includes the following steps S301:

step S301: the following steps B1-B2 are repeatedly executed for the target service request sent based on the HTTP protocol until the request success information is obtained.

The target service request carries a preset partition identifier or a partition identifier corresponding to a partition server which successfully responds to the previous service request. Specifically, the preset partition identifier may be a default partition identifier or a randomly allocated partition identifier of an application program of the client when the user is a new user; the partition identifier corresponding to the server that successfully responds to the previous request may be that when the user is an old user and the previous service request is completed, the partition identifier of the partition server is stored in the application program of the client, and when the target service request is currently initiated, the target service request is sent to the server that completes the previous service request based on the stored partition identifier. Alternatively, if a partition server successfully processes the last service request of the ue, it may be understood that the ue is divided into the partition servers.

Optionally, when the request success information is received, the user equipment further stores a partition identifier corresponding to the partition server that processes the target service request.

Step B1: receiving response information fed back by the partition server based on the current load state; the response information comprises request success information corresponding to the processing target service request or redirection information corresponding to the redirection partition server based on the HTTP protocol.

The request success information comprises a state code fed back by the partition server processing target service request or reminding information generated when the information fed back by the partition server is not received within a preset time length.

Optionally, when the current resource of the partition server is applicable to providing the service to the user equipment, the target service request initiated by the user equipment is processed, and the corresponding status code 200 and the corresponding request content are fed back to the user equipment. In a possible embodiment, no information is fed back to the user device (e.g., responses 204, 205) even though the partitioned server has processed or is preparing to process the target service request; at this time, the user equipment automatically generates the reminding information if it does not receive the information fed back by the partition server within the preset time length, so as to determine that the target service request has been processed (considering that the user equipment must receive the redirection information if the partition server performs the redirection operation, it may be set that it is default that the target service request has been processed by the partition server if it does not receive any information within the preset time length).

Step B2: upon receiving the redirection information, a target service request is sent based on the redirection information.

Specifically, the redirection information includes a next partition identifier corresponding to a high load state or a last partition identifier corresponding to a low load state; the step B2 of sending the target service request based on the redirection information includes any one of the following steps B21-B22:

step B21: the target service request is resent based on the next partition identification.

Specifically, if the partition server currently receiving the target service request processes a high-load state, the partition server performs a redirection operation and feeds back redirection information to the user equipment, where the redirection information includes a next partition identifier corresponding to the next partition server from the redirection. The user equipment re-initiates the target service request to the server corresponding to the next partition based on the next partition identification.

Step B22: resending the target service request based on the last partition identification.

Specifically, if the partition server currently receiving the target service request processes a low-load state, the partition server performs a redirection operation, and feeds back redirection information to the user, where the redirection information includes a last partition identifier corresponding to a previous partition server from the redirection. The user equipment will reinitiate the target service request based on the last partition identification.

Optionally, in consideration of forward redirection, there is a case that the intermediate partition has been reduced and released, such as assuming that partitions 0, 1, and 2 are included in the current running system; where partition 1 has been curtailed free (e.g., merged with partition 0), the system may store the association for partition 1; the user equipment sends a target service request to a partition server corresponding to the partition 2, and when the partition server corresponding to the partition 2 executes redirection operation, the target service request is redirected to a partition server corresponding to the partition 1; when the user equipment resends the target service request based on the redirection information fed back by the partition server corresponding to the partition 2, because the partition 1 is reduced and released, the target service request resent by the user equipment is directly sent to the partition server corresponding to the partition 0; in this process, the forwarding of the target service request may be implemented by the gateway, for example: when the user equipment resends the target service request based on the redirection information (corresponding to the identifier of the partition 1), the gateway forwards the target service request to the partition server corresponding to the upper partition (that is, forwards the target service request to the partition server corresponding to the partition 0) based on the information that the partition 1 stored in the current system is reduced and released.

In a possible embodiment, step B22 and step a221 (partition server setting virtual identifier) shown in the above embodiment can be understood as adapting to the same application scenario (a certain intermediate partition and its corresponding partition server have been downscaled and released, i.e. merged), and are processed in different ways. Alternatively, the method steps shown in step B22 and step a221 may be referred to one another; that is, when a partition executes the task of merging partitions, the partition server is provided with a virtual identifier and the system stores the relevant information that the partition has been reduced and released.

For the description of determining the load status of the partition server, reference may be made to the description of the above embodiments, and details are not described here.

When the above embodiments are explained with respect to the load balancing method applied to the user side and the load balancing method applied to the service side, there are cases where the load balancing methods are mutually cited, and the cases may be mutually referred to when the specific embodiments are explained.

The method and the device for partitioning the service user equipment can realize the function of partitioning and serving the served user equipment, are simple in implementation process, have the capability of automatically partitioning the user equipment, and can be suitable for being used as the zone service by a single machine, and the zone service can be used for virtualizing a scene automatically expanded.

In a possible embodiment, the operating environment of the present application may include a user device and a server, and on this basis, may further include an intermediate server, such as a gateway, configured to receive a service request initiated by the user device, and automatically forward, in a load-balanced manner, the service request to a partition server corresponding to a partition identifier according to the partition identifier carried in the service request. Optionally, in the embodiment of the present application, when the redirection capability of the HTTP protocol is utilized, the partition may be designed in a Uniform Resource Locator (URL), and the processing may be performed according to a load balancing manner of the URL HASH.

For further explanation of the load balancing method provided in the present application, a feasible application example is provided below with reference to fig. 4 and 5.

Application example 1: in Tracker (a program running on a server) service based on XP2P (a technology with a new generation of P2P as a core), user equipment watching the same video content can be gathered in the same area, and thus, the operations that users can communicate, discuss or share with each other are realized. Then, for video content such as spring festival and evening, because the number of users requesting to view the video content at the same time is very large, all the users cannot be gathered in the same partition, at this time, a partition can be created and a partition server can be configured according to information such as the current number of users, and the user equipment can be divided into various partitions. The process of user equipment division can be realized by adopting the load balancing method provided by the application. For example, 1 hundred million people need very large bandwidth to watch spring festival and evening at the same time, 10 partitions can be divided by using the load balancing method provided by the application, each partition comprises 1000 million people, and users watch through the partition where the respective equipment is located. At this time, the load balancing effect of 10 partitions can be achieved.

Application example 2: in conjunction with fig. 4 and 5, the current operating environment includes a plurality of user devices 501, a partitioned server 502, and a gateway 503. When the user equipment a initiates a target service request, the gateway 503 forwards the target service request to a partition server corresponding to the partition 0 based on the partition identifier 0 carried in the target service request (for example: http:// a. com/service/g0/join xxx); if the partition server corresponding to partition 0 is in a high-load state, initiating a task of extending the partition server backward (at this time, a partition server corresponding to partition 1 is newly added in the operating environment), executing a redirection operation, and sending a redirection response, and forwarding redirection information fed back by the partition server corresponding to partition 0 to the user equipment a by the gateway 503 (for example, the redirection information includes a status code 302 and a URL address http:// a.com/service/g 1/joinxpand ═ 1 determined in the redirection response, where the parameter expand ═ 1 represents redirection to a next partition server); the user equipment A resends the target service request based on the received redirection information; when receiving a target service request retransmitted by the user equipment a, the gateway 503 forwards the target service request to a partition server corresponding to the partition 1 based on a URL address (http:// a. com/service/group-1/joinxpand ═ 1) carried by the request; when a partition server of the partition 1 receives a target service request sent by the user equipment a, and determines that the current state is in a high load state, the partition server initiates a task of expanding the partition server backward (at this time, a partition server corresponding to the partition 2 is newly added in the operating environment), and executes a redirection operation to send out a redirection response, and the gateway 503 forwards redirection information fed back by the partition server corresponding to the partition 1 to the user equipment a (for example, the redirection information includes a state code 302 and a URL address http:// a.com/service/g 2/joinxpand ═ 1 determined in the redirection response, wherein the parameter expand ═ 1 represents redirection to a next partition server); the user equipment a resends the target service request based on the received redirection information, and when the gateway 503 receives the target service request resent by the user equipment a, the gateway forwards the target service request to the partition server corresponding to the partition 2 based on a URL address (http:// a. com/service/group-2/joinxpand ═ 1) carried by the request (this process may be regarded as the user equipment a sending the target service request to the partition server corresponding to the partition 2); when receiving a target service request sent by user equipment A, a partition server of a partition 2 determines that the target service request is in a medium load state at present, processes the target service request and feeds back a response status code 200; the gateway 503 forwards the status code 200 to the user equipment a, and when receiving the status code 200, the user equipment a knows that the current target service request has been successfully processed by the partition server corresponding to the partition 2, and the user equipment a stores the partition identifier 2 of the partition server. When the user equipment A initiates a service request next time, the service request carries the partition identifier 2; when receiving the service request, the gateway 503 forwards the service request to a partition server corresponding to the partition 2 based on the carried partition identifier 2; after receiving the service request, the partition server corresponding to the partition 2 determines that the current state is in a low load state, executes a forward convergence operation (merging with the previous partition server) and executes a redirection operation to send out a redirection response; the gateway 503 forwards the redirection information fed back by the partition server corresponding to the partition 2 to the user equipment a (for example, including the status code 302, and the URL address http:// a.com/service/group-1/htbt; the user equipment A resends the service request based on the redirection information; the gateway 503 forwards the service request to a partition server corresponding to the partition 1 based on the last partition identifier carried by the service request (for example: http:// a. com/service/group-1/htbtree ═ 1). The above steps B1-B2 will be repeated until user equipment a obtains the request success information (e.g., status code 200). The subsequent execution steps are not described in detail.

In combination with application example 2, it can be seen that the URL address http:// a. com/service/g0/joinxxx includes partition identifier g 0; the URL address http:// a. com/service/g 1/joinxpand ═ 1 includes partition identification g1 and parameter expand ═ 1. Therefore, the partition identifier referred to in the embodiments of the present application may be designed in combination with the URL address.

In an embodiment, as shown in fig. 6, there is provided a load balancing apparatus 600 applied to a server, including: a receiving module 601, a processing module 602 and a feedback module 603.

Specifically, the method comprises the following steps: a receiving module 601, configured to receive a target service request sent by a user equipment based on an HTTP protocol; a processing module 602, configured to process a target service request or redirect a partition server based on an HTTP protocol based on a current load status; the feedback module 603 is configured to, if the partition server is redirected based on the HTTP protocol, feed back corresponding redirection information, so that the user equipment sends the target service request based on the redirection information.

Optionally, the processing module 602 includes any one of the following units:

the processing unit is used for acquiring current load-related information and processing the target service request when the load state is determined to be moderate load based on the information;

and the redirection unit is used for acquiring the current information related to the load, and redirecting the partitioned server based on the HTTP when the load state is determined to be low load or high load based on the information.

Optionally, the redirection unit includes any of the following sub-units:

the first redirection subunit is used for initiating a task of expanding the partition server when the load state is high load and redirecting to the next partition server;

and the second redirection subunit is used for executing the task of merging the current partition server and other partition servers and redirecting to the previous partition server when the load state is low load.

Optionally, the second redirecting subunit is further configured to perform at least one of:

setting a virtual identifier; the virtual identifier is used for being combined with other partition servers and then redirected to the upper partition server based on the virtual identifier when a service request is received;

when merging with other partition servers, determining that the current load reaches a preset threshold value, and if a service request is not received within a preset time period, executing a task of destroying the current partition server;

when merging with other partition servers or after executing a task of destroying the current partition server, redirecting a partition server corresponding to a service request to an upper partition server when receiving the service request sent based on redirection information;

when merging with other partition servers and receiving tasks of the extended partition servers, stopping merging;

and after the task of destroying the current partition server is executed and the task of the expanded partition server is received, executing the task of rebuilding the partition server to continuously process the service request or redirect the partition server.

Optionally, the apparatus 600 further comprises a success feedback module: and the server is used for feeding back corresponding request success information if the target service request is processed so as to receive the service request sent by the user equipment next time. In an embodiment, as shown in fig. 7, there is provided a load balancing apparatus 700 applied to a user side, including: a loop module 701; specifically, the loop module 701 is configured to repeatedly perform the following steps for a target service request sent based on an HTTP protocol until request success information is obtained: receiving response information fed back by the partition server based on the current load state; the response information comprises request success information corresponding to the processing target service request or redirection information corresponding to the redirection partition server based on the HTTP protocol; upon receiving the redirection information, a target service request is sent based on the redirection information.

Optionally, the target service request carries a preset partition identifier or a partition identifier corresponding to a partition server that successfully responds to the previous service request; the apparatus 700 further includes a storage module, configured to store, when the request success information is received, a partition identifier corresponding to a partition server that processes the target service request;

the request success information comprises a state code fed back by the partition server processing target service request or reminding information generated when the information fed back by the partition server is not received within a preset time length.

Optionally, the redirection information includes a next partition identifier corresponding to a high load state or a last partition identifier corresponding to a low load state; the circulation module 701 includes any one of the following units:

a first sending unit, configured to resend the target service request based on the next partition identifier;

a second sending unit, configured to resend the target service request based on the last partition identification.

The load balancing device of the embodiment of the present application may execute the load balancing method provided in the embodiment of the present application, and the implementation principles thereof are similar, the actions executed by each module in the load balancing device in each embodiment of the present application correspond to the steps in the load balancing method in each embodiment of the present application, and for the detailed functional description of each module in the load balancing device, reference may be specifically made to the description in the corresponding load balancing method shown in the foregoing, and details are not repeated here.

In an alternative embodiment, an electronic device is provided, as shown in fig. 8, the electronic device 800 shown in fig. 8 comprising: a processor 801 and a memory 803. Wherein the processor 801 is coupled to a memory 803, such as via a bus 802. Optionally, the electronic device 800 may also include a transceiver 804. It should be noted that the transceiver 804 is not limited to one in practical applications, and the structure of the electronic device 800 is not limited to the embodiment of the present application.

The Processor 801 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 801 may also be a combination of computing functions, e.g., comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.

Bus 802 may include a path that transfers information between the above components. The bus 802 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 802 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.

The Memory 803 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.

The memory 803 is used for storing application program code for performing the present solution and is controlled in execution by the processor 801. The processor 801 is configured to execute application program code stored in the memory 803 to implement the content shown in the foregoing method embodiments.

Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.

According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the 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 load balancing method provided in the above-mentioned various alternative implementations.

The present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, the method provided by the application processes the target service request or redirects the partitioned server based on the HTTP protocol based on the current load state when receiving the target service request sent by the user equipment based on the HTTP protocol; and if the partition server is redirected based on the HTTP protocol, feeding back corresponding redirection information so that the user equipment sends a target service request based on the redirection information. According to the application, the server can be used for acquiring the load capacity of the server and the redirection capacity of the HTTP, so that the user group can be automatically and separately served in different zones, the effect of load balancing of the server is achieved, the user does not need to select the zones, the implementation complexity is reduced, and the operation stability is improved.

It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

It should be noted that the computer readable medium mentioned above in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.

The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.

The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.

Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The modules described in the embodiments of the present application may be implemented by software or hardware. The name of the module does not in some cases form a limitation of the module itself, and for example, the receiving module may also be described as a "module for receiving a target service request sent by the user equipment based on the HTTP protocol".

The above description mainly describes that the execution main body is hardware, and here, please briefly describe that the execution main body may be software. In some embodiments, the load balancing apparatus provided in the embodiments of the present invention may be implemented by a combination of hardware and software, and by way of example, the load balancing apparatus provided in the embodiments of the present invention may be a processor in the form of a hardware decoding processor, which is programmed to execute the load balancing method provided in the embodiments of the present invention, for example, the processor in the form of the hardware decoding processor may be one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), or other electronic components.

In other embodiments, the load balancing apparatus provided in the embodiments of the present invention may be implemented in software, and fig. 6 and fig. 7 respectively show load balancing apparatuses 600 and 700 stored in a memory, which may be software in the form of programs and plug-ins, and include a series of modules, where the apparatus 600 includes a receiving module 601, a processing module 602, and a feedback module 603; the apparatus 700 includes a cycle module 701; the load balancing method is used for achieving the load balancing method provided by the embodiment of the application.

The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the disclosure. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:Warp级别调度的任务调度方法、系统、GPU及设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!