Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related toWhen attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodimentDescribed in embodiment do not represent all embodiments consistent with the application.On the contrary, they be only with it is such as appendedThe example of the consistent device and method of some aspects be described in detail in claims, the application.
It is only to be not intended to be limiting the application merely for for the purpose of describing particular embodiments in term used in this application.It is also intended in the application and the "an" of singular used in the attached claims, " described " and "the" including majorityForm, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to and wrapsIt may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the applicationA little information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other out.For example, not departing fromIn the case where the application range, the first information can also be referred to as the second information, and similarly, the second information can also be referred to asOne information.Depending on context, word as used in this " if " can be construed to " ... when " or " when ...When " or " in response to determination ".
Fig. 1 is the schematic diagram of a scenario of the method for the illustrative control server of the application one shutdown.In this schematic diagram, it there is no harm inAssuming that: when load-balancing device 12 receives the shutdown command to shut down for server to be shut down, clothes to be shut downBusiness device is carrying out the business 1 that client device 11 is requested, and the business 1 must be complete with session 1, session 2 and session 3At.It will be appreciated by those skilled in the art that being several request messages that above-mentioned each session can be sent by client device 11Composition, if server to be shut down directly shut down at this time, which will cannot reprocess what client device 11 was sentAny request, eventually leading to the business 1 that client device 11 is requested can not normally complete.
For this problem, the soft-off mechanism that the prior art provides can execute currently in above-mentioned server to be shut downAfter session, then server shutdown to be shut down is controlled, at the same time, for other sessions in the business, is then calculated according to schedulingMethod is dispatched to the server of normal work, or directly carries out packet loss processing.Specifically, it is directed to former processing method,If in the business 1 that client device 11 is requested, the target of session 1 is to be added to the authentication information of client device 11Server to be shut down, and the target of session 2 is to pass through the authentication of the server based on above-mentioned authentication information, and obtaining shouldVideo data on server, then the soft-off mechanism provided according to the prior art, load-balancing device can be in clothes to be shut downBusiness device controls server completion shutdown to be shut down after having handled session 1, and is dispatched to session 2 normally according to dispatching algorithmThe server of work, still, since the authentication of client device 11 is not stored in advance for the server of the normal workInformation can not normally complete so the video data needed for it can not be provided for client device 11 so as to cause business 1.
In view of this, what will not be handled the server appoints to guarantee when executing power-off operation to certain serverWhat business has any impact, and this application provides a kind of methods of control server shutdown.This method is by for each businessIt introduces session and keeps list item, and the real-time monitoring session keeps whether the aging duration of list item reaches preset threshold, it can be determined thatWhether the corresponding business of the list item is also executing out.Compared with the prior art only using the completion of current sessions as completion shutdownFor judgment criteria, the application ability control server can shut down after the complete current all business of server process to be shut down,To when the business needs to complete with multiple sessions, realize all conversation dispatchings of the business to same serviceDevice, and finally guarantee normally completing for the business.It should be pointed out that above-mentioned session keeps the aging duration of list item to refer to from thisList item last time is interviewed to be asked, the duration passed through.Above-mentioned server to be shut down may be to carry on certain serverOne specific service.
In order to make those skilled in the art more fully understand the technical solution in the embodiment of the present application, and keep the application realThe above objects, features, and advantages for applying example can be more obvious and easy to understand, with reference to the accompanying drawing to technical side in the embodiment of the present applicationCase is described in further detail.
Referring to fig. 2, Fig. 2 is a kind of one embodiment flow chart of the method for control server shutdown of the application, the processFigure may comprise steps of:
Step 201: load-balancing device receives shutdown command, which carries the mark letter of server to be shut downBreath.
In the present embodiment, the shutdown command that load-balancing device receives can be given birth to by network management personnel's manual configurationAt can also carry in the message of server transmission to be shut down.The identification information of server can interconnect between networkThe agreement address (IP:Internet Protocol Address) and media access control (MAC:Media AccessControl) address etc..
Step 202: load-balancing device is kept in table in preconfigured session, determines that record has server to be shut downThe session of identification information keeps list item.
In the present embodiment, each list item in session holding table has recorded the mark and tune of one group of client device respectivelySpend the corresponding relationship of server identification, for describing a business between the client device and the dispatch server, and everySecondary business operation can be triggered to the access behavior with the business corresponding table item.Wherein the mark of client device can be the visitorThe IP address of family end equipment.
Step 203: load-balancing device keeps list item for identified session, and the real-time monitoring list item is from for the last timeInterviewed to ask, whether the duration passed through reaches preset threshold, and server shutdown to be shut down is controlled if reaching.
In the present embodiment, load-balancing device keeps list item for identified session, the list item of institute's real-time monitoring fromLast time is interviewed to be asked, and the duration passed through is the aging duration of the list item, when the aging duration of the list item reaches defaultWhen threshold value, it is believed that the operation of business corresponding to the list item does not access the list item in one section of duration, that is, has shown the businessThrough completing.
As a preferred embodiment, if load-balancing device judges the list item, corresponding aging duration not yet reachesTo preset threshold, then it is assumed that the corresponding business of the list item is still executing, at this point, load-balancing device is receiving client deviceWhen the message of the correspondence of the transmission business, it will continue to the corresponding dispatching message of the business to server to be shut down, to guaranteeThe client device business smoothly completes.
Load-balancing device keeps list item by the corresponding session of a certain business of real-time monitoring it can be seen from the above processIt is asked from last time is interviewed, whether the duration passed through reaches preset threshold, can determine that the corresponding operation of the business isIt is no also to keep list item in access session, to judge whether the business is also executing.Compared with the prior art only current meetingFor the completion of words is as the judgment criteria for completing shutdown, the application can be in the complete current all industry of server process to be shut downAbility control server is shut down after business, to realize when the business needs to complete with multiple sessions by all of the businessConversation dispatching finally guarantees normally completing for the business to same server.
Present invention also provides a kind of another embodiments of the method for control server shutdown.Implement with above methodUnlike example, present embodiment assumes that: when load-balancing device receives the shutdown command of server to be shut down, this is to be shut downServer is carrying out business 1, and the business 1 is completed with three sessions, these three sessions be respectively session 1, session 2 withAnd session 3, the present embodiment will be described in detail below:
Load-balancing device receives shutdown command, which carries the identification information of server to be shut down.
In the present embodiment, the identification information of the shutdown command and server that receive about load-balancing device has existedIt is described in detail in step 201, details are not described herein.
Load-balancing device is kept in table in preconfigured session, determines that record has the identification information of server to be shut downSession keep list item.
In the present embodiment, the content recorded in list item and session is kept to keep the relationship of list item and business about sessionIt is described in detail in step 202, details are not described herein.
As a preferred embodiment, it is assumed that the identification information of server to be shut down is the IP address of the server8.8.8.8, the identification information for sending the client device of service message is the IP address 1.1.1.1 of the client device, thenRecord has the session of server identification information to be shut down to keep list item that can be expressed as form as shown in Figure 4, which keepsList item describes a business between client device 1.1.1.1 and server 8.8.8.8 to be shut down, is denoted as business 1.
Load-balancing device keeps list item for identified session, and whether the aging duration of the real-time monitoring list item reachesPreset threshold controls server shutdown to be shut down if reaching.
In the present embodiment, which can be 300 seconds, then load-balancing device can set one according to practical applicationA cycle monitoring timer simultaneously sets the monitoring cycle of the timer as 15 seconds, i.e., was a minimum monitoring cycle with 15 seconds, realWhen monitor the aging duration of the list item and whether reach above-mentioned 300 seconds preset thresholds, service to be shut down is controlled if reachingDevice shutdown.It should be pointed out that any one business operation of business 1, which can all be hit, to be determined in the implementation procedure of business 1Session keep list item, at this point, the aging duration of the list item can be reset to 0 second by load-balancing device, for entire industryTime enough is reserved in the completion of business 1.Wherein, the business operation of business 1 can be specially to send business to load-balanced serverMessage or conversation establishing message etc., these messages carry message identification, to keep the client in list item to set with sessionStandby mark or session identification are matched, and think that the business operation has hit the session and kept list item in successful match.Wherein, it will be illustrated in the following embodiments about the matched content of mark, details are not described herein.Further, above-mentionedConversation establishing message can be transmission control protocol (TCP:Transmission Control Protocol) negotiation packet, useTo establish TCP connection with target dispatch server, in this case, the service message that client device is sent generally can be superText transfer protocol (HTTP:Hyper Text Transfer Protocol) message, but due to the specific behaviour of business executionMake not within the scope of the application, so being no longer described in detail.
Referring to Fig. 3, as a preferred embodiment, if the default threshold of the list item has not yet been reached in above-mentioned aging durationValue, load-balancing device can execute the content as described in step 331 to step 334:
Step 331: load-balancing device, which judges whether to receive, hits the message that identified session keeps list item, ifIt is then to reset the session to keep the aging duration of list item, and execute step 332.
As a preferred embodiment, for ease of description, might as well assume herein the message be by IP address be 1.1.1.1Client device send.At this point, load-balancing device will keep list item to reset aging for above-mentioned identified sessionDuration, and real-time monitoring is carried out to the aging duration of the list item.Specifically, load-balancing device can be protected in following access sessionsWhile holding list item, the aging duration of the list item is reset, the present embodiment does not carry out the specific reset time of the aging durationStringent limitation.
Step 332: load-balancing device accesses identified session and keeps list item, and judges that identified session keeps tableIt whether there is existing session in, so that the session identification of the existing session and the message identification of the message match, if so,Then follow the steps 333, it is no to then follow the steps 334.
In the present embodiment, message identification can be the message five-tuple information, then then above preferred embodiment, fiveIt can be end that source IP in tuple information, which is 1.1.1.1, destination IP 8.8.8.8, source port can be port 1, destination portMouth 2, agreement can be Transmission Control Protocol, then referring to fig. 4 it is found that the session identification of the message identification of the message and session 2 in business 1Match.
Step 333: load-balancing device by the message received according to existing conversation dispatching to server to be shut down, andWhen above-mentioned aging duration reaches the preset threshold of determined list item, server shutdown to be shut down is controlled.
Step 334: load-balancing device creates session, and according to the session that is created by the dispatching message received toThe server of shutdown.
In the present embodiment, load-balancing device can create one by establishing TCP connection with server to be shut downNew session, and the session new according to this is by the dispatching message received to server to be shut down.
At the same time, the message identification of the message can be determined as the session identification of created session by load-balancing device,And the session identification of created session is recorded to identified session and is kept in list item, for future use.Specifically, reference can be made to figureThe session identification of the part that dotted line is chosen in 4, i.e., above-mentioned newly-built session can be the five-tuple information of the message received, i.e. sourceIP is 1.1.1.1, destination IP 8.8.8.8, source port are port 2, destination port is port 1, agreement is Transmission Control Protocol.
In the present embodiment, load-balancing device can pass through the five-tuple information of the message sent to above-mentioned client deviceIt is analyzed, to determine whether needing to create new session with target dispatch server.Specifically, if any in five-tupleWhen element changes, then a new session can be created, to be distinguished with a upper session, and the business be guaranteed with thisOrderly progress.
It is kept in table in load-balancing device in preconfigured session if being pointed out that, determines that record needs to be closedThe session of the identification information of machine server keeps identified session in list item to keep list item more than one, then shows to be shut downServer is still executing multiple business, the corresponding business of each list item.Such case exists, and load-balancing device can be for institute reallyAny one fixed session keeps list item, and whether the aging duration of the real-time monitoring list item reaches preset threshold, if reachingThe list item is deleted from session holding table, and so on, and session in session holding table keeps list item number when being zero,Control server shutdown to be shut down.
As can be seen from the above embodiments, load-balancing device keeps table by the corresponding session of a certain business of real-time monitoringItem is asked from last time is interviewed, and whether the duration passed through reaches preset threshold, can determine the corresponding operation of the businessWhether list item also is kept in access session, to judge whether the business is also executing.Compared with the prior art only currentFor the completion of session is as the judgment criteria for completing shutdown, the application can own server process to be shut down is complete currentAbility control server is shut down after business, to realize when the business needs to complete with multiple sessions by the institute of the businessThere is conversation dispatching to same server, and finally guarantees normally completing for the business.
Corresponding with a kind of aforementioned embodiment of method of control server shutdown, present invention also provides a kind of control clothesThe embodiment of the device of business device shutdown.
A kind of embodiment of the device of control server shutdown of the application can be applied on load-balancing device.Device is realApplying example can also be realized by software realization by way of hardware or software and hardware combining.Taking software implementation as an example, makeFor the device on a logical meaning, being will be right in nonvolatile memory by the processor on load-balancing device where itThe computer program instructions answered are read into memory what operation was formed.
It is a kind of a kind of structural schematic diagram of the device of control server shutdown of the application referring to Fig. 5, Fig. 5, which answersIt may include: instruction receiving unit 510, list item determination unit 520, shutdown control unit 530 for load-balancing device.
Wherein, instruction receiving unit 510, for receiving shutdown command, which carries the mark of server to be shut downKnow information;
List item determination unit 520 determines that record has server to be shut down for keeping in table in preconfigured sessionThe session of identification information keeps list item;Each list item in the session holding table has recorded the mark of one group of client device respectivelyKnow and dispatch server mark corresponding relationship, for describing the Xiang Ye between the client device and the dispatch serverBusiness, and business operation can be triggered to the access behavior with the business corresponding table item every time;
Shutdown control unit 530, for keeping list item for identified session, the real-time monitoring list item is from for the last timeInterviewed to ask, whether the duration passed through reaches preset threshold, and server shutdown to be shut down is controlled if reaching.
In a kind of specific embodiment of the application, each single item is present between client device and dispatch serverBusiness is made of at least one session;Above-mentioned session keeps each list item in table, is also recorded: forming the list item and correspond to industryThe session identification of the existing session of business, message identification of the session identification for being carried in matching message, above-mentioned apparatus further include:List item access unit, existing conversation dispatching unit, newly-built conversation dispatching unit.
Wherein, list item access unit, for keeping list item for identified session, the real-time monitoring list item is from lastPrimary be interviewed asks, and during whether the duration passed through reaches preset threshold, and sends receiving client deviceMessage when, access determined by session keep list item, and judge identified session keep list item in whether there is it is existingThe session identification of session, so that the message identification that the session identification of the existing session is carried with message matches;
Existing conversation dispatching unit is used in the presence of existing session, directly by above-mentioned message according to existing conversation dispatchingTo server to be shut down;
Newly-built conversation dispatching unit, in the absence of existing session, creating session, and will according to the session createdAbove-mentioned dispatching message is to server to be shut down.
In a kind of specific embodiment of the application, above-mentioned newly-built conversation dispatching unit be can be also used for messageMessage identification is determined as the session identification of created session;The session identification of created session is recorded to identified session and is protectedHold list item.
In a kind of specific embodiment of the application, above-mentioned message identification can be the five-tuple information of the message, packetInclude source IP address, purpose IP address, source port, destination port and transport protocol;
The mark of above-mentioned client device can be the IP address of the client device.
In a kind of specific embodiment of the application, above-mentioned shutdown control unit 530 may include: duration monitoringUnit 531, list item delete subelement 532, shutdown control subelement 533, specific as shown in Figure 6.
Wherein, duration monitors subelement 531, for keeping list item, real-time monitoring for identified any one sessionThe list item is asked from last time is interviewed, and whether the duration passed through reaches preset threshold;
List item deletes subelement 532, for when above-mentioned duration reaches above-mentioned preset threshold, by the list item from above-mentioned sessionIt is deleted in holding table;
Shutdown control subelement 533, in session holding table session keep list item number be zero when, control wait closeThe server of machine shuts down.
It can be seen that load-balancing device from apparatus above embodiment to protect by the corresponding session of a certain business of real-time monitoringIt holds list item to ask from last time is interviewed, whether the duration passed through reaches preset threshold, can determine that the business is correspondingWhether operation also keeps list item in access session, to judge whether the business is also executing.Compared with the prior art onlyFor the completion of current sessions is as the judgment criteria for completing shutdown, the application can be complete currently in server process to be shut downAbility control server is shut down after all business, to realize when the business needs to complete with multiple sessions by the businessAll conversation dispatchings to same server, and finally guarantee normally completing for the business.
The function of each unit and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatusRealization process, details are not described herein.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method realityApply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unitThe unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be withIt is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actualThe purpose for needing to select some or all of the modules therein to realize application scheme.Those of ordinary skill in the art are not payingOut in the case where creative work, it can understand and implement.
The foregoing is merely the preferred embodiments of the application, not to limit the application, all essences in the applicationWithin mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the application protection.