CN110198359A - A kind of load-balancing method and device - Google Patents

A kind of load-balancing method and device Download PDF

Info

Publication number
CN110198359A
CN110198359A CN201910610104.7A CN201910610104A CN110198359A CN 110198359 A CN110198359 A CN 110198359A CN 201910610104 A CN201910610104 A CN 201910610104A CN 110198359 A CN110198359 A CN 110198359A
Authority
CN
China
Prior art keywords
server
state
data
load
client
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.)
Pending
Application number
CN201910610104.7A
Other languages
Chinese (zh)
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.)
Unicloud Technology Co Ltd
Original Assignee
Unicloud 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 Unicloud Technology Co Ltd filed Critical Unicloud Technology Co Ltd
Priority to CN201910610104.7A priority Critical patent/CN110198359A/en
Publication of CN110198359A publication Critical patent/CN110198359A/en
Pending legal-status Critical Current

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

Abstract

The present invention provides a kind of load-balancing method and device, method is the following steps are included: A. is received and cached to the data of client;B. the state of each server is obtained;C. it is calculated according to the state of the server in step B, optimal server is selected to carry out data processing;D. the data distribution of the client cached in step A is given to optimal server.The invention has the advantages that: can better equalization server working efficiency, the case where avoiding certain inefficient server process data;The case where continuing with data can be overloaded to avoid CPU height;The case where continuing with data can be overloaded to avoid memory height.

Description

A kind of load-balancing method and device
Technical field
The invention belongs to Communication Control Technology fields, more particularly, to a kind of load-balancing method and device.
Background technique
With the development of internet, service traffics are increasing and service logic also becomes increasingly complex, single machine Performance issue and single-point problem, which have highlighted, to be come out, it is therefore desirable to which more machines carry out the horizontal extension of performance and avoid list Point failure.But how will be particularly important above the traffic distribution of different users to different servers.By negative Carrying balancing technique may be implemented the distribution of flow, and basic model is as shown in Figure 1.
The essence of load balancing apparatus is that reasonable forwarding client traffic is handled to back-end server.
The algorithm of load balancing includes polling method, randomized, source address Hash method, weighted polling method, Weighted random at present Method and Smallest connection method.Client traffic can be distributed to server by these algorithms.
Polling method: data successively are sent to server.
Weighted polling method: on the basis of polling method, weight is set to server, the big server process of weight is more Data.
Smallest connection method: the processing least server of task quantity carries out processing data.
Source address Hash method: being a numerical value being calculated by hash function according to the IP address for obtaining client, Modulo operation is carried out with size of the numerical value to server list, obtained result is the sequence that customer side will access server Number.
But the shortcomings that these algorithms, is, does not account for sub-health state when server operation.Sub-health state It is the very time-consuming operation of server process or the state that memory exhausts.When server is in sub-health state, it is also possible to locate The managing client of the task causes processing data performance slack-off.
Summary of the invention
In view of this, the present invention is directed to propose a kind of load-balancing method and device, with the deficiency that solves the above problems Place.
In order to achieve the above objectives, the technical scheme of the present invention is realized as follows:
The embodiment of first aspect present invention provides a kind of load-balancing method, comprising the following steps:
A. the data of client are received and is cached;
B. the state of each server is obtained;
C. it is calculated according to the state of the server in step B, optimal server is selected to carry out data processing;
D. the data distribution of the client cached in step A is given to optimal server.
Further, the calculation formula of server state is in the step C,
Value=ServerStatus* (75*CPUStatus+25*MemoryStatus),
Wherein, ServerStatus:1 or 0, when server can be used, being worth is 1;When server delay machine, being worth is 0;When When CPU usage amount 98% or memory usage 98%, being worth is 0;
CPUStatus:100* (1-cupuesed), wherein cupuesed is that current server cup uses percentage;
MemoryStatus:100* (1-memoryused), wherein memoryused is that current server memory uses hundred Divide ratio.
In addition, the embodiment of second aspect of the present invention additionally provides a kind of load balancing apparatus, including message queue module, Management module, block of state and distribution module,
The message queue module is used to receive the data of client, carries out the caching of data,
The block of state is used to carry out real-time, interactive with server end, obtains the state of each server,
The state for the server that the management module is provided according to block of state is calculated, select optimal server into Row data processing, and the information in optimal service device information and message queue is sent to distribution module,
The distribution module is for sending the message in message queue module in specific server.
Compared with the existing technology, a kind of load-balancing method and device of the present invention have the advantage that
A kind of load-balancing method of the present invention can preferably equalization server working efficiency, avoid certain The case where inefficient server process data;The case where continuing with data can be overloaded to avoid CPU height;It can be to avoid The case where memory height overload continues with data.
Detailed description of the invention
The attached drawing for constituting a part of the invention is used to provide further understanding of the present invention, schematic reality of the invention It applies example and its explanation is used to explain the present invention, do not constitute improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is the basic model structure schematic diagram of load balancing in the prior art;
Fig. 2 is load balancing apparatus structural schematic diagram described in the embodiment of the present invention;
Fig. 3 is load-balancing method flow chart described in the embodiment of the present invention.
Specific embodiment
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the present invention can phase Mutually combination.
The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
The embodiment of first aspect present invention provides a kind of load-balancing method, comprising the following steps:
A. the data of client are received and is cached;
B. the state of each server is obtained;
C. it is calculated according to the state of the server in step B, optimal server is selected to carry out data processing;
D. the data distribution of the client cached in step A is given to optimal server.
The calculation formula of server state is in the step C,
Value=ServerStatus* (75*CPUStatus+25*MemoryStatus),
Value indicates server state value, and bigger, the efficiency of server process is higher, and server process data will It is faster,
Wherein, ServerStatus:1 or 0, when server can be used, being worth is 1;When server delay machine, being worth is 0;When When CPU usage amount 98% or memory usage 98%, being worth is 0;
CPUStatus:100* (1-cupuesed), wherein cupuesed is that current server cup uses percentage;
MemoryStatus:100* (1-memoryused), wherein memoryused is that current server memory uses hundred Divide ratio.
In addition, as shown in Fig. 2, the embodiment of second aspect of the present invention additionally provides a kind of load balancing apparatus, including disappear Queue module, management module, block of state and distribution module are ceased,
The message queue module is used to receive the data of client, carries out the caching of data,
The block of state is used to carry out real-time, interactive with server end, obtains the state of each server, server State includes CPU usage, memory usage.
The state for the server that the management module is provided according to block of state is calculated, select optimal server into Row data processing, and the information in optimal service device information and message queue is sent to distribution module,
The distribution module is for sending the message in message queue module in specific server.
The course of work of the present embodiment is as follows:
As shown in figure 3, the block of state will be interacted with back-end server when load balancing works, clothes are obtained The state of device of being engaged in and the specifying information of server, and this result is fed back into management module, the mistake that this cycle executes Journey, gap periods 500ms;
If there are the data of client at this time, it is cached in message queue;
Optimal server is obtained by calculation in the management module, by the data in this server info and message queue It is sent to distribution module together.
The distribution module packaged data gives data distribution to optimal server.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention Within mind and principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (3)

