Disclosure of Invention
The application provides a load balancing method and related equipment, which can solve at least one technical problem. The technical scheme is as follows:
In a first aspect, a load balancing method is provided, applied to a current partition server, and includes receiving a target service request sent by user equipment based on an HTTP protocol;
processing the target service request or redirecting the partition server based on an HTTP (hyper text transport protocol) protocol based on the 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 partition server based on the HTTP protocol based on the current load status includes any one of the following:
acquiring current information related to the load, and processing the target service request when the load state is determined to be a moderate load based on the information;
Information related to the load is obtained, and when the load state is determined to be low load or high load based on the information, the partition server is redirected based on the HTTP protocol.
With reference to the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the redirecting partition server based on the HTTP protocol includes any one of the following:
when the load state is high load, initiating a task of the extended partition server, and redirecting to the next partition server based on the HTTP protocol;
When the load state is low load, the task that the current partition server is combined with other partition servers is executed, and the task is redirected to the previous partition server based on the HTTP protocol.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the merging with other partition servers includes at least one of the following:
After the virtual identifier is combined with other partitioned servers, redirecting the service request to the last partitioned server based on the virtual identifier;
when merging with other partition servers, determining that the current load reaches a preset threshold, if a service request is not received within a preset time period, executing a task of destroying the current partition server;
When the service request sent based on the redirection information is received after the task of destroying the current partition server is combined with other partition servers or executed, redirecting the partition server corresponding to the service request to the previous partition server;
When merging with other partition servers, stopping merging when receiving the tasks of the extended partition servers;
and after executing the task of destroying the current partition server, executing the task of reconstructing the partition server when receiving the task of expanding the partition server so as 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 the service request sent by the user equipment next time.
In a second aspect, a load balancing method is provided, applied to a user equipment, and includes, for a target service request sent based on an HTTP protocol, repeating the following steps until request success information is obtained:
receiving response information fed back by the partition server based on the current load state, wherein the response information comprises request success information corresponding to the target service request or redirection information corresponding to the partition server based on HTTP protocol;
and sending the target service request based on the redirection information when the redirection information is received.
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 the previous service request, and the method further includes:
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 state codes fed back by the target service request processed by the partition server or reminding information generated when information fed back by the partition server is not received within 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, and the resending the target service request based on the redirection information includes any one of the following:
Resending the target service request based on the next partition identification;
And resending the target service request based on the last partition identification.
In a third aspect, a load balancing apparatus is provided, comprising:
The receiving module is used for receiving a target service request sent by the user equipment based on the HTTP protocol;
The processing module is used for processing the target service request or redirecting the partition 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 a moderate load based on the information;
And the redirection unit is used for acquiring the current information related to the load, and redirecting the partition server based on the HTTP protocol 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 redirecting unit includes any one of the following subunits:
The first redirecting subunit is used for initiating the task of the extended partition server and redirecting to the next partition server when the load state is high load;
and the second redirecting subunit is used for merging with other partition servers and redirecting to the previous partition 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 the following:
After the virtual identifier is combined with other partitioned servers, redirecting the service request to the last partitioned server based on the virtual identifier;
when merging with other partition servers, determining that the current load reaches a preset threshold, if a service request is not received within a preset time period, executing a task of destroying the current partition server;
When the service request sent based on the redirection information is received after the task of destroying the current partition server is combined with other partition servers or executed, redirecting the partition server corresponding to the service request to the previous partition server;
When merging with other partition servers, stopping merging when receiving the tasks of the extended partition servers;
and after executing the task of destroying the current partition server, executing the task of reconstructing the partition server when receiving the task of expanding the partition server so as 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, configured to, if the target service request is processed, feedback corresponding request success information to receive a service request sent by the user equipment next time.
In a fourth aspect, a load balancing device is provided, including a loop module, configured to repeatedly perform, for a target service request sent based on an HTTP protocol, the following steps until request success information is obtained:
Receiving response information fed back based on the current load state, wherein 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 protocol;
and retransmitting the target service request based on the redirection information when the redirection information is received.
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 the previous service request;
The request success information comprises state codes fed back by the target service request processed by the partition server or reminding information generated when information fed back by the partition server is not received within 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, and the loop module includes any one of the following units:
a first sending unit, configured to resend the target service request based on the next partition identifier;
and the second sending unit is used for resending the target service request based on the last partition identification.
In a fifth aspect, there is provided an electronic device comprising one or more processors, 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 applications configured to perform the load balancing method of the first aspect and any one of the second aspects and any one of the embodiments thereof.
In a sixth aspect, there is provided a computer readable storage medium storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by a processor to implement the load balancing method of the first aspect and any one of the second aspects and any one of the embodiments thereof.
The technical scheme provided by the application has the beneficial effects that:
Compared with the prior art, the method provided by the application processes the target service request or redirects the partition 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 feeds back the 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. The implementation of the application can obtain the load capacity of the service and the redirection capacity of HTTP by using the server, thereby achieving the effects of automatically dividing the user group into different areas and realizing the load balancing of the server, reducing the implementation complexity and improving the operation stability while needing not to select the areas by the user.
Additional aspects and advantages of the 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 application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. 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. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Terms or related techniques that may be involved in the embodiments of the present application are set forth below:
Cloud technology (Cloud technology) is based on the general terms of network technology, information technology, integration technology, management platform technology, application technology and the like applied by Cloud computing business models, and can form a resource pool, so that the Cloud computing business model is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud computing (cloud computing) refers to the delivery and usage mode of an IT infrastructure, to obtaining required resources in an on-demand, easily scalable manner over a network, and generalized cloud computing refers to the delivery and usage mode of a service, to obtaining required services in an on-demand, easily scalable manner over a network. Such services may be IT, software, internet related, or other services. Cloud Computing is a product of fusion of traditional computer and network technology developments such as Grid Computing (Grid Computing), distributed Computing (DistributedComputing), 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 the internet, real-time data flow and diversification of connected devices, and the promotion of demands of search services, social networks, mobile commerce, open collaboration and the like, cloud computing is rapidly developed. Unlike the previous parallel distributed computing, the generation of cloud computing will promote the revolutionary transformation of the whole internet mode and enterprise management mode in concept.
User, user under certain internet service.
User equipment, electronic equipment adopted by the user.
Partitioning, namely dividing users into different service partitions, such as a Huadong area, a Huabei area, a Huanan area, a Huazhong area and the like when dividing based on geographic positions.
And (5) regional service, namely a background server for providing services for all user equipment under a certain region. The regional service may be a distributed cluster or a stand-alone unit. The application can treat a district as a whole.
And newly creating a partition (an extended partition) when more user equipment under a certain partition causes high load, so as to schedule partial users under the partition into the newly created partition.
Merging partitions (pools) when user equipment under a partition becomes smaller, the partition is merged into another partition.
And the partition management module is used for controlling newly-built partitions or merging partitions according to the states of the partitions.
The real-time online people counting system is characterized in that a system capable of counting the online people of the system in real time generally uses big data analysis tools such as Storm, spark and the like to count access logs of user equipment to acquire results.
And the observing and controlling module is used for observing and controlling the load. The real-time online people counting system belongs to an observation and control module.
The gateway receives the service request sent by the user equipment based on HTTP (HyperText Transfer Protocol ) and forwards the request of the user equipment to different servers, and the flow dispatching, the session maintaining and the load balancing can be realized in the gateway.
In the prior art, aiming at the situation that in a plurality of services implemented based on the internet, the service characteristics are limited, the scale of a user cannot be supported to be infinitely enlarged, and a plurality of subareas are required to be set for operation, a manual operation scheme is provided, generally, manual operation is adopted, when the number of users is large, the users actively select one subarea from the plurality of subareas which are currently set, when the number of users is small, the subareas are artificially combined, so that the subareas which the users can select are reduced, and the aim of combining the subareas (such as reducing resource waste) is fulfilled. The manual operation scheme is illustrated in the scene of an online game, and specifically comprises the following steps:
(1) Firstly, dividing areas according to the activity of the number of people on line in each partition, and arranging regional service;
(2) When a user logs in a game, guiding the user to select a partition, and entering the game after the user selects a certain partition;
(3) When the users of the online games are reduced or the liveness of the number of online people of some partitions is reduced, the step (1) is called back to reduce part of the partitions.
(4) When the number of users on the online game increases or the number of people on some partitions is excessive, i.e. the load of the regional service is exceeded, the step (1) is called back to increase some partitions.
The above-mentioned manual operation scheme is usually required to cooperate with issuing notices to users when changing partitions, or to combine partitions under the call of users, so as to maintain the activity of the users in the partitions, and to allow the services to continue to operate well. Therefore, by adopting the manual operation scheme, the generated product has lower user friendliness, such as the requirement that a user selects a 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 partition scheme based on a real-time online people counting system is provided, the real-time online people counting system is adopted, the real-time counted online people are fed back to a partition management module responsible for dividing the area, and the partition management module controls the newly built partition or the merged partition so as to schedule the users in the adaptive partition.
Specifically, compared with a manual operation scheme, the automatic partition scheme based on the real-time online people counting system saves the operations of manual operation partition and partition combining, and can intelligently partition and combine the regions by 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 partition, and then whether to build and merge the partition 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 in connection with fig. 1, and in particular comprises the following steps:
1. The system records the relationship between the user equipment and the subarea;
2. The access behavior of the user equipment generates an access log, and the real-time online people counting system perceives 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 partition to the partition management module, and the partition management module performs new partition establishment or merging partition treatment according to a set strategy.
Therefore, the automatic partition scheme based on the real-time online people counting system does not need to enable a user to select partitions, and compared with the manual operation scheme, the user experience is higher. However, in some scenarios where infrastructure is relatively late, the automatic partitioning scheme based on the real-time online people counting system may require manual operation and maintenance to deploy the partitions, and thus still requires manual intervention. In addition, the real-time online people counting system is generally completed by a large data processing cluster set such as Kafka, zooKeeper, storm, spark and the like, and has high cost, or the load is judged by counting the area load of each partition, such as the connection number, the CPU use rate and other indexes, but a complex observation and control module is still needed to provide support to observe and control the load of each partition and the load of the whole partition.
Aiming at the problems, the application provides a load balancing method, which can acquire the load capacity of the service based on a server without introducing a complex observation and control module, and can achieve the effect of automatically dividing and dividing the user groups by combining the redirection capacity of HTTP.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The load balancing method provided by the embodiment of the application is applied to the server, and can be specifically executed by the electronic equipment provided by the embodiment of the application, wherein the electronic equipment can be a server, the server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and can also be a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and an artificial intelligent platform, and the like, but the load balancing method is not limited to the cloud servers. As shown in fig. 2, the load balancing method provided by the embodiment of the present application includes the following steps S201 to S203:
step S201, receiving a target service request sent by user equipment based on HTTP protocol.
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 HTTP protocol, or may be sent using HTTPs protocol. The HTTP protocol is an application layer protocol for distributed, collaborative and hypermedia information systems, and the HTTPS protocol is a network protocol which is constructed by SSL (Secure Sockets Layer) +HTTP protocol and can carry out encryption transmission and identity authentication. Optionally, operations such as data transmission and redirection based on the HTTP protocol according to the embodiments of the present application may also be performed in accordance with the HTTPs protocol.
Optionally, the target service request may be a user initial request or a user secondary request, and when the target service request is a user initial request, the application scenario may be adapted to initiate the target service request to the corresponding partition server based on a default partition identifier or a random partition identifier when the user equipment initially initiates the service request (the user is a new user). When the target service request is a user secondary request, the application scenario may adapt to the existing request history of the user equipment (the user is an old user), and initiate the target service request to the corresponding partition server based on the identification of the partition server that successfully responded to the previous service request.
Step S202, based on the current load state, processing the target service request or redirecting the partition server based on the HTTP protocol.
In particular, load (load) may be understood as the average number of threads in a running queue within a particular time interval, which if excessive load may cause a partition server to fail to process requests and/or operations. The current load state may be determined by the average load of the last 1 minute, 5 minutes, and/or 15 minutes (the above times are merely examples and embodiments of the present application are not limited in this respect). The current load state can be determined by the partition server, for example, the partition server determines the load state according to the current throughput, the connection number, the CPU or the memory utilization rate and other index information. If the partition server measures the load state of the partition server based on CPU usage, memory usage and IO consumption, the partition server determines that the load is high when any item is detected to be used too much (the first set threshold value is exceeded in a specific time), and determines that the load is low when any item is detected to be used less (the second set threshold value is exceeded in the specific time). The first set threshold and the second set threshold may be set according to configuration of the partition server, for example, the partition server operated by the single-core CPU may be set to 0.7, when the load value is not less than 0.7, the current load is determined to be high (overload), the second set threshold may be set to 0.1 or 0, when the load value is not greater than the second set threshold, the current load is determined to be low, and destruction of the partition server may be considered. In addition, when the load value is between the first set threshold value and the second set threshold value, it can be determined that the current load state belongs to a moderate load, and the current partition server can normally provide service to process the service request of the user equipment.
In a possible embodiment, the current load state may be that after the partition server obtains its own index information and uploads the index information to the management platform (may be a cloud computing platform), the management platform determines a corresponding load state and issues the load state to the partition server.
Optionally, in step 202, when the partition server is in a different load state, the corresponding result is different, if the current load state of the partition server belongs to a moderate load (may provide a service), the target service request is processed, otherwise, the partition server will redirect the partition server based on the HTTP protocol. The specific procedure for processing the target service request or redirecting the partition server based on the HTTP protocol with respect to the partition server based on the current load status will be described in detail in the following embodiments.
Step S203, if the partition server is redirected based on the HTTP protocol, the corresponding redirection information is fed back, so that the user equipment sends the target service request based on the redirection information.
Specifically, embodiments of the present application are based on the HTTP protocol, in which the redirect operation is triggered by the partition server by sending a special response (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 partition server may be understood that the partition server sends out a redirect response, and the redirect information corresponding to the feedback of the partition server may include a status code corresponding to the redirect response and information provided by the redirect response, which in the embodiment of the present application may be represented by a partition identifier corresponding to the partition server determined by redirecting. When the user equipment receives the redirection response (e.g. receives 302 the status code), the target server request is resent 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. Referring to fig. 4, it is illustrated that the user equipment sends a service request (http:// a.com/service/g 0/joinxxx) to the partition server 0, and when the partition server 0 determines that the load is high based on the current load status of itself, the partition server 0 feeds back redirection information (302 http:// a.com/service/g1/joinexpand =1; 302 is a status code) to the user equipment, at this time, the user equipment receives the status code 302 and URL address, and can learn about redirecting the determined partition server g1 in the URL address, so the user equipment sends a service request (http:// a.com/service/group-1/joinexpand =1) to the partition server 1 based on the redirection information.
Alternatively, in the present application, the redirection may be a temporary redirection, with a corresponding status code of 302. The method can be applied to the scene that the current partition server cannot provide services for users and sends out a redirection response.
In the application, the user equipment can be understood as an HTTP client/terminal, the partition server can be understood as an HTTP server, and the user equipment initiates a service request to create a TCP connection to a designated port of the partition server. The partition server then detects a service request of the user device at the port. Upon receipt of the service request, the partition server returns a status to the user device, such as "200 OK" when the partition server successfully processes the service request, and related content, such as a file requested by the user device, an error message, or other information, to the user device.
In an embodiment, the load balancing method provided by the application further includes step S204 of feeding back corresponding request success information when processing the target service request, so as to receive the service request sent by the user equipment next time.
Specifically, when the server can provide service to the user equipment currently, 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 has been processed, the user equipment may be considered to be divided into the current partition server, and the service request is sent to the current partition server when the next service request is initiated by the same user equipment.
The embodiment of the application explains the load balancing method, mainly uses the redirection capability of HTTP to realize the self-adaptive division of the user equipment in different partition servers based on the current load state by the servers, and achieves the effect of balancing the load of each server. Specifically, the self-adaptation means that when the user equipment is divided based on the load state of the partition server, the user equipment can be divided into the current partition server (embodied as the current partition server processes the service request sent by the user equipment) if the current load state of the partition server belongs to a moderate load, the task of expanding the partition server is initiated if the current load state of the current partition server belongs to a high load, the user equipment is indicated to be divided into the partition server (the next partition server) obtained by expanding (embodied as the partition server obtained by expanding processes the service request sent by the user equipment), and the merging task of the current partition server and the last partition server is executed if the current load state of the current partition server belongs to a low load, and the user equipment is indicated to be divided into the last partition server (embodied as the service request sent by the user equipment is processed by the last partition server). When the redirection operation is executed, the user cannot perceive, and the whole redirection process is reflected in that the user equipment re-sends the target service request to other servers based on the partition identification corresponding to the partition server corresponding to the redirection.
The following describes specific procedures for processing a target service request or redirecting a partitioned server based on HTTP protocol based on a current load status in the present application with reference to the accompanying drawings and embodiments.
Specifically, step S202 processes the target service request or redirects the partitioned server based on the current load status, including any one of the following steps A1-A2:
And A1, acquiring current information related to the load, and processing a target service request when the load state is determined to be a moderate load based on the information.
And step A2, acquiring information related to the current load, and redirecting the partition server based on the HTTP when the load state is determined to be low load or high load based on the information.
The load state is used for measuring the busyness of the server, and the information related to the load can be index information such as throughput, connection number, CPU or memory utilization rate and the like. The load state may be determined based on the number of processes in the runnable state (runnable state) and the uninterruptible state (uninterrupttable state) when determining the load state, optionally the load state determined based on the load related information includes the following three cases:
(1) The load state is a moderate load, and at this time, it can be understood that the resources of the server CPU can process the target service request.
In the loaded state, the server may process the target service request, such as response 200, i.e., successfully process the request, and, such as response 202, i.e., the server accepts to process the request, but remains unprocessed.
(2) The load state is high load, which can be understood as that the resources of the server cannot provide services, such as high load caused by insufficient CPU resources, for example, when the server only has one CPU, each process needs to be processed for 1s, but when two processes need to be processed at the same time for 1s, one process corresponding to each 1s cannot be processed, the load of the corresponding server is increased continuously, and finally the service request cannot be processed timely. As another example, the high load caused by the CPU utilization may cause the IO to become a bottleneck when the server receives a large number of read requests, and the process to be processed is in an untenable state when waiting for the IO, so that the high load is finally presented when the server load is calculated.
(3) The load state is low, which can be understood that the server needs few processes to be processed currently and the user request which is possibly received is very few, and the destruction of the server can be considered to avoid the waste of network resources. If the number of processes currently required to be processed by the server is only 2, the processes are scheduled to other partition servers for processing without affecting the original processing process capability of the partition servers, so that the partition servers with low destruction load states can be considered.
When the load state is at high load 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 the load value, and the load can be regarded as high if the load exceeds 1 when the full load is 1, and as low if the load is lower than 0.1. The above values are only to be understood as examples, and in practical application, the values may be set according to practical application scenarios, which is not limited by the present application.
Optionally, the redirecting partition server in step A2 based on the HTTP protocol includes at least one of the following steps a21-a 22:
And step A21, when the load state is high load, initiating the task of the extended partition server, and redirecting to the next partition server based on the HTTP protocol.
Specifically, when a task of expanding a partition server is initiated, it can be understood that the server determines that a new partition is needed, and at this time, a partition will be created in the whole running system of the product and a partition server providing a corresponding service will be configured. By way of example, assuming that the partition in which the current partition server is located is identified as N, when the task of expanding the partition server is initiated, a partition identified as N+1 will be created and configured with the corresponding partition server throughout the operating environment.
Alternatively, redirecting to the next partition server may be understood as the server providing the user device with the partition identifier corresponding to the next partition server when issuing a redirect response.
Through implementation of the step A21, the purpose of adding the user equipment into the newly-built partition by utilizing the characteristic of high self-load of the zone service and matching with the jump redirection capability of HTTP can be achieved. The following description will be made with respect to a specific procedure of merging partitions in the case where the load of the adaptation area itself is low.
And step A22, 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 protocol.
When merging with other partition servers, it can be understood that the current partition server determines that the partition needs to be merged, and at this time, the whole running system of the product at least includes two partitions and is respectively configured with corresponding partition servers. When the merging partition is executed, the current partition server is merged with other partition servers, and the other partition servers may be any partition servers except the current partition server in the whole running system, or may be the last partition server of the current partition server (such as a partition server indicating to extend the current partition server). Optionally, when executing the merge partition, redirecting all user devices served by the current partition server to the previous partition server is further included.
In particular, redirecting to a previous partition server may be understood as that the server provides the user equipment with the partition identification corresponding to the previous partition server when sending out a redirect response.
Optionally, step a22 may be combined with other partitioned servers, and may include at least one of the following steps a221-a 225:
step A221, setting a virtual identifier, wherein the virtual identifier is used for being combined with other partitioned servers, and redirecting to the previous partitioned 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 low, and it is determined that the task of merging the partitions needs to be executed, the partition server sets a virtual identifier, and when the partition server receives a service request sent again by the current user equipment or receives a service request sent based on redirection information, based on the current virtual identifier, a redirection response is directly sent, and the service request corresponding to the retransmission is redirected to the partition identifier N-1 corresponding to the previous partition server. By setting the virtual identifier, network resources for the partition server to determine redirection can be effectively saved.
Alternatively, the virtual identifier may be set for a server resource utilization situation, for example, an identifier 0 or 1 is set for a partition server, where an identifier 0 (virtual identifier) indicates that the current partition server needs to be combined with other partition servers (which is reflected in that the current partition server does not process a service request any more), and an identifier 1 indicates that a load state of the current partition server belongs to a moderate load (which is reflected in that the service request can be processed normally).
And step A222, when the current load reaches a preset threshold value when the current load is combined with other partition servers, executing the task of destroying the current partition server if the service request is not received within a preset time period.
Specifically, considering that in the whole running system of the product, when a last service request of the user equipment is processed by a current partition server, a next service request initiated by the user equipment is still sent to the current partition server, and a subsequent partition possibly converges to a partition corresponding to the current partition server (for example, when the current partition server N is combined with a last partition server N-1, the next partition server n+1 requests to be combined with the current partition server N), the application does not directly execute the task of executing the combined partition when determining to execute the task of combining the partitions, but executes the task of destroying the partition server when determining that the load of the user equipment reaches a preset threshold (for example, the load value drops to 0) after redirecting all user equipment served by the current partition server to other partition servers, and waits for a certain time period (which can be determined based on a preset time period) if any service request is not received in the waiting process.
And step A223, when the service request sent based on the redirection information is received when the service request is combined with other partition servers or after the task of destroying the current partition server is executed, redirecting the partition server corresponding to the service request to the previous partition server.
Specifically, assuming that the current whole running system includes three partitions, partitions 0, 1 and 2, when the partition server corresponding to partition 1 determines to merge (or after merging, that is, after destroying), and when partition 2 still exists, 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 redirect response sent by the partition server corresponding to partition 2, at this time, since the partition server corresponding to partition 1 no longer processes the service request, the partition server corresponding to partition 1 will send a redirect response (the partition server may perform a redirect operation by means of parameter reduce=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, stopping merging when receiving the tasks of the extended partition servers.
Specifically, for example, assuming that the current whole 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 performs merging, 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 other partition servers or a management platform is received in the merging process (for example, when the partition server corresponding to partition 1 is in a high load state, an instruction including parameter expand=1 is received), the partition server corresponding to partition 2 stops performing the merging operation, so that partition 2 and its corresponding partition server are reserved to provide services for users.
And step A225, when the task of destroying the current partition server is executed and the task of the extended partition server is received, executing the task of the reconstructed partition server to continue to process the service request or redirect the partition server.
Specifically, for example, assume that the current whole running system includes three partitions, partition 0,1 and 2, and when the partition server corresponding to partition 1 executes the task of destroying the current partition server, the server releases the occupied resources, and the corresponding partition 1 appears as a virtual partition (the corresponding state can be determined by querying a database or the like), at this time, if the task of expanding the partition server is received (e.g., a request of expand=1 is received), the partition 1 that has been destroyed at present is reconstructed (including configuring the corresponding partition server), so as to obtain a functional scenario corresponding to the original partition 1 (e.g., service can be provided for the user equipment or redirection operation can be performed).
In the process implemented by the above embodiment, the user using the electronic device is not aware of the specific situation of the partition, and the whole process (including the redirecting operation) may be recorded by the application program of the client.
The embodiment of the application also provides a load balancing method which can be executed by the user equipment, and particularly can be executed by the electronic equipment provided by the embodiment of the application, wherein the electronic equipment can be a client or a web terminal, and the client can be a smart phone, a tablet personal computer, a notebook computer, a desktop computer, a smart sound box, a smart watch, a smart camera, a robot and the like, but is not limited to the method. As shown in fig. 3, the load balancing method provided by the embodiment of the present application includes the following step S301:
step S301, for the target service request sent based on the HTTP protocol, the following steps B1-B2 are repeatedly executed 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 last service request. 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, and the partition identifier corresponding to the server which successfully responds to the previous request may be a partition identifier of a partition server stored in the application program of the client when the user is an old user and the previous service request is completed, and when the target service request is currently initiated, the target service request is sent to the server which completes the previous service request based on the stored partition identifier. Alternatively, if a partition server successfully processes a previous service request of a user equipment, it may be understood that the user equipment is partitioned into the partition servers.
Optionally, when receiving the request success information, the user equipment further stores a partition identifier corresponding to the partition server for processing the target service request.
And step B1, receiving response information fed back by the partition server based on the current load state, wherein the response information comprises request success information corresponding to the processing target service request or redirection information corresponding to the partition server based on the HTTP protocol.
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 information fed back by the partition server is not received within a preset time length.
Alternatively, when the current resource of the partition server can be applied to provide services for 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, even if the partition server has processed the target service request or is ready to process the target service request, no information is fed back to the user equipment (e.g. responses 204, 205), at this time, the user equipment automatically generates a reminder if no information fed back by the partition server is received within a preset time period, so as to determine that the target service request has been processed (considering that if the partition server performs a redirection operation, the user equipment must receive the redirection information, so that it may be set that the target service request is processed by the partition server by default if no information is received within the preset time period).
And B2, when the redirection information is received, sending a target service request 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, and the sending of the target service request in step B2 based on the redirection information includes any one of the following steps B21-B22:
and step B21, resending the target service request based on the next partition identification.
Specifically, if the partition server currently receiving the target service request processes the high-load state, the partition server executes the redirecting operation and feeds back the redirecting information to the user equipment, where the information includes the next partition identifier corresponding to the redirecting to the next partition server. The user equipment will reinitiate the target service request to the server corresponding to the next partition based on the next partition identification.
And 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 the low-load state, the partition server executes the redirecting operation and feeds back redirecting information to the user, where the information includes a last partition identifier corresponding to a last partition server by redirecting. The user equipment will re-initiate the target service request based on the last partition identification.
Optionally, considering that when the forward redirection is performed, there is a situation that the intermediate partition has been reduced and released, for example, it is assumed that the current running system includes partitions 0, 1 and 2, where partition 1 has been reduced and released (e.g. combined with partition 0), the system may store the relevant situation of partition 1, the user equipment sends the target service request to the partition server corresponding to partition 2, when the partition server corresponding to partition 2 performs the redirection operation, the target service request is redirected to the partition server corresponding to partition 1, when the user equipment resends the target service request based on the redirection information fed back by the partition server corresponding to partition 2, because partition 1 has been reduced and released, at this time, the target service request resent by the user equipment will be directly sent to the partition server corresponding to partition 0, where 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 information stored by the current system that partition 1 has been reduced and released (i.e. forwards the target service request to the corresponding to partition 0).
In a possible embodiment, step B22 and step a221 (partition server setting virtual identifier) shown in the foregoing embodiments may be understood as adapting to the same application scenario (a certain intermediate partition and its corresponding partition server have been reduced and released, i.e. combined), and processing is performed by using different methods. Alternatively, the method steps shown in step B22 and step A221 may be mutually referenced, i.e., when a partition performs a merge partition task, the partition server is provided with a virtual identification and the system stores information about the partition that has been reduced for release.
The description of the determination of the load status by the partition server may refer to the description of the above embodiment, and will not be described in detail herein.
The above embodiments are explained with respect to the load balancing method applied to the user side and the service side, and the cases of mutual references may be referred to each other when explaining specific embodiments.
The embodiment of the application can realize the function of dividing and dividing the served user equipment, has simple realization process and the capability of automatically dividing the user equipment, and can be suitable for a scene that a single machine is taken as the area service and the area service can be virtualized and automatically expanded.
In a possible embodiment, the running environment of the present application may include a user equipment and a server, and on the basis of this, an intermediate server, such as a gateway, may be further included, where the gateway is configured to receive a service request initiated by the user equipment, and automatically forward, in a load-balancing manner, the service request to a partition server corresponding to the partition identifier according to the partition identifier carried in the service request. Optionally, when the embodiment of the application utilizes the redirection capability of the HTTP protocol, the partition may be designed in a uniform resource location system (uniform resource locator, URL), and processed according to the load balancing manner of the URL HASH.
In order to further explain the load balancing method provided by the present application, a feasible application example is provided below in conjunction with fig. 4 and fig. 5.
Application example 1 in a Tracker (a program running on a server) service based on XP2P (a technology with a new generation of P2P technology as a core), user devices watching the same video content can be gathered in the same area, so as to realize the operation that users can communicate with each other, discuss or share. Then, for video content such as evening in spring festival, because the number of users requesting to watch the video content in the same time period is very huge, all users cannot be gathered in the same partition, at this time, a partition server can be newly built and configured according to the current information such as the number of users, and user equipment is divided into various partitions. The user equipment dividing process can be realized by adopting the load balancing method provided by the application. If 1 hundred million people need very large bandwidth at the same time to watch spring festival at night, 10 partitions can be divided by using the load balancing method provided by the application, each partition comprises 1000 ten thousand people, and users watch through the partition where the respective equipment is located. At this time, the effect of load balancing of 10 partitions can be achieved.
Application example 2 in connection with fig. 4 and 5, a current operating environment includes a plurality of user devices 501, a partition 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 a partition identifier 0 carried in the target service request (examples: http:// a.com/service/g 0/joinxxx), the partition server corresponding to the partition 0 is in a high load state, then a task of a backward expansion partition server is initiated (when the partition server corresponding to the partition 1 is newly added in the running environment) and a redirection operation is executed, the gateway 503 forwards redirection information fed back by the partition server corresponding to the partition 0 to the user equipment a (examples: the state code 302 is included, and a URL address http:// a.com/service/g1/joinexpand =1 determined during the redirection response, wherein the parameter expad=1 characterizes the redirection to the next partition server), when the user equipment a receives the target service request based on the received redirection information, and determines that the user equipment a is in the state of the current partition server corresponding to the partition 1, and the user equipment a determines that the user equipment a is in the high load state when the partition server corresponding to the partition 1 is newly added in the running environment, and the URL address 53 is sent based on the received by the partition server corresponding to the partition 1, gateway 503 forwards the redirection information fed back by the partition server corresponding to partition 1 to user equipment a (in the example, the method comprises a state code 302 and a URL address http:// a.com/service/g2/joinexpand =1 determined in response to the redirection, wherein parameter expand=1 characterizes the redirection to the next partition server), user equipment a resends the target service request based on the received redirection information, gateway 503 receives the target service request resent by user equipment a, forwards the target service request to the partition server corresponding to partition 2 based on the URL address carried by the request (http:// a.com/service/group-2/joinexpand =1) (the process can be regarded as that user equipment a sends the target service request to the partition server corresponding to partition 2), when the partition server of partition 2 receives the target service request sent by user equipment a, the target service request is determined to be in a medium load state currently, and feeds back a response state code 200, and the gateway forwards the state code 200 to the user equipment a, when the state code is received by the user equipment a, and the current service code is successfully processed by the partition 2, and the partition server corresponding to the partition 2 receives the target service request. When the user equipment a initiates a service request next time, the gateway 503 forwards the service request to a partition server corresponding to the partition 2 based on the carried partition identifier 2, after the partition server corresponding to the partition 2 receives the service request, determines that the service request is currently in a low-load state, performs forward convergence operation (merging with a last partition server) and performs redirection operation to send a redirection response, and forwards redirection information fed back by the partition server corresponding to the partition 2 to the user equipment a (examples include a status code 302 and URL addresses http:// a.com/service/group-1/htbtreduce =1 determined by the redirection response, wherein the parameter reduce=1 characterizes redirection to a last partition server), and the user equipment a resends the service request based on the redirection information, and forwards the service request to the partition server corresponding to the partition 1 based on the last partition identifier carried by the service request (examples: http:// a.com/service/group-1/htbtreduce =1). The above steps B1-B2 are repeated until the 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 the above application example 2, it can be seen that the URL address http:// a.com/service/g0/joinxxx includes the partition identifier g0, and the URL address http:// a.com/service/g1/joinexpand =1 includes the partition identifier g1 and the parameter expand=1. It can be seen that the partition identifier according to the embodiments of the present application may be designed with reference to URL addresses.
In one embodiment, as shown in fig. 6, a load balancing apparatus 600 applied to a server is provided, and the load balancing apparatus includes a receiving module 601, a processing module 602, and a feedback module 603.
The system comprises a receiving module 601, a processing module 602 and a feedback module 603, wherein the receiving module is used for receiving a target service request sent by user equipment based on an HTTP protocol, the processing module 602 is used for processing the target service request based on the current load state or redirecting the partitioned server based on the HTTP protocol, and the feedback module 603 is used for feeding back corresponding redirection information if the partitioned server is redirected based on the HTTP protocol, so that the user equipment sends the target service request based on the redirection information.
Optionally, the processing module 602 includes any of the following units:
the processing unit is used for acquiring current information related to the load and processing a target service request when the load state is determined to be a moderate load based on the information;
And the redirection unit is used for acquiring the current information related to the load, and redirecting the partition server based on the HTTP protocol when the load state is determined to be low load or high load based on the information.
Optionally, the redirecting unit includes any one of the following subunits:
The first redirecting subunit is used for initiating the task of the extended partition server and redirecting to the next partition server when the load state is high load;
and the second redirecting subunit is used for executing the task of merging the current partition server with other partition servers when the load state is low load and redirecting to the previous partition server.
Optionally, the second redirecting subunit is further configured to perform at least one of:
after the virtual identifier is combined with other partitioned servers, redirecting the service request to the last partitioned server based on the virtual identifier;
when merging with other partition servers, determining that the current load reaches a preset threshold, if a service request is not received within a preset time period, executing a task of destroying the current partition server;
When the service request sent based on the redirection information is received after the task of destroying the current partition server is combined with other partition servers or executed, the partition server corresponding to the service request is redirected to the last partition server;
When merging with other partition servers, stopping merging when receiving the tasks of the extended partition servers;
And after executing the task of destroying the current partition server, executing the task of reconstructing the partition server to continue to process the service request or redirect the partition server when receiving the task of expanding the partition server.
Optionally, the apparatus 600 further includes a success feedback module, configured to, if the target service request is processed, feedback corresponding request success information to receive a service request sent by the user equipment next time.
In an embodiment, as shown in fig. 7, a load balancing apparatus 700 applied to a client is provided, and the load balancing apparatus includes a loop module 701, specifically, the loop module 701 is configured to repeatedly execute, for a target service request sent based on an HTTP protocol, the following steps until request success information is obtained, where the response information includes response information fed back by a partition server based on a current load state, the response information includes request success information corresponding to the processing target service request or redirection information corresponding to the partition server based on the HTTP protocol, and when the redirection information is received, the target service request is sent based on the redirection information.
Optionally, the device 700 further comprises a storage module, configured to store, when receiving request success information, 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 target service request processed by the partition server or reminding information generated when information fed back by the partition server is not received within a preset time length.
Optionally, the redirection information includes a next partition identification corresponding to a high load state or a last partition identification corresponding to a low load state, and the loop module 701 includes any of the following units:
a first sending unit, configured to resend the target service request based on the next partition identifier;
And the second sending unit is used for resending the target service request based on the last partition identification.
The load balancing device according to the embodiments of the present application may perform a load balancing method according to the embodiments of the present application, and its implementation principle is similar, and actions performed by each module in the load balancing device according to each embodiment of the present application correspond to steps in the load balancing method according to each embodiment of the present application, and detailed functional descriptions of each module of the load balancing device may be specifically referred to descriptions in the corresponding load balancing method shown in the foregoing, which are not described herein.
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. 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, in practical applications, the transceiver 804 is not limited to one, 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 ), general purpose Processor, DSP (DIGITAL SIGNAL Processor, data signal Processor), ASIC (Application SPECIFIC INTEGRATED Circuit), FPGA (Field Programmable GATE ARRAY ) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 801 may also be a combination of computing functions, e.g., including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 802 may include a path to transfer information between the aforementioned components. Bus 802 may be a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. Bus 802 may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 8, but not only one bus or one type of bus.
The Memory 803 may be, but is not limited to, 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, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, 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.
The memory 803 is used to store application code for performing the aspects of the present application and is controlled by the processor 801 for execution. The processor 801 is configured to execute application code stored in the memory 803 to implement what is shown in the foregoing method embodiment.
Among them, the 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), car terminals (e.g., car navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the application.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the load balancing methods provided in the various alternative implementations described above.
Embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which when run on a computer, causes the computer to perform the corresponding method embodiments described above. Compared with the prior art, when receiving a target service request sent by user equipment based on the HTTP protocol, the method provided by the application processes the target service request or redirects the partition server based on the HTTP protocol based on the current load state, and if the partition server is redirected based on the HTTP protocol, the corresponding redirection information is fed back so that the user equipment sends the target service request based on the redirection information. The implementation of the application can obtain the load capacity of the service and the redirection capacity of HTTP by using the server, thereby achieving the effects of automatically dividing the user group into different areas and realizing the load balancing of the server, reducing the implementation complexity and improving the operation stability while needing not to select the areas by the user.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The computer readable medium of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a 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 context of this document, 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 the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 wiring, fiber optic cable, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated 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-described embodiments.
Computer program code for carrying out operations 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 ++ 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts 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 involved in the embodiments of the present application may be implemented in software or in hardware. The name of the module does not in any way constitute a limitation of the module itself, 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 foregoing description mainly describes that the execution body is hardware, and the device is herein described briefly that the execution body may be software. In some embodiments, the load balancing apparatus provided by the embodiments of the present invention may be implemented by combining software and hardware, and by way of example, the load balancing apparatus provided by the embodiments of the present invention may be a processor in the form of a hardware decoding processor that is programmed to perform the load balancing method provided by the embodiments of the present invention, for example, the processor in the form of a hardware decoding processor may use one or more Application specific integrated circuits (ASICs, applications SPECIFIC INTEGRATED circuits), DSPs, programmable logic devices (PLDs, programmable Logic Device), complex Programmable logic devices (CPLDs, complex Programmable Logic Device), field Programmable Gate Arrays (FPGAs), field-Programmable GATE ARRAY), or other electronic components.
In other embodiments, the load balancing apparatus provided in the embodiments of the present application 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 a program, a plug-in unit, etc., and include a series of modules, where the apparatus 600 includes a receiving module 601, a processing module 602, and a feedback module 603, and the apparatus 700 includes a loop module 701 for implementing the load balancing method provided in the embodiments of the present application.
The above description is only illustrative of the preferred embodiments of the present application and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in the present application is not limited to the specific combinations of technical features described above, but also covers other technical features formed by any combination of the technical features described above or their equivalents without departing from the spirit of the disclosure. Such as the above-mentioned features and the technical features disclosed in the present application (but not limited to) having similar functions are replaced with each other.