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 ".
In order to make those skilled in the art more fully understand the technical solution in the embodiment of the present application, below first to this ShenPlease the relevant technologies of Dialog processing that are related to of embodiment, be briefly described.
Referring to Figure 1, Fig. 1 is a kind of networking diagram for SiteServer LBS that one embodiment of the application provides.
SiteServer LBS as shown in Figure 1 includes: load-balancing device (SLB), client (C1, C2, C3), server-side(S1,S2,S3);
Wherein, client is through network as shown in Figure 1, is connected with server-side communication by load-balancing device.
When realizing, the session request of client as shown in Figure 1 to server-side can be forwarded by load-balancing deviceTo the server-side by being selected by load-balancing algorithm.
Such as: the session request from C1 client can be transmitted to server-side S1 by load balancing by SLB;SLB canServer-side S2 will be transmitted to by load balancing from the session request of C2 client;SLB can will be from C3 clientSession request is transmitted to server-side S3 by load balancing.
On the basis of group-network construction illustrated above, the application is directed to one kind, based on cookie and source IP sessionKeep the technical solution of the associated Dialog processing of list item.
When realizing, SiteServer LBS includes load-balancing device, client, server-side;Wherein, the client warpThe load-balancing device is connected communication with the server-side.
Further, load-balancing device receives the first session request for carrying insertion cookie of the client;It creates source IP session corresponding with the insertion cookie of first session request and keeps list item;If receiving the clientThe second session request of insertion cookie is not carried, then list item is kept based on the source IP session, second session is askedIt asks and executes the Dialog processing that corresponding source IP session is kept.
In above scheme, keeps list item associated with source IP session based on cookie, realizes after cookie loss,The request of cookie respective session is forwarded to the server-side of last visit by associated source IP session holding list item, it is therefore prevented that meetingWords are interrupted, and ensure that business continuance.
The application is described below by specific embodiment and in conjunction with specific application scenarios.
Referring to FIG. 2, Fig. 2 is a kind of flow chart for conversation processing method that one embodiment of the application provides, the methodApplied to the load-balancing device in SiteServer LBS, the SiteServer LBS further includes client, server-side;Wherein,The client is connected communication through the load-balancing device with the server-side, and the above method executes following steps:
Step 202, the first session request for carrying insertion cookie for receiving the client.
Step 204, creation source IP session corresponding with the insertion cookie of first session request keep list item.
If step 206, the second session request for not carrying insertion cookie for receiving the client, are based on instituteIt states source IP session and keeps list item, the Dialog processing that corresponding source IP session is kept is executed to second session request.
In the present specification, above-mentioned load-balancing device may include that be integrated with load-balancing function any setsIt is standby.For example, in practical applications, above-mentioned load-balancing device can specifically include interchanger with load-balancing function, roadBy device, firewall, server and load balancer etc..
In the present specification, above-mentioned client, including one or more equipment to initiate a session request to above-mentioned server-side.
For example, above-mentioned client may include wherein one or more combinations in C1, C2, C3 as shown in Figure 1.
In the present specification, above-mentioned server-side, including receive above-mentioned client and initiate a session request and execute corresponding businessOne or more equipment of processing.
For example, above-mentioned server-side may include one of equipment or multiple equipment in S1, S2, S3 as shown in Figure 1Combination.
In the present specification, above-mentioned session request, refer to that above-mentioned client initiates to above-mentioned server-side based on http(HyperText Transfer Protocol, hypertext transfer protocol) or https (Hyper Text TransferProtocol over Secure Socket Layer, Hyper text transfer security protocol) service request message.
For example, shown in Figure 1, above-mentioned session request can be the service request report based on http that C1 is initiated to S1Text is also possible to the service request message based on https that C1 is initiated to S1.
In the present specification, above-mentioned SiteServer LBS, refer to including above-mentioned load-balancing device, above-mentioned client, onState the whole network system of server-side;Wherein, above-mentioned client is connected communication through above-mentioned load-balancing device with above-mentioned server-side.
Such as: shown in Figure 1, above-mentioned SiteServer LBS includes SLB (above-mentioned load-balancing device), above-mentioned clientHold (C1, C2, C3), above-mentioned server-side (S1, S2, S3);Wherein, above-mentioned client is through above-mentioned load-balancing device and above-mentioned serviceEnd, which is connected, to be communicated.
Below by way of specific embodiment, and combine " cookie is associated with list item creation ", " at the session that cookie losesReason ", " Dialog processing that cookie does not lose ", are described in detail the technical solution of the application being related to:
In the present specification, above-mentioned client initiates a session request to above-mentioned server-side;The session request is through above-mentioned loadEqualizing equipment is forwarded to above-mentioned server-side through preset load-balancing algorithm, by the session request, to be directed to by above-mentioned server-sideThe session request executes corresponding business processing.
When realizing, Virtual Service Address that above-mentioned load-balancing device provides above-mentioned client.Above-mentioned client canTo send session request by accessing the Virtual Service Address, above-mentioned load-balancing device, can be with by the Virtual Service AddressThe session request is distributed to above-mentioned server-side.
For example, referring to Figure 1, the Virtual Service Address of SLB as shown in Figure 1 is 100.30.5.1, load-balancing deviceThe Virtual Service Address 100.30.5.1 that SLB provides above-mentioned client (C1, C2, C3).Above-mentioned client can pass through accessThe Virtual Service Address sends session request, and load-balancing device SLB, can be by the session request by the Virtual Service AddressIt is distributed to above-mentioned server-side.
It should be noted that the session request of above-mentioned client to above-mentioned server-side can be combined there are many corresponding, such as:C1-S1,C2-S2,C3-S3;For another example: the session request pair of C1-S2, C2-S3, C3-S1 above-mentioned client and above-mentioned server-sideIt should be related to, be not especially limited in the present note.
In this specification, above-mentioned server-side further executes the session and asks after the session request for receiving above-mentioned clientCorresponding business processing is sought, and by the corresponding conversational response of the session request, above-mentioned client is returned to by above-mentioned load-balancing deviceEnd.
For example, shown in Figure 1, above-mentioned client is S1, above-mentioned client is C1, and S1 is in the session request for receiving C1Afterwards, it further executes the session request and corresponds to business processing, and by the corresponding conversational response of the session request, pass through load balancingEquipment SLB returns to C1.
In this specification, above-mentioned insertion cookie refers to above-mentioned load-balancing device in the meeting for receiving above-mentioned server-sideAfter words response, the server info of above-mentioned server-side is inserted into the cookie of the head designated position of above-mentioned conversational response.
Then above example continues to illustrate, and load-balancing device SLB is receiving session request pair from S1, with C1After the conversational response answered, load-balancing device SLB by the server info of S1 (such as: IP address, the type of server of S1 of S1Deng) in the form of cookie, it is inserted into the head designated position of the conversational response.
In this specification, further, after above-mentioned insertion cookie has been inserted into the conversational response, above-mentioned load is equalThe conversational response is sent to above-mentioned client by the equipment that weighs.
Then above example continues to illustrate, and above-mentioned load-balancing device carries the insertion cookie of the server info of S1It is sent to C1.
In this specification, further, above-mentioned insertion is got from above-mentioned load-balancing device in above-mentioned clientCookie, and it is stored in local, so as to which above-mentioned insertion can be carried when above-mentioned client initiates session request next timeCookie, and parsed by above-mentioned load-balancing device for the insertion cookie in the session request, obtain the insertionLast session in cookie requests corresponding server info, such as: the IP address of S1, thus by above-mentioned load-balancing deviceBy this, session request is forwarded to S1 next time.
In this specification, above-mentioned first session request, refer to above-mentioned client carries the upper of above-mentioned insertion cookieState session request.
Then above example continues to illustrate, and what above-mentioned first session request can be C1 carries above-mentioned insertion cookieThe above-mentioned session request of (the insertion cookie for carrying the server info of S1).
In this specification, above-mentioned load-balancing device receives carry insertion cookie above-mentioned first of above-mentioned clientSession request.
Then above example continues to illustrate, and the above-mentioned insertion cookie that carries that SLB receives C1 (carries the server of S1The insertion cookie of information) session request.
In order to facilitate understanding, " source IP session holding " concept under first introducing here.Under normal conditions, load-balancing device existsWhen making load balancing, the main foundation at corresponding with service end can be distributed as it according to the source IP address of access request;And " source IP meetingWords are kept " refer to, load-balancing device is making load balancing to all access requests of the client from same source IP addressWhen, all access requests of the client can be assigned to same server-side.
When realizing, load-balancing device is based on " source IP session keeps table " execution " source IP session holding " Dialog processing;Wherein, source IP session keeps table to include at least the corresponding clothes distributed of the corresponding source IP address of above-mentioned session request, the session requestBusiness end IP address.
Then above example continues to illustrate, and source IP session keeps the table structure and contents in table of table, refers to shown in table 1:
Table 1
The source IP session that every a line as shown in Table 1 just corresponds in " source IP session keeps table " keeps list item.It is negativeThe target session request that equalizing equipment is C1 to the correspondence client device for being 10.30.5.6 from same source IP address is carried to makeWhen load balancing, all access requests of client device C1 can be assigned to the corresponding with service that IP address is 100.30.5.6End equipment S1.Similarly, as shown in table 1, C2 and S2, C3 and S3 respectively correspond respective source IP session and keep list item.
In the present specification, above-mentioned source IP session keeps list item, refer to above-mentioned load-balancing device be above-mentioned client andThe corresponding table item in " source IP session keeps table " that corresponding with service end is established;Wherein, above-mentioned source IP session keeps list item at least to wrapInclude the IP address of server-side corresponding with above-mentioned client.
Then above example continues to illustrate, and above-mentioned client is C1, then it is such as table 1 that the corresponding source IP session of C1, which keeps list item,The first row shown in, it is 100.30.5.6 (S1 as shown in Figure 1 which, which keeps the IP address of the corresponding server-side of list item,IP address).
Certainly, when realizing, it further includes that the source IP address of above-mentioned client (refers to table that above-mentioned source IP session, which keeps list item," source IP address " field shown in 1).
In this specification, further, after receiving above-mentioned first session request, the creation of above-mentioned load-balancing device withThe corresponding source IP session of the insertion cookie of above-mentioned first session request keeps list item.
Then above example continues to illustrate, and (C1's carries with above-mentioned first session request for load-balancing device SLB creationAbove-mentioned insertion cookie) the corresponding source IP session of insertion cookie (the insertion cookie for carrying the server info of S1) protectList item is held, table is kept with the associated source IP session of insertion cookie, refers to exemplified by table 2:
Table 2
Source IP session holding table as shown in Table 2 is changed on the basis of table 1, and table 2 and the difference of table 1 are,Table 2 increases " association insertion cookie " field compared to table 1, and after increasing the field, every source IP session keeps list item (to correspond to such asA line in table 2) " source IP session keeps list item " as shown in Table 1 can be associated with " insertion cookie ", that is, onStating source IP session keeps list item on the basis of saving the list item of original " source IP session keeps table ", also saves and above-mentioned firstThe corresponding relationship of the insertion cookie of session request.
It should be noted that being based on the load balancing mode of " source IP session keeps table " in existing realization and based on " slottingEnter the load balancing mode of cookie " be it is independent, the two has no to be associated with.And
In the present specification, above-mentioned second session request refers to the above-mentioned client after above-mentioned first session requestThe above-mentioned session request for not carrying above-mentioned insertion cookie.
Then above example continues to illustrate, when the existence for artificially removing cookie information (ensureing user security) or cookiePeriod reaches time restriction or user and closes after system after browser removes cookie automatically, and above-mentioned client is sentThe above-mentioned session request of cookie is not carried, such as: above-mentioned second session request can be the C1's after above-mentioned first requestThe above-mentioned session request of above-mentioned insertion cookie (not carrying the insertion cookie of the server info of S1) is not carried.
In the present specification, further, after above-mentioned client sends above-mentioned second session request, above-mentioned load balancingIf equipment receives above-mentioned second session request of above-mentioned client, list item is kept based on above-mentioned source IP session, to above-mentioned theTwo session requests execute the Dialog processing that corresponding source IP session is kept.
Then above example continues to illustrate, if load-balancing device SLB receives above-mentioned second session request of C1, baseList item is kept in corresponding source IP session as shown in Table 2, corresponding source IP session is executed to above-mentioned second session request and is keptDialog processing.
In a kind of embodiment shown, above-mentioned load-balancing device by above-mentioned second session request be forwarded to it is above-mentionedThe IP address of the corresponding server-side of client.
Then above example continues to illustrate, and above-mentioned second session request of C1 is forwarded to C1 pairs by load-balancing device SLBThe IP address 100.30.5.6 of the server-side S1 answered.
In order to facilitate understanding, under first introducing here " ageing time ", since load-balancing device resource is limited, source IP sessionIt is also limited that source IP session in holding table, which keeps list item number, in general, load-balancing device is protected by setting source IP sessionThe corresponding ageing time of list item is held, it is being more than preset that the corresponding source IP session of the session to realize no message interaction, which keeps list item,After ageing time (namely digestion period), just deletes the source IP session and keep list item.Such as: ageing time is 5 minutes, 5 minutesInterior, 3 source IP sessions as shown in Table 2 keep corresponding 3 sessions of list item without message interaction, then are more than that after five minutes, load is equalWeighing apparatus equipment then deletes 3 source IP sessions and keeps list item.
In the present specification, the expired time of above-mentioned insertion cookie refers to the life cycle of above-mentioned insertion cookie.
When realizing, insertion cookie realizes that there are life cycles as cookie, by cookie.The life of cookieThe expired time of cycle of deposit namely cookie was usually indicated by the value of the Exprire field in cookie, in life cycleInterior cookie is effective, will be automatically left out beyond cookie life cycle;When the value of Exprire is 0 or is empty, then refer toShow when user exits browser (being located in above-mentioned client), cookie will not be saved, to ensure the information security of user.ThanSuch as, the expired time of above-mentioned insertion cookie can be it is expired more than 10 minutes or expired more than 2 hours or expired more than 2 days orIt is expired more than January etc..
In the present specification, above-mentioned second session request to be forwarded to the IP of server-side corresponding with above-mentioned clientBehind location, above-mentioned load-balancing device needs to update the ageing time that above-mentioned source IP session keeps list item.
In a kind of embodiment shown, above-mentioned load-balancing device presses preset strategy, updates above-mentioned source IP session and protectsHold the ageing time of list item;Wherein, above-mentioned ageing time is greater than the expired time of above-mentioned insertion cookie.
Then above example continues to illustrate, it is assumed that and the expired time of above-mentioned insertion cookie is T (time of any length),The then ageing time that the IP session keeps the ageing time of list item to be greater than by preset strategy, such as: the IP session keeps list itemAgeing time be 2T+1.Above-mentioned second session request of C1 is forwarded to the corresponding server-side of C1 in load-balancing device SLBAfter the IP address 100.30.5.6 of S1, load-balancing device SLB updates the corresponding IP session holding table of the session by preset strategyThe ageing time of item (the first row as shown in Table 2) is 2T+1.
In the present specification, above-mentioned third session request refers to the above-mentioned client after above-mentioned first session requestThe above-mentioned session request for carrying above-mentioned insertion cookie.
Then above example continues to illustrate, and above-mentioned third session request can be the C1's after above-mentioned first session requestCarry the above-mentioned session request of above-mentioned insertion cookie (the insertion cookie for carrying the server info of S1).Above-mentioned thirdThe above-mentioned insertion cookie that carries that session request is also possible to the C1 after above-mentioned first session request (carries the service of S2The insertion cookie of device information) above-mentioned session request.
In the present specification, after receiving above-mentioned third session request, above-mentioned load-balancing device can be based on above-mentioned theInsertion cookie in three session requests executes forwarding to above-mentioned third session request.
In a kind of embodiment shown, if above-mentioned load-balancing device receive above-mentioned client carry insertionAbove-mentioned third session request is then forwarded to and insertion cookie corresponding with service end by the above-mentioned third session request of cookieIP address.
Then above example continues to illustrate, and after above-mentioned load-balancing device receives above-mentioned third session request, can incite somebody to actionAbove-mentioned third session request is forwarded to the IP address at the insertion cookie corresponding with service end carried with it.Such as: if above-mentioned thirdThe corresponding insertion cookie of session request is the server info for carrying S1, then load-balancing device SLB is by above-mentioned third meetingWords request can be forwarded to S1 as shown in Figure 1;If the corresponding insertion cookie of above-mentioned third session request is to carry S2'sServer info, then above-mentioned third session request can be forwarded to S2 as shown in Figure 1 by load-balancing device SLB.
In above technical scheme, keep list item associated with source IP session based on cookie, on the one hand, to realizeAfter cookie loses, the request of cookie respective session is forwarded to the clothes of last visit by associated source IP session holding list itemBusiness end, it is therefore prevented that conversation ensure that business continuance;On the other hand, realizing load-balancing device can support simultaneouslyBased on cookie and based on the session request forwarding that source IP session is kept, overcomes in existing scheme while can only support to be based onThe forwarding of cookie session request or the session request forwarding kept based on source IP session.
Fig. 3 is a kind of block diagram for Dialog processing device that one exemplary embodiment of the application provides.Implement with the above methodExample is corresponding, and present invention also provides a kind of embodiment of Dialog processing device, described device is applied in SiteServer LBSLoad-balancing device, the SiteServer LBS further includes client, server-side;Wherein, the client is through the loadEqualizing equipment is connected communication with the server-side, please refers to a kind of Dialog processing device 30, described device packet exemplified by Fig. 3It includes:
Receiving module 301 receives the first session request for carrying insertion cookie of the client;
Creation module 302 creates source IP session corresponding with the insertion cookie of first session request and keeps list item;
Dialog processing module 303, if receiving the second session request for not carrying insertion cookie of the client,List item is then kept based on the source IP session, second session request is executed at the session that corresponding source IP session is keptReason.
In the present embodiment, the source IP session keeps list item including at least the IP of server-side corresponding with the clientAddress, the Dialog processing module 303 further,
Second session request is forwarded to the IP address of server-side corresponding with the client.
In the present embodiment, the Dialog processing module 303 further,
By preset strategy, the ageing time that the source IP session keeps list item is updated;Wherein, the ageing time is greater than instituteState the expired time of insertion cookie.
In the present embodiment, the Dialog processing module 303 further,
If receiving the third session request for carrying insertion cookie of the client, the third session is askedSeek the IP address being forwarded to insertion cookie corresponding with service end.
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 module of explanation may or may not be physically separated, and the component shown as module can be or can also be withIt is not physical module, it can it is in one place, or may be distributed on multiple network modules.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.
System, device, module or the module that above-described embodiment illustrates can specifically realize by computer chip or entity,Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer canTo be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media playIn device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipmentThe combination of any several equipment.
The embodiment of the Dialog processing device of the application can be using on electronic equipment shown in Fig. 4.Installation practiceIt can also be realized by way of hardware or software and hardware combining by software realization.Taking software implementation as an example, as oneDevice on a logical meaning is by the processor of electronic equipment where it by calculating corresponding in machine readable storage mediumMachine program instruction runs the machine-executable instruction of formation after reading.For hardware view, as shown in figure 4, for the application'sA kind of hardware structure diagram of electronic equipment where Dialog processing device, in addition to processor shown in Fig. 4, communication interface, bus withAnd except machine readable storage medium, the practical function of electronic equipment in embodiment where device generally according to the electronic equipmentCan, it can also include other hardware, this is repeated no more.
Accordingly, it the embodiment of the present application also provides the hardware configuration of a kind of electronic equipment of Fig. 3 shown device, refers toFig. 4, Fig. 4 are the hardware structural diagram of a kind of electronic equipment provided by the embodiments of the present application.The equipment includes: communication interface401, processor 402, machine readable storage medium 403 and bus 404;Wherein, communication interface 401, processor 402, machine canIt reads storage medium 403 and mutual communication is completed by bus 404.Wherein, communication interface 401, for carrying out network communication.PlaceReason device 402 can be a central processing unit (CPU), and processor 402 can execute to be stored in machine readable storage medium 403Machine readable instructions, to realize process as described above.
Machine readable storage medium 403 referred to herein can be any electronics, magnetism, optics or other physical storesDevice may include or store information, such as executable instruction, data, etc..For example, machine readable storage medium may is that easilyLose memory, nonvolatile memory or similar storage medium.Specifically, machine readable storage medium 403 can be RAM(Radom Access Memory, random access memory), flash memory, memory driver (such as hard disk drive), solid state hard disk,Any kind of storage dish (such as CD, DVD) perhaps similar storage medium or their combination.
So far, hardware configuration description shown in Fig. 4 is completed.
In addition, the embodiment of the present application also provides a kind of machine readable storage medium including machine-executable instruction, exampleSuch as the machine-readable readable storage medium storing program for executing 403 in Fig. 4, the machine-executable instruction can be by Dialog processing deviceDevice 402 is managed to execute to realize data processing method described above.
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.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the applicationIts embodiment.This application is intended to cover any variations, uses, or adaptations of the application, these modifications, purposes orPerson's adaptive change follows the general principle of the application and including the undocumented common knowledge in the art of the applicationOr conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the application are by followingClaim is pointed out.
It should be understood that the application is not limited to the precise structure that has been described above and shown in the drawings, andAnd various modifications and changes may be made without departing from the scope thereof.Scope of the present application is only limited by the accompanying claims.
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.