1. a kind of load-balancing method, it is characterised in that the following steps are included:
A. the data of client are received and is cached;
B. the state of each server is obtained;
C. it is calculated according to the state of the server in step B, optimal server is selected to carry out data processing;
D. the data distribution of the client cached in step A is given to optimal server.
2. a kind of load-balancing method according to claim 1, it is characterised in that: server state in the step C Calculation formula is,
Value=ServerStatus* (75*CPUStatus+25*MemoryStatus),
Wherein, ServerStatus 1or0, when server can be used, being worth is 1;When server delay machine, being worth is 0;When CPU makes When dosage 98% or memory usage 98%, being worth is 0;
CPUStatus is 100* (1-cupuesed), wherein cupuesed is that current server cup uses percentage;
MemoryStatus is 100* (1-memoryused), and wherein memoryused is that current server memory uses percentage Than.
3. a kind of load-balancing method, it is characterised in that: including message queue module, management module, block of state and distribution mould Block,
The message queue module is used to receive the data of client, carries out the caching of data,
The block of state is used to carry out real-time, interactive with server end, obtains the state of each server,
The state for the server that the management module is provided according to block of state is calculated, and optimal server is selected to be counted It is sent to distribution module according to processing, and by the information in optimal service device information and message queue,
The distribution module is for sending the message in message queue module in specific server.
CN201910610104.7A 2019-07-08 2019-07-08 A kind of load-balancing method and device Pending CN110198359A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910610104.7A CN110198359A (en) 2019-07-08 2019-07-08 A kind of load-balancing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910610104.7A CN110198359A (en) 2019-07-08 2019-07-08 A kind of load-balancing method and device

Publications (1)

Publication Number Publication Date
CN110198359A true CN110198359A (en) 2019-09-03

Family

ID=67756008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910610104.7A Pending CN110198359A (en) 2019-07-08 2019-07-08 A kind of load-balancing method and device

Country Status (1)

Country Link
CN (1) CN110198359A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866395A (en) * 2020-11-18 2021-05-28 统信软件技术有限公司 Service request processing system and method and computing device

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207550A (en) * 2007-03-16 2008-06-25 中国科学技术大学 Load balancing system and method for multi business to implement load balancing
US20100251258A1 (en) * 2009-03-31 2010-09-30 Fujitsu Limited Recording medium having load balancing program recorded thereon, load balancing apparatus and method thereof
CN102185759A (en) * 2011-04-12 2011-09-14 田文洪 Multi-physical server load equalizing method and device capable of meeting requirement characteristic
CN103179217A (en) * 2013-04-19 2013-06-26 中国建设银行股份有限公司 Load balancing method and device applicable to WEB application server group
CN105183670A (en) * 2015-10-27 2015-12-23 北京百度网讯科技有限公司 Data processing method and device used for distributed cache system
CN105245617A (en) * 2015-10-27 2016-01-13 江苏电力信息技术有限公司 Container-based server resource supply method
CN106506701A (en) * 2016-12-28 2017-03-15 北京奇艺世纪科技有限公司 A kind of server load balancing method and load equalizer
CN106656533A (en) * 2015-10-29 2017-05-10 大唐移动通信设备有限公司 Method and device for monitoring load processing of cluster system
CN107645540A (en) * 2017-08-21 2018-01-30 西安交大捷普网络科技有限公司 The load-balancing method of web application systems
US20190199790A1 (en) * 2017-12-22 2019-06-27 A10 Networks, Inc. Managing health status of network devices in a distributed global server load balancing system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207550A (en) * 2007-03-16 2008-06-25 中国科学技术大学 Load balancing system and method for multi business to implement load balancing
US20100251258A1 (en) * 2009-03-31 2010-09-30 Fujitsu Limited Recording medium having load balancing program recorded thereon, load balancing apparatus and method thereof
CN102185759A (en) * 2011-04-12 2011-09-14 田文洪 Multi-physical server load equalizing method and device capable of meeting requirement characteristic
CN103179217A (en) * 2013-04-19 2013-06-26 中国建设银行股份有限公司 Load balancing method and device applicable to WEB application server group
CN105183670A (en) * 2015-10-27 2015-12-23 北京百度网讯科技有限公司 Data processing method and device used for distributed cache system
CN105245617A (en) * 2015-10-27 2016-01-13 江苏电力信息技术有限公司 Container-based server resource supply method
CN106656533A (en) * 2015-10-29 2017-05-10 大唐移动通信设备有限公司 Method and device for monitoring load processing of cluster system
CN106506701A (en) * 2016-12-28 2017-03-15 北京奇艺世纪科技有限公司 A kind of server load balancing method and load equalizer
CN107645540A (en) * 2017-08-21 2018-01-30 西安交大捷普网络科技有限公司 The load-balancing method of web application systems
US20190199790A1 (en) * 2017-12-22 2019-06-27 A10 Networks, Inc. Managing health status of network devices in a distributed global server load balancing system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866395A (en) * 2020-11-18 2021-05-28 统信软件技术有限公司 Service request processing system and method and computing device
CN112866395B (en) * 2020-11-18 2023-04-07 统信软件技术有限公司 Service request processing system and method and computing device

Similar Documents

Publication Publication Date Title
CN113037869B (en) Method and apparatus for back-sourcing of content distribution network system
US9456056B2 (en) Load balancing utilizing adaptive thresholding
US9104492B2 (en) Cloud-based middlebox management system
WO2021012663A1 (en) Access log processing method and device
Nakai et al. Load balancing for internet distributed services using limited redirection rates
CN102004673A (en) Processing method and system of multi-core processor load balancing
CN103369601A (en) Method for providing large concurrent processing and flow control for mobile phone client sides
US20180329771A1 (en) Identifying failed customer experience in distributed computer systems
CN102970242B (en) Method for achieving load balancing
CN108933829A (en) A kind of load-balancing method and device
CN103516744A (en) A data processing method, an application server and an application server cluster
CN102970142B (en) A kind of VPN device is adding the method and system of concurrent encryption and decryption under close snap ring border
CN104780210A (en) Load balancing method and device
CN103049336A (en) Hash-based network card soft interrupt and load balancing method
CN107645540A (en) The load-balancing method of web application systems
CN105471700B (en) A kind of methods, devices and systems of Message Processing
CN106330610A (en) Load balance processing system and method
CN103873293A (en) Health detection device and method
CN102932269A (en) Method and device for balancing load
CN107846365A (en) A kind of load balancing based on SDN realizes system and method
CN109600240A (en) Group Communications method and device
CN104580228A (en) System and method for generating blacklist for access requests from network
CN104301241B (en) A kind of SOA dynamic load distributing methods and system
CN110198359A (en) A kind of load-balancing method and device
CN111338750A (en) Pressure adjusting method and device for execution node, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190903