[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN105915646A - Method and device for dispersing load of servers - Google Patents

Method and device for dispersing load of servers Download PDF

Info

Publication number
CN105915646A
CN105915646A CN201610443845.7A CN201610443845A CN105915646A CN 105915646 A CN105915646 A CN 105915646A CN 201610443845 A CN201610443845 A CN 201610443845A CN 105915646 A CN105915646 A CN 105915646A
Authority
CN
China
Prior art keywords
server
cluster
minimum
access
module
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
CN201610443845.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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201610443845.7A priority Critical patent/CN105915646A/en
Publication of CN105915646A publication Critical patent/CN105915646A/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
    • 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/1023Server selection for load balancing based on a hash applied to IP addresses or costs

Landscapes

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

Abstract

The invention discloses a method and device for dispersing load of servers. The method comprises that a master server receives a request and obtains load parameters of multiple cluster servers in a cluster; an optimum server is determined from the multiple cluster servers according to the obtained multiple load parameters; the IP address of the optimum server is obtained and is sent to a client; and the client accesses the optimum server according to the IP address. According to the technical scheme provided by the invention, the load of the servers in the cluster can be effectively dispersed, the resource consumption of the servers is reduced, and the experience of the client is improved.

Description

Method and device for distributing server load
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method and an apparatus for distributing server loads.
Background
In the prior art, during the process of accessing the server by the client, there are no explicit offloading policies and current limiting measures, which often causes the situation that the server is overloaded and returns a timeout response or no response to the client. At the initial stage of software new version release, the problem of server overload caused by centralized upgrading of the client is more obvious, so how to effectively disperse the load of the server, reduce the resource consumption of the server, and improve the experience of the client becomes a problem to be solved urgently.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method and a device for distributing server load.
In one aspect, the present invention provides a method for distributing server load, including:
step S1: the main server receives the request;
step S2: the main server acquires load parameters of a plurality of cluster servers in a cluster, and determines an optimal server in the plurality of cluster servers according to the acquired load parameters;
step S3: and the main server acquires the IP address of the optimal server and sends the IP address to the client side, so that the client side can access the optimal server according to the IP address.
Optionally, the step S2, further includes: the main server updates the information of the cluster servers in the cluster server list;
in step S2, the acquiring, by the master server, load parameters of a plurality of cluster servers in the cluster specifically includes: and the main server acquires the load parameters of a plurality of cluster servers in the cluster from the cluster server list.
The updating of the information of the cluster server in the cluster server list by the main server specifically includes:
step a: and the main server downloads the log files of all the cluster servers, analyzes the log files to obtain the accessed times and the used flow of the corresponding cluster servers, and updates the accessed times and the used flow of the corresponding cluster servers in the cluster server list into the obtained accessed times and the used flow.
Optionally, the analyzing the log file to obtain the number of times of access and the flow rate of the corresponding cluster server specifically includes:
the main server analyzes the log file, and counts the number of lines of the access records in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
Optionally, the step S2, further includes: and when the main server does not find the optimal server in the cluster servers according to the obtained load parameters, returning an error code to the client, and ending.
Optionally, the load parameter specifically includes: the access times of the cluster server in a preset time;
the step S2 specifically includes: the main server acquires the number of times of access of a plurality of cluster servers in a cluster within preset time, and determines an optimal server in the plurality of cluster servers according to the acquired number of times of access.
Optionally, the determining, according to the obtained multiple access times, an optimal server among the multiple cluster servers specifically includes: and the main server selects the minimum accessed times from the acquired multiple accessed times, and takes the cluster server corresponding to the minimum accessed times as an optimal server.
Optionally, before taking the cluster server corresponding to the minimum number of times of access as the optimal server, the method further includes:
step E: and the main server judges whether the minimum access times are smaller than a preset access time threshold value, if so, the cluster server corresponding to the minimum access times is used as an optimal server, otherwise, the optimal server is not found in the cluster servers according to the obtained multiple load parameters, an error code is returned to the client, and the operation is finished.
Optionally, when the determination in step E is yes, the method further includes:
step e 1: the main server judges whether the number of the cluster servers corresponding to the minimum access times is one, if so, the step e2 is executed, otherwise, the step e3 is executed;
step e 2: the main server reads the used flow of the cluster server corresponding to the main server according to the minimum accessed times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum accessed times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client and ends;
step e 3: and the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, selects the minimum flow from the read used flow, judges whether the minimum flow is smaller than a preset flow threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained load parameters, returns an error code to the client, and ends.
Optionally, when the number of the cluster servers corresponding to the minimum flow is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
Optionally, the load parameter specifically includes: the used flow of the cluster server in the preset time;
the step S2 specifically includes: the method comprises the steps that a main server obtains used flow of a plurality of cluster servers in a cluster within preset time, and an optimal server is determined in the cluster servers according to the obtained used flow.
Optionally, the determining an optimal server in the plurality of cluster servers according to the obtained plurality of used flows specifically includes: and the main server selects the minimum flow from the acquired multiple used flows, and takes the cluster server corresponding to the minimum flow as the optimal server.
Optionally, before taking the cluster server corresponding to the minimum traffic as the optimal server, the method further includes:
and T: and the main server judges whether the minimum flow is smaller than a preset flow threshold value, if so, the cluster server corresponding to the minimum flow is used as an optimal server, otherwise, the main server confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client and finishes.
Optionally, when the step T determines yes, the method further includes:
step t 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, the step t2 is executed, otherwise, the step t3 is executed;
step t 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step t 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, selects the minimum access time from the read access times, judges whether the minimum access time is less than a preset access time threshold, if so, takes the cluster server corresponding to the minimum access time as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters, returns an error code to the client, and ends.
Optionally, when the number of the cluster servers corresponding to the minimum number of times of access is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
Optionally, the load parameter is specifically the number of times the cluster server is accessed and the flow used within a preset time;
the step S2 specifically includes: the main server acquires the access times and the used flow of a plurality of cluster servers in a cluster, and determines an optimal server in the plurality of cluster servers according to the acquired access times and the used flow.
Optionally, the determining an optimal server among the plurality of cluster servers according to the obtained multiple access times and the obtained traffic includes:
step F1: the main server selects the minimum access times from the acquired multiple access times, and selects the minimum flow from the acquired multiple used flows;
step F2: and the main server respectively calculates the loads of the corresponding cluster servers according to the minimum access times and the minimum flow, selects the minimum load and takes the cluster server corresponding to the minimum load as the optimal server.
Optionally, before the step F2, the method further includes:
step Y: and the main server judges whether the minimum access times and the minimum flow are smaller than corresponding preset access times threshold values and preset flow threshold values or not, when the minimum access times and the minimum flow are judged to be yes, the cluster server corresponding to the main server is taken as an optimal server, when the minimum access times and the minimum flow are judged to be yes, step F2 is executed, when the minimum access times and the minimum flow are judged to be no, the optimal server is not found in the cluster servers according to the obtained load parameters, an error code is returned to the client side, and the operation is finished.
Optionally, in the step Y, the step C,
when one of the judgment results is yes, the method specifically comprises the following steps: when the minimum access times are judged to be smaller than a preset access times threshold value, before the cluster server corresponding to the minimum access times is taken as an optimal server, the method further comprises the following steps:
step d 1: the main server judges whether the number of the cluster servers corresponding to the minimum number of accessed times is one, if so, the step d2 is executed, otherwise, the step d3 is executed;
step d 2: the main server reads the used flow of the corresponding cluster server according to the minimum accessed times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum accessed times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step d 3: the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, judges whether the used flow is smaller than a preset flow threshold value or not, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the used flow is judged to be not smaller than the preset flow threshold value, returns an error code to the client side, and ends the operation, otherwise, selects the minimum flow from the used flow smaller than the preset flow threshold value, and takes the server corresponding to the minimum flow as the optimal server;
when one of the judgment results is yes, the method specifically comprises the following steps: when the minimum flow is judged to be smaller than a preset flow threshold value, before the cluster server corresponding to the minimum flow is taken as an optimal server, the method further comprises the following steps:
step g 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, executing a step g2, otherwise, executing a step g 3;
step g 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step g 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the judgment result is negative, returns an error code to the client, and ends the operation, otherwise selects the minimum access time from the access times smaller than the preset access time threshold, and takes the cluster server corresponding to the minimum access time as the optimal server.
Optionally, in the step d3, when the number of the cluster servers corresponding to the minimum traffic is greater than one, the master server randomly selects one of the cluster servers as an optimal server;
in the step g3, when the number of the cluster servers corresponding to the minimum number of times of access is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
Optionally, the determining an optimal server in the plurality of cluster servers according to the obtained multiple access times and the obtained traffic includes:
step H1: the main server calculates and stores the load of the corresponding cluster server according to the acquired access times and the acquired flow;
step H2: and the main server selects the minimum load from the stored loads, and takes the cluster server corresponding to the minimum load as the optimal server.
Optionally, before the step H1, the method further includes: and the main server judges whether the acquired access times and the acquired flow are smaller than corresponding preset access time threshold values and preset flow threshold values, and if yes, the step H1 is executed.
Optionally, before the step H2, the method further includes: and the main server judges whether the number of the stored loads is zero, if so, the main server confirms that the optimal server is not found in the cluster servers according to the obtained load parameters, and returns an error code to the client, and the operation is finished, otherwise, the step H2 is executed.
Optionally, when the number of the cluster servers corresponding to the minimum load is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
Optionally, the calculating the load of the corresponding cluster server specifically includes:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and a preset base number.
Optionally, in step S3, the method may further include: and the main server acquires the IP address of the optimal server and sends a connection request to the optimal server according to the IP address.
Optionally, when the main server is embodied as an application server,
the step S1 specifically includes: an application server receives a connection request sent by a client;
in step S3, the application server obtains the IP address of the optimal server and sends the IP address to the client, specifically: and the application server acquires the IP address of the optimal server, organizes connection request response data according to the IP address and sends the connection request response data to the client.
Optionally, when the main server is embodied as a management server,
before the step S1, the method further includes: an application server receives a connection request sent by a client;
the step S1 specifically includes: the management server receives a server acquisition request sent by the application server;
in step S2, when the optimal server is not found in the cluster servers according to the obtained multiple load parameters, the application server returns an error code to the client;
in step S3, after the management server obtains the IP address of the optimal server, the method further includes: and the management server sends the acquired IP address to the application server, and the application server organizes connection request response data according to the IP address and sends the connection request response data to the client.
In another aspect, the present invention further provides an apparatus for distributing server load, including:
a receiving module for receiving a request;
the first acquisition module is used for acquiring load parameters of a plurality of cluster servers in a cluster;
the selection module is used for determining an optimal server in the cluster servers according to the load parameters of the cluster servers acquired by the first acquisition module;
the second acquisition module is used for acquiring the IP address of the optimal server determined by the selection module;
and the sending module is used for sending the IP address obtained by the second obtaining module to a client side, so that the client side can access the optimal server according to the IP address.
Optionally, the apparatus further comprises: the updating module is used for updating the information of the cluster servers in the cluster server list;
the first obtaining module is specifically configured to: and accessing the cluster server list to acquire the load parameters of a plurality of cluster servers in the cluster.
Optionally, the update module specifically includes:
the download submodule is used for downloading the log files of all the cluster servers;
the analysis submodule is used for analyzing the log file downloaded by the downloading submodule to obtain the accessed times and the used flow of the corresponding cluster server;
and the updating submodule is used for updating the accessed times and the used flow of the corresponding cluster server in the cluster server list into the accessed times and the used flow obtained by the analyzing submodule.
Optionally, the parsing submodule is specifically configured to: analyzing the log file downloaded by the downloading submodule, and counting the number of lines of the access record in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
Optionally, the sending module is further configured to, when the selecting module does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end.
Optionally, the load parameter specifically includes: the access times of the cluster server in a preset time;
the first obtaining module is specifically configured to: acquiring the number of times of access of a plurality of cluster servers in a cluster within preset time;
the selection module is specifically configured to: and determining an optimal server in the cluster servers according to the multiple access times acquired by the first acquisition module.
Optionally, the selecting module specifically includes:
the first selection submodule is used for selecting the minimum accessed times from the multiple accessed times acquired by the first acquisition module;
and the first sub-module is used for taking the server corresponding to the minimum accessed times as an optimal server.
Optionally, the selecting module further includes:
the first judgment sub-module is used for judging whether the minimum access times is smaller than a preset access times threshold value before the first serving sub-module takes the cluster server corresponding to the minimum access times as an optimal server;
the first serving sub-module is specifically configured to, when the first determining sub-module determines that the minimum number of times of access is smaller than a preset number of times of access threshold, serve the cluster server corresponding to the minimum number of times of access as an optimal server;
the sending module is specifically configured to, when the first determining sub-module determines that the minimum number of times of access is not less than a preset number of times of access threshold, confirm that the selecting module does not find an optimal server among the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module, return an error code to the client, and end.
Optionally, the selecting module further includes:
the second judgment submodule is used for judging whether the number of the cluster servers corresponding to the minimum access times is one or not when the first judgment submodule judges that the minimum access times is smaller than a preset access times threshold value;
a third determining submodule, configured to, when the second determining submodule determines that the number of the cluster servers corresponding to the minimum number of times of access is one, read a traffic of the cluster server corresponding to the minimum number of times of access according to the minimum number of times of access, and determine whether the traffic is smaller than a preset traffic threshold;
the first as sub-module is specifically configured to: when the third judging submodule judges that the read used flow according to the minimum access times is smaller than a preset flow threshold, the cluster server corresponding to the minimum access times is used as an optimal server;
the first selection judgment sub-module is used for reading the used flow of the plurality of cluster servers corresponding to the minimum accessed times according to the minimum accessed times when the second judgment sub-module judges that the number of the cluster servers corresponding to the minimum accessed times is not one, selecting the minimum flow from the read used flow, and judging whether the minimum flow is smaller than a preset flow threshold value or not;
the first serving sub-module is further configured to, when the first selection judgment sub-module judges that the minimum traffic is smaller than a preset traffic threshold, serve the cluster server corresponding to the minimum traffic as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the third determination sub-module determines that the used traffic read according to the minimum number of times of access is not smaller than a preset traffic threshold, and return an error code to the client, and then end; and when the first selection judgment sub-module judges that the minimum flow is not less than a preset flow threshold, the selection module is determined to not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the method is finished.
Optionally, the first sub-module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one.
Optionally, the load parameter specifically includes: the used flow of the cluster server in the preset time;
the first obtaining module is specifically configured to: acquiring the flow used by a plurality of cluster servers in a cluster within preset time;
the selection module is specifically configured to: and determining an optimal server in the plurality of cluster servers according to the plurality of used flows acquired by the first acquisition module.
Optionally, the selecting module specifically includes:
the second selection submodule is used for selecting the minimum flow from the obtained multiple used flows;
and the second sub-module is used for taking the cluster server corresponding to the minimum flow as the optimal server.
Optionally, the selecting module further includes:
a fourth judgment submodule, configured to judge whether the minimum traffic is smaller than a preset traffic threshold before the second serving submodule uses the cluster server corresponding to the minimum traffic as the optimal server;
the second as a sub-module is specifically configured to: when the fourth judging submodule judges that the minimum flow is smaller than a preset flow threshold, the cluster server corresponding to the minimum flow is used as an optimal server;
the sending module is specifically configured to: and when the fourth judging submodule judges that the minimum flow is not smaller than a preset flow threshold, confirming that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, returning an error code to the client, and ending.
Optionally, the selecting module further includes:
a fifth judging submodule, configured to judge whether the number of cluster servers corresponding to the minimum flow is one or not when the fourth judging submodule judges that the minimum flow is smaller than a preset flow threshold;
the reading judgment submodule is specifically used for: when the fifth judging submodule judges that the number of the cluster servers corresponding to the minimum flow is one, the number of times of access of the cluster servers corresponding to the minimum flow is read according to the minimum flow, and whether the number of times of access is smaller than a preset access number threshold value is judged;
the second as a sub-module is specifically configured to: when the reading judgment submodule judges that the number of times of access read according to the minimum flow is smaller than a preset access time threshold value, the cluster server corresponding to the minimum flow is used as an optimal server;
the second selection judgment submodule is used for reading the accessed times of the plurality of cluster servers corresponding to the minimum flow according to the minimum flow when the fifth judgment submodule judges that the number of the cluster servers corresponding to the minimum flow is not one, selecting the minimum accessed times from the read accessed times, and judging whether the minimum accessed times is smaller than a preset access time threshold value or not;
the second as a sub-module is specifically configured to: when the second selection judgment submodule judges that the minimum access times are smaller than a preset access times threshold value, the cluster server corresponding to the minimum access times is used as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the second reading judgment submodule judges that the number of times of access read according to the minimum flow is not less than a preset access time threshold, and return an error code to the client, and then end; and when the second selection judgment sub-module judges that the minimum access times are not less than a preset access time threshold, the selection module is determined to not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the process is finished.
Optionally, the second sub-module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum number of times of access is greater than one.
Optionally, the load parameter is specifically the number of times the cluster server is accessed and the flow used;
the first obtaining module is specifically configured to: acquiring the access times and the used flow of a plurality of cluster servers in a cluster;
the selection module is specifically configured to: and determining an optimal server in the cluster servers according to the accessed times and the used flow acquired by the first acquisition module.
Optionally, the selecting module specifically includes:
a third selection submodule, configured to select a minimum number of times of access from the multiple numbers of times of access acquired by the first acquisition module, and select a minimum flow from the multiple used flows acquired by the first acquisition module;
the calculation submodule is used for respectively calculating the load of the corresponding cluster server and selecting the minimum load according to the minimum access times and the minimum flow selected by the third selection submodule;
and the third is used as a sub-module for taking the cluster server corresponding to the minimum load as the optimal server.
Optionally, the selecting module further includes:
a sixth judgment submodule, configured to judge whether the minimum access time and the minimum traffic are smaller than corresponding preset access time thresholds and preset traffic thresholds;
the third sub-module is used for taking the cluster server corresponding to the sixth judgment sub-module as the optimal server when the sixth judgment sub-module judges that the first sub-module is yes;
the calculation submodule is specifically configured to: when the sixth judgment submodule judges that all the cluster servers are the same, respectively calculating the loads of the corresponding cluster servers and selecting the minimum load according to the minimum access times and the minimum flow selected by the selection submodule;
the sending module is specifically configured to: and when the sixth judgment sub-module determines that the load parameters are all negative, the selection module is confirmed to find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the operation is finished.
Optionally, the selecting module further includes:
a seventh judging submodule, configured to, when the sixth judging submodule judges that one of the judgment submodules is yes, specifically: when the minimum access times are judged to be smaller than a preset access times threshold value, the third acting sub-module judges whether the number of the cluster servers corresponding to the minimum access times is one or not before the cluster servers corresponding to the minimum access times are taken as optimal servers;
an eighth judging submodule, configured to, when the seventh judging submodule judges that the number of the cluster servers corresponding to the minimum number of times of access is one, read a traffic of the cluster server corresponding to the minimum number of times of access according to the minimum number of times of access, and judge whether the traffic is smaller than a preset traffic threshold;
the third sub-module is specifically configured to, when the eighth determining sub-module determines that the used traffic read according to the minimum number of times of access is smaller than a preset traffic threshold, use the cluster server corresponding to the minimum number of times of access as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the eighth determination submodule determines that the used traffic read according to the minimum number of times of access is not smaller than a preset traffic threshold, and return an error code to the client, and then the process is finished;
a ninth judging submodule, configured to, when the seventh judging submodule judges that the number of cluster servers corresponding to the minimum number of times of access is not one, read traffic used by the plurality of cluster servers corresponding to the minimum number of times of access according to the minimum number of times of access, and judge whether the traffic is smaller than a preset traffic threshold;
the sending module is further configured to, when the ninth determining sub-module determines that the load parameters are all negative, confirm that the selection module does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end;
the third selection submodule is further configured to select a minimum flow from the used flows smaller than the preset flow threshold when the ninth judgment submodule judges that the flow rates are not all negative;
the third sub-module is specifically configured to: taking the server corresponding to the minimum flow selected by the third selection submodule as an optimal server;
a tenth determining sub-module, configured to, when the sixth determining sub-module determines that one of the first and second determination sub-modules is yes, specifically: when the minimum flow is judged to be smaller than a preset flow threshold value, the third acting submodule judges whether the number of the cluster servers corresponding to the minimum flow is one or not before the cluster servers corresponding to the minimum flow are taken as optimal servers;
an eleventh judging submodule, configured to, when the tenth judging submodule judges that the number of cluster servers corresponding to the minimum traffic is one, read, according to the minimum traffic, the number of times that the cluster server corresponding to the minimum traffic is accessed, and judge whether the number of times is smaller than a preset access number threshold;
the third sub-module is specifically configured to: when the eleventh judging submodule judges that the number of times of access read according to the minimum flow is smaller than a preset access number threshold, the cluster server corresponding to the minimum flow is used as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the eleventh determination module determines that the number of times of access read according to the minimum traffic is not less than a preset access number threshold, return an error code to the client, and end;
a twelfth judging submodule, configured to, when the tenth judging submodule judges that the number of cluster servers corresponding to the minimum traffic is not one, read, according to the minimum traffic, the number of times that the plurality of cluster servers corresponding to the minimum traffic are accessed, and judge whether the number of times is smaller than a preset access number threshold;
the sending module is further configured to, when the twelfth judging sub-module judges that the load parameters are all negative, confirm that the selection module does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end;
the third selecting submodule is further configured to select a minimum access time from the access times smaller than the preset access time threshold when the twelfth judging submodule judges that the access times are not all negative;
the third sub-module is specifically configured to: and taking the cluster server corresponding to the minimum accessed times selected by the third selection submodule as an optimal server.
Optionally, the third sub-module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one; and when the number of the cluster servers corresponding to the minimum number of accessed times is more than one, randomly selecting one cluster server as an optimal server.
Optionally, the selecting module specifically includes:
the calculation submodule is used for calculating and storing the load of the corresponding cluster server according to the accessed times and the used flow acquired by the first acquisition module;
a fourth selection submodule for selecting a minimum load among the saved loads;
and the fourth selection submodule is used for selecting the cluster server corresponding to the minimum load selected by the fourth selection submodule as the optimal server.
Optionally, the selecting module further includes:
a thirteenth judging sub-module, configured to, before the calculating sub-module calculates and stores the load of the corresponding cluster server according to the acquired access times and the acquired traffic, judge whether the access times and the acquired traffic acquired by the first acquiring module are smaller than the corresponding preset access time threshold and preset traffic threshold;
the calculation submodule is specifically configured to: and when the judgment result of the thirteenth judgment submodule is yes, calculating and storing the load of the corresponding cluster server according to the acquired accessed times and the acquired flow.
Optionally, the selecting module further includes:
a fourteenth determining submodule, configured to determine whether the number of the stored loads is zero before the fourth selecting submodule selects the minimum load from the stored loads;
the sending module is specifically configured to: when the fourteenth judging submodule judges that the number of the stored loads is zero, confirming that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquiring module, returning an error code to the client, and ending;
the fourth selecting submodule is specifically configured to select a minimum load from the stored loads when the fourteenth determining submodule determines that the number of the stored loads is not zero.
Optionally, the fourth module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum load is greater than one.
Optionally, the calculation submodule is specifically configured to:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and a preset base number.
Optionally, the sending module may be further configured to: and sending a connection request to the optimal server according to the IP address acquired by the second acquisition module.
Optionally, the receiving module is specifically configured to: receiving a connection request sent by a client;
the sending module is specifically configured to: and organizing connection request response data according to the IP address acquired by the second acquisition module, and sending the connection request response data to the client.
Optionally, the receiving module is specifically configured to: receiving an acquisition server request sent by an application server;
the sending module is specifically configured to: and sending the IP address acquired by the second acquisition module to the application server.
Compared with the prior art, the invention has the following advantages: the load of the servers in the cluster can be effectively dispersed, the resource consumption of the servers is reduced, and the experience of the client is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a method for distributing server load according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for distributing server load according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for distributing server load according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for distributing server load according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a method for distributing server load according to a fifth embodiment of the present invention;
fig. 6 is a diagram of an apparatus for distributing server load according to a sixth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The technical scheme of the invention is suitable for a server cluster comprising at least two server nodes, wherein the IP address, the flow threshold and the access frequency threshold of each server in the cluster are preset by an administrator.
Example one
An embodiment of the present invention provides a method for distributing server load, as shown in fig. 1, including:
step 101: the main server receives the request;
in this embodiment, when the main server is specifically an application server, step 101 is specifically: the method comprises the steps that a main server receives a connection request sent by a client;
for example, the connection request sent by the client and received by the main server is http:// ip: port/reqtype ═ 6;
in this embodiment, when the main server is a management server, step 101 specifically includes: the method comprises the steps that a main server receives a server acquisition request sent by an application server;
correspondingly, before step 101, the method further includes: and the application server receives the connection request sent by the client.
Step 102: the method comprises the steps that a main server obtains load parameters of a plurality of cluster servers in a cluster, and an optimal server is determined in the cluster servers according to the obtained load parameters;
in this embodiment, step 102 further includes: the main server updates the information of the cluster servers in the cluster server list; correspondingly, the main server obtains load parameters of a plurality of cluster servers in the cluster, specifically: the main server obtains the load parameters of a plurality of cluster servers in the cluster from the cluster server list.
In this embodiment, the updating, by the master server, the information of the cluster server in the cluster server list specifically includes: the main server downloads the log files of all the cluster servers, analyzes the downloaded log files to obtain the accessed times and the used flow of the corresponding cluster servers, and updates the accessed times and the used flow of the corresponding cluster servers in the cluster server list into the obtained accessed times and the used flow;
more specifically, the main server analyzes the downloaded log file to obtain the access times and the used flow of the corresponding cluster server, and specifically includes: the main server analyzes the downloaded log file, and counts the number of lines of the access records in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
In this embodiment, step 102 further includes: when the main server does not find the optimal server in the cluster servers according to the obtained load parameters, returning an error code to the client, and ending; further, when the main server is the management server, the application server returns an error code to the client, and the operation is finished.
In this embodiment, the load parameter may be the number of times the cluster server is accessed within a preset time;
correspondingly, step 102 specifically includes: the method comprises the steps that a main server obtains the number of times of access of a plurality of cluster servers in a cluster within preset time, and an optimal server is determined in the plurality of cluster servers according to the obtained number of times of access;
in this embodiment, according to the obtained multiple access times, an optimal server is determined in the multiple cluster servers, which specifically includes: the main server selects the minimum accessed times from the acquired multiple accessed times, and takes the cluster server corresponding to the minimum accessed times as an optimal server;
further, in this embodiment, before taking the cluster server corresponding to the minimum number of accesses as the optimal server, the method further includes:
step E: and the main server judges whether the minimum access times are smaller than a preset access time threshold value, if so, the cluster server corresponding to the minimum access times is used as the optimal server, otherwise, the optimal server is not found in the cluster servers according to the obtained load parameters, an error code is returned to the client, and the operation is finished.
Further, in this embodiment, when the determination in step E is yes, the method further includes:
step e 1: the main server judges whether the number of the cluster servers corresponding to the minimum access times is one, if so, the step e2 is executed, otherwise, the step e3 is executed;
step e 2: the main server reads the used flow of the corresponding cluster server according to the minimum access times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum access times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step e 3: and the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, selects the minimum flow from the read used flow, judges whether the minimum flow is smaller than a preset flow threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters, returns an error code to the client, and ends.
In this embodiment, when the number of the cluster servers corresponding to the minimum traffic is greater than one, the master server randomly selects one of the cluster servers as the optimal server.
In this embodiment, the load parameter may also be: the used flow of the cluster server in the preset time;
correspondingly, step 102 specifically includes: the method comprises the steps that a main server obtains used flow of a plurality of cluster servers in a cluster within preset time, and an optimal server is determined in the plurality of cluster servers according to the obtained used flow;
the method comprises the following steps of determining an optimal server in a plurality of cluster servers according to a plurality of acquired used flows, specifically: the main server selects the minimum flow from the acquired multiple used flows, and the cluster server corresponding to the minimum flow is used as the optimal server;
further, in this embodiment, before taking the cluster server corresponding to the minimum traffic as the optimal server, the method further includes:
and T: and the main server judges whether the minimum flow is smaller than a preset flow threshold value, if so, the cluster server corresponding to the minimum flow is used as the optimal server, otherwise, the optimal server is not found in the cluster servers according to the obtained load parameters, an error code is returned to the client, and the operation is finished.
Further, in this embodiment, when the step T determines yes, the method further includes:
step t 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, the step t2 is executed, otherwise, the step t3 is executed;
step t 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step t 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, selects the minimum access time from the read access times, judges whether the minimum access time is less than a preset access time threshold, if so, takes the cluster server corresponding to the minimum access time as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters, returns an error code to the client, and ends.
In this embodiment, when the number of cluster servers corresponding to the minimum number of times of access is greater than one, the master server randomly selects one of the cluster servers as the optimal server.
In this embodiment, the load parameter may also be: the access times and the used flow of the cluster server in the preset time;
correspondingly, step 102 specifically includes: the method comprises the steps that a main server obtains the number of times of access and the flow used by a plurality of cluster servers in a cluster, and an optimal server is determined in the plurality of cluster servers according to the obtained number of times of access and the obtained flow used by the plurality of cluster servers;
in this embodiment, determining an optimal server among a plurality of cluster servers according to the obtained multiple access times and the obtained traffic includes:
step F1: the main server selects the minimum access times from the acquired multiple access times, and selects the minimum flow from the acquired multiple used flows;
step F2: and the main server respectively calculates the loads of the corresponding cluster servers according to the minimum access times and the minimum flow, selects the minimum load and takes the cluster server corresponding to the minimum load as the optimal server.
In this embodiment, before step F2, the method further includes:
step Y: and the main server judges whether the minimum access times and the minimum flow are smaller than the corresponding preset access time threshold and the corresponding preset flow threshold, when the minimum access times and the minimum flow are judged to be yes, the cluster server corresponding to the main server is used as the optimal server, when the minimum access times and the minimum flow are judged to be yes, the step F2 is executed, when the minimum access times and the minimum flow are judged to be no, the optimal server is not found in the cluster servers according to the obtained load parameters, an error code is returned to the client, and the operation is finished.
Further, in this embodiment, in step Y,
when one of the judgment results is yes, the method specifically comprises the following steps: when the minimum access times is judged to be smaller than the preset access times threshold value, before the cluster server corresponding to the minimum access times is taken as the optimal server, the method further comprises the following steps:
step d 1: the main server judges whether the number of the cluster servers corresponding to the minimum number of accessed times is one, if so, the step d2 is executed, otherwise, the step d3 is executed;
step d 2: the main server reads the used flow of the corresponding cluster server according to the minimum access times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum access times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step d 3: the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, judges whether the used flow is smaller than a preset flow threshold value or not, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the judgment result is negative, returns an error code to the client, and ends the operation, otherwise, selects the minimum flow from the used flow smaller than the preset flow threshold value, and takes the server corresponding to the minimum flow as the optimal server;
when one of the judgment results is yes, the method specifically comprises the following steps: when the minimum flow is judged to be smaller than the preset flow threshold, before the cluster server corresponding to the minimum flow is used as the optimal server, the method further comprises the following steps:
step g 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, the step g2 is executed, otherwise, the step g3 is executed;
step g 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step g 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the judgment result is negative, returns an error code to the client, and ends the operation, otherwise selects the minimum access time from the access times smaller than the preset access time threshold, and takes the cluster server corresponding to the minimum access time as the optimal server.
Further, in step d3, when the number of the cluster servers corresponding to the minimum flow is greater than one, the master server randomly selects one of the cluster servers as an optimal server;
in step g3, when the number of cluster servers corresponding to the minimum number of accesses is greater than one, the master server randomly selects one of the cluster servers as the optimal server.
In this embodiment, when the load parameters are: when the cluster server is accessed for the number of times and the traffic used within the preset time, step 102 may further be:
step H1: the main server calculates and stores the load of the corresponding cluster server according to the acquired access times and the acquired flow;
step H2: and the main server selects the minimum load from the stored loads, and takes the cluster server corresponding to the minimum load as the optimal server.
In this embodiment, before step H1, the method further includes: the main server judges whether the acquired access times and the acquired flow are smaller than corresponding preset access time threshold values and preset flow threshold values, and if yes, the step H1 is executed;
before step H2, the method further includes: the main server judges whether the number of the stored loads is zero, if yes, the main server confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, an error code is returned to the client, and the operation is finished, otherwise, the step H2 is executed;
further, in this embodiment, when the number of the cluster servers corresponding to the minimum load is greater than one, the master server randomly selects one of the cluster servers as the optimal server.
Further, in this embodiment, the load of the cluster server is calculated, specifically:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and the preset base number.
For example: the used traffic of the server is 60, the access amount is 20, the preset base number is that each access amount corresponds to 5M traffic, and the load of the server is 60/5+ 20-32.
Step 103: and the main server acquires the IP address of the optimal server and sends the IP address to the client so that the client can access the optimal server according to the IP address.
In this embodiment, when the main server is specifically an application server, in step 103, the main server obtains an IP address of the optimal server and sends the IP address to the client, specifically: the application server acquires the IP address of the optimal server, organizes connection request response data according to the acquired IP address, and sends the connection request response data to the client;
in this embodiment, when the main server is specifically a management server, after the management server obtains the IP address of the optimal server, the method further includes: and the management server sends the acquired IP address to the application server, and the application server organizes connection request response data according to the IP address and sends the connection request response data to the client.
For example, the IP address of the optimal server acquired by the management server is 192.168.17.42;
the application server organizes the connection request response data according to the IP address as follows: { errcode: "0000", errmsg: "success", ipaddress: "192.168.17.42" };
further, in this embodiment, step 103 may also be: the main server obtains the IP address of the optimal server and sends a connection request to the optimal server according to the IP address.
Example two
An embodiment of the present invention provides a method for distributing server loads, as shown in fig. 2, including:
step 201: the client sends a first connection request to the application server;
step 202: the application server waits for and receives a first connection request sent by the client;
for example, the first connection request sent by the client and received by the application server is http:// ip: port/reqtype ═ 6.
Step 203: the application server acquires the accessed times of the cluster server and selects the minimum accessed times;
in this embodiment, the number of times that the application server obtains the cluster server is accessed may be: the method comprises the steps that an application server accesses a database, and the accessed times of cluster servers are obtained from a cluster server list in the database, wherein the cluster server list comprises information of all cluster servers in a cluster;
specifically, the application server shares a database with the management server, and the management server updates information of the cluster servers in the cluster server list.
In this embodiment, the obtaining, by the application server, the number of times of access to the cluster server may further be: the method comprises the steps that an application server accesses a shared file, and the accessed times of cluster servers are obtained from a cluster server list in the shared file, wherein the cluster server list comprises information of all cluster servers in a cluster;
specifically, the management server updates information of the cluster servers in the cluster server list, stores the updated cluster server list in the shared file according to a storage address of a preset shared file, the application server accesses the shared file according to the storage address of the preset shared file, and the accessed times of the cluster servers are acquired from the cluster server list in the shared file.
In this embodiment, the obtaining, by the application server, the number of times of access to the cluster server may further be: the application server sends a list acquisition request to the management server, and after receiving the list acquisition request, the management server sends the cluster server list to the application server; the cluster server list comprises information of all cluster servers in the cluster, and the management server updates the information of the cluster servers in the cluster server list;
for example: the application server sends { reqtype: 2, wherein it is agreed in advance that when the value of reqtype is 2, the cluster server list is obtained.
In addition, the application server can also send a data acquisition request, and after receiving the data acquisition request, the management server reads corresponding data in the cluster server list and sends the read data to the application server.
Further, the updating, by the management server, the information of the cluster server in the cluster server list may be: the method for polling and updating the cluster server list by the management server at intervals of a first preset time interval specifically comprises the following steps:
step a 1: the management server judges whether the timing value of the timer reaches the timing point of updating the cluster server list, if so, the step a2 is executed, otherwise, the step a1 is continuously executed;
in the embodiment, the management server updates the cluster server list in the database at intervals of a first preset time interval according to the timing value of the timer;
preferably, in the present embodiment, the first preset time interval is 1 minute.
Step a 2: the management server accesses the cluster server list, takes the accessed cluster server as the current cluster server, and executes the step a 3;
step a 3: the management server downloads a log file of the current cluster server;
specifically, the management server finds the log file of the current cluster server and downloads the log file according to the file path of the log file of the current cluster server stored in the cluster server list;
further, in this embodiment, each cluster server in the cluster reads and compresses its respective log file every second preset time interval; specifically, the cluster server searches the last line of the log file every second preset time interval, reads the access records of the preset lines from back to front to obtain the access records generated in the second preset time interval, and compresses the access records to obtain the first log file in a compressed format; the second preset time interval is smaller than and approximately equal to the first preset time interval, and the time difference between the second preset time interval and the first preset time interval can be ignored;
in this embodiment, step a3 specifically includes: and the management server downloads a first log file of the current cluster server.
Step a 4: the management server analyzes the downloaded log file to obtain and store the load parameters of the current cluster server;
in this embodiment, the load parameter of the cluster server may be preset according to a requirement, and may also be all information in the access record, preferably, in this embodiment, the load parameter of the cluster server specifically is: the number of times the cluster server is accessed and the traffic used, step a4 specifically includes:
step a 4-1: the management server analyzes the downloaded log file to obtain and store the access times of the current cluster server;
in this embodiment, each row in the cluster server log file is an access record;
the step a4-1 specifically comprises the following steps: the management server decompresses the downloaded first log file to obtain a log file of the current cluster server, counts the number of lines of access records in the log file to obtain the number of times of access of the current cluster server, and stores the obtained number of times of access to a first preset position in a line of the current cluster server in a cluster server list according to the identification of the current cluster server.
Step a 4-2: the management server analyzes the downloaded log file to obtain and store the flow used by the current cluster server;
in this embodiment, each access record in the log file of the server includes information such as access time, access IP, and used traffic;
the step a4-2 specifically comprises the following steps: the management server analyzes each access record in the log file obtained by decompression of the management server, reads flow used by each access, adds all the read flows to obtain the flow used by the current cluster server, and stores the obtained flow used to a second preset position in a row of the current cluster server in the cluster server list according to the identification of the current cluster server;
further, the management server reads the traffic used for each access, specifically: the management server analyzes each access record, reads the last section of digital data in each access record, and obtains the flow used by each access;
for example, in access record 192.168.17.11- - [23/Feb/2016:11:19:50+0800] "GET/bank _ kl/node2/SC _ Cardbin _ Check _ enc. txt HTTP/1.1". 200236, the management server reads that the traffic for this access is 236 bytes;
further, in the present embodiment, the order of step a4-1 and step a4-2 may be reversed.
Step a 5: the management server judges whether the timing value of the timer reaches the timing point of stopping updating the cluster server list, if so, the step a1 is returned, otherwise, the step a6 is executed;
in this embodiment, before returning from step a5 to step a1, the method further includes: the management server sets an update identifier;
in this embodiment, the update identifier is used to identify the location where the update is completed, and when the management server updates the cluster server list again, the update identifier is found and the update is started from the next server of the server with the update identifier;
further, in this embodiment, the update identifier may also be used to identify a start position of the update again, and when the management server updates the cluster server list again, the update identifier is found, and the update is started from the server with the update identifier.
Step a 6: the management server continues to access the cluster server list, and returns to the step a3 by taking the accessed cluster server as the current cluster server;
in this embodiment, the updating, by the management server, the information of the cluster server in the cluster server list, and stopping the first preset time interval after the updating of the information of all the servers in the cluster server list is completed may further include:
step b 1: the management server accesses the cluster server list, takes the accessed cluster server as the current cluster server, and executes the step b 2;
step b 2: the management server downloads a log file of the current cluster server;
step b 3: the management server analyzes the downloaded log file to obtain and store the load parameters of the current cluster server;
step b 4: and b, the management server judges whether the current cluster server is the last cluster server, if so, the management server returns to the step b1 after stopping the first preset time interval, otherwise, the management server returns to the step b2 by taking the next cluster server of the current cluster server as the current cluster server.
In this embodiment, the updating, by the management server, the information of the cluster server in the cluster server list may also be:
step c 1: the management server loads all server nodes in the cluster and correspondingly starts an analysis thread;
specifically, the management server starts an analysis thread for each cluster server in the cluster.
Step c 2: and the analysis thread downloads the log file of the corresponding server, analyzes the downloaded log file to obtain the load parameter of the corresponding cluster server, and stores the load parameter into the cluster server list.
Preferably, in this embodiment, the application server sorts the acquired access times of the plurality of cluster servers to obtain a minimum access time; specifically, the method comprises the following steps: the application server calls a sorting function interface of the cluster server list, and sorts data in a first predetermined position in the cluster server list to obtain the minimum access times;
in this embodiment, the application server may sort the acquired access times of the plurality of cluster servers in a positive order or a negative order; preferably, in this embodiment, the application server performs positive sequence sorting on the obtained access times of the plurality of cluster servers;
further, in this embodiment, when the updating of the information of the cluster server in the cluster server list by the management server is implemented through step a1 to step a5, step 203 further includes: and the application server judges whether the cluster server list has the cluster server which is not updated, if so, the accessed times of the updated cluster server are obtained, otherwise, the accessed times of all the cluster servers in the cluster server list are obtained.
Step 204: the application server judges whether the minimum access times is less than a preset access times threshold value, if so, the step 205 is executed, otherwise, an error code is returned to the client, and the step 202 is returned;
step 205: the application server judges whether the number of the cluster servers corresponding to the minimum access times is one, if so, step 206 is executed, otherwise, step 207 is executed;
step 206: the application server reads the used flow of the corresponding cluster server according to the minimum accessed times, judges whether the flow is smaller than a preset flow threshold value, if so, takes the server corresponding to the minimum accessed times as an optimal server, executes step 209, otherwise, returns an error code to the client, and returns to step 202;
step 207: the application server reads the used flow of the plurality of cluster servers corresponding to the application server according to the minimum access times and selects the minimum flow from the flow;
specifically, the application server searches a plurality of cluster servers corresponding to the application server according to the minimum number of times of access, and reads data in a second predetermined position in a row where the searched cluster server is located; preferably, the application server calls a sorting function interface of the cluster server list to sort the read data, so as to obtain the minimum flow.
Step 208: the application server judges whether the minimum flow is smaller than a preset flow threshold value, if so, the corresponding cluster server is taken as an optimal server, step 209 is executed, otherwise, an error code is returned to the client, and step 202 is returned;
further, in this embodiment, when the number of cluster servers corresponding to the minimum traffic in step 207 is greater than one and the determination in step 208 is yes, the application server randomly selects one of the cluster servers as the optimal server, and performs step 209.
Step 209: the application server acquires the IP address of the optimal server;
specifically, the application server reads the data in the third predetermined setting, for example, the read IP address is 192.168.25.24, in the row where the optimal server in the cluster server list is located.
Step 210: the application server organizes connection request response data according to the acquired IP address and sends the connection request response data to the client;
preferably, in this embodiment, the connection request response data obtained by the application server is: { errcode: "0000", errmsg: "success", ipaddress: "192.168.25.24" }.
Step 211: the client waits for and receives the connection request response data sent by the application server, and analyzes the received connection request response data to obtain the IP address of the optimal server;
in this embodiment, the client parses the connection request response data to obtain the IP address 192.168.25.24 of the optimal server.
Step 212: the client sends a second connection request to the optimal server according to the obtained IP address of the optimal server, judges whether a connection success status code returned by the optimal server is received or not, if so, the connection is successful, and ends; otherwise, the connection fails, and the step 201 is returned to.
Preferably, in this embodiment, when the client receives the status code 200 returned by the optimal server, it confirms that the connection is successful, otherwise, it confirms that the connection is failed.
In this embodiment, after the application server receives the first connection request, the following steps may be further performed: the application server sends a server acquisition request to the management server, the management server selects the optimal server according to the method after receiving the server acquisition request, the IP address of the optimal server is sent to the application server, the application server organizes and obtains connection request response data according to the IP address of the optimal server, and the obtained connection request response data are sent to the client.
For example, the application server sends { reqtype: 1, giving the management server, wherein when the value of reqtype is agreed in advance to be 1, the optimal server is obtained;
the management server returns { decode: 0000, resmsg: "Return success", ip: "192.168.17.42", wherein the IP address of the optimal server is 192.168.17.42;
the connection request response data obtained by the application server is as follows: { errcode: "0000", errmsg: "success", ipaddress: "192.168.17.42" };
further, in this embodiment, after the application server obtains the IP address of the optimal server, the following steps may be further performed: the application server sends a first connection request to the optimal server.
In the method described in this embodiment, the load parameter is mainly used as the number of times the cluster server is accessed, and the traffic used by the cluster server is used as an additional condition, the optimal server is selected, and the access mode of the optimal server is sent to the client, so as to achieve the purpose of dispersing the load of the cluster server in the cluster.
EXAMPLE III
An embodiment of the present invention provides a method for distributing server load, as shown in fig. 3, including:
step 301: the client sends a first connection request to the application server;
step 302: the application server waits for and receives a first connection request sent by the client;
for example, the connection request sent by the client and received by the application server is http:// ip: port/reqtype ═ 6.
Step 303: the application server obtains the used flow of the cluster server and selects the minimum flow from the flow;
in this embodiment, the obtaining, by the application server, the traffic used by the cluster server may be: the method comprises the steps that an application server accesses a database, and the accessed times of cluster servers are obtained from a cluster server list in the database, wherein the cluster server list comprises information of all cluster servers in a cluster;
specifically, the application server shares a database with the management server, and the management server updates information of the cluster servers in the cluster server list.
In this embodiment, the step of acquiring, by the application server, the traffic used by the cluster server may further be: the method comprises the steps that an application server accesses a shared file, and the flow used by a cluster server is obtained from a cluster server list in the shared file, wherein the cluster server list comprises information of all cluster servers in a cluster;
specifically, the management server updates information of the cluster servers in the cluster server list, stores the updated cluster server list in the shared file according to a storage address of a preset shared file, the application server accesses the shared file according to the storage address of the preset shared file, and the used flow of the cluster servers is obtained from the cluster server list in the shared file.
In this embodiment, the step of acquiring, by the application server, the traffic used by the cluster server may further be: the application server sends a list acquisition request to the management server, and after receiving the list acquisition request, the management server sends the cluster server list to the application server; the cluster server list comprises information of all cluster servers in a cluster, and the management server updates the information of the cluster servers in the cluster server list;
for example: the application server sends { reqtype: 2, wherein it is agreed in advance that when the value of reqtype is 2, the cluster server list is obtained.
In addition, the application server can also send a data acquisition request, and after receiving the data acquisition request, the management server reads corresponding data in the cluster server list and sends the read data to the application server;
in this embodiment, the method for updating the information of the cluster server in the cluster server list by the management server is the same as the method described in the first embodiment, and is not described herein again.
Step 304: the application server judges whether the minimum flow is smaller than a preset flow threshold value, if so, the step 305 is executed, otherwise, an error code is returned to the client, and the step 302 is returned;
step 305: the application server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, step 306 is executed, otherwise, step 307 is executed;
step 306: the application server reads the accessed times of the cluster server corresponding to the application server according to the minimum flow, judges whether the accessed times are smaller than a preset access time threshold, if so, the cluster server corresponding to the minimum flow is used as an optimal server, and executes step 309, otherwise, an error code is returned to the client, and the step 302 is returned;
step 307: the application server reads the access times of the corresponding cluster servers according to the minimum flow and selects the minimum access time from the access times;
specifically, the application server searches a plurality of cluster servers corresponding to the application server according to the minimum flow, and reads data in a first predetermined position in a row where the searched cluster servers are located; preferably, the application server calls a sorting function interface of the cluster server list to sort the read data, so as to obtain the minimum number of times of access.
Step 308: the application server judges whether the minimum access times are smaller than a preset access time threshold value, if so, the corresponding cluster server is taken as an optimal server, the step 309 is executed, otherwise, an error code is returned to the client, and the step 302 is returned;
further, in this embodiment, when the number of cluster servers corresponding to the minimum number of times of access in step 307 is greater than one and the determination in step 308 is yes, the application server randomly selects one of the cluster servers as the optimal server, and performs step 309.
Step 309: the application server acquires the IP address of the optimal server;
specifically, the application server reads the data in the third predetermined setting, for example, the read IP address is 192.168.25.24, in the row where the optimal server in the cluster server list is located.
Step 310: the application server organizes connection request response data according to the acquired IP address and sends the connection request response data to the client;
preferably, in this embodiment, the connection request response data obtained by the application server is: { errcode: "0000", errmsg: "success", ipaddress: "192.168.25.24" }.
Step 311: the client waits for and receives the connection request response data sent by the application server, and analyzes the received connection request response data to obtain the IP address of the optimal server;
in this embodiment, the client parses the connection request response data to obtain the IP address 192.168.25.24 of the optimal server.
Step 312: the client sends a second connection request to the optimal server according to the obtained IP address of the optimal server, judges whether a connection success status code returned by the optimal server is received or not, if so, the connection is successful, and ends; otherwise, the connection fails, and the step 301 is returned to.
Preferably, in this embodiment, when the client receives the status code 200 returned by the optimal server, it confirms that the connection is successful, otherwise, it confirms that the connection is failed.
In this embodiment, after the application server receives the first connection request, the following steps may be further performed: the application server sends a server acquisition request to the management server, the management server selects the optimal server according to the method after receiving the server acquisition request, the IP address of the optimal server is sent to the application server, the application server organizes and obtains connection request response data according to the IP address of the optimal server, and the obtained connection request response data are sent to the client.
For example, the application server sends { reqtype: 1, giving the management server, wherein when the value of reqtype is agreed in advance to be 1, the optimal server is obtained;
the management server returns { decode: 0000, resmsg: "Return success", ip: "192.168.17.42", wherein the IP address of the optimal server is 192.168.17.42;
the connection request response data obtained by the application server is as follows: { errcode: "0000", errmsg: "success", ipaddress: "192.168.17.42" };
further, in this embodiment, after the application server obtains the IP address of the optimal server, the following steps may be further performed: the application server sends a first connection request to the optimal server.
In the method described in this embodiment, the load parameter is mainly used as the traffic of the cluster server, the number of times of access is an additional condition, and the optimal server is selected and the access mode of the optimal server is sent to the client, so as to achieve the purpose of dispersing the load of the cluster server in the cluster.
Example four
A fourth embodiment of the present invention provides a method for distributing server loads, as shown in fig. 4, including:
step 401: the client sends a first connection request to the application server;
step 402: the application server waits for and receives a first connection request sent by the client;
for example, the first connection request sent by the client and received by the application server is http:// ip: port/reqtype ═ 6.
Step 403: the application server accesses the cluster server list and takes the accessed first cluster server as the current cluster server;
in this embodiment, the accessing of the cluster server list by the application server may be: the application server and the management server share a database, and the application server accesses the database and further accesses the cluster server list; the management server updates the information of the cluster servers in the cluster server list;
in this embodiment, the accessing of the cluster server list by the application server may also be: the application server accesses the shared file according to the preset storage address of the shared file, and then accesses the cluster server list; the management server updates the information of the cluster servers in the cluster server list and stores the updated cluster server list into the shared file according to the preset storage address of the shared file;
in this embodiment, the accessing of the cluster server list by the application server may also be: the application server sends an information file acquisition request to the management server, and after receiving the information file acquisition request, the management server sends a cluster server list to the application server; the management server updates the information of the cluster servers in the cluster server list;
for example, the application server sends { reqtype: 2, wherein when the value of reqtype is agreed in advance to be 2, the cluster server list is obtained;
in addition, the application server can also send a data acquisition request, and after receiving the data acquisition request, the management server reads corresponding data in the cluster server list and sends the read data to the application server.
The method for updating the information of the cluster server in the cluster server list by the management server is the same as the method described in the first embodiment, and is not described herein again.
Step 404: the application server reads the accessed times of the current cluster server and judges whether the accessed times are smaller than a preset access time threshold, if so, the step 405 is executed, otherwise, the step 407 is executed;
in this embodiment, the reading, by the application server, the number of times of access to the current cluster server specifically includes: the application server reads data in a first preset position in a row where a current cluster server is located in a cluster server list;
further, in this embodiment, when the number of times that all cluster servers in the cluster are accessed is greater than the preset threshold value of the number of times of access, the application server returns an error code to the client, and returns to step 402.
Step 405: the application server reads the flow used by the current cluster server and judges whether the flow is smaller than a preset flow threshold value, if so, step 406 is executed, otherwise, step 407 is executed;
in this embodiment, the reading, by the application server, of the traffic used by the current cluster server specifically includes: the application server reads data in a second preset position in a row where the current cluster server is located in the cluster server list;
further, in this embodiment, when the traffic used by all cluster servers in the cluster is greater than the preset traffic threshold, the application server returns an error code to the client, and returns to step 402.
Step 406: the application server calculates and stores the load of the current cluster server;
specifically, the application server divides the read used flow of the current cluster server by a preset base number, and adds the read accessed times of the current cluster server to obtain the load of the current cluster server and stores the load of the current cluster server to a fourth preset position in a row of the current cluster server in the cluster server list;
for example, if the number of times of access of the current cluster server read by the application server is 15, the used traffic is 75M, and the preset base number is 5, the load of the current cluster server is calculated to be 75/5+ 15-30, and 30 is stored in the fourth predetermined position in the row of the current cluster server in the cluster server list.
Step 407: the application server judges whether the current cluster server is the last cluster server, if so, step 408 is executed, otherwise, the next cluster server is accessed and taken as the current cluster server, and the step 404 is returned;
further, in this embodiment, when the management server updates the information of the cluster server in the cluster server list through steps a1 to a6, and when there is an un-updated cluster server in the cluster server list, step 407 specifically includes: the application server judges whether the current cluster server is the last cluster server updated, if yes, step 408 is executed, otherwise, the next updated cluster server is accessed and used as the current cluster server, and the step 404 is returned;
when all the cluster server information in the cluster server list is updated, step 407 specifically includes: the application server judges whether the current cluster server is the last cluster server in the cluster server list, if yes, step 408 is executed, otherwise, the next cluster server is accessed and taken as the current cluster server, and the step 404 is returned.
Step 408: the application server selects the minimum load from the stored loads, and takes the server corresponding to the minimum load as the optimal server;
preferably, the application server calls a sorting function interface of the cluster server list to sort the data in a fourth predetermined position in the cluster server list to obtain a minimum load;
further, the application server may sort the stored loads in a positive order or a negative order, and preferably, in this embodiment, the application server sorts the stored loads in a positive order.
Step 409: the application server acquires the IP address of the optimal server;
specifically, the application server reads the data in the third predetermined location in the row where the optimal server is located in the cluster server list, for example, the read IP address is 192.168.25.24.
Step 410: the application server organizes connection request response data according to the read IP address and sends the connection request response data to the client;
preferably, in this embodiment, the connection request response data obtained by the application server is: { errcode: "0000", errmsg: "success", ipaddress: "192.168.25.24" }.
Step 411: the client waits for and receives the connection request response data sent by the application server, and analyzes the received connection request response data to obtain the IP address of the optimal server;
in this embodiment, the client parses the connection request response data to obtain the IP address 192.168.25.24 of the optimal server.
Step 412: the client sends a second connection request to the optimal server according to the obtained IP address of the optimal server, judges whether a connection success status code returned by the optimal server is received or not, if so, the connection is successful, and ends; otherwise, the connection fails, and the step 401 is returned to.
Preferably, in this embodiment, when the client receives the status code 200 returned by the optimal server, it confirms that the connection is successful, otherwise, it confirms that the connection is failed.
In this embodiment, after the application server receives the first connection request, the following steps may be further performed: sending an acquisition server request to a management server, obtaining an optimal server according to the method after the management server receives the acquisition server request, sending the IP address of the optimal server to an application server, organizing and obtaining connection request response data by the application server according to the received IP address of the optimal server, and sending the obtained connection request response data to a client;
further, in this embodiment, after the application server obtains the IP address of the optimal server, the following steps may be further performed: the application server sends a first connection request to the optimal server.
In the method described in this embodiment, the load of the cluster server is calculated according to the number of times the cluster server is accessed and the traffic used, the optimal server is obtained by comparing the calculated load, and the access mode of the optimal server is sent to the client, so as to achieve the purpose of dispersing the load of the cluster server in the cluster.
EXAMPLE five
An embodiment of the present invention provides a method for distributing server loads, as shown in fig. 5, including:
step 501: the client sends a first connection request to the application server;
step 502: the application server waits for and receives a first connection request sent by the client;
for example, the connection request sent by the client and received by the application server is http:// ip: port/reqtype ═ 6.
Step 503: the application server acquires the accessed times of the cluster server and selects the minimum accessed times;
in this embodiment, the method for the application server to obtain the number of times of access to the cluster server is the same as the method described in the second embodiment, and details are not described herein;
preferably, the application server calls a sorting function interface of the cluster server list to sort the data in the first predetermined position in the cluster server list to obtain the minimum accessed times;
in this embodiment, the application server may sort the accessed times of the cluster servers in a positive order or a negative order; preferably, in this embodiment, the application server performs positive sequence sorting on the number of times the cluster server is accessed;
further, in this embodiment, the method for updating the information of the cluster server in the cluster server list by the management server is the same as the method described in the first embodiment, and when the updating of the server information in the cluster server list by the management server is implemented through step a1 to step a6, step 503 further includes: and the application server judges whether the cluster server list has the cluster server which is not updated, if so, the accessed times of the updated cluster server are sequenced, and otherwise, the accessed times of all the cluster servers in the cluster server list are sequenced.
Step 504: the application server judges whether the minimum access times is less than a preset access time threshold, if so, the step 505 is executed, otherwise, an error code is sent to the client, and the step 502 is returned;
step 505: the application server reads the used flow of the corresponding cluster server according to the minimum accessed times, and judges whether the used flow is smaller than a preset flow threshold, if so, the step 506 is executed, otherwise, an error code is returned to the client, and the step 502 is returned:
in this embodiment, the reading, by the application server, of the traffic of the server corresponding to the application server according to the minimum number of times of access specifically includes: the application server searches a corresponding cluster server in the cluster server list according to the minimum access times, and reads data in a second predetermined position in a row where the searched cluster server is located;
further, when the number of cluster servers corresponding to the minimum number of times of access in step 503 is greater than one, step 505 specifically includes:
step c 1: the application server reads the first minimum access times as the current minimum access times according to the natural sequence after the access times are sequenced;
step c 2: the application server reads the used flow of the corresponding cluster server according to the current minimum access times, judges whether the used flow is larger than a preset flow threshold value or not, abandons the cluster server if the used flow is larger than the preset flow threshold value, and executes the step c3, otherwise executes the step c 3;
step c 3: the application server determines whether the current minimum number of accesses is the last minimum number of accesses, if yes, step 506 is executed, otherwise, the next minimum number of accesses is taken as the current minimum number of accesses, and the process returns to step c 2.
Step 506: the application server obtains the used flow of the cluster server and selects the minimum flow from the flow;
in this embodiment, the method for the application server to obtain the traffic of the cluster server is the same as the method described in the third embodiment, and is not described herein again;
preferably, the application server calls a sorting function interface of the cluster server list to sort the data in a second predetermined position in the cluster server list to obtain the minimum flow;
in this embodiment, the application server may sort the traffic statistics used by the cluster servers in a positive order or a negative order; preferably, in this embodiment, the application server performs forward sequencing on the traffic used by the cluster servers;
further, in this embodiment, when the updating of the information of the cluster server in the cluster server list by the management server is implemented by performing step a1 to step a6, step 507 further includes: and the application server judges whether the cluster server list has the cluster server which is not updated, if so, the flow used by the updated cluster server is obtained, otherwise, the flow used by all the cluster servers in the cluster server list is obtained.
Step 507: the application server judges whether the minimum flow is smaller than a preset flow threshold value, if so, step 508 is executed, otherwise, an error code is sent to the client, and the step 502 is returned;
step 508: the application server reads the access times of the corresponding cluster server according to the minimum flow, and judges whether the access times are smaller than a preset access time threshold, if so, the step 509 is executed, otherwise, an error code is returned to the client, and the step 502 is returned;
in this embodiment, the reading, by the application server, the number of times of access to the server corresponding to the application server according to the minimum traffic includes: the application server searches the corresponding cluster server in the cluster server list according to the minimum flow, and reads data in a first predetermined position in a row where the searched cluster server is located;
further, in this embodiment, when the multiple cluster servers corresponding to the minimum traffic are obtained through sorting in step 506, step 508 specifically includes:
step b 1: the application server reads the first minimum flow as the current minimum flow according to the natural sequence after the minimum flow is sequenced;
step b 2: the application server reads the accessed times of the corresponding cluster server according to the current minimum flow, judges whether the accessed times is larger than a preset access time threshold value, if so, abandons the server, and executes the step b3, otherwise, executes the step b 3;
step b 3: the application server determines whether the current minimum traffic is the last minimum traffic, if so, step 509 is executed, otherwise, the next minimum traffic is taken as the current minimum traffic, and the step b2 is returned.
Step 509: the application server judges the number of the current remaining cluster servers, when the number of the remaining cluster servers is zero, an error code is returned to the client, and the step 502 is returned; when the number of the remaining cluster servers is one, taking the remaining cluster servers as optimal servers, executing step 512, and when the number of the remaining cluster servers is more than one, executing step 510;
step 510: the application server calculates and stores the load of the current remaining cluster servers;
specifically, when the remaining cluster servers are the cluster servers corresponding to the minimum number of times of access, step 510 specifically includes: the application server divides the read used flow according to the minimum accessed times by a preset base number, and adds the minimum accessed times to obtain the load of the cluster server corresponding to the minimum accessed times, and the load is stored in a fourth preset position in a row of the cluster server in the cluster server list;
for example, the minimum number of times of access is 15, the read used traffic is 75M according to the minimum number of times of access, and the preset base number is 5, then the load of the cluster server corresponding to the minimum number of times of access is calculated to be 75/5+15, which is equal to 30.
When the remaining cluster servers are the servers corresponding to the minimum traffic, step 510 specifically includes: the application server divides the minimum flow by a preset base number, and obtains the load of the cluster server corresponding to the minimum flow by adding the number of accessed times read according to the minimum flow, and stores the load in a fourth preset position in a row where the cluster server is located in the cluster server list;
for example, the minimum traffic is 40, the number of times of access read according to the minimum traffic is 20, and the preset base number is 5, then the load of the cluster server corresponding to the minimum traffic is calculated to be 40/5+ 20-28.
Step 511: the application server selects the minimum load from the stored loads, takes the cluster server corresponding to the minimum load as the optimal server, and executes step 512;
preferably, the application server calls a sorting function interface of the cluster server list to sort the data in a fourth predetermined position in the cluster server list to obtain a minimum load;
further, when the minimum load corresponds to a plurality of cluster servers, the application server randomly selects one of the cluster servers as an optimal server, and then executes step 512.
Step 512: the application server acquires the IP address of the optimal server;
specifically, the application server reads the data in the third predetermined location in the row where the optimal server is located in the cluster server list, for example, the read IP address is 192.168.25.24.
Step 513: the application server organizes connection request response data according to the read IP address of the optimal server and sends the connection request response data to the client;
preferably, in this embodiment, the connection request response data obtained by the application server is: { errcode: "0000", errmsg: "success", ipaddress: "192.168.25.24" }.
Step 514: the client waits for and receives the connection request response data sent by the application server, and analyzes the received connection request response data to obtain the IP address of the optimal server;
in this embodiment, the client parses the connection request response data to obtain the IP address 192.168.25.24 of the optimal server.
Step 515: the client sends a second connection request to the optimal server according to the obtained IP address of the optimal server, and determines whether a connection success status code returned by the optimal server is received, if so, the connection is successful, and if not, the connection is failed, and the step 501 is returned.
Preferably, in this embodiment, when the client receives the status code 200 returned by the optimal server, it confirms that the connection is successful, otherwise, it confirms that the connection is failed.
In this embodiment, after the application server receives the first connection request, the following steps may be further performed: the application server sends a request for obtaining the optimal server to the management server, the management server selects the optimal server according to the method and sends the IP address of the optimal server to the application server, the application server organizes and obtains connection request response data according to the IP address of the received optimal server, and the obtained connection request response data are sent to the client.
For example: the application server sends { reqtype: 1, giving the management server, wherein when the value of reqtype is agreed in advance to be 1, the optimal server is obtained;
the management server returns { decode: 0000, resmsg: "Return success", ip: "192.168.17.42", wherein the IP address of the optimal server is 192.168.17.42;
the connection request response data obtained by the application server is as follows: { errcode: "0000", errmsg: "success", ipaddress: "192.168.17.42" };
further, in this embodiment, after the application server obtains the IP address of the optimal server, the following steps may be further performed: the application server sends a first connection request to the optimal server.
In the method described in this embodiment, the optional servers are respectively obtained according to the number of times of access to the cluster server and the traffic used, the loads of the optional servers are compared to obtain the optimal server, and the access mode of the optimal server is sent to the client, so as to achieve the purpose of dispersing the server loads in the cluster.
EXAMPLE six
An embodiment of the present invention provides an apparatus for distributing server load, as shown in fig. 6, including:
a receiving module 601, configured to receive a request;
a first obtaining module 602, configured to obtain load parameters of a plurality of cluster servers in a cluster;
a selecting module 603, configured to determine an optimal server among the multiple cluster servers according to the load parameters of the multiple cluster servers acquired by the first acquiring module 602;
a second obtaining module 604, configured to obtain the IP address of the optimal server determined by the selecting module 603;
a sending module 605, configured to send the second obtained IP address to the client, so that the client accesses the optimal server according to the IP address.
The apparatus in this embodiment further includes: the updating module is used for updating the information of the cluster servers in the cluster server list;
accordingly, the first obtaining module 602 is specifically configured to obtain the load parameters of the multiple cluster servers in the cluster from the cluster server list.
In this embodiment, the update module specifically includes:
the download submodule is used for downloading the log files of all the cluster servers;
the analysis submodule is used for analyzing the log file downloaded by the downloading submodule to obtain the accessed times and the used flow of the corresponding cluster server;
and the updating submodule is used for updating the accessed times and the used flow of the corresponding cluster server in the cluster server list into the accessed times and the used flow obtained by the analyzing submodule.
In this embodiment, the parsing submodule is specifically configured to: analyzing the log file downloaded by the downloading submodule, and counting the number of lines of the access record in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
In this embodiment, the sending module 605 is further configured to, when the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module 602, return an error code to the client, and end.
In this embodiment, the load parameters of the cluster server may be: the access times of the cluster server in a preset time;
accordingly, the first obtaining module 602 is specifically configured to: acquiring the number of times of access of a plurality of cluster servers in a cluster within preset time;
the selecting module 603 is specifically configured to: according to the multiple times of access acquired by the first acquisition module 602, an optimal server is determined among the multiple cluster servers.
Specifically, the selecting module 603 includes:
a first selection sub-module, configured to select a minimum number of times of access from the multiple numbers of times of access acquired by the first acquisition module 602;
the first sub-module is used for taking the server corresponding to the minimum accessed times as the optimal server.
In this embodiment, the selecting module 603 further includes:
the first judgment submodule is used for judging whether the minimum access times are smaller than a preset access times threshold value before the first serving submodule takes the cluster server corresponding to the minimum access times as the optimal server;
the first serving sub-module is specifically configured to, when the first judging sub-module judges that the minimum access time is smaller than a preset access time threshold, serve the cluster server corresponding to the minimum access time as an optimal server;
the sending module 605 is specifically configured to, when the first determining sub-module determines that the minimum access time is not less than the preset access time threshold, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end.
In this embodiment, the selecting module 603 further includes:
the second judgment submodule is used for judging whether the number of the cluster servers corresponding to the minimum access times is one or not when the first judgment submodule judges that the minimum access times is smaller than the preset access times threshold;
the third judgment submodule is used for reading the used flow of the cluster server corresponding to the minimum accessed time according to the minimum accessed time and judging whether the used flow is smaller than a preset flow threshold value or not when the second judgment submodule judges that the number of the cluster servers corresponding to the minimum accessed time is one;
the first serving sub-module is specifically configured to, when the third determining sub-module determines that the used traffic read according to the minimum number of times of access is smaller than a preset traffic threshold, serve the cluster server corresponding to the minimum number of times of access as an optimal server;
the first selection judgment sub-module is used for reading the used flow of the plurality of cluster servers corresponding to the minimum accessed times according to the minimum accessed times when the second judgment sub-module judges that the number of the cluster servers corresponding to the minimum accessed times is not one, selecting the minimum flow from the read used flow, and judging whether the minimum flow is smaller than a preset flow threshold value or not;
the first selection judgment submodule is further used for judging whether the minimum flow is smaller than a preset flow threshold value or not, and taking the cluster server corresponding to the minimum flow as an optimal server;
in this embodiment, the sending module 605 is further configured to, when the third determining sub-module determines that the used traffic read according to the minimum number of times of access is not smaller than the preset traffic threshold, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end; and when the first selection judgment sub-module judges that the minimum flow is not less than the preset flow threshold, the selection determining module 603 determines that the optimal server is not found in the cluster servers according to the load parameters acquired by the first acquiring module 602, and returns an error code to the client, and the process is finished.
In this embodiment, the first sub-module is further configured to randomly select one of the cluster servers as the optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one.
In this embodiment, the load parameters of the cluster server may also be: the used flow of the cluster server in the preset time;
accordingly, the first obtaining module 602 is specifically configured to: acquiring the flow used by a plurality of cluster servers in a cluster within preset time;
the selecting module 603 is specifically configured to: according to the plurality of used flows acquired by the first acquisition module 602, an optimal server is determined among the plurality of cluster servers.
Specifically, the selecting module 603 includes:
the second selection submodule is used for selecting the minimum flow from the obtained multiple used flows;
and the second is used as a submodule for using the cluster server corresponding to the minimum flow as the optimal server.
In this embodiment, the selecting module 603 further includes:
the fourth judgment submodule is used for judging whether the minimum flow is smaller than a preset flow threshold value before the cluster server corresponding to the minimum flow is used as the optimal server by the second serving submodule;
the second serving sub-module is specifically configured to, when the fourth determining sub-module determines that the minimum traffic is smaller than the preset traffic threshold, serve the cluster server corresponding to the minimum traffic as the optimal server;
the sending module 605 is specifically configured to, when the fourth determining sub-module determines that the minimum flow is not smaller than the preset flow threshold, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end.
In this embodiment, the selecting module 603 further includes:
the fifth judgment submodule is used for judging whether the number of the cluster servers corresponding to the minimum flow is one or not when the fourth judgment submodule judges that the minimum flow is smaller than the preset flow threshold;
the second reading judgment submodule is specifically configured to, when the fifth judgment submodule judges that the number of the cluster servers corresponding to the minimum flow rate is one, read the number of times that the cluster server corresponding to the minimum flow rate is accessed according to the minimum flow rate, and judge whether the number of times is smaller than a preset access number threshold;
the second serving sub-module is specifically configured to, when the second reading judgment sub-module judges that the number of times of access read according to the minimum traffic is smaller than a preset access number threshold, serve the cluster server corresponding to the minimum traffic as an optimal server;
the selection judgment submodule is used for reading the accessed times of the plurality of cluster servers corresponding to the minimum flow according to the minimum flow when the fifth judgment submodule judges that the number of the cluster servers corresponding to the minimum flow is not one, selecting the minimum accessed times from the read accessed times, and judging whether the minimum accessed times is smaller than a preset access time threshold value or not;
the second serving sub-module is specifically configured to, when the selection judgment sub-module judges that the minimum access time is smaller than a preset access time threshold, serve the cluster server corresponding to the minimum access time as an optimal server;
in this embodiment, the sending module 605 is further configured to, when the second reading and determining submodule determines that the number of times of access read according to the minimum flow is not less than the preset access number threshold, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end; and when the selection judgment sub-module judges that the minimum access time is not less than the preset access time threshold, the selection determining module 603 determines that the optimal server is not found in the cluster servers according to the load parameters acquired by the first acquiring module 602, and returns an error code to the client, and the process is finished.
In this embodiment, the second as a sub-module is further configured to randomly select one of the cluster servers as the optimal server when the number of the cluster servers corresponding to the minimum number of times of access is greater than one.
In this embodiment, the load parameters of the cluster server may also be: the number of times the cluster server is accessed and the flow used;
accordingly, the first obtaining module 602 is specifically configured to: acquiring the access times and the used flow of a plurality of cluster servers in a cluster;
the selecting module 603 is specifically configured to: according to the multiple accessed times and the used flow acquired by the first acquisition module 602, an optimal server is determined in the multiple cluster servers.
In this embodiment, the selecting module 603 specifically includes:
a third selection sub-module, configured to select a minimum number of times of access from the multiple numbers of times of access acquired by the first acquisition module 602, and select a minimum flow from the multiple used flows acquired by the first acquisition module 602;
the computing submodule is used for respectively computing the loads of the corresponding cluster servers according to the minimum access times and the minimum flow selected by the third selecting submodule and selecting the minimum load from the loads;
and the third is used as a sub-module for taking the cluster server corresponding to the minimum load as the optimal server.
In this embodiment, the selecting module 603 further includes:
a sixth judgment submodule, configured to judge whether the minimum access time and the minimum traffic are smaller than corresponding preset access time thresholds and preset traffic thresholds;
the third sub-module is used for taking the cluster server corresponding to the sixth judgment sub-module as the optimal server when the sixth judgment sub-module judges that the first judgment sub-module is yes;
the computing submodule is specifically used for respectively computing the loads of the corresponding cluster servers and selecting the minimum load from the loads according to the minimum access times and the minimum flow selected by the selection submodule when the sixth judgment submodule judges that all the access times and the minimum flow are yes;
the sending module 605 is specifically configured to: when the sixth judgment sub-module determines that the load parameters are all negative, the selection module 603 determines that the optimal server is not found in the cluster servers according to the load parameters obtained by the first obtaining module 602, and returns an error code to the client, and the process is finished.
In this embodiment, the selecting module 603 further includes:
a seventh judging submodule, configured to, when the sixth judging submodule judges that one of the judgment submodules is yes, specifically: when the minimum access times are judged to be smaller than a preset access time threshold value, before the cluster server corresponding to the minimum access times is taken as the optimal server by the third acting submodule, whether the number of the cluster servers corresponding to the minimum access times is one or not is judged;
the eighth judging submodule is used for reading the used flow of the cluster server corresponding to the minimum accessed time according to the minimum accessed time and judging whether the used flow is smaller than a preset flow threshold value or not when the seventh judging submodule judges that the number of the cluster servers corresponding to the minimum accessed time is one;
the third sub-module is specifically used for taking the cluster server corresponding to the minimum access times as the optimal server when the eighth judging sub-module judges that the used flow read according to the minimum access times is smaller than a preset flow threshold;
the sending module 605 is further configured to, when the eighth determining submodule determines that the used traffic read according to the minimum number of times of access is not smaller than the preset traffic threshold, confirm that the selecting module 603 does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module 602, return an error code to the client, and end;
a ninth judging submodule, configured to, when the seventh judging submodule judges that the number of cluster servers corresponding to the minimum number of times of access is not one, read, according to the minimum number of times of access, traffic used by the plurality of cluster servers corresponding to the minimum number of times of access, and judge whether the traffic is smaller than a preset traffic threshold;
in this embodiment, the sending module 605 is further configured to, when the ninth determining sub-module determines that the load parameter is negative, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end;
in this embodiment, the third selecting submodule is further configured to select the minimum flow rate from the used flow rates smaller than the preset flow rate threshold value when the ninth determining submodule determines that the flow rates are not all negative;
the third selection submodule is specifically used for selecting the server corresponding to the minimum flow selected by the third selection submodule as the optimal server;
a tenth determining submodule, configured to, when the sixth determining submodule determines that one of the first and second determining submodules is yes, specifically: when the minimum flow is judged to be smaller than the preset flow threshold value, the third acting sub-module judges whether the number of the cluster servers corresponding to the minimum flow is one or not before the cluster servers corresponding to the minimum flow are taken as the optimal servers;
the eleventh judging submodule is used for reading the accessed times of the cluster server corresponding to the minimum flow according to the minimum flow and judging whether the accessed times are smaller than a preset access time threshold or not when the tenth judging submodule judges that the number of the cluster servers corresponding to the minimum flow is one;
the third sub-module is specifically configured to, when the eleventh judging sub-module judges that the number of times of access read according to the minimum traffic is smaller than a preset access number threshold, use the cluster server corresponding to the minimum traffic as the optimal server;
in this embodiment, the sending module 605 is further configured to, when the eleventh determining module determines that the number of accesses read according to the minimum flow is not less than the preset access number threshold, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end;
a twelfth judging submodule, configured to, when the tenth judging submodule judges that the number of cluster servers corresponding to the minimum traffic is not one, read, according to the minimum traffic, the number of times that the plurality of cluster servers corresponding to the minimum traffic are accessed, and judge whether the number of times is smaller than a preset access number threshold;
in this embodiment, the sending module 605 is further configured to, when the twelfth determining sub-module determines that the load parameter is negative, determine that the selecting module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, return an error code to the client, and end;
in this embodiment, the third selecting sub-module is further configured to select the minimum number of accesses from the number of accesses smaller than the preset number of accesses threshold when the twelfth judging sub-module judges that all the accesses are not negative;
and the third selection submodule is specifically configured to use the cluster server corresponding to the minimum accessed time selected by the third selection submodule as the optimal server.
Further, in this embodiment, the third is used as a sub-module, and is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one; and when the number of the cluster servers corresponding to the minimum number of accessed times is more than one, randomly selecting one of the cluster servers as the optimal server.
In this embodiment, when the load parameters of the cluster server are specifically: when the number of times of access to the cluster server and the traffic used by the cluster server are determined, the selecting module 603 may further include:
the calculating submodule is used for calculating and storing the load of the corresponding cluster server according to the accessed times and the used flow acquired by the first acquiring module 602;
a fourth selection submodule for selecting a minimum load among the saved loads;
and the fourth selection submodule is used for selecting the cluster server corresponding to the minimum load selected by the fourth selection submodule as the optimal server.
Further, in this embodiment, the selecting module 603 further includes:
a thirteenth judging submodule, configured to judge, before the calculating submodule calculates and stores the load of the corresponding cluster server according to the acquired accessed times and the acquired traffic, whether the accessed times and the acquired traffic acquired by the first acquiring module 602 are smaller than the corresponding preset access time threshold and preset traffic threshold;
and the calculating submodule is specifically configured to, when the thirteenth judging submodule judges that all the access times are yes, calculate and store the load of the corresponding cluster server according to the acquired access times and the acquired traffic.
Further, in this embodiment, the selecting module 603 further includes:
a fourteenth judging submodule, configured to judge whether the number of the stored loads is zero before the fourth selecting submodule selects the minimum load from the stored loads;
the sending module 605 is specifically configured to: when the fourteenth judging submodule judges that the number of the stored loads is zero, the selection confirming module 603 does not find the optimal server in the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module 602, and returns an error code to the client, and the process is finished;
and the fourth selection submodule is specifically configured to select the minimum load from the stored loads when the fourteenth judgment submodule judges that the number of the stored loads is not zero.
In this embodiment, the fourth module is further configured to randomly select one of the cluster servers as the optimal server when the number of the cluster servers corresponding to the minimum load is greater than one.
In this embodiment, the calculation submodule is specifically configured to:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and the preset base number.
In this embodiment, the sending module 605 may further be configured to: and sending a connection request to the optimal server according to the IP address acquired by the second acquiring module 604.
In this embodiment, the receiving module 601 may be configured to receive a connection request sent by a client;
correspondingly, the sending module 605 is specifically configured to organize the connection request response data according to the IP address acquired by the second acquiring module 604, and send the connection request response data to the client.
In this embodiment, the receiving module 601 may be further specifically configured to: receiving an acquisition server request sent by an application server;
accordingly, the sending module 605 is specifically configured to: and sending the IP address acquired by the second acquiring module 604 to the application server.
According to the technical scheme, the load of the servers in the cluster can be effectively dispersed, the resource consumption of the servers is reduced, and the experience of the client is improved.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all such changes or substitutions should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (56)

1. A method of distributing server load, comprising:
step S1: the main server receives the request;
step S2: the main server acquires load parameters of a plurality of cluster servers in a cluster, and determines an optimal server in the plurality of cluster servers according to the acquired load parameters;
step S3: and the main server acquires the IP address of the optimal server and sends the IP address to the client side, so that the client side can access the optimal server according to the IP address.
2. The method according to claim 1, wherein the step S2 further comprises: the main server updates the information of the cluster servers in the cluster server list;
in step S2, the acquiring, by the master server, load parameters of a plurality of cluster servers in the cluster specifically includes: and the main server acquires the load parameters of a plurality of cluster servers in the cluster from the cluster server list.
3. The method according to claim 2, wherein the master server updates information of the cluster servers in the cluster server list, specifically:
step a: and the main server downloads the log files of all the cluster servers, analyzes the log files to obtain the accessed times and the used flow of the corresponding cluster servers, and updates the accessed times and the used flow of the corresponding cluster servers in the cluster server list into the obtained accessed times and the used flow.
4. The method according to claim 3, wherein the analyzing the log file to obtain the number of times of access and the flow rate used by the corresponding cluster server specifically comprises:
the main server analyzes the log file, and counts the number of lines of the access records in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
5. The method according to claim 1, wherein the step S2 further comprises: and when the main server does not find the optimal server in the cluster servers according to the obtained load parameters, returning an error code to the client, and ending.
6. The method according to claim 5, wherein the load parameters are in particular: the access times of the cluster server in a preset time;
the step S2 specifically includes: the main server acquires the number of times of access of a plurality of cluster servers in a cluster within preset time, and determines an optimal server in the plurality of cluster servers according to the acquired number of times of access.
7. The method according to claim 6, wherein the determining an optimal server among the plurality of cluster servers according to the obtained plurality of access times specifically comprises: and the main server selects the minimum accessed times from the acquired multiple accessed times, and takes the cluster server corresponding to the minimum accessed times as an optimal server.
8. The method of claim 7, wherein before the cluster server corresponding to the minimum number of times of access is taken as the optimal server, the method further comprises:
step E: and the main server judges whether the minimum access times are smaller than a preset access time threshold value, if so, the cluster server corresponding to the minimum access times is used as an optimal server, otherwise, the optimal server is not found in the cluster servers according to the obtained multiple load parameters, an error code is returned to the client, and the operation is finished.
9. The method according to claim 8, wherein when the step E determines yes, further comprising:
step e 1: the main server judges whether the number of the cluster servers corresponding to the minimum access times is one, if so, the step e2 is executed, otherwise, the step e3 is executed;
step e 2: the main server reads the used flow of the cluster server corresponding to the main server according to the minimum accessed times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum accessed times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client and ends;
step e 3: and the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, selects the minimum flow from the read used flow, judges whether the minimum flow is smaller than a preset flow threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained load parameters, returns an error code to the client, and ends.
10. The method according to claim 9, wherein when the number of cluster servers corresponding to the minimum traffic is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
11. The method according to claim 5, wherein the load parameters are in particular: the used flow of the cluster server in the preset time;
the step S2 specifically includes: the method comprises the steps that a main server obtains used flow of a plurality of cluster servers in a cluster within preset time, and an optimal server is determined in the cluster servers according to the obtained used flow.
12. The method according to claim 11, wherein the determining an optimal server among the plurality of cluster servers according to the obtained plurality of used flows specifically includes: and the main server selects the minimum flow from the acquired multiple used flows, and takes the cluster server corresponding to the minimum flow as the optimal server.
13. The method of claim 12, wherein before the cluster server corresponding to the minimum traffic is taken as the optimal server, the method further comprises:
and T: and the main server judges whether the minimum flow is smaller than a preset flow threshold value, if so, the cluster server corresponding to the minimum flow is used as an optimal server, otherwise, the main server confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client and finishes.
14. The method according to claim 13, wherein when the step T is yes, further comprising:
step t 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, the step t2 is executed, otherwise, the step t3 is executed;
step t 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step t 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, selects the minimum access time from the read access times, judges whether the minimum access time is less than a preset access time threshold, if so, takes the cluster server corresponding to the minimum access time as an optimal server, otherwise, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters, returns an error code to the client, and ends.
15. The method according to claim 14, wherein when the number of cluster servers corresponding to the minimum number of times of access is greater than one, the main server randomly selects one of the cluster servers as an optimal server.
16. The method according to claim 5, wherein the load parameters are specifically the number of times the cluster server is accessed and the traffic used within a preset time;
the step S2 specifically includes: the main server acquires the access times and the used flow of a plurality of cluster servers in a cluster, and determines an optimal server in the plurality of cluster servers according to the acquired access times and the used flow.
17. The method according to claim 16, wherein the determining an optimal server among the plurality of cluster servers according to the obtained multiple access times and the obtained traffic includes:
step F1: the main server selects the minimum access times from the acquired multiple access times, and selects the minimum flow from the acquired multiple used flows;
step F2: and the main server respectively calculates the loads of the corresponding cluster servers according to the minimum access times and the minimum flow, selects the minimum load and takes the cluster server corresponding to the minimum load as the optimal server.
18. The method according to claim 17, wherein said step F2 is preceded by the steps of:
step Y: and the main server judges whether the minimum access times and the minimum flow are smaller than corresponding preset access times threshold values and preset flow threshold values or not, when the minimum access times and the minimum flow are judged to be yes, the cluster server corresponding to the main server is taken as an optimal server, when the minimum access times and the minimum flow are judged to be yes, step F2 is executed, when the minimum access times and the minimum flow are judged to be no, the optimal server is not found in the cluster servers according to the obtained load parameters, an error code is returned to the client side, and the operation is finished.
19. The method according to claim 18, wherein in step Y,
when the first judgment result is yes, the method specifically comprises the following steps: when the minimum access times are judged to be smaller than a preset access times threshold value, before the cluster server corresponding to the minimum access times is taken as an optimal server, the method further comprises the following steps:
step d 1: the main server judges whether the number of the cluster servers corresponding to the minimum number of accessed times is one, if so, the step d2 is executed, otherwise, the step d3 is executed;
step d 2: the main server reads the used flow of the corresponding cluster server according to the minimum accessed times, judges whether the used flow is smaller than a preset flow threshold value or not, if so, takes the cluster server corresponding to the minimum accessed times as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step d 3: the main server reads the used flow of the plurality of cluster servers corresponding to the main server according to the minimum access times, judges whether the used flow is smaller than a preset flow threshold value or not, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the used flow is judged to be not smaller than the preset flow threshold value, returns an error code to the client side, and ends the operation, otherwise, selects the minimum flow from the used flow smaller than the preset flow threshold value, and takes the server corresponding to the minimum flow as the optimal server;
when the first judgment result is yes, the method specifically comprises the following steps: when the minimum flow is judged to be smaller than a preset flow threshold value, before the cluster server corresponding to the minimum flow is taken as an optimal server, the method further comprises the following steps:
step g 1: the main server judges whether the number of the cluster servers corresponding to the minimum flow is one, if so, executing a step g2, otherwise, executing a step g 3;
step g 2: the main server reads the access times of the cluster server corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold value, if so, takes the cluster server corresponding to the minimum flow as an optimal server, otherwise, confirms that the optimal server is not found in the cluster servers according to the obtained multiple load parameters, returns an error code to the client, and ends;
step g 3: and the main server reads the access times of the plurality of cluster servers corresponding to the main server according to the minimum flow, judges whether the access times are smaller than a preset access time threshold, confirms that the optimal server is not found in the plurality of cluster servers according to the obtained plurality of load parameters when the judgment result is negative, returns an error code to the client, and ends the operation, otherwise selects the minimum access time from the access times smaller than the preset access time threshold, and takes the cluster server corresponding to the minimum access time as the optimal server.
20. The method of claim 19,
in step d3, when the number of the cluster servers corresponding to the minimum traffic is greater than one, the master server randomly selects one of the cluster servers as an optimal server;
in the step g3, when the number of the cluster servers corresponding to the minimum number of times of access is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
21. The method according to claim 16, wherein the determining an optimal server among the plurality of cluster servers according to the obtained plurality of access times and the obtained traffic includes:
step H1: the main server calculates and stores the load of the corresponding cluster server according to the acquired access times and the acquired flow;
step H2: and the main server selects the minimum load from the stored loads, and takes the cluster server corresponding to the minimum load as the optimal server.
22. The method according to claim 21, wherein said step H1 is preceded by the steps of: and the main server judges whether the acquired access times and the acquired flow are smaller than corresponding preset access time threshold values and preset flow threshold values, and if yes, the step H1 is executed.
23. The method according to claim 21, wherein said step H2 is preceded by the steps of: and the main server judges whether the number of the stored loads is zero, if so, the main server confirms that the optimal server is not found in the cluster servers according to the obtained load parameters, and returns an error code to the client, and the operation is finished, otherwise, the step H2 is executed.
24. The method of claim 21, wherein when the number of cluster servers corresponding to the minimum load is greater than one, the master server randomly selects one of the cluster servers as an optimal server.
25. The method according to claim 17 or 21, wherein the calculating of the load of the corresponding cluster server specifically includes:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and a preset base number.
26. The method according to claim 1, wherein the step S3 is further: and the main server acquires the IP address of the optimal server and sends a connection request to the optimal server according to the IP address.
27. The method according to claim 1, characterized in that, when the master server is embodied as an application server,
the step S1 specifically includes: an application server receives a connection request sent by a client;
in step S3, the application server obtains the IP address of the optimal server and sends the IP address to the client, specifically: and the application server acquires the IP address of the optimal server, organizes connection request response data according to the IP address and sends the connection request response data to the client.
28. The method according to claim 1, characterized in that, when the master server is embodied as a management server,
before the step S1, the method further includes: an application server receives a connection request sent by a client;
the step S1 specifically includes: the management server receives a server acquisition request sent by the application server;
in step S2, when the optimal server is not found in the cluster servers according to the obtained multiple load parameters, the application server returns an error code to the client;
in step S3, after the management server obtains the IP address of the optimal server, the method further includes: and the management server sends the acquired IP address to the application server, and the application server organizes connection request response data according to the IP address and sends the connection request response data to the client.
29. An apparatus for distributing server load, comprising:
a receiving module for receiving a request;
the first acquisition module is used for acquiring load parameters of a plurality of cluster servers in a cluster;
the selection module is used for determining an optimal server in the cluster servers according to the load parameters of the cluster servers acquired by the first acquisition module;
the second acquisition module is used for acquiring the IP address of the optimal server determined by the selection module;
and the sending module is used for sending the IP address obtained by the second obtaining module to a client side, so that the client side can access the optimal server according to the IP address.
30. The apparatus of claim 29, further comprising: the updating module is used for updating the information of the cluster servers in the cluster server list;
the first obtaining module is specifically configured to: and acquiring the load parameters of a plurality of cluster servers in the cluster from the cluster server list.
31. The apparatus according to claim 30, wherein the update module specifically includes:
the download submodule is used for downloading the log files of all the cluster servers;
the analysis submodule is used for analyzing the log file downloaded by the downloading submodule to obtain the accessed times and the used flow of the corresponding cluster server;
and the updating submodule is used for updating the accessed times and the used flow of the corresponding cluster server in the cluster server list into the accessed times and the used flow obtained by the analyzing submodule.
32. The apparatus of claim 31, wherein the parsing submodule is specifically configured to: analyzing the log file downloaded by the downloading submodule, and counting the number of lines of the access record in the log file to obtain the number of times of access of the corresponding cluster server; and reading the data of the last section of data type in each row of access record in the log file and summing the data to obtain the used flow of the corresponding cluster server.
33. The apparatus according to claim 29, wherein the sending module is further configured to, when the selecting module does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end.
34. The apparatus according to claim 33, wherein the load parameters are in particular: the access times of the cluster server in a preset time;
the first obtaining module is specifically configured to: acquiring the number of times of access of a plurality of cluster servers in a cluster within preset time;
the selection module is specifically configured to: and determining an optimal server in the cluster servers according to the multiple access times acquired by the first acquisition module.
35. The apparatus according to claim 34, wherein the selection module specifically includes:
the first selection submodule is used for selecting the minimum accessed times from the multiple accessed times acquired by the first acquisition module;
and the first sub-module is used for taking the server corresponding to the minimum accessed times as an optimal server.
36. The apparatus of claim 35, wherein the selection module further comprises:
the first judgment sub-module is used for judging whether the minimum access times is smaller than a preset access times threshold value before the first serving sub-module takes the cluster server corresponding to the minimum access times as an optimal server;
the first serving sub-module is specifically configured to, when the first determining sub-module determines that the minimum number of times of access is smaller than a preset number of times of access threshold, serve the cluster server corresponding to the minimum number of times of access as an optimal server;
the sending module is specifically configured to, when the first determining sub-module determines that the minimum number of times of access is not less than a preset number of times of access threshold, confirm that the selecting module does not find an optimal server among the plurality of cluster servers according to the plurality of load parameters acquired by the first acquiring module, return an error code to the client, and end.
37. The apparatus of claim 36, wherein the selection module further comprises:
the second judgment submodule is used for judging whether the number of the cluster servers corresponding to the minimum access times is one or not when the first judgment submodule judges that the minimum access times is smaller than a preset access times threshold value;
a third determining submodule, configured to, when the second determining submodule determines that the number of the cluster servers corresponding to the minimum number of times of access is one, read a traffic of the cluster server corresponding to the minimum number of times of access according to the minimum number of times of access, and determine whether the traffic is smaller than a preset traffic threshold;
the first as sub-module is specifically configured to: when the third judging submodule judges that the read used flow according to the minimum access times is smaller than a preset flow threshold, the cluster server corresponding to the minimum access times is used as an optimal server;
the first selection judgment sub-module is used for reading the used flow of the plurality of cluster servers corresponding to the minimum accessed times according to the minimum accessed times when the second judgment sub-module judges that the number of the cluster servers corresponding to the minimum accessed times is not one, selecting the minimum flow from the read used flow, and judging whether the minimum flow is smaller than a preset flow threshold value or not;
the first serving sub-module is further configured to, when the first selection judgment sub-module judges that the minimum traffic is smaller than a preset traffic threshold, serve the cluster server corresponding to the minimum traffic as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the third determination sub-module determines that the used traffic read according to the minimum number of times of access is not smaller than a preset traffic threshold, and return an error code to the client, and then end; and when the first selection judgment sub-module judges that the minimum flow is not less than a preset flow threshold, the selection module is determined to not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the method is finished.
38. The apparatus of claim 37, wherein the first sub-module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one.
39. The apparatus according to claim 33, wherein the load parameters are in particular: the used flow of the cluster server in the preset time;
the first obtaining module is specifically configured to: acquiring the flow used by a plurality of cluster servers in a cluster within preset time;
the selection module is specifically configured to: and determining an optimal server in the plurality of cluster servers according to the plurality of used flows acquired by the first acquisition module.
40. The apparatus according to claim 39, wherein the selection module specifically includes:
the second selection submodule is used for selecting the minimum flow from the obtained multiple used flows;
and the second sub-module is used for taking the cluster server corresponding to the minimum flow as the optimal server.
41. The apparatus of claim 40, wherein the selection module further comprises:
a fourth judgment submodule, configured to judge whether the minimum traffic is smaller than a preset traffic threshold before the second serving submodule uses the cluster server corresponding to the minimum traffic as the optimal server;
the second as a sub-module is specifically configured to: when the fourth judging submodule judges that the minimum flow is smaller than a preset flow threshold, the cluster server corresponding to the minimum flow is used as an optimal server;
the sending module is specifically configured to: and when the fourth judging submodule judges that the minimum flow is not smaller than a preset flow threshold, confirming that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, returning an error code to the client, and ending.
42. The apparatus of claim 41, wherein the selection module further comprises:
a fifth judging submodule, configured to judge whether the number of cluster servers corresponding to the minimum flow is one or not when the fourth judging submodule judges that the minimum flow is smaller than a preset flow threshold;
the reading judgment submodule is specifically used for: when the fifth judging submodule judges that the number of the cluster servers corresponding to the minimum flow is one, the number of times of access of the cluster servers corresponding to the minimum flow is read according to the minimum flow, and whether the number of times of access is smaller than a preset access number threshold value is judged;
the second as a sub-module is specifically configured to: when the reading judgment submodule judges that the number of times of access read according to the minimum flow is smaller than a preset access time threshold value, the cluster server corresponding to the minimum flow is used as an optimal server;
the second selection judgment submodule is used for reading the accessed times of the plurality of cluster servers corresponding to the minimum flow according to the minimum flow when the fifth judgment submodule judges that the number of the cluster servers corresponding to the minimum flow is not one, selecting the minimum accessed times from the read accessed times, and judging whether the minimum accessed times is smaller than a preset access time threshold value or not;
the second as a sub-module is specifically configured to: when the second selection judgment submodule judges that the minimum access times are smaller than a preset access times threshold value, the cluster server corresponding to the minimum access times is used as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the reading judgment sub-module judges that the number of times of access read according to the minimum flow is not less than a preset access number threshold, and return an error code to the client, and then end; and when the second selection judgment sub-module judges that the minimum access times are not less than a preset access time threshold, the selection module is determined to not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the process is finished.
43. The apparatus of claim 42, wherein the second acting submodule is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum number of times of access is greater than one.
44. The apparatus according to claim 39, wherein the load parameters are specifically the number of times the cluster server is accessed and the traffic used;
the first obtaining module is specifically configured to: acquiring the access times and the used flow of a plurality of cluster servers in a cluster;
the selection module is specifically configured to: and determining an optimal server in the cluster servers according to the accessed times and the used flow acquired by the first acquisition module.
45. The apparatus according to claim 44, wherein the selection module specifically includes:
a third selection submodule, configured to select a minimum number of times of access from the multiple numbers of times of access acquired by the first acquisition module, and select a minimum flow from the multiple used flows acquired by the first acquisition module;
the calculation submodule is used for respectively calculating the load of the corresponding cluster server and selecting the minimum load according to the minimum access times and the minimum flow selected by the third selection submodule;
and the third is used as a sub-module for taking the cluster server corresponding to the minimum load as the optimal server.
46. The apparatus of claim 45, wherein the selection module further comprises:
a sixth judgment submodule, configured to judge whether the minimum access time and the minimum traffic are smaller than corresponding preset access time thresholds and preset traffic thresholds;
the third sub-module is used for taking the cluster server corresponding to the sixth judgment sub-module as the optimal server when the sixth judgment sub-module judges that the first sub-module is yes;
the calculation submodule is specifically configured to: when the sixth judgment submodule judges that all the cluster servers are the same, respectively calculating the loads of the corresponding cluster servers and selecting the minimum load according to the minimum access times and the minimum flow selected by the selection submodule;
the sending module is specifically configured to: and when the sixth judgment sub-module determines that the load parameters are all negative, the selection module is confirmed to find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module, an error code is returned to the client, and the operation is finished.
47. The apparatus of claim 46, wherein the selection module further comprises:
a seventh judging submodule, configured to, when the sixth judging submodule judges that one of the judgment submodules is yes, specifically: when the minimum access times are judged to be smaller than a preset access times threshold value, the third acting sub-module judges whether the number of the cluster servers corresponding to the minimum access times is one or not before the cluster servers corresponding to the minimum access times are taken as optimal servers;
an eighth judging submodule, configured to, when the seventh judging submodule judges that the number of the cluster servers corresponding to the minimum number of times of access is one, read a traffic of the cluster server corresponding to the minimum number of times of access according to the minimum number of times of access, and judge whether the traffic is smaller than a preset traffic threshold;
the third sub-module is specifically configured to, when the eighth determining sub-module determines that the used traffic read according to the minimum number of times of access is smaller than a preset traffic threshold, use the cluster server corresponding to the minimum number of times of access as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the eighth determination submodule determines that the used traffic read according to the minimum number of times of access is not smaller than a preset traffic threshold, and return an error code to the client, and then the process is finished;
a ninth judging submodule, configured to, when the seventh judging submodule judges that the number of cluster servers corresponding to the minimum number of times of access is not one, read traffic used by the plurality of cluster servers corresponding to the minimum number of times of access according to the minimum number of times of access, and judge whether the traffic is smaller than a preset traffic threshold;
the sending module is further configured to, when the ninth determining sub-module determines that the load parameters are all negative, confirm that the selection module does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end;
the third selection submodule is further configured to select a minimum flow from the used flows smaller than the preset flow threshold when the ninth judgment submodule judges that the flow rates are not all negative;
the third sub-module is specifically configured to: taking the server corresponding to the minimum flow selected by the third selection submodule as an optimal server;
a tenth determining submodule, configured to, when the sixth determining submodule determines that one of the first and second judging submodules is yes, specifically: when the minimum flow is judged to be smaller than a preset flow threshold value, the third acting submodule judges whether the number of the cluster servers corresponding to the minimum flow is one or not before the cluster servers corresponding to the minimum flow are taken as optimal servers;
an eleventh judging submodule, configured to, when the tenth judging submodule judges that the number of cluster servers corresponding to the minimum traffic is one, read, according to the minimum traffic, the number of times that the cluster server corresponding to the minimum traffic is accessed, and judge whether the number of times is smaller than a preset access number threshold;
the third sub-module is specifically configured to: when the eleventh judging submodule judges that the number of times of access read according to the minimum flow is smaller than a preset access number threshold, the cluster server corresponding to the minimum flow is used as an optimal server;
the sending module is further configured to confirm that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquisition module when the eleventh determination module determines that the number of times of access read according to the minimum traffic is not less than a preset access number threshold, return an error code to the client, and end;
a twelfth judging submodule, configured to, when the tenth judging submodule judges that the number of cluster servers corresponding to the minimum traffic is not one, read, according to the minimum traffic, the number of times that the plurality of cluster servers corresponding to the minimum traffic are accessed, and judge whether the number of times is smaller than a preset access number threshold;
the sending module is further configured to, when the twelfth judging sub-module judges that the load parameters are all negative, confirm that the selection module does not find the optimal server among the plurality of cluster servers according to the plurality of load parameters obtained by the first obtaining module, return an error code to the client, and end;
the third selecting submodule is further configured to select a minimum access time from the access times smaller than the preset access time threshold when the twelfth judging submodule judges that the access times are not all negative;
the third sub-module is specifically configured to: and taking the cluster server corresponding to the minimum accessed times selected by the third selection submodule as an optimal server.
48. The apparatus according to claim 47, wherein the third sub-module is further configured to randomly select one of the cluster servers as an optimal server when the number of the cluster servers corresponding to the minimum traffic is greater than one; and when the number of the cluster servers corresponding to the minimum number of accessed times is more than one, randomly selecting one cluster server as an optimal server.
49. The apparatus according to claim 44, wherein the selection module specifically includes:
the calculation submodule is used for calculating and storing the load of the corresponding cluster server according to the accessed times and the used flow acquired by the first acquisition module;
a fourth selection submodule for selecting a minimum load among the saved loads;
and the fourth selection submodule is used for selecting the cluster server corresponding to the minimum load selected by the fourth selection submodule as the optimal server.
50. The apparatus of claim 49, wherein the selection module further comprises:
a thirteenth judging sub-module, configured to, before the calculating sub-module calculates and stores the load of the corresponding cluster server according to the acquired access times and the acquired traffic, judge whether the access times and the acquired traffic acquired by the first acquiring module are smaller than the corresponding preset access time threshold and preset traffic threshold;
the calculation submodule is specifically configured to: and when the judgment result of the thirteenth judgment submodule is yes, calculating and storing the load of the corresponding cluster server according to the acquired accessed times and the acquired flow.
51. The apparatus of claim 49, wherein the selection module further comprises:
a fourteenth determining submodule, configured to determine whether the number of the stored loads is zero before the fourth selecting submodule selects the minimum load from the stored loads;
the sending module is specifically configured to: when the fourteenth judging submodule judges that the number of the stored loads is zero, confirming that the selection module does not find the optimal server in the cluster servers according to the load parameters acquired by the first acquiring module, returning an error code to the client, and ending;
the fourth selecting submodule is specifically configured to select a minimum load from the stored loads when the fourteenth determining submodule determines that the number of the stored loads is not zero.
52. The apparatus of claim 49, wherein the fourth module is further configured to randomly select one of the cluster servers as the optimal server when the number of the cluster servers corresponding to the minimum load is greater than one.
53. The apparatus according to claim 45 or 49, wherein the computation submodule is configured to:
dividing the flow used by the cluster server by a quotient obtained by a preset base number and adding the number of times of accessing the cluster server;
or,
and adding the accessed times of the cluster server to the quotient obtained by the surplus of the used flow of the cluster server and a preset base number.
54. The apparatus of claim 29, wherein the sending module is further configured to: and sending a connection request to the optimal server according to the IP address acquired by the second acquisition module.
55. The apparatus of claim 29,
the receiving module is specifically configured to: receiving a connection request sent by a client;
the sending module is specifically configured to: and organizing connection request response data according to the IP address acquired by the second acquisition module, and sending the connection request response data to the client.
56. The apparatus of claim 29,
the receiving module is specifically configured to: receiving an acquisition server request sent by an application server;
the sending module is specifically configured to: and sending the IP address acquired by the second acquisition module to the application server.
CN201610443845.7A 2016-06-20 2016-06-20 Method and device for dispersing load of servers Pending CN105915646A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610443845.7A CN105915646A (en) 2016-06-20 2016-06-20 Method and device for dispersing load of servers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610443845.7A CN105915646A (en) 2016-06-20 2016-06-20 Method and device for dispersing load of servers

Publications (1)

Publication Number Publication Date
CN105915646A true CN105915646A (en) 2016-08-31

Family

ID=56758355

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610443845.7A Pending CN105915646A (en) 2016-06-20 2016-06-20 Method and device for dispersing load of servers

Country Status (1)

Country Link
CN (1) CN105915646A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106953926A (en) * 2017-03-31 2017-07-14 北京奇艺世纪科技有限公司 A kind of method for routing and device
CN106972975A (en) * 2017-04-27 2017-07-21 上海斐讯数据通信技术有限公司 A kind of server management method and system
CN108471387A (en) * 2018-03-27 2018-08-31 中国农业银行股份有限公司 A kind of daily record flow decentralized control method and system
CN108881379A (en) * 2018-05-03 2018-11-23 网宿科技股份有限公司 The synchronous method and apparatus of data between a kind of server cluster
CN110048896A (en) * 2019-04-29 2019-07-23 广州华多网络科技有限公司 A kind of company-data acquisition methods, device and equipment
CN110808981A (en) * 2019-11-04 2020-02-18 普联技术有限公司 Video stream preview method and device
CN111083244A (en) * 2018-10-22 2020-04-28 浙江宇视科技有限公司 Cluster address allocation method and device
CN111385327A (en) * 2018-12-28 2020-07-07 阿里巴巴集团控股有限公司 Data processing method and system
CN113869977A (en) * 2021-09-26 2021-12-31 中国联合网络通信集团有限公司 Order processing system
CN117081996A (en) * 2023-10-16 2023-11-17 北京乐讯科技有限公司 Flow control method based on real-time feedback and soft value of server and related equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030109994A1 (en) * 2001-12-06 2003-06-12 Koninklijke Philips Electronics N.V. Charger system for receiving and transferring data to an electronic device
CN101217483A (en) * 2008-01-21 2008-07-09 中兴通讯股份有限公司 A method to realize cluster server inner load sharing agent
CN104468852A (en) * 2013-09-18 2015-03-25 腾讯科技(北京)有限公司 Method, device and system for client to select IP link address

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030109994A1 (en) * 2001-12-06 2003-06-12 Koninklijke Philips Electronics N.V. Charger system for receiving and transferring data to an electronic device
CN101217483A (en) * 2008-01-21 2008-07-09 中兴通讯股份有限公司 A method to realize cluster server inner load sharing agent
CN104468852A (en) * 2013-09-18 2015-03-25 腾讯科技(北京)有限公司 Method, device and system for client to select IP link address

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
苏新宁、杨建林等: "《数据挖掘理论与技术》", 30 June 2003 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106953926A (en) * 2017-03-31 2017-07-14 北京奇艺世纪科技有限公司 A kind of method for routing and device
CN106972975A (en) * 2017-04-27 2017-07-21 上海斐讯数据通信技术有限公司 A kind of server management method and system
CN108471387A (en) * 2018-03-27 2018-08-31 中国农业银行股份有限公司 A kind of daily record flow decentralized control method and system
CN108881379A (en) * 2018-05-03 2018-11-23 网宿科技股份有限公司 The synchronous method and apparatus of data between a kind of server cluster
CN111083244A (en) * 2018-10-22 2020-04-28 浙江宇视科技有限公司 Cluster address allocation method and device
CN111083244B (en) * 2018-10-22 2022-09-06 浙江宇视科技有限公司 Cluster address allocation method and device
CN111385327A (en) * 2018-12-28 2020-07-07 阿里巴巴集团控股有限公司 Data processing method and system
CN111385327B (en) * 2018-12-28 2022-06-14 阿里巴巴集团控股有限公司 Data processing method and system
CN110048896A (en) * 2019-04-29 2019-07-23 广州华多网络科技有限公司 A kind of company-data acquisition methods, device and equipment
CN110808981A (en) * 2019-11-04 2020-02-18 普联技术有限公司 Video stream preview method and device
CN113869977A (en) * 2021-09-26 2021-12-31 中国联合网络通信集团有限公司 Order processing system
CN117081996A (en) * 2023-10-16 2023-11-17 北京乐讯科技有限公司 Flow control method based on real-time feedback and soft value of server and related equipment
CN117081996B (en) * 2023-10-16 2024-01-05 北京乐讯科技有限公司 Flow control method based on server-side real-time feedback and soft threshold and related equipment

Similar Documents

Publication Publication Date Title
CN105915646A (en) Method and device for dispersing load of servers
CN108268372B (en) Mock test processing method and device, storage medium and computer equipment
CN107688496B (en) Task distributed processing method and device, storage medium and server
CN111385112B (en) Slice resource deployment method, device, slice manager and computer storage medium
CN106302632B (en) Downloading method of basic mirror image and management node
US8825684B2 (en) Arrangement for comparing content identifiers of files
US8572621B2 (en) Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
CN108062243B (en) Execution plan generation method, task execution method and device
CN105516347A (en) Method and device for load balance allocation of streaming media server
CN110661829A (en) File downloading method and device, client and computer readable storage medium
CN110933136A (en) Service node selection method, device, equipment and readable storage medium
CN113656168A (en) Method, system, medium and equipment for automatic disaster recovery and scheduling of traffic
CN110830551B (en) Service request processing method, device and system
CN110377430B (en) Data migration method, device, storage medium and device
CN112769943A (en) Service processing method and device
CN114185763A (en) Dynamic allocation method, device, storage medium and electronic equipment
CN115329005A (en) Multi-cluster cooperation method, system, device and computer readable storage medium
CN111083204A (en) File transmission method, device and storage medium
CN107493315B (en) Behavior data collection method, resource server and storage medium
CN111159131A (en) Performance optimization method, device, equipment and computer readable storage medium
CN111177221B (en) Statistical data acquisition method, device and equipment
CN112948104B (en) Load balancing data acquisition method and device
CN115086299B (en) File downloading method, device, equipment, medium and program product
CN115952003A (en) Method, device, equipment and storage medium for cluster server load balancing
CN106445784B (en) Information monitoring 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20160831

RJ01 Rejection of invention patent application after publication