Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
Be illustrated in figure 1 the flow chart of the message server load-balancing method that preferred embodiment according to the present invention provides.As shown in Figure 1, the message server load-balancing method that preferred embodiment of the present invention provides comprises step 101-103.
Step 101: when receiving new information, message server judges whether current handled size of message is greater than the first preset value;
Step 102: if current handled size of message is greater than the first preset value, then reclaim the timeslice of the message selected from current handled message according to predetermined policy in recovery pond;
Described predetermined policy comprises: according to the pre-set priority of type of message, the timeslice of message corresponding for type of message minimum for priority is recycled in described recovery pond, or the timeslice corresponding to the message of onrelevant degree is recycled in described recovery pond.
Or, described predetermined policy comprises: the quantity of the weight corresponding according to type of message, each type of message and message corresponding to each type of message, obtain the comprehensive assessment value of current handled message corresponding to described type of message, the timeslice of message corresponding for minimum comprehensive assessment value is recycled in described recovery pond.Wherein, described type of message at least comprise following one or more: meeting message, chat messages, teaching message, system message, query manipulation, deletion action, increase operation.
Step 103: the timeslice in described recovery pond is distributed to described new information.
The process that timeslice in described recovery pond distributes to described new information is comprised: obtain the degree of correlation between new information, be that described new information distributes corresponding timeslice according to the height of the degree of correlation, or, determine the type of described new information, distribute different timeslices according to the new information that the important level of the type of message preset is different messages type.
Discharged timeslice is reclaimed in the process of the described new information of process, and the message selected described in the timeslice of described release is distributed to.
Citing is below described in detail:
Suppose in a communications system, have three message servers, be respectively message server 1, message server 2 and message server 3, and the first preset value of the size of message of each message server process is 30000.When receiving new information, the current handled size of message of message server 1, message server 2 and message server 3 is respectively 25000,35000 and 28000.
The size of message processed due to message server 2 is greater than the first preset value 30000, therefore when message server 2 receives new information, needs to take method provided by the invention to carry out load balance process.If the current handled type of message of message server 2 is chat messages, meeting message and teaching message, wherein chat messages be the first priority, meeting message be the second priority and teaching message be the 3rd priority, its medium priority order is from low to high followed successively by the first priority, the second priority, the 3rd priority, then the timeslice of message corresponding for chat messages be recycled in described recovery pond.
In another preferred embodiment, the method that the timeslice of the message selected from current handled message according to predetermined policy is recycled in recovery pond can also be: suppose in a communications system, current handled type of message is divided into chat messages, query manipulation, deletion action and increase operation, wherein, there is sequencing between operating in query manipulation, deletion action and increase: increase action need and carried out before query manipulation and deletion action, query manipulation also needs to carry out before deletion action simultaneously.So both can not causing can not find out thing because of also not carrying out increase operation, can not, because carrying out deletion action needing the thing of inquiry to delete, so just can inquire the thing wanting to inquire about, and the thing found like this be more accurate again.Because chat messages and query manipulation, deletion action, increase do not exist association between operating, then the timeslice of message corresponding for chat messages is recycled in recovery pond.
In another preferred embodiment, the method that the timeslice of the message selected from current handled message according to predetermined policy is recycled in recovery pond can also be: suppose in a communications system, current handled type of message is divided into chat messages, meeting message, system message and teaching message, and the comprehensive assessment corresponding to various types of messages is worth shown in table specific as follows:
Table 1
The weight that quantity × type of message that comprehensive assessment value=type of message is corresponding is corresponding.
Known based on table 1 content, the comprehensive assessment value of chat messages is minimum comprehensive assessment value, then the timeslice of message corresponding for chat messages be recycled in described recovery pond.
Suppose that the timeslice in recovery pond is 8, be that each message arranges the degree of association according to the pass between new information, the degree of association of message is divided into 0,1, wherein 0 represents onrelevant degree between message, and 1 represents between message and has sequencing.When new information be chat messages, query manipulation and increase operation time, increase action need to carry out before query manipulation, therefore, the degree of correlation of chat messages and query manipulation is 0, chat messages is 0 with increasing the degree of correlation operated, and the degree of association of query manipulation and increase operation is 1, therefore, chat messages and new information query manipulation and and increase operate between onrelevant degree, the timeslice of 8 in recovery pond is distributed to query manipulation and increases and operate.
In another preferred embodiment, process timeslice in recovery pond being distributed to new information can also be: suppose that the timeslice in recovery pond is 8, new information is chat messages, query manipulation and increase operation, wherein be followed successively by according to from important level order from high to low: query manipulation, increase operation and chat messages, the timeslice of 8 in recovery pond distributed to query manipulation and increase operation.
In the process of the described new information of process, reclaim discharged timeslice, and the timeslice of described release is distributed to chat messages.
Figure 2 shows that the schematic diagram of the message server SiteServer LBS that preferred embodiment according to the present invention provides.As shown in Figure 2, the message server SiteServer LBS that preferred embodiment of the present invention provides, said system comprises: comprise multiple message server, is mutually connected between two between described message server; Described message server is used for when receiving new information, judge whether current handled size of message is greater than the first preset value, if current handled size of message is greater than the first preset value, then the timeslice of the message selected from current handled message according to predetermined policy is recycled in recovery pond, and the timeslice in described recovery pond is distributed to described new information.
Be illustrated in figure 3 the flow chart of the message server load-balancing method that another preferred embodiment according to the present invention provides.As shown in Figure 2, the message server load-balancing method that preferred embodiment of the present invention provides comprises step 201-204.
Step 201: the size of message that each message server is handled in controller reporting predetermined amount of time;
Step 202: described controller judges whether the size of message handled in described predetermined amount of time of each message server is greater than the second preset value, and the message server that size of message handled in described predetermined amount of time is greater than the second preset value is defined as excess load message server;
Step 203: described controller selects part messages as message to be migrated from the current handled message of described excess load message server;
The selection strategy of described message to be migrated is the priority orders corresponding to the type of message preset, using message corresponding for type of message minimum for priority as described message to be migrated; Or for arranging the operating time order of message according to the degree of association between message, using operating time message the latest as described message to be migrated.
Step 204: described message to be migrated is moved to target message server by described controller.
The selection strategy of described target message server comprises: the weight corresponding according to type of message, each type of message and every
The quantity that one type of message is corresponding, obtains the comprehensive assessment value of current handled message corresponding to described type of message, institute
Stating target message server is message server corresponding to minimum comprehensive assessment value
Citing is below described in detail:
Suppose in a communications system, there are three message servers, be respectively message server 1, message server 2 and message server 3, and the second preset value of the size of message that each message server processes within a predetermined period of time is 30000, message server 1, message server 2 and message server 3 are respectively 25000 respectively to size of message handled in controller reporting predetermined amount of time, 35000 and 28000, the size of message processed within a predetermined period of time due to message server 2 is greater than the first preset value 30000, thus determine that message server 2 is for excess load message server.
Suppose that the current handled message of message server 2 comprises chat messages, meeting message and teaching message, wherein chat messages be the first priority, meeting message be the second priority and teaching message be the 3rd priority, its medium priority order is from low to high followed successively by the first priority, the second priority, the 3rd priority, determines that the chat messages that priority is minimum is message to be migrated.
In another preferred embodiment, the selection strategy of described message to be migrated can also be: suppose that the current handled message of message server 2 is query manipulation, deletion action and increase operation, need in operation first to carry out increase operation, carry out query manipulation again, carry out deletion action afterwards, the result of such inquiry is more accurate, operating time message is the latest deletion action, thus using deletion action as message to be migrated.
Suppose that current message service device is message server 1, message server 2 and message server 3, wherein message server 2 is excess load message server, the weight that the current handled type of message of message server 1 and message server 3 correspondence, quantity that each type of message is corresponding, each type of message are corresponding and comprehensive assessment value as shown in table 2, wherein the comprehensive assessment value of message server is that the quantity that weight that each type of message in each message server is corresponding is multiplied by each type of message corresponding obtains.
Table 2
According to table 2 content, the comprehensive assessment value of message server 1 is less than the comprehensive assessment value of message server 3, and message server 1 is message server corresponding to minimum comprehensive assessment value.
Therefore, the chat messages of message server 2 is moved to message server 1 by controller.
Compared to prior art, according to a kind of message server load-balancing method provided by the invention and system, the invention solves that the input of message server in existing network is high, very flexible and the problem such as reliability is not enough, can while guarantee transmission of messages quality, better guarantee new information is preferentially processed.The invention provides the method for the higher new information of a kind of priority treatment degree of association, the timeslice in described recovery pond, in recovery pond, is distributed to described new information by the timeslice of the message selected from current handled message according to predetermined policy.So both achieve effective distribution of timeslice in message processing procedure, in turn ensure that new information obtains priority treatment.In addition, the present invention is also different classes of by message being divided into, and carries out personalization scheduling, achieves the load balancing of message server, improves the performance of server.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.