Summary of the invention
The purpose of this invention is to provide a kind of method and system that communicates flow control,, solved in the prior art problem that causes system processing power effectively not utilized with CPU usage as the foundation of flow control owing to only by the present invention.Do not solved in the prior art owing to message not added differentiation and directly abandoned the problem that causes system that effective handling rate of message is descended.
In addition, the purpose of this invention is to provide the method and system that another kind communicates flow control, solved in the prior art, the problem that causes system that the handling rate of efficient message is descended owing to the long message bag that lost efficacy of will not delaying time is rejected.
The objective of the invention is to be achieved through the following technical solutions:
The invention provides a kind of method of carrying out flow control, comprising:
A, obtain the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result;
B, described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming shares the control that parameter communicates flow by the overall situation of setting.
Wherein, described step B specifically comprises:
B1, judge whether the described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, execution in step B2 then; If, execution in step B3 then;
B2, removing Flow Control sign enter normal operating condition, and execution in step B1;
B3, the Flow Control sign is set, shares the control that parameter communicates flow, continue execution in step B1 then by the overall situation that is provided with.
Wherein, the shared parameter of the described overall situation comprises:
Message priority configuration parameter and/or dispatch scanning weight parameter.
Wherein, described step B3 comprises:
B31, read the described overall situation and share parameter;
B32, share parameter according to the described overall situation message traffic in the internal queues of different priorities grade is carried out the flow control of appropriate level, continue execution in step B1 then.
Wherein, described step B32 specifically comprises:
B321, share parameter according to the described overall situation and whether completely judge the highest internal queues of priority level, if, then carry out urgent flow control, continue execution in step B1 then; Otherwise, execution in step B322;
B322, according to the described overall situation share parameter judge beyond the highest internal queues of priority level internal queues whether completely, if, then carry out general flow control, continue execution in step B1 then; Otherwise, execution in step B1.
Wherein, the process of carrying out urgent flow control described in the step B321 specifically comprises:
B3211, when the message in confirming internal queues is initial message or retry message,, the priority level of initial message or retry message is reduced one-level according to the message priority configuration parameter of setting;
B3212, initial message or retry message after according to the priority level order from high to low after descending priority level being descended are dispatched;
Or,
B3213, when the message in confirming internal queues is initial message or retry message, dispatch scanning weight according to the dispatch scanning weight parameter of the setting internal queues that priority level is the highest increases one-level, and the dispatch scanning weight of the internal queues that priority level is minimum reduces one-level;
B3214, described initial message or retry message are dispatched according to dispatch scanning weight parameter and priority level order from high to low after changing;
Or,
B3215, when the message in confirming internal queues is initial message or retry message,, the priority level of initial message is reduced one-level according to the message priority configuration parameter of setting; And according to the dispatch scanning weight increase one-level of the dispatch scanning weight parameter of the setting internal queues that priority level is the highest, and the dispatch scanning weight of the internal queues that priority level is minimum reduces one-level;
B3216, according to the dispatch scanning weight parameter after changing, and initial message or retry message after according to the priority level order from high to low after descending priority level being descended are dispatched;
Or,
B3217, when the message in confirming described internal queues is initial message, then according to the message priority configuration parameter of setting, with the priority level decline one-level of initial message.
B3218, judge whether the message in the described internal queues is the retry initial message, if, then according to the message priority configuration parameter of setting, with the priority level of initial message descend again one-level, execution in step B3219 then; Otherwise, direct execution in step B3220;
B3219, the retry initial message after according to the priority level order from high to low after descending priority level being descended are dispatched;
B3220, the initial message after according to the priority level order from high to low after descending priority level being descended are dispatched.
Or,
B3221, when the message in confirming described internal queues is initial message, then according to the message priority configuration parameter of setting, with the priority level decline one-level of initial message;
B3222, judge whether the message in the described internal queues is the retry initial message, if, then according to the message priority configuration parameter of setting, with the priority level of the initial message one-level that descends again, and, dispatch scanning weight according to the dispatch scanning weight parameter of the setting internal queues that priority level is the highest increases one-level, and the dispatch scanning weight of the internal queues that priority level is minimum reduces one-level, execution in step B3223 then; Otherwise, direct execution in step B3224;
B3223, according to the dispatch scanning weight parameter after changing, and the retry initial message after according to the priority level order from high to low after descending priority level being descended is dispatched;
B3224, according to the dispatch scanning weight parameter after changing, and the initial message after according to the priority level order from high to low after descending priority level being descended is dispatched.
Wherein, the process of carrying out general flow control described in the step B322 specifically comprises:
B3221, according to the message priority configuration parameter of setting, the priority level of the retry message in the internal queues is reduced one-level;
B3222, the retry message after according to the priority level order from high to low after descending priority level being descended are dispatched.
Wherein, described step B specifically comprises:
B4, judge whether the described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, then remove the Flow Control sign, enter normal operating condition; If, execution in step B5 then;
B5, the Flow Control sign is set, shares the control that parameter communicates flow by the overall situation that is provided with.
B6, communicate the control of flow according to the size of message in the input block and/or the size of message in the internal queues.
Wherein, described step B6 specifically comprises:
B61, judge whether message is arranged in the input block, if, the message of preparing to enter described input block is carried out access control, continue execution in step B4 then; Otherwise clear stream control sign enters normal operating condition;
Or,
B62, judge whether message is arranged in the internal queues, if then, continue execution in step B4 then by the dispatch scanning weight parameter of different priorities formation setting is dispatched processing; Otherwise clear stream control sign enters normal operating condition;
Or,
B63, judge whether message is arranged in the input block, if, then the message of preparing to enter described input block is carried out access control, continue execution in step B4 then; Otherwise, execution in step B64;
B64, judge whether message is arranged in the internal queues, if then, continue execution in step B4 then by communicate the control of flow for the dispatch scanning weight parameter of different priorities formation setting; Otherwise clear stream control sign enters normal operating condition.
Wherein, described step B6 also comprises:
B65, judge whether the dispatch scanning number of times arrives, if then finish this process; Otherwise, change step B6 over to.
Wherein, the process of described in the step B6 message of preparing to enter described input block being carried out access control specifically comprises:
C1, read a piece of news, and set the message life cycle of described message from the input block;
C2, judge according to User Identity whether described message is initial message or retry message, if then the priority with described initial message or retry message reduces a grade, execution in step C3 then; Otherwise, direct execution in step C3;
C3, according to the priority level of described message, judge whether corresponding internal queues full, if then abandon described message; Otherwise, described message of carrying message life cycle is put into internal queues, finish this process then;
Or,
C4, read a piece of news, and set the message life cycle of described message from the input block;
C5, judge according to User Identity whether described message is initial message, if then the priority with described initial message reduces a grade, execution in step C6 then; Otherwise, direct execution in step C6;
C6, judge according to User Identity whether described message is retry message, if then the priority with described retry message reduces a grade, execution in step C7 then again; Otherwise direct execution in step C7;
C7, according to the priority level of described message, judge whether corresponding internal queues full, if then abandon described message; Otherwise, described message is put into internal queues, finish this process then.
Wherein, specifically comprise by the process of the dispatch scanning weight parameter of different priorities formation setting being dispatched processing described in the step B6:
D1, according to the weighting dispatching algorithm, according to reading a piece of news in the formation internally of from high to low priority level order;
D2, judge whether message in the internal queues of this priority dispatches and finish, if then the message in the internal queues of the priority of next grade is dispatched; Otherwise, change step D1 over to;
D3, whether dispatch scanning finishes to judge all priority internal queues, if then finish this process; Otherwise, change step D1 over to.
Wherein, the weighting dispatching algorithm specifically comprises described in the step D1:
The internal queues that every wheel scan is all; And,
According to the dispatch scanning weight parameter of setting, whenever take turns scheduling is read from the high internal queues of priority level message number greater than from the low internal queues of priority level, dispatching the message number of reading; And,
Whenever, take turns the message number summation that scheduling is read from all priority internal queues, keep balance with every message number summation of reading in of taking turns from the input block scheduling; And,
If increase the dispatch scanning weight parameter of high priority internal queues, then reduce the dispatch scanning weight parameter of low priority internal queues.
Wherein, before described step D1, also comprise:
Judge whether the message in the internal queues is reached for the message life cycle of its setting, if then will directly abandon in the formation internally of described message; Otherwise, execution in step D1.
A kind of system that carries out flow control provided by the invention comprises:
Main control module, Flow Control module, input block and internal queues;
Described main control module obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result; And it is described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming, share parameter by described Flow Control module according to the overall situation of setting, message and the message in the internal queues preparing to enter in the input block are carried out flow control.
Wherein, described system also comprises:
The access module is used to accept the control of main control module or the control of main control module and Flow Control module, and the message traffic of preparing to enter in the input block is controlled.
Wherein, described system also comprises:
Scheduler module is used to accept the control of main control module or the control of main control module and Flow Control module, according to the shared parameter of the overall situation of setting the message traffic in the internal queues is dispatched and is read.
As seen from the above technical solution provided by the invention, the present invention at first obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result, described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming, share parameter by the overall situation of setting and communicate flow control.The CPU occupation rate that adopts by the present invention and the double check mechanism of buffering time-delay/length, can to the overload situations of system hold more accurate, thereby the assurance system processing power can access effective utilization; And, the present invention can share parameter by the overall situation of setting and communicate flow control, thereby guaranteed that important service obtains priority treatment when system overload, do not solved in the prior art owing to message not added differentiation and directly abandoned the problem that causes system that effective handling rate of message is descended.
The present invention also shares parameter to preparing to enter the message traffic of input block and/or being provided with that message traffic in the internal queues of different priorities is controlled and by being the message life cycle of message sets by the overall situation that is provided with in addition, guaranteed that further important service obtains priority treatment when system overload, system is improved to the effective handling rate of message and the handling rate of efficient message.
Embodiment
The invention provides a kind of method and system that communicates flow control, its core is: main control module obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result; Described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming, share the control that parameter communicates flow by the overall situation of setting.
The schematic diagram of first embodiment of a kind of system that communicates flow control provided by the invention comprises as shown in Figure 2: input buffering 00, output buffering 01, access module 02, scheduler module 03, internal queues 04, main control module 05, Flow Control module 06 and the configurable overall situation are shared parameter database 07.
Input block 00 is used for the message bag of buffer memory from a last link;
Output buffer 01 is used for next link of the treated Messages-Waiting of buffer memory and handles;
Access module 02, be used to accept the control of main control module or the control of main control module and Flow Control module, the message traffic of preparing to enter in the input block is controlled: judge whether the message of preparing IO buffering district 00 possesses entry criteria, if possess entry criteria, then message priority is set according to overall flow control parameters, start timer, setup message (Time to Live life cycle, TTL), promptly increase a ttl field every message front, insert initial value, for example 5s puts into corresponding buffer region according to the priority level of message with message then.The message that does not meet entry criteria is directly abandoned.
Scheduler module 03 is used to accept the control of main control module or the control of main control module and Flow Control module, shares parameter according to the overall situation of setting and the message traffic in the internal queues is dispatched is read: dispatch scanning message and handling in the formation internally 04.Dispatch scanning carries out according to the dispatch scanning weight parameter that Flow Control module 06 is set in the shared parameter of the overall situation, be all formations of every wheel scan, the message bag number of right internal queues scan process reduces successively according to the dispatch scanning weight order from high to low of internal queues.The number of each processing messages bag is exactly an algorithm parameter.Algorithm parameter can be shared parameter by the overall situation by the Flow Control module and dynamically adjust.In the process of handling, message bag of every processing is read timer No. one time, obtains message and wraps in stand-by period in the formation, and the TTL with all message bags in the formation deducts the stand-by period then.If find that TTL is 0, just message abandoned; If find that internal queues is full, then the message that will enter in advance in the internal queues abandons.
Internal queues 04, the present invention is provided with three priority internal queues, and priority level is that 1 internal queues priority is the highest, and priority level is that 3 internal queues priority is minimum, and the internal queues of other quantity certainly is set according to system's needs.
Main control module 05 is used to finish flow detection, starts functions such as Flow Control operational mode and recovery normal operation mode.Described main control module obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result; And it is described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming, share parameter by described Flow Control module according to the overall situation of setting, start the Flow Control operational mode message and the message in the internal queues preparing to enter in the input block are carried out flow control.
Flow Control module 06 receives the order of main control module 05, by setting the shared parameter of the overall situation message traffic in the internal queues is controlled, and is shared the behavior of parameter influence access module and scheduler module by the overall situation of setting; And the shared parameter of the overall situation that will set is placed in the configurable global parameter database 07.
The configurable overall situation is shared parameter database 07, can write Flow Control module and main control module, and be read-only to access module and scheduler module.The overall situation is shared parameter and is comprised message priority configuration parameter and dispatch scanning weight parameter etc.
During enforcement, the present invention is embedded into will carries out in the main frame of flow control, the present invention starts operation with the main-machine communication program.
Just often, internal queues 04 reports main control module 05 with the mean residence time that internal queues length and message wrap in the internal queues;
Main control module 05 monitoring communications flow, be input buffering section length and time-delay comprehensive parameters, additional CPU occupation rate testing result, have only when communication host and take place when congested, main control module 05 of the present invention detects internal queues or the CPU occupation rate is unusual, then notify Flow Control module 06 to share parameter, make whole system enter flow control mode, promptly the communication flows of system is controlled by setting the overall situation.
The described process that the communication flows of system is controlled can comprise following three processes:
1, main control module 05 is shared parameter according to the overall situation of setting message traffic is controlled by Flow Control module 06.
2, main control module 05 is dispatched or by Flow Control module 06 scheduling access module 02, is shared parameter according to the overall situation of setting the message traffic that preparation enters the input block is controlled.
3, main control module 05 is dispatched or by Flow Control module 06 scheduling scheduler module 03, according to setting the shared parameter of the overall situation message traffic in the internal queues is controlled.
As adopt the operating system of single task, with above-mentioned three processes (master control, access and scheduling) serial process.As adopt the multi-task operation system, with above-mentioned three process parallel processings.
Second embodiment that provides at system of the present invention, as shown in Figure 3, the difference of itself and first embodiment is that it does not comprise scheduler module 03 and access module 02.In the process that realizes flow control, only comprise main control module 05 by Flow Control module 06, share the process that parameter is controlled message traffic according to the overall situation of setting.
The 3rd embodiment that provides at system of the present invention, as shown in Figure 4, the difference of itself and first embodiment is that it does not comprise scheduler module 03.In the process that realizes flow control, comprise that main control module 05 is by Flow Control module 06, share the process that parameter is controlled message traffic according to the overall situation of setting, and, main control module 05 scheduling or by Flow Control module 06 scheduling access module 02 is shared the process that parameter is controlled the message traffic of preparing to enter the input block according to the overall situation of setting.
The 4th embodiment that provides at system of the present invention, as shown in Figure 5, the difference of itself and first embodiment is that it does not comprise access module 02.In the process that realizes flow control, comprise that main control module 05 is by Flow Control module 06, share the process that parameter is controlled message traffic according to the overall situation of setting, and, main control module 05 is dispatched or is dispatched scheduler module 03 by Flow Control module 06, according to setting the process that the shared parameter of the overall situation is controlled the message traffic in the internal queues.
A kind of the 5th embodiment that communicates the method for flow control provided by the invention as shown in Figure 6, comprising:
Step S101 obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result.
Step S102 judges that whether described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, and execution in step S103 then; If, execution in step S104 then.
Step S103 removes the Flow Control sign, enters normal operating condition.
Step S104 puts the Flow Control sign, shares the control that parameter communicates flow by the overall situation that is provided with, and continues execution in step S102 then.
In step S104, the described overall situation is shared parameter and is comprised: message priority configuration parameter and/or dispatch scanning weight parameter.In this step, at first read the described overall situation and share parameter; Share parameter according to the described overall situation then and the message traffic in the internal queues of different priorities grade is carried out the flow control of appropriate level.The specific implementation process as shown in Figure 7, comprises the steps:
Step S51 reads the described overall situation and shares parameter;
Step S52 shares parameter according to the described overall situation and judges whether the highest internal queues of priority level is full, if then execution in step S53 promptly carries out urgent flow control, then execution in step S56; Otherwise, execution in step S54;
Step S54 shares parameter according to the described overall situation and judges whether the internal queues beyond the highest internal queues of priority level is full, if then execution in step S55 promptly carries out general flow control; Otherwise execution in step S56 promptly returns step S103, promptly removes the Flow Control sign, enters normal operating condition.
Specifically comprise kind of a situation in the process of carrying out urgent flow control described in the step S53.
First kind of situation, when the message in confirming internal queues is initial message or retry message, only the priority level of described internal queues is adjusted, and the message traffic in this internal queues is controlled according to adjusted priority level according to the message priority configuration parameter of setting.The specific implementation process is as follows:
Step 531 is when the message in confirming internal queues is initial message or retry message, according to the message priority configuration parameter of setting, with the priority level reduction one-level of initial message or retry message.
Step 532, initial message or retry message after according to the priority level order from high to low after descending priority level being descended are dispatched.
Second kind of situation, when the message in confirming internal queues is initial message or retry message, the priority of connecting inner formation is adjusted the dispatch scanning weight parameter of this priority query, according to adjusted dispatch scanning weight parameter the message traffic in this internal queues is controlled then.The specific implementation process is as follows:
Step 533, when the message in confirming internal queues is initial message or retry message, dispatch scanning weight according to the dispatch scanning weight parameter of the setting internal queues that priority level is the highest increases one-level, and the dispatch scanning weight of the internal queues that priority level is minimum reduces one-level.
Step 534 is dispatched described initial message or retry message according to dispatch scanning weight parameter and priority level order from high to low after changing.
The third situation, when the message in confirming internal queues is initial message or retry message, not only adjust the priority of this internal queues, but also the dispatch scanning weight parameter of this internal queues is adjusted, and the message traffic in this internal queues is controlled according to adjusted priority and dispatch scanning weight parameter according to the priority of current internal queues.The specific implementation process is as follows:
Step 535 is when the message in confirming internal queues is initial message or retry message, according to the message priority configuration parameter of setting, with the priority level reduction one-level of initial message; And according to the dispatch scanning weight increase one-level of the dispatch scanning weight parameter of the setting internal queues that priority level is the highest, and the dispatch scanning weight of the internal queues that priority level is minimum reduces one-level;
Step 536, according to the dispatch scanning weight parameter after changing, and initial message or retry message after according to the priority level order from high to low after descending priority level being descended are dispatched;
The 4th kind of situation, when the message in confirming internal queues is initial message, not only adjust the priority of this internal queues, but also to judge further whether described message is the retry initial message, and further adjust the priority of this internal queues according to judged result, according to adjusted priority the message traffic in this internal queues is controlled then.The specific implementation process comprises:
Step 537 is when the message in confirming described internal queues is initial message, then according to the message priority configuration parameter of setting, with the priority level decline one-level of initial message.
Step 538 judges whether the message in the described internal queues is the retry initial message, if then according to the message priority configuration parameter of setting, with the priority level of the initial message one-level that descends again, execution in step 539 then; Otherwise, direct execution in step 540.
Step 539, the retry initial message after according to the priority level order from high to low after descending priority level being descended is dispatched.
Step 540, the initial message after according to the priority level order from high to low after descending priority level being descended is dispatched.
The 5th kind of situation in conjunction with the dispatch scanning weight parameter of adjusting this internal queues, controlled the message traffic in this internal queues on the 4th kind basis.The specific implementation process comprises:
Step 541 is when the message in confirming described internal queues is initial message, then according to the message priority configuration parameter of setting, with the priority level decline one-level of initial message.
Step 542, judge whether the message in the described internal queues is the retry initial message, if, then according to the message priority configuration parameter of setting, with the priority level of the initial message one-level that descends again, and, one-level increased according to the dispatch scanning weight of the dispatch scanning weight parameter of the setting internal queues that priority level is the highest, and the dispatch scanning weight of the internal queues that priority level is minimum reduction one-level, execution in step 543 then; Otherwise, direct execution in step 544.
Step 543, according to the dispatch scanning weight parameter after changing, and the retry initial message after according to the priority level order from high to low after descending priority level being descended is dispatched.
Step 544, according to the dispatch scanning weight parameter after changing, and the initial message after according to the priority level order from high to low after descending priority level being descended is dispatched.
In above-mentioned steps S55, described process of carrying out general flow control specifically comprises:
At first according to the message priority configuration parameter of setting, with the priority level reduction one-level of the retry message in the internal queues; Retry message after according to the priority level order from high to low after descending priority level being descended is then dispatched.
The 6th embodiment at method of the present invention provides as shown in Figure 8, comprising:
Step S201 obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result.
Step S202 judges that whether described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, and execution in step S203 then; If, execution in step S204 then.
Step S203 removes the Flow Control sign, enters normal operating condition.
Step S204 puts the Flow Control sign, shares the control that parameter communicates flow by the overall situation that is provided with.Description among this step and above-mentioned the 5th embodiment is identical, is not described in detail.
Step S205 judges whether message is arranged in the input block, if, execution in step S206 then; Otherwise, execution in step S203, clear stream control sign enters normal operating condition;
Step S206 calls the access module, and the message that preparation is entered described input block is carried out access control, continues execution in step S202 then.
The specific implementation process of step S206 comprises two kinds of situations, and first kind of situation comprises the steps: as shown in Figure 9
21, read a piece of news from the input block, and set the message life cycle of described message;
22, judge according to User Identity whether described message is initial message or retry message, if then execution in step 23, with grade of priority reduction of described initial message or retry message, execution in step 24 then; Otherwise, direct execution in step 24;
24,, judge that whether corresponding internal queues is full, if then execution in step 25, abandons described message according to the priority level of described message; Otherwise execution in step 26 is put into internal queues with described message of carrying message life cycle, and execution in step 27 then;
27, judge whether the dispatch scanning number of times arrives,, finish this process, return step S202 if then execution in step 28; Otherwise, change step 21 over to.
Second kind of situation comprises the steps: as shown in figure 10
31, read a piece of news from the input block, and set the message life cycle of described message;
32, judge according to User Identity whether described message is initial message, if then execution in step 33, the priority that is about to described initial message reduces a grade, and execution in step 34 then; Otherwise, direct execution in step 34;
34, judge according to User Identity whether described message is the retry initial message, if then execution in step 35, the priority that is about to described retry initial message reduces a grade again, and execution in step 36 then; Otherwise direct execution in step 36;
36,, judge whether corresponding internal queues is full, if then execution in step 37, promptly abandons described message, and execution in step 39 then according to the priority level of described message; Otherwise execution in step 38 is about to described message and puts into internal queues, and execution in step 39 then.
39, judge whether the dispatch scanning number of times arrives, if then execution in step 40, finish this process, return step S202; Otherwise, change step 31 over to.
The 7th embodiment at method of the present invention provides as shown in figure 11, comprising:
Step S301 obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result.
Step S302 judges that whether described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, and execution in step S303 then; If, execution in step S304 then.
Step S303 removes the Flow Control sign, enters normal operating condition.
Step S304 puts the Flow Control sign, shares the control that parameter communicates flow by the overall situation that is provided with.Description among this step and above-mentioned the 5th embodiment is identical, is not described in detail.
Step S305 judges whether message is arranged in the internal queues, if, execution in step S306 then; Otherwise execution in step S307, clear stream control sign enters normal operating condition;
Step S306 calls scheduler module, by the dispatch scanning weight parameter of different priorities formation setting is dispatched processing, continues execution in step S302 then.
Call scheduler module described in the step S306,, as shown in figure 12, specifically comprise by the dispatch scanning weight parameter of different priorities formation setting being dispatched the process of processing:
71, judge whether the message in the internal queues is reached for the message life cycle of its setting,, will directly abandon in the formation internally of described message if then execution in step 72; Otherwise, execution in step 73.
73, according to the weighting dispatching algorithm, according to reading a piece of news in the priority level order formation internally from high to low.
The dispatching algorithm of weighting described in the step 73 specifically comprises:
The internal queues that every wheel scan is all; And,
According to the dispatch scanning weight parameter of setting, whenever take turns scheduling is read from the high internal queues of priority level message number greater than from the low internal queues of priority level, dispatching the message number of reading; And,
Whenever, take turns the message number summation that scheduling is read from all priority internal queues, keep balance with every message number summation of reading in of taking turns from the input block scheduling; And,
If increase the dispatch scanning weight parameter of high priority internal queues, then reduce the dispatch scanning weight parameter of low priority internal queues.
74, judge whether message in the internal queues of this priority dispatches and finish that if then execution in step 75, the message in the internal queues of the priority of next grade is dispatched, execution in step 76 then; Otherwise, change step 71 over to;
76, whether dispatch scanning finishes to judge all priority internal queues, if then execution in step 77, finishes this process, returns step S302; Otherwise, change step 71 over to.
The 8th embodiment at method of the present invention provides as shown in figure 13, comprising:
Step S401 obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result.
Step S402 judges that whether described comprehensive parameters that obtains or described CPU occupation rate testing result data surpass preset threshold, if not, and execution in step S403 then; If, execution in step S404 then.
Step S403 removes the Flow Control sign, enters normal operating condition.
Step S404 puts the Flow Control sign, shares the control that parameter communicates flow by the overall situation that is provided with.Description among this step and above-mentioned the 5th embodiment is identical, is not described in detail.
Step S405 judges whether message is arranged in the input block, if, execution in step S406 then; Otherwise, execution in step S407;
Step S406 promptly calls the access module, and the message that preparation is entered described input block is carried out access control.Description among this step and above-mentioned the 6th embodiment is identical, is not described in detail.
Step S407 judges whether message is arranged in the internal queues, if, execution in step S408 then; Otherwise, execution in step S409, clear stream control sign enters normal operating condition.
Step S408 calls scheduler module, by communicate the control of flow for the dispatch scanning weight parameter of different priorities formation setting, returns step S402 then.Description among this step and above-mentioned the 7th embodiment is identical, is not described in detail.
As seen from the above technical solution provided by the invention, the present invention at first obtains the comprehensive parameters that internal queues length and message wrap in mean residence time in the internal queues, or CPU occupation rate testing result, described when obtaining comprehensive parameters or described CPU occupation rate testing result data and surpassing preset threshold when confirming, share parameter by the overall situation of setting and communicate flow control.The CPU occupation rate that adopts by the present invention and the double check mechanism of buffering time-delay/length, can to the overload situations of system hold more accurate, thereby the assurance system processing power can access effective utilization; And, the present invention can share parameter by the overall situation of setting and communicate flow control, thereby guaranteed that important service obtains priority treatment when system overload, do not solved in the prior art owing to message not added differentiation and directly abandoned the problem that causes system that effective handling rate of message is descended.
The present invention also shares parameter to preparing to enter the message traffic of input block and/or being provided with that message traffic in the internal queues of different priorities is controlled and by being the message life cycle of message sets by the overall situation that is provided with in addition, guaranteed that further important service obtains priority treatment when system overload, system is improved to the effective handling rate of message and the handling rate of efficient message.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.