CN107800744A - A kind of service request retransmission method, apparatus and system - Google Patents
A kind of service request retransmission method, apparatus and system Download PDFInfo
- Publication number
- CN107800744A CN107800744A CN201610806093.6A CN201610806093A CN107800744A CN 107800744 A CN107800744 A CN 107800744A CN 201610806093 A CN201610806093 A CN 201610806093A CN 107800744 A CN107800744 A CN 107800744A
- Authority
- CN
- China
- Prior art keywords
- service server
- server
- weight value
- target service
- present weight
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
- H04L67/1008—Server selection for load balancing based on parameters of servers, e.g. available memory or workload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention discloses a kind of service request retransmission method, apparatus and system, wherein, the service request repeater system includes:Control server, at least one service server.This method is applied to the control server in service request repeater system, including:Receive target service requests;Obtain the present weight value of at least one service server;According to the present weight value, the selection target service server from least one service server;The target service requests are transmitted to the target service server;Wherein, the present weight value of at least one service server calculates in such a way:Receive the current residual disk size and current network flow of the service server of each service server feedback;According to the current residual disk size and current network flow of each service server, the present weight value of the service server is calculated.Using the embodiment of the present invention, it is possible to achieve the load balancing of service server.
Description
Technical field
The present invention relates to Internet technical field, more particularly to a kind of service request retransmission method, apparatus and system.
Background technology
With the popularization of the Internet, applications, people use network more and more, and network access quantity is also constantly increased sharply, to carrying
Higher requirement is proposed for the hardware performance of the server of heavy load service, but simply raising hardware performance can not be true
Just solving this problem, because the performance of single server is always limited.Therefore generally use load balancing in the prior art
Technology solves the above problems.Specifically, a server set is formed in a symmetrical manner by more backend services servers,
Every service server all has status of equal value, service individually can be externally provided and without the auxiliary of other servers.
The service request that outside is sent is evenly distributed on the service server in symmetrical structure, and receives the industry of service request
Business server independently responds the service request of client, so as to reach the purpose of the load balancing of every service server.
In the prior art, the load-balancing algorithm based on poll is that service request is transmitted into each business successively in order
Server, in actual applications, due to the remaining disk space of every server, each service request data volume etc. not exclusively
Equally, the server for easily causing remaining disk size less is fully written quickly, causes the collapse of these servers.
That is, for all backend services servers, the existing load-balancing algorithm based on poll is used
When carrying out service request forwarding, remaining disk space, the data of current service request of current business server are not accounted for
Amount, cause the load imbalance of service server.
The content of the invention
The purpose of the embodiment of the present invention is to provide a kind of service request retransmission method, apparatus and system, to realize business
The load balancing of server.
To reach above-mentioned purpose, the embodiment of the invention discloses a kind of service request retransmission method, applied to service request
Control server in repeater system, wherein, the service request repeater system includes:Control server, at least one business
Server, methods described include:
Receive target service requests;
Obtain the present weight value of at least one service server;
According to the present weight value, the selection target service server from least one service server;
The target service requests are transmitted to the target service server;
Wherein, the present weight value of at least one service server calculates in such a way:
Receive the current residual disk size and current network flow of the service server of each service server feedback;
According to the current residual disk size and current network flow of each service server, the service server is calculated
Present weight value.
Optionally, the current residual disk size and current network flow according to each service server, calculating should
The present weight value of service server, including:
In such a way, the present weight value W of each service server is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
Optionally, first expression formula is:W=F, wherein, F is the current residual disk of the target service server
Capacity.
Optionally, second expression formula is:W=b*F/ (N-c), wherein, N is the current of the target service server
Network traffics, b, c are preset value.
Optionally, the service request repeater system also includes calculation server,
The present weight value for obtaining at least one service server, including:
Obtain the present weight value of at least one service server of the calculation server feedback.
Optionally, it is described according to the present weight value, the selection target business from least one service server
Server, including:
According to the present weight value, generation includes the array of K element, wherein, K is of the service server
Number;
According to last element of the array, a random value is generated;
According to the random value and the array, the selection target business service from least one service server
Device.
Optionally, the array is:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
Optionally, described last element according to the array, a random value is generated, including:
According to below equation, a random value R is generated:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
Optionally, it is described according to the random value and the array, select mesh from least one service server
Service server is marked, including:
Determine the target interval that the random value is in the array;
Service server corresponding to object element is defined as destination server, wherein, the object element is:It is described
Element corresponding to target interval.
To reach above-mentioned purpose, the embodiment of the present invention additionally provides a kind of service request retransmission unit, please applied to service
The control server in repeater system is sought, wherein, the service request repeater system includes:Control server, at least one industry
Business server, described device include:
Receiving module, for receiving target service requests;
Module is obtained, for obtaining the present weight value of at least one service server, wherein, it is described at least one
The present weight value of service server is:The current residual disk of the service server fed back according to each service server holds
What amount and current network flow were calculated;
Selecting module, for according to the present weight value, the selection target industry from least one service server
Business server;
Forwarding module, for the target service requests to be transmitted into the target service server.
Optionally, the present weight value W of at least one service server is:
In such a way, it is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
Optionally, first expression formula is:W=F, wherein, F is the current residual disk of the target service server
Capacity.
Optionally, second expression formula is:W=b*F/ (N-c), wherein, N is the current of the target service server
Network traffics, b, c are preset value.
Optionally, the service request repeater system also includes calculation server,
The acquisition module, is used for:
Obtain the present weight value of at least one service server of the calculation server feedback.
Optionally, the selecting module, including:
First generation submodule, for including the array of K element according to the present weight value, generation, wherein, K is
The number of the service server;
Second generation submodule, for last element according to the array, generates a random value;
Submodule is selected, for according to the random value and the array, being selected from least one service server
Select target service server.
Optionally, the array is:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
Optionally, the second generation submodule, is used for:
According to below equation, a random value R is generated:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
Optionally, the selection submodule, including:
First determining unit, the target interval being in for determining the random value in the array;
Second determining unit, for the service server corresponding to object element to be defined as into destination server, wherein, institute
Stating object element is:Element corresponding to the target interval.
To reach above-mentioned purpose, the embodiment of the present invention additionally provides a kind of service request repeater system, and the system includes
Server, at least one service server are controlled, wherein:
The control server, for receiving target service requests;Obtain the current of at least one service server
Weighted value;According to the present weight value, the selection target service server from least one service server;By described in
Target service requests are transmitted to the target service server;
At least one service server, for receiving the target service requests of the control server forwarding;
At least one service server, it is additionally operable to the current surplus of the control server feedback service server
Remaining disk size and current network flow;
The control server, it is additionally operable to receive the current residual magnetic of the service server of each service server feedback
Disk capacity and current network flow;According to the current residual disk size and current network flow of each service server, calculate
The present weight value of the service server.
Optionally, the control server, the current power specifically in such a way, calculating each service server
Weight values W:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
Optionally, first expression formula is:W=F, wherein, F is the current residual disk of the target service server
Capacity.
Optionally, second expression formula is:W=b*F/ (N-c), wherein, N is the current of the target service server
Network traffics, b, c are preset value.
Optionally, the control server, specifically for including the number of K element according to the present weight value, generation
Group, wherein, K is the number of the service server;According to last element of the array, a random value is generated;Root
According to the random value and the array, the selection target service server from least one service server.
Optionally, the array is:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
Optionally, the control server, specifically for according to below equation, generating a random value R:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
Optionally, the control server, the target area being in specifically for determining the random value in the array
Between;Service server corresponding to object element is defined as destination server, wherein, the object element is:The target
Element corresponding to section.
To reach above-mentioned purpose, the embodiment of the present invention additionally provides a kind of service request repeater system, and the system includes
Server, calculation server, at least one service server are controlled, wherein:
At least one service server, for feeding back the current residual of the service server to the calculation server
Disk size and current network flow;
The calculation server, the current residual disk of the service server for receiving each service server feedback
Capacity and current network flow;According to the current residual disk size and current network flow of each service server, calculating should
The present weight value of service server;To the present weight of at least one service server described in the control server feedback
Value;
The control server, for receiving target service requests;Obtain calculation server feedback it is described at least
The present weight value of one service server;According to the present weight value, selected from least one service server
Target service server;The target service requests are transmitted to the target service server;
At least one service server, it is additionally operable to receive the target service requests of the control server forwarding.
Optionally, the calculation server, the current power specifically in such a way, calculating each service server
Weight values W:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
Optionally, first expression formula is:W=F, wherein, F is the current residual disk of the target service server
Capacity.
Optionally, second expression formula is:W=b*F/ (N-c), wherein, N is the current of the target service server
Network traffics, b, c are preset value.
Optionally, the control server, specifically for including the number of K element according to the present weight value, generation
Group, wherein, K is the number of the service server;According to last element of the array, a random value is generated;Root
According to the random value and the array, the selection target service server from least one service server.
Optionally, the array is:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
Optionally, the control server, specifically for according to below equation, generating a random value R:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
Optionally, the control server, the target area being in specifically for determining the random value in the array
Between;Service server corresponding to object element is defined as destination server, wherein, the object element is:The target
Element corresponding to section.
As seen from the above, in the scheme that the embodiment of the present invention is provided, control server obtains at least one business service
The present weight value of device;According to the present weight value obtained, the selection target business service from least one service server
Device, the target service requests received are transmitted to target service server, the present weight value of wherein service server is root
Calculated according to the current residual disk size and current network flow of the service server.Compared with prior art, the present invention is real
The scheme that example is provided is applied, due to when calculating the present weight value of each service server, it is contemplated that current business server
Remaining disk space and current network flow, target service server is determined based on the present weight value obtained and forwards mesh
Mark service request, rather than it is simple target service requests are transmitted to each service server successively in order, therefore can
Realize the load balancing of service server.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the first schematic flow sheet of service request retransmission method provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic flow sheet of S103 embodiment in Fig. 1 provided in an embodiment of the present invention;
Fig. 3 is second of schematic flow sheet of service request retransmission method provided in an embodiment of the present invention;
Fig. 4 is the first structural representation of service request retransmission unit provided in an embodiment of the present invention;
Fig. 5 is second of structural representation of service request retransmission unit provided in an embodiment of the present invention;
Fig. 6 is the first structural representation of service request repeater system provided in an embodiment of the present invention;
Fig. 7 is second of structural representation of service request repeater system provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
To solve prior art problem, the embodiments of the invention provide a kind of service request retransmission method, apparatus and system.
First below by specific embodiment, a kind of service request retransmission method provided the embodiment of the present invention is carried out specifically
It is bright.
Needing, the embodiment of the present invention is applied to the control server in service request repeater system, wherein, the clothes
Business request repeater system comprises at least:Control server, at least one service server.In actual applications, the business service
Device can be the storage server in distributed memory system, or the other kinds of server of specific business is provided,
The application is not limited this.
Fig. 1 is the first schematic flow sheet of service request retransmission method provided in an embodiment of the present invention, and this method includes:
S101, receive target service requests.
S102, the present weight value for obtaining at least one service server.
It should be noted that the present weight value that control server obtains service server can be according to the default time
Interval, having been obtained before receiving service request or just obtain after service request is received, this Shen
Please this is not limited.
In actual applications, the present weight value of service server can be obtained by control server from local, wherein, control
The present weight value for each service server that control server is locally stored, server can be controlled to be calculated, may be used also
To be after the present weight value of each service server is calculated in other servers, control server is sent to.In this hair
In a kind of bright implementation, above-mentioned SERVICE FORWARDING SYSTEM can also include calculation server, in this case, other above-mentioned clothes
Business device can be above-mentioned calculation server.
Specifically, control server can calculate the present weight value of service server in such a way:
Receive the current residual disk size and current network flow of the service server of each service server feedback;
According to the current residual disk size and current network flow of each service server, the service server is calculated
Present weight value.
It should be noted that the weight of service server and the current network flow and current residual disk of the server are held
Measure relevant.Because the maximum bandwidth that the network interface card of service server can be provided is certain, when the current network of service server
When flow is smaller, illustrate that the bandwidth that the service server currently takes is smaller, then it is considered that current network flow takes to business
The weight of business device is only considered by current residual disk size without influence when calculating the weighted value of service server;And work as
When the current network flow of service server is larger, illustrate that the service server has currently occupied more bandwidth, now,
It can not only consider by current residual disk size when calculating the weighted value of service server, it is also necessary to consider current network stream
Amount.
In a specific embodiment of the present invention, according to the current residual disk size of each service server and work as
Preceding network traffics, the present weight value of the service server is calculated, can be included:
In such a way, the present weight value W of each service server is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, target service service
Device is:Any service server;
If it has not, the present weight value of target service server is calculated according to default first expression formula, wherein, the first table
The present weight value of target service server and the current residual disk size positive correlation of target service server up in formula;
If it is, the present weight value of target service server is calculated according to default second expression formula, wherein, the second table
The present weight value of target service server and the current residual disk size positive correlation of target service server up in formula, and with
The current network flow of target service server is negatively correlated.
Specifically, above-mentioned first expression formula can be:W=F, wherein, F is the current residual disk of target service server
Capacity.
Above-mentioned second expression formula can be:W=b*F/ (N-c), wherein, N is the current network stream of target service server
Amount, b, c are preset value.
Assuming that the network interface card of all service servers is all PCI-Express, current residual disk size F unit is GB, currently
Network traffics N unit is MB/S, and in a kind of preferred embodiment, the first preset value a values are 50, b values are 10, c takes
It is worth for 40.
Certainly, in actual applications, value, this Shen can also be carried out to preset value a, b, c according to specific service conditions
Please preset value a, b, c value are not limited.
It should be noted that service server is to control server feedback current residual disk size and current network stream
Amount, can actively be sent according to prefixed time interval to control server feedback or receiving control server
Instruction when fed back, wherein, the instruction that control server is sent can be sent according to prefixed time interval, also may be used
To send upon receipt of a service request, the application is not limited this.
In addition, calculation server calculates the mode of the present weight value of each service server, can be with controlling server
It is identical to calculate the mode of the present weight value of each service server, wouldn't be described in detail again here.
S103, according to present weight value, the selection target service server from least one service server.
In embodiments of the present invention, for according to present weight value from least one service server selection target business
The step of server, as shown in Fig. 2 can include:
S1031, according to present weight value, generation includes the array of K element, wherein, K for service server number;
S1032, last element according to array, generate a random value;
S1033, according to random value and array, the selection target service server from least one service server.
It should be understood that intuitively represent the present weight value of each service server, all business services in order to clear
Current total weighted value of device and each current total weighted value of the present weight value of service server in all service servers
In shared ratio, according to present weight value, one can be constructed every time after the present weight value of K service server is obtained
The individual array ArrayNew for including K element.Specifically, can directly using each present weight value as the element in array,
In a preferred embodiment, present weight value can also be utilized to construct the array that element is section.
, can be using each element in ArrayNew as one when building the array that element is section using present weight value
The right section opened is closed on an individual left side:[start, end), wherein, the higher limit that start is the lower limit in section, end is section, and area
Between length for higher limit and lower limit difference, equal to the present weight value of service server corresponding to the element.
Specifically, array ArrayNew can be expressed as:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
The start values of the 1st element are that 0, end values are W it can be seen from above-mentioned array ArrayNew expression formula1;The
The start values of i element are W1+W2+…+Wi-1, end values are start+Wi;Each element so in ArrayNew arrays
Scope is respectively W1、W2、…、WK, the present weight value of each service server is corresponded to respectively.
After array ArrayNew is constructed, according to last element of array, when generating a random value, Ke Yigen
According to below equation, generation random value R:
R=random (SUM);
Wherein, SUM is the higher limit end, random () in the section corresponding to array ArrayNew last element
For default random function.
It should be understood that the array limited range of above-mentioned determination be [0, SUM), due to it is determined that target service service
, it is necessary to which the random value R of generation is within above range during device, target service service could be determined according to the random value of generation
Device, if the random value of generation is not within the above range, target service server can not be determined according to the random value of generation.Cause
This using random function, it is necessary to generate the [random value in the range of 0, SUM.
Specifically, according to random value R and array ArrayNew, selection target business takes from least one service server
Business device, Ke Yiwei:Determine the target interval that random value R is in array ArrayNew;By the business corresponding to object element
Server is defined as destination server, wherein, object element is:Element corresponding to target interval.
It should be understood that SUM is current total weighted value of K service server, and 0R < SUM, if R value is in section
[W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) in, i.e. R falls in i-th of section, and i-th of section corresponds in array i-th yuan
Element, then service server i corresponding to i-th of element can be defined as destination server.
Seen from the above description, probability selected service server i is Wi/ SUM, i.e. present weight value is bigger, is chosen
In probability it is also bigger.Come selection target service server by way of random function generates random value, from prolonged angle
Spend to consider to ensure that each service server can be uniformly selected.That is, service request is not concentrated in spy
On fixed service server, but it is dynamically assigned on all service servers, so as to realize the dynamic of all service servers
State load balancing.
In actual applications, single background thread can be set in server is controlled, to obtain service server
Present weight value, and array ArrayNew is constructed according to the present weight value obtained, so, do not influence to control server to ring
Answer the service request of simultaneously distributing user.Control server can also generate the pointer pCurrent of a sensing array and preserve and be somebody's turn to do
Pointer, after a new array ArrayNew is constructed out, switching pointer pCurrent points to the new array
ArrayNew。
It should be understood that due to control server fall into a trap count group thread and distributing user service request thread point
From, and the thread in distribution service request needs to obtain the array of present construction, it is, needing to work as the thread for calculating array
The array that front construction goes out is copied in the thread of the service request of distributing user.And switch the number that neotectonics goes out using pointer
Group, the copy of data can be avoided.
According to random value R and array ArrayNew, the selection target service server from least one service server
When, can be in the array ArrayNew that pointer pCurrent is pointed to, in sequence or the order of inverted order determines that random value R exists
The target interval being in array ArrayNew, it can also be in using binary search random value R in array ArrayNew
Target interval, the application do not limited this.
Specifically, due in array ArrayNew element be to be arranged by ascending order, can be with when being searched using dichotomy
First by the element that ArrayNew centre positions record compared with random value R, if the member of random value R records in an intermediate position
In the section of element, then search successfully;Otherwise, ArrayNew is divided into former and later two subnumbers by the element recorded using centre position
Group, if random value R is less than the interval limit value of the element of centre position record, previous subnumber group is further searched for, if
Random value R is equal to greatly the section higher limit of the element of centre position record, then latter subnumber group is further searched for, until finding
The target interval that random value R is in array ArrayNew.
Seen from the above description, because array ArrayNew length is K, then the time complexity of dichotomy is O
(logK).Therefore, the target interval being in using binary search random value R in array ArrayNew, time complexity is low,
Number of comparisons is few, and lookup speed is fast, and average behavior is good.
S104, target service requests are transmitted to target service server.
As seen from the above, in the scheme that the embodiment of the present invention is provided, control server obtains at least one business service
The present weight value of device;According to the present weight value obtained, the selection target business service from least one service server
Device, the target service requests received are transmitted to target service server, the present weight value of wherein service server is root
Calculated according to the current residual disk size and current network flow of the service server.Compared with prior art, the present invention is real
The scheme that example is provided is applied, due to when calculating the present weight value of each service server, it is contemplated that current business server
Remaining disk space and current network flow, target service server is determined based on the present weight value obtained and forwards mesh
Mark service request, rather than it is simple target service requests are transmitted to each service server successively in order, realize industry
The load balancing of business server.
In one particular embodiment of the present invention, in order to reduce the amount of calculation of control server, it is easy to system maintenance, also
It can increase in the service request repeater system:Calculation server.
Specifically, illustrate referring to second of flow of Fig. 3, Fig. 3 document down loading method provided by the embodiment of the present invention
Figure, obtain the present weight value (S102) of at least one service server, Ke Yiwei:
S102A, the present weight value for obtaining at least one service server that calculation server feeds back.
In practical application, the present weight value of each service server can be calculated by calculation server, and will be calculated
To the present weight values of all service servers feed back to control server, to control server:Obtain at least one
The present weight value of service server;According to present weight value, the selection target business service from least one service server
Device;Target service requests are transmitted to target service server.
Specifically, the calculation server can calculate the present weight value of each service server in accordance with the following methods:
Receive the current residual disk size and current network flow of the service server of each service server feedback;
According to the current residual disk size and current network flow of each service server, the service server is calculated
Present weight value.
In a specific embodiment of the present invention, calculation server is according to the current residual magnetic of each service server
Disk capacity and current network flow, the present weight value of the service server is calculated, can be included:
In such a way, the present weight value W of each service server is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, target service service
Device is:Any service server;
If it has not, the present weight value of target service server is calculated according to default first expression formula, wherein, the first table
The present weight value of target service server and the current residual disk size positive correlation of target service server up in formula;
If it is, the present weight value of target service server is calculated according to default second expression formula, wherein, the second table
The present weight value of target service server and the current residual disk size positive correlation of target service server up in formula, and with
The current network flow of target service server is negatively correlated.
Specifically, above-mentioned first expression formula can be:W=F, wherein, F is the current residual disk of target service server
Capacity.
Above-mentioned second expression formula is:W=b*F/ (N-c), wherein, N be target service server current network flow, b,
C is preset value.
It should be noted that service server feeds back current residual disk size and current network stream to calculation server
Amount, can actively feed back to calculation server according to prefixed time interval or sent receiving calculation server
Instruction when fed back, wherein, the instruction that calculation server is sent can be sent according to prefixed time interval, also may be used
To send upon receipt of a service request, the application is not limited this.
Calculation server can be according to pre- to the present weight value of the control at least one service server of server feedback
If the present weight value for the service server being calculated actively is sent to control server or connect by time interval
Receive what is fed back during the instruction that control server is sent, wherein, the instruction that control server is sent can be according to default
That time interval is sent or sending upon receipt of a service request, the application is not also limited this.
As seen from the above, in the scheme that the embodiment of the present invention is provided, each service server is calculated by calculation server
Present weight value, and the present weight value for all service servers being calculated is fed back into control server, to cause
Control server:Obtain the present weight value of at least one service server;According to present weight value, taken from least one business
Selection target service server in business device;Target service requests are transmitted to target service server.Compared with prior art, no
Only realize the dynamic load leveling of service server;Further, it is not necessary to control server to calculate each business service
The present weight value of device, the amount of calculation of control server is reduced, so as to mitigate the pressure of control server, and be easy to system
Safeguard.
A kind of service request retransmission method provided below with a specific embodiment the embodiment of the present invention is said
It is bright.
In distributed memory system, control server, at least one storage server, calculation server can be included.
Wherein, server is controlled to be used for the service request for receiving user, the present weight value information fed back according to calculation server selects
Storage server dispatch service is asked;Storage server is used for the service request that response control server is assigned, and deposits on user
The data of biography, the current residual disk size and current network flow of book server are reported into calculation server;Calculate service
Device is used for the current residual disk size reported according to storage server and current network flow calculates working as the storage server
Preceding weighted value, and the present weight value being calculated is fed back into control server.
For example, each storage server reported the current residual magnetic of book server every 5 seconds to calculation server
Disk capacity and current network flow.In actual inline system, all storage servers corresponding to every calculation server are regarded
For a cluster, in order to avoid the data traffic of calculation server processing per second is too high, every calculation server pair can be set
The quantity of storage server in the cluster answered, for example the quantity of the storage server of a cluster can be 1000 or so,
Multiple clusters can be disposed in one computer room.
The current residual disk size and current network flow that calculation server reports according to each storage server, calculate
The present weight value of the storage server, can be every 1 in order to reflect the present weight value of the storage server in cluster in time
Second calculate a weight.It should be understood that having substantial amounts of storage server in a cluster, these storage servers are not
It is concurrently deployed, but repeatedly increased to according to service conditions in cluster, or it is due to abnormal off-line and heavy after eliminating extremely
Newly be deployed to the cluster, etc., even if causing all storage servers in a cluster to be all according between the identical time
Every reporting self information to calculation server, but it is not necessarily all to report self information to calculation server in synchronization, because
This, the time interval that calculation server calculates weight need not be consistent with the time interval that storage server reports information.
One background thread of startup of server is controlled, all storage servers were pulled from calculation server every 1 second
Present weight value, when receiving the service request of user, target storage server is chosen according to present weight value, distribute
Service request.
As seen from the above, real-time remaining disk size and real-time network stream of the embodiment of the present invention based on storage server
Amount, the present weight value per second for calculating once each storage server, the service request of user is in strict accordance with present weight value quilt
Be assigned to each storage server, rather than it is simple service request is sequentially allocated in order to each storage server, because
This can realize the load balancing of storage server.In actual applications, the scheme that the embodiment of the present invention is provided, which is applied, to be had
In the distributed memory system for there are 5000 storage server scales, good effect is achieved.
Corresponding with above-mentioned service request retransmission method, the embodiment of the present invention additionally provides a kind of service request forwarding dress
Put.
It should be noted that the service request retransmission unit that the embodiment of the present invention is provided is applied to service request forwarding system
Control server in system, wherein, the service request repeater system includes:Control server, at least one service server.
Corresponding with the embodiment of the method shown in Fig. 1, Fig. 4 is service request retransmission unit provided in an embodiment of the present invention
The first structural representation, the device include:Receiving module 401, obtain module 402, selecting module 403, forwarding module 404.
Wherein,
Receiving module 401, for receiving target service requests;
Obtain module 402, for obtaining the present weight value of at least one service server, wherein, it is described at least
The present weight value of one service server is:The current residual magnetic of the service server fed back according to each service server
What disk capacity and current network flow were calculated;
Selecting module 403, for according to the present weight value, the selection target from least one service server
Service server;
Forwarding module 404, for the target service requests to be transmitted into the target service server.
In actual applications, the present weight value W of at least one service server can be:
In such a way, it is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
In actual applications, first expression formula can be:W=F, wherein, F is working as the target service server
Preceding remaining disk size.
In actual applications, second expression formula can be:W=b*F/ (N-c), wherein, N takes for the target service
The current network flow of business device, b, c are preset value.
In actual applications, as shown in figure 5, the selecting module 403, can include:
First generation submodule 4031, for including the array of K element according to the present weight value, generation, wherein,
K is the number of the service server;
Second generation submodule 4032, for last element according to the array, generates a random value;
Submodule 4033 is selected, for according to the random value and the array, from least one service server
Middle selection target service server.
In actual applications, the array can be:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
In actual applications, the second generation submodule 4032, is specifically used for:
According to below equation, a random value R is generated:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
In actual applications, the selection submodule 4033, can include:
First determining unit (not shown), the target area being in for determining the random value in the array
Between;
Second determining unit (not shown), for the service server corresponding to object element to be defined as into target clothes
Business device, wherein, the object element is:Element corresponding to the target interval.
As seen from the above, in the scheme that the embodiment of the present invention is provided, control server obtains at least one business service
The present weight value of device;According to the present weight value obtained, the selection target business service from least one service server
Device, the target service requests received are transmitted to target service server, the present weight value of wherein service server is root
Calculated according to the current residual disk size and current network flow of the service server.Compared with prior art, the present invention is real
The scheme that example is provided is applied, due to when calculating the present weight value of each service server, it is contemplated that current business server
Remaining disk space and current network flow, target service server is determined based on the present weight value obtained and forwards mesh
Mark service request, rather than it is simple target service requests are transmitted to each service server successively in order, realize industry
The load balancing of business server.
In one particular embodiment of the present invention, the feelings of calculation server are included in the service request repeater system
Under condition, the acquisition module 402, the present weight of at least one service server specifically for obtaining calculation server feedback
Value, wherein, the present weight value of at least one service server is:Calculation server feeds back according to each service server
The service server current residual disk size and current network flow be calculated.
In actual applications, the present weight value W of at least one service server can be:
In such a way, it is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
In actual applications, first expression formula can be:W=F, wherein, F is working as the target service server
Preceding remaining disk size.
In actual applications, second expression formula can be:W=b*F/ (N-c), wherein, N takes for the target service
The current network flow of business device, b, c are preset value.
As seen from the above, in the scheme that the embodiment of the present invention is provided, each service server is calculated by calculation server
Present weight value, and the present weight value for all service servers being calculated is fed back into control server, to cause
Control server:Obtain the present weight value of at least one service server;According to present weight value, taken from least one business
Selection target service server in business device;Target service requests are transmitted to target service server.Compared with prior art, no
Only realize the dynamic load leveling of service server;Further, it is not necessary to control server to calculate each business service
The present weight value of device, the amount of calculation of control server is reduced, so as to mitigate the pressure of control server, and be easy to system
Safeguard.
Corresponding with above-mentioned service request retransmission method, device, the embodiment of the present invention additionally provides a kind of service request
Repeater system.
Fig. 6 is the first structural representation of SERVICE FORWARDING SYSTEM provided in an embodiment of the present invention, and the system includes:Control
Server 601, at least one service server 602, wherein:
The control server 601, for intended recipient service request;Obtain at least one service server 602
Present weight value;According to the present weight value, the selection target business service from least one service server 602
Device;The target service requests are transmitted to the target service server;
At least one service server 602, please for receiving the destination service that the control server 601 forwards
Ask;
At least one service server 602, it is additionally operable to feed back the service server to the control server 601
Current residual disk size and current network flow;
The control server 601, it is additionally operable to receive the current of the service server that each service server 602 feeds back
Remaining disk size and current network flow;According to the current residual disk size and current network of each service server 602
Flow, calculate the present weight value of the service server.
In actual applications, the control server 601, is specifically used for:
In such a way, the present weight value W of each service server 602 is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server 602;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
In actual applications, first expression formula can be:W=F, wherein, F is working as the target service server
Preceding remaining disk size.
In actual applications, second expression formula can be:W=b*F/ (N-c), wherein, N takes for the target service
The current network flow of business device, b, c are preset value.
In actual applications, the control server 601, is specifically used for:
According to the present weight value, generation includes the array of K element, wherein, K is the service server 602
Number;According to last element of the array, a random value is generated;According to the random value and the array, from institute
State selection target service server at least one service server 602.
In actual applications, the array can be:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
In actual applications, the control server 601, is specifically used for:
According to below equation, a random value R is generated:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
In actual applications, the control server 601, is specifically used for:
Determine the target interval that the random value is in the array;By the service server corresponding to object element
602 are defined as destination server, wherein, the object element is:Element corresponding to the target interval.
As seen from the above, in the scheme that the embodiment of the present invention is provided, control server obtains at least one business service
The present weight value of device;According to the present weight value obtained, the selection target business service from least one service server
Device, the target service requests received are transmitted to target service server, the present weight value of wherein service server is root
Calculated according to the current residual disk size and current network flow of the service server.Compared with prior art, the present invention is real
The scheme that example is provided is applied, due to when calculating the present weight value of each service server, it is contemplated that current business server
Remaining disk space and current network flow, target service server is determined based on the present weight value obtained and forwards mesh
Mark service request, rather than it is simple target service requests are transmitted to each service server successively in order, realize industry
The load balancing of business server.
Fig. 7 is second of structural representation of SERVICE FORWARDING SYSTEM provided in an embodiment of the present invention, and the system includes:Control
Server 601, calculation server 603, at least one service server 602, wherein:
At least one service server 602, for feeding back working as the service server to the calculation server 603
Preceding remaining disk size and current network flow;
The calculation server 603, the current of the service server fed back for receiving each service server 602 remain
Remaining disk size and current network flow;According to the current residual disk size and current network stream of each service server 602
Amount, calculate the present weight value of the service server;At least one service server is fed back to the control server 601
602 present weight value;
The control server 601, for receiving target service requests;Obtain the institute that the calculation server 603 feeds back
State the present weight value of at least one service server 602;According to the present weight value, from least one business service
Selection target service server in device 602;The target service requests are transmitted to the target service server;
At least one service server 602, it is additionally operable to receive the target service requests of the control server forwarding.
In actual applications, the calculation server 603, is specifically used for:
In such a way, the present weight value W of each service server 602 is calculated:
Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service
Server is:Any service server 602;
If it has not, the present weight value of the target service server is calculated according to default first expression formula, wherein, institute
State the present weight value of target service server described in the first expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation;
If it is, the present weight value of the target service server is calculated according to default second expression formula, wherein, institute
State the present weight value of target service server described in the second expression formula and the current residual magnetic of the target service server
Disk capacity positive correlation, and it is negatively correlated with the current network flow of the target service server.
In actual applications, first expression formula can be:W=F, wherein, F is working as the target service server
Preceding remaining disk size.
In actual applications, second expression formula can be:W=b*F/ (N-c), wherein, N takes for the target service
The current network flow of business device, b, c are preset value.
In actual applications, the control server 601, is specifically used for:
According to the present weight value, generation includes the array of K element, wherein, K is the service server 602
Number;According to last element of the array, a random value is generated;According to the random value and the array, from institute
State selection target service server at least one service server 602.
In actual applications, the array can be:
{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+
W2+…+WK-1+WK)};
Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1
+W2+…+Wi-1+Wi) it is element corresponding to service server i.
In actual applications, the control server 601, is specifically used for:
According to below equation, a random value R is generated:
R=random (SUM);
Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default
Random function.
In actual applications, the control server 601, is specifically used for:
Determine the target interval that the random value is in the array;By the service server corresponding to object element
It is defined as destination server, wherein, the object element is:Element corresponding to the target interval.
As seen from the above, in the scheme that the embodiment of the present invention is provided, each service server is calculated by calculation server
Present weight value, and the present weight value for all service servers being calculated is fed back into control server, to cause
Control server:Obtain the present weight value of at least one service server;According to present weight value, taken from least one business
Selection target service server in business device;Target service requests are transmitted to target service server.Compared with prior art, no
Only realize the dynamic load leveling of service server;Further, it is not necessary to control server to calculate each business service
The present weight value of device, the amount of calculation of control server is reduced, so as to mitigate the pressure of control server, and be easy to system
Safeguard.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality
Body or operation make a distinction with another entity or operation, and not necessarily require or imply and deposited between these entities or operation
In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to
Nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those
Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include
Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that
Other identical element also be present in process, method, article or equipment including the key element.
Each embodiment in this specification is described by the way of related, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for device
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
Can one of ordinary skill in the art will appreciate that realizing that all or part of step in above method embodiment is
To instruct the hardware of correlation to complete by program, described program can be stored in computer read/write memory medium,
The storage medium designated herein obtained, such as:ROM/RAM, magnetic disc, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent substitution and improvements made within the spirit and principles in the present invention etc., are all contained in protection scope of the present invention
It is interior.
Claims (30)
- A kind of 1. service request retransmission method, it is characterised in that applied to the control server in service request repeater system, its In, the service request repeater system includes:Server, at least one service server are controlled, methods described includes:Receive target service requests;Obtain the present weight value of at least one service server;According to the present weight value, the selection target service server from least one service server;The target service requests are transmitted to the target service server;Wherein, the present weight value of at least one service server calculates in such a way:Receive the current residual disk size and current network flow of the service server of each service server feedback;According to the current residual disk size and current network flow of each service server, the current of the service server is calculated Weighted value.
- 2. according to the method for claim 1, it is characterised in that the current residual disk according to each service server Capacity and current network flow, the present weight value of the service server is calculated, including:In such a way, the present weight value W of each service server is calculated:Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service service Device is:Any service server;If it has not, calculate the present weight value of the target service server according to default first expression formula, wherein, described the The present weight value of target service server described in one expression formula and the current residual disk of the target service server hold Measure positive correlation;If it is, calculate the present weight value of the target service server according to default second expression formula, wherein, described the The present weight value of target service server described in two expression formulas and the current residual disk of the target service server hold Positive correlation is measured, and it is negatively correlated with the current network flow of the target service server.
- 3. according to the method for claim 2, it is characterised in that first expression formula is:W=F, wherein, F is the mesh Mark the current residual disk size of service server.
- 4. according to the method in claim 2 or 3, it is characterised in that second expression formula is:W=b*F/ (N-c), its In, N is the current network flow of the target service server, and b, c are preset value.
- 5. according to the method for claim 1, it is characterised in that the service request repeater system also includes calculating service Device,The present weight value for obtaining at least one service server, including:Obtain the present weight value of at least one service server of the calculation server feedback.
- 6. according to the method for claim 1, it is characterised in that it is described according to the present weight value, from described at least one Selection target service server in individual service server, including:According to the present weight value, generation includes the array of K element, wherein, K is the number of the service server;According to last element of the array, a random value is generated;According to the random value and the array, the selection target service server from least one service server.
- 7. according to the method for claim 6, it is characterised in that the array is:{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+W2+… +WK-1+WK)};Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1+W2 +…+Wi-1+Wi) it is element corresponding to service server i.
- 8. according to the method for claim 7, it is characterised in that described last element according to the array, generation One random value, including:According to below equation, a random value R is generated:R=random (SUM);Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default random Function.
- 9. according to the method for claim 8, it is characterised in that it is described according to the random value and the array, from described Selection target service server at least one service server, including:Determine the target interval that the random value is in the array;Service server corresponding to object element is defined as destination server, wherein, the object element is:The target Element corresponding to section.
- A kind of 10. service request retransmission unit, it is characterised in that applied to the control server in service request repeater system, Wherein, the service request repeater system includes:Server, at least one service server are controlled, described device includes:Receiving module, for receiving target service requests;Module is obtained, for obtaining the present weight value of at least one service server, wherein, at least one business The present weight value of server is:According to each service server feed back the service server current residual disk size and What current network flow was calculated;Selecting module, for according to the present weight value, selection target business to take from least one service server Business device;Forwarding module, for the target service requests to be transmitted into the target service server.
- 11. device according to claim 10, it is characterised in that the present weight value of at least one service server W is:In such a way, it is calculated:Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service service Device is:Any service server;If it has not, calculate the present weight value of the target service server according to default first expression formula, wherein, described the The present weight value of target service server described in one expression formula and the current residual disk of the target service server hold Measure positive correlation;If it is, calculate the present weight value of the target service server according to default second expression formula, wherein, described the The present weight value of target service server described in two expression formulas and the current residual disk of the target service server hold Positive correlation is measured, and it is negatively correlated with the current network flow of the target service server.
- 12. device according to claim 11, it is characterised in that first expression formula is:W=F, wherein, F is described The current residual disk size of target service server.
- 13. the device according to right wants 11 or 12, it is characterised in that second expression formula is:W=b*F/ (N-c), its In, N is the current network flow of the target service server, and b, c are preset value.
- 14. device according to claim 10, it is characterised in that the service request repeater system also includes calculating service Device,The acquisition module, is used for:Obtain the present weight value of at least one service server of the calculation server feedback.
- 15. device according to claim 10, it is characterised in that the selecting module, including:First generation submodule, for including the array of K element according to the present weight value, generation, wherein, K is described The number of service server;Second generation submodule, for last element according to the array, generates a random value;Submodule is selected, for according to the random value and the array, mesh to be selected from least one service server Mark service server.
- 16. device according to claim 15, it is characterised in that the array is:{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+W2+… +WK-1+WK)};Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1+W2 +…+Wi-1+Wi) it is element corresponding to service server i.
- 17. device according to claim 16, it is characterised in that the second generation submodule, be used for:According to below equation, a random value R is generated:R=random (SUM);Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default random Function.
- 18. device according to claim 17, it is characterised in that the selection submodule, including:First determining unit, the target interval being in for determining the random value in the array;Second determining unit, for the service server corresponding to object element to be defined as into destination server, wherein, the mesh Marking element is:Element corresponding to the target interval.
- 19. a kind of service request repeater system, it is characterised in that the system includes control server, at least one business clothes Business device, wherein:The control server, for receiving target service requests;Obtain the present weight of at least one service server Value;According to the present weight value, the selection target service server from least one service server;By the target Service request is transmitted to the target service server;At least one service server, for receiving the target service requests of the control server forwarding;At least one service server, it is additionally operable to the current residual magnetic to the control server feedback service server Disk capacity and current network flow;The control server, the current residual disk for being additionally operable to receive the service server of each service server feedback hold Amount and current network flow;According to the current residual disk size and current network flow of each service server, the industry is calculated The present weight value of business server.
- 20. system according to claim 19, it is characterised in thatThe control server, the present weight value W specifically in such a way, calculating each service server:Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service service Device is:Any service server;If it has not, calculate the present weight value of the target service server according to default first expression formula, wherein, described the The present weight value of target service server described in one expression formula and the current residual disk of the target service server hold Measure positive correlation;If it is, calculate the present weight value of the target service server according to default second expression formula, wherein, described the The present weight value of target service server described in two expression formulas and the current residual disk of the target service server hold Positive correlation is measured, and it is negatively correlated with the current network flow of the target service server.
- 21. system according to claim 20, it is characterised in that first expression formula is:W=F, wherein, F is described The current residual disk size of target service server.
- 22. the system according to claim 20 or 21, it is characterised in that second expression formula is:W=b*F/ (N-c), Wherein, N is the current network flow of the target service server, and b, c are preset value.
- 23. a kind of service request repeater system, it is characterised in that the system includes control server, calculation server, at least One service server, wherein:At least one service server, for feeding back the current residual disk of the service server to the calculation server Capacity and current network flow;The calculation server, the current residual disk size of the service server for receiving each service server feedback And current network flow;According to the current residual disk size and current network flow of each service server, the business is calculated The present weight value of server;To the present weight value of at least one service server described in the control server feedback;The control server, for receiving target service requests;Obtain the described at least one of the calculation server feedback The present weight value of service server;According to the present weight value, the selection target from least one service server Service server;The target service requests are transmitted to the target service server;At least one service server, it is additionally operable to receive the target service requests of the control server forwarding.
- 24. system according to claim 23, it is characterised in thatThe calculation server, the present weight value W specifically in such a way, calculating each service server:Judge whether the current network flow of target service server is more than the first preset value, wherein, the target service service Device is:Any service server;If it has not, calculate the present weight value of the target service server according to default first expression formula, wherein, described the The present weight value of target service server described in one expression formula and the current residual disk of the target service server hold Measure positive correlation;If it is, calculate the present weight value of the target service server according to default second expression formula, wherein, described the The present weight value of target service server described in two expression formulas and the current residual disk of the target service server hold Positive correlation is measured, and it is negatively correlated with the current network flow of the target service server.
- 25. system according to claim 24, it is characterised in that first expression formula is:W=F, wherein, F is described The current residual disk size of target service server.
- 26. the system according to claim 24 or 25, it is characterised in that second expression formula is:W=b*F/ (N-c), Wherein, N is the current network flow of the target service server, and b, c are preset value.
- 27. system according to claim 23, it is characterised in thatThe control server, specifically for including the array of K element according to the present weight value, generation, wherein, K is The number of the service server;According to last element of the array, a random value is generated;According to the random value With the array, the selection target service server from least one service server.
- 28. system according to claim 27, it is characterised in that the array is:{ [0, W1), [0, W1+W2) ..., [W1+W2+…+Wi-1, W1+W2+…+Wi-1+Wi) ..., [W1+W2+…+WK-1, W1+W2+… +WK-1+WK)};Wherein, WiFor service server i present weight value, i-th of element [W in the array1+W2+…+Wi-1, W1+W2 +…+Wi-1+Wi) it is element corresponding to service server i.
- 29. system according to claim 28, it is characterised in thatThe control server, specifically for according to below equation, generating a random value R:R=random (SUM);Wherein, SUM is the higher limit in the section corresponding to last element of the array, and random () is default random Function.
- 30. system according to claim 29, it is characterised in thatThe control server, the target interval being in specifically for determining the random value in the array;By target element Service server corresponding to element is defined as destination server, wherein, the object element is:It is first corresponding to the target interval Element.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610806093.6A CN107800744B (en) | 2016-09-06 | 2016-09-06 | Service request forwarding method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610806093.6A CN107800744B (en) | 2016-09-06 | 2016-09-06 | Service request forwarding method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107800744A true CN107800744A (en) | 2018-03-13 |
CN107800744B CN107800744B (en) | 2021-06-18 |
Family
ID=61530727
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610806093.6A Active CN107800744B (en) | 2016-09-06 | 2016-09-06 | Service request forwarding method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107800744B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109831524A (en) * | 2019-03-11 | 2019-05-31 | 平安科技(深圳)有限公司 | A kind of load balance process method and device |
CN110445725A (en) * | 2019-07-08 | 2019-11-12 | 福建天泉教育科技有限公司 | It is new that method, the storage medium that load node shunts is added |
CN112711376A (en) * | 2019-10-25 | 2021-04-27 | 北京金山云网络技术有限公司 | Method and device for determining object master copy file in object storage system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557499A (en) * | 2008-04-09 | 2009-10-14 | 中兴通讯股份有限公司 | System and method for delivering media and method for renewing resource of media delivering system |
CN103024034A (en) * | 2012-12-11 | 2013-04-03 | 华为技术有限公司 | Scheduling method and device |
CN104158732A (en) * | 2014-08-22 | 2014-11-19 | 成都致云科技有限公司 | Intelligent cloud service dynamic routing strategy |
-
2016
- 2016-09-06 CN CN201610806093.6A patent/CN107800744B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557499A (en) * | 2008-04-09 | 2009-10-14 | 中兴通讯股份有限公司 | System and method for delivering media and method for renewing resource of media delivering system |
CN103024034A (en) * | 2012-12-11 | 2013-04-03 | 华为技术有限公司 | Scheduling method and device |
CN104158732A (en) * | 2014-08-22 | 2014-11-19 | 成都致云科技有限公司 | Intelligent cloud service dynamic routing strategy |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109831524A (en) * | 2019-03-11 | 2019-05-31 | 平安科技(深圳)有限公司 | A kind of load balance process method and device |
CN110445725A (en) * | 2019-07-08 | 2019-11-12 | 福建天泉教育科技有限公司 | It is new that method, the storage medium that load node shunts is added |
CN110445725B (en) * | 2019-07-08 | 2022-07-26 | 福建天泉教育科技有限公司 | Method and storage medium for shunting newly-added load node |
CN112711376A (en) * | 2019-10-25 | 2021-04-27 | 北京金山云网络技术有限公司 | Method and device for determining object master copy file in object storage system |
Also Published As
Publication number | Publication date |
---|---|
CN107800744B (en) | 2021-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107801086B (en) | The dispatching method and system of more cache servers | |
US20210385171A1 (en) | Software load balancer to maximize utilization | |
US8959225B2 (en) | Cooperative caching method and contents providing method using request apportioning device | |
CN106161120B (en) | The distributed meta-data management method of dynamic equalization load | |
CN104348679B (en) | A kind of methods, devices and systems of point of bucket test | |
US8576710B2 (en) | Load balancing utilizing adaptive thresholding | |
US8103767B2 (en) | Method and apparatus for distributing requests among a plurality of resources | |
US7127513B2 (en) | Method and apparatus for distributing requests among a plurality of resources | |
CN108376112A (en) | Method for testing pressure, device and readable medium | |
CN107800768A (en) | Open platform control method and system | |
CN101815033A (en) | Method, device and system for load balancing | |
CN107800744A (en) | A kind of service request retransmission method, apparatus and system | |
WO2015191359A1 (en) | Efficient and scalable pull-based load distribution | |
CN107749887A (en) | A kind of CDN resource allocations, localization method and device and CDN system | |
CN106569892A (en) | Resource scheduling method and device | |
CN105068755A (en) | Data duplicate storage method facing cloud computing content distribution network | |
WO2021194616A1 (en) | Load balancing for memory channel controllers | |
JP2019204489A (en) | Object storage system with multi-level hashing function for storage address determination | |
CN108304236B (en) | User interface refreshing method based on message subscription under cloud platform | |
CN107835262A (en) | A kind of streaming media server dynamical load distribution method | |
CN108200112A (en) | Distributed storage method and system | |
CN107395708B (en) | Method and device for processing download request | |
CN110008029B (en) | ceph metadata cluster directory distribution method, system, device and readable storage medium | |
CN105872082B (en) | Fine granularity resource response system based on container cluster load-balancing algorithm | |
CN109756429A (en) | Bandwidth allocation methods and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |