CN105915644B - Server load balancing method - Google Patents

Server load balancing method Download PDF

Info

Publication number
CN105915644B
CN105915644B CN201610440518.6A CN201610440518A CN105915644B CN 105915644 B CN105915644 B CN 105915644B CN 201610440518 A CN201610440518 A CN 201610440518A CN 105915644 B CN105915644 B CN 105915644B
Authority
CN
China
Prior art keywords
server
database server
load value
current
data processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610440518.6A
Other languages
Chinese (zh)
Other versions
CN105915644A (en
Inventor
曾向群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Hantang Ziyuan Technology Co Ltd
Original Assignee
Beijing Hantang Ziyuan Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Hantang Ziyuan Technology Co Ltd filed Critical Beijing Hantang Ziyuan Technology Co Ltd
Priority to CN201610440518.6A priority Critical patent/CN105915644B/en
Publication of CN105915644A publication Critical patent/CN105915644A/en
Application granted granted Critical
Publication of CN105915644B publication Critical patent/CN105915644B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1034Reaction to server failures by a load balancer

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

the embodiment of the invention relates to a server load balancing method, which comprises the following steps: the control server receives a data processing request sent by the application server; the control server judges the type of the data processing request; when the data processing request is a data reading request, the control server acquires load information of each database server and obtains a load value of each database server according to the load information; and the control server distributes the data processing request to a first database server for processing according to the current load value and the current total load value of each database server. The server load balancing method provided by the embodiment of the invention can flexibly distribute the data processing tasks according to the server load value, thereby realizing the server load balancing.

Description

server load balancing method
Technical Field
The invention relates to the technical field of networks, in particular to a server load balancing method.
Background
With the development of communication technology and network technology, the network access amount and data traffic are rapidly increased, the processing performance and the computing intensity of each core part of the network are correspondingly increased, and a single server obviously cannot meet the requirement of data processing, so that a plurality of servers are required to share the requirement.
in the prior art, when a plurality of servers are used for data processing, the problem of server load imbalance exists, the data processing amount of a part of servers is too large, the processing speed is slow, the processing time exceeds the expectation, and the data processing amount of other servers is lower than the expectation or is idle, so that the resource waste is caused. Therefore, a method for reasonably and effectively allocating resources and realizing server load balancing is needed.
Disclosure of Invention
The invention aims to provide a server load balancing method to solve the problem of server load imbalance in the prior art.
In order to achieve the above object, the present invention provides a server load balancing method, including:
The control server receives a data processing request sent by the application server;
The control server judges the type of the data processing request;
when the data processing request is a data reading request, the control server acquires load information of each database server and obtains a load value of each database server according to the load information;
and the control server distributes the data processing request to a first database server for processing according to the current load value and the current total load value of each database server.
Further, the step of allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
And when the current total load value is smaller than the theoretical total load value, distributing the data processing request to a first database server with the largest difference between the theoretical load value and the current load value.
Further, the step of allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
And when the current total load value is smaller than the theoretical total load value, distributing the data processing request to the first database server with the minimum current load value.
Further, the allocating the data processing request to the first database server with the smallest current load value specifically includes:
and the control server reads data by using the database server with the minimum current load value and in a normal working state.
Further, the step of allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
And when the current total load value is smaller than the theoretical total load value, distributing the data processing request to any first database server of which the current load value is not larger than the theoretical load value.
further, the step of allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
And when the current total load value is equal to the theoretical total load value, distributing the data processing request to a newly-invested first database server for processing.
Further, the method further comprises: and the database server sends the state information to the control server, and when the current state information is received as a fault state or the current state information is not received after the time exceeds a threshold value, all tasks of the database server are switched to a standby database server or other database servers corresponding to the database server.
Further, when the received current state information is in a fault state or the current state information is not received after the time exceeds the threshold value, switching all tasks of the database server to a standby database server or other database servers corresponding to the database server specifically includes:
When the current state information is in a fault state or the current state information is not received after the time exceeds a threshold value, all tasks of the database server are switched to a standby database server corresponding to the database server in a unified mode; or
and switching all tasks of the database server to other database servers according to the load information.
The server load balancing method provided by the embodiment of the invention can flexibly distribute the data processing tasks according to the server load value, thereby realizing the server load balancing.
Drawings
fig. 1 is a system architecture diagram of a server load balancing method according to an embodiment of the present invention;
Fig. 2 is a flowchart of a server load balancing method according to an embodiment of the present invention.
Detailed Description
the technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Fig. 1 is a system architecture diagram of a server load balancing method according to an embodiment of the present invention. As shown in fig. 1, includes a plurality of application servers 11, a plurality of control servers 12, and a plurality of database servers 13. The application server 11 sends a data processing request to the control server 12, the control server 12 determines the type of the data processing request, and when the data processing request is a data reading request, the control server 12 obtains load information of each database server 13 and obtains a load value of each database server 13 according to the load information. The control server 13 distributes the data processing request to the database servers 13 for processing according to the current load value and the current total load value of each database server. When the data processing request is a write data request, the application server 11 caches data to be written in the control server 12, and the control server 12 writes the data to be written in the plurality of database servers 13. In addition, each database server 13 has a corresponding backup database server (not shown in the figure), and when the database server 13 has a problem and cannot work normally, the corresponding backup database server is started to execute a data processing task. Before that, the database needs to be mirrored, and then the backup database server needs to be snapshot periodically, so as to ensure that the backup database server and the database server 13 are synchronized.
Fig. 2 is a schematic diagram of a server load balancing method according to an embodiment of the present invention. As shown in fig. 2, the method includes:
step 201, the control server receives a data processing request sent by the application server.
Specifically, the control server serves as an intermediate layer between the application server and the database server, receives a data processing request sent by the application server, and cuts off direct connection between the application server and the database server, so that the control server can specifically control access to a certain database. The control server puts the database into the intranet, so that the security of the database is better protected.
in addition, the control server is convenient for a database manager to manage the databases, and a plurality of control servers are needed to be arranged because the control servers are connected with all the databases, so that the system paralysis caused by the problem of one control server is avoided.
step 202, the control server judges the type of the data processing request.
specifically, the data processing request includes a data reading request and a data writing request, and the control server first needs to make a judgment and then performs subsequent processing.
Step 203, when the data processing request is a data reading request, the control server obtains load information of each database server, and obtains a load value of each database server according to the load information.
the load information comprises the CPU utilization rate, the memory utilization rate, the network bandwidth occupancy rate and the like of the server, weights are respectively given to all items in the load information, and weighting processing is carried out to obtain the load value of the database server.
in addition, when the data processing request is a data writing request, the application server caches data to be written in the control server, and the control server writes the data to be written in the plurality of database servers.
and 204, the control server distributes the data processing request to a first database server for processing according to the current load value and the current total load value of each database server.
Specifically, when the current total load value is smaller than the theoretical total load value, the following three processing methods are adopted:
First, the data processing request is distributed to a first database server with the maximum difference between the theoretical load value and the current load value.
The difference between the theoretical load value and the current load value is the largest, which shows that the database server has more free space for data processing than other database servers.
and the theoretical load value is the maximum load value of each database server. The theoretical total load value is the sum of the maximum load values of each database server.
Second, the data processing request is distributed to the first database server with the smallest current load value.
specifically, the control server reads data by using the database server with the minimum current load value and in a normal working state.
Here, it should be noted that, if the database server fails, the current load value may be the smallest, and therefore, the control server needs to read data by using the database server that is in a normal operating state and has the smallest current load value.
Third, the data processing request is distributed to any first database server with the current load value not larger than the theoretical load value.
The database server can continue to add data processing tasks as long as the current load value is not greater than the theoretical load value, and therefore, a data processing request can be distributed to any database server of which the current load value is not greater than the theoretical load value.
When the current total load value is equal to the theoretical total load value, and all the database servers are not idle at present, a new database server needs to be added, and the data processing request is distributed to the newly added first database server for processing.
Optionally, the technical solution of the present application further includes: and the database server sends the state information to the control server, and when the current state information is received to be in a fault state or the current state information is not received after the time exceeds the threshold value, all tasks of the database server are switched to a standby database server or other database servers corresponding to the database server.
specifically, when the current state information is in a fault state or the current state information is not received after the current state information exceeds a threshold value, all tasks of the database server are switched to a standby database server corresponding to the database server in a unified mode; or all tasks of the database server are switched to other database servers according to the load information.
The server load balancing method provided by the embodiment of the invention can flexibly distribute the data processing tasks according to the server load value, thereby realizing the server load balancing.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (7)

1. A method for server load balancing, the method comprising:
The control server receives a data processing request sent by the application server;
The control server judges the type of the data processing request;
When the data processing request is a data reading request, the control server acquires load information of each database server and obtains a load value of each database server according to the load information;
The control server distributes the data processing request to a first database server for processing according to the current load value and the current total load value of each database server;
The step of allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
and when the current total load value is smaller than a theoretical total load value, distributing the data processing request to a first database server with the largest difference between the theoretical load value and the current load value.
2. The server load balancing method according to claim 1, wherein the allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
And when the current total load value is smaller than the theoretical total load value, distributing the data processing request to the first database server with the minimum current load value.
3. The server load balancing method according to claim 2, wherein the allocating the data processing request to the first database server with the smallest current load value specifically comprises:
And the control server reads data by using the database server with the minimum current load value and in a normal working state.
4. The server load balancing method according to claim 1, wherein the allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
and when the current total load value is smaller than the theoretical total load value, distributing the data processing request to any first database server of which the current load value is not larger than the theoretical load value.
5. The server load balancing method according to claim 1, wherein the allocating, by the control server, the data processing request to the first database server for processing according to the current load value and the current total load value of each database server specifically includes:
and when the current total load value is equal to the theoretical total load value, distributing the data processing request to a newly-invested first database server for processing.
6. The server load balancing method according to claim 1, further comprising:
and the database server sends the state information to the control server, and when the current state information is received as a fault state or the current state information is not received after the time exceeds a threshold value, all tasks of the database server are switched to a standby database server or other database servers corresponding to the database server.
7. The server load balancing method according to claim 6, wherein switching all tasks of the database server to a standby database server or other database servers corresponding to the database server when the received current state information is a failure state or the current state information is not received after a threshold time is exceeded specifically comprises:
when the current state information is in a fault state or the current state information is not received after the time exceeds a threshold value, all tasks of the database server are switched to a standby database server corresponding to the database server in a unified mode; or
And switching all tasks of the database server to other database servers according to the load information.
CN201610440518.6A 2016-06-17 2016-06-17 Server load balancing method Active CN105915644B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610440518.6A CN105915644B (en) 2016-06-17 2016-06-17 Server load balancing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610440518.6A CN105915644B (en) 2016-06-17 2016-06-17 Server load balancing method

Publications (2)

Publication Number Publication Date
CN105915644A CN105915644A (en) 2016-08-31
CN105915644B true CN105915644B (en) 2019-12-06

Family

ID=56751321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610440518.6A Active CN105915644B (en) 2016-06-17 2016-06-17 Server load balancing method

Country Status (1)

Country Link
CN (1) CN105915644B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101252603B (en) * 2008-04-11 2011-03-30 清华大学 Cluster distributed type lock management method based on storage area network SAN
CN101562543B (en) * 2009-05-25 2013-07-31 阿里巴巴集团控股有限公司 Cache data processing method and processing system and device thereof
CN101741908B (en) * 2009-12-25 2012-07-11 青岛朗讯科技通讯设备有限公司 Identification method for application layer protocol characteristic
CN102567106B (en) * 2010-12-30 2014-10-01 中国移动通信集团云南有限公司 Task scheduling method, system and device
CN103036979B (en) * 2012-12-12 2015-07-01 广州尚融网络科技有限公司 Server loading balancing method and loading balancer
CN103997526B (en) * 2014-05-21 2018-05-22 中国科学院计算技术研究所 A kind of expansible SiteServer LBS and method

Also Published As

Publication number Publication date
CN105915644A (en) 2016-08-31

Similar Documents

Publication Publication Date Title
US10735509B2 (en) Systems and methods for synchronizing microservice data stores
US10277525B2 (en) Method and apparatus for disaggregated overlays via application services profiles
US20190235979A1 (en) Systems and methods for performing computing cluster node switchover
US7587492B2 (en) Dynamic performance management for virtual servers
US8055933B2 (en) Dynamic updating of failover policies for increased application availability
CN108733509B (en) Method and system for backing up and restoring data in cluster system
US10609159B2 (en) Providing higher workload resiliency in clustered systems based on health heuristics
EP3467652B1 (en) Data balancing method and device
CN103533063A (en) Method and device capable of realizing dynamic expansion of WEB (World Wide Web) application resource
CN111917846A (en) Kafka cluster switching method, device and system, electronic equipment and readable storage medium
US9292371B1 (en) Systems and methods for preventing failures of nodes in clusters
WO2014024863A1 (en) Load distribution method taking into account each node in multi-level hierarchy
US20120036345A1 (en) Embedded device and file change notification method of the embedded device
CN110677274A (en) Event-based cloud network service scheduling method and device
US20220137876A1 (en) Method and device for distributed data storage
CN114221994A (en) Dynamic allocation method for PCIE (peripheral component interface express) password card virtualized resources
CN110209498B (en) Cross-available-area resource scheduling method based on private cloud
CN111666167A (en) Input event reading processing optimization method, nonvolatile memory and terminal equipment
CN111045602A (en) Cluster system control method and cluster system
US8621260B1 (en) Site-level sub-cluster dependencies
CN101853185B (en) Blade server and service dispatching method thereof
CN105915644B (en) Server load balancing method
US10110502B1 (en) Autonomous host deployment in managed deployment systems
CN102868594B (en) Method and device for message processing
CN111400241A (en) Data reconstruction method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant