CN107733995A - A kind of session keeping method, device and electronic equipment - Google Patents

A kind of session keeping method, device and electronic equipment Download PDF

Info

Publication number
CN107733995A
CN107733995A CN201710861038.1A CN201710861038A CN107733995A CN 107733995 A CN107733995 A CN 107733995A CN 201710861038 A CN201710861038 A CN 201710861038A CN 107733995 A CN107733995 A CN 107733995A
Authority
CN
China
Prior art keywords
server
access request
parameter
parameter value
holding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710861038.1A
Other languages
Chinese (zh)
Inventor
王静
窦志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xin'an Century Polytron Technologies Inc
Original Assignee
Beijing Xin'an Century Polytron Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xin'an Century Polytron Technologies Inc filed Critical Beijing Xin'an Century Polytron Technologies Inc
Priority to CN201710861038.1A priority Critical patent/CN107733995A/en
Publication of CN107733995A publication Critical patent/CN107733995A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of session keeping method, device and electronic equipment, methods described, including:The access request that client is sent is received, the parameter for the holding that is used to indicating needing conversating is included in the access request;Extraction is described be used to indicating needing conversating holding parameter parameter value;And according to the parameter value of storage and the corresponding relation of server identification, it is determined that server identification corresponding to the parameter value extracted;And the access request is transmitted to server corresponding to the server identification determined, the access request is handled by the server.Handled it is possible thereby to realize the access request for carrying same parameters value being transmitted to same server, session holding can be achieved without being handled access request, flow is simple.

Description

A kind of session keeping method, device and electronic equipment
Technical field
The present invention relates to field of computer technology, more particularly to a kind of session keeping method, device and electronic equipment.
Background technology
Session keeps referring to there is a kind of mechanism on load-balancing device, same for ensureing while load balancing is made The access request that one user is associated is assigned on same server.For example, during shopping on the web, from login → clap eastern West → addition address → payment, this all a series of operating process should all be completed by same server, and can not be born Balancing equipment is carried to be assigned on different servers.Therefore, it is necessary to keep technology by session to ensure to need what session was kept The HTTP request message of client is assigned on same server and handled, to ensure the integrality and security of communication.
Existing session keeping method, when client is sent to some website asks for the first time, WEB (webpage) server Determine whether it is to ask for the first time, keep identifying and being saved in internal memory if it is, WEB server understands oneself generation one In.Then when to browser feedback response result, the holding mark of generation is carried client is fed back in head response.Visitor Family end receives to obtain from head response and keeps identifying and preserving.Treat the transmission request that client triggers in subsequently received user When, the holding mark can be encapsulated into request cookie, so that WEB server keeps mark determination should according to the session The session for asking to have established.That is when carrying out holding session, client is needed in the request cookie asked every time Middle addition keeps mark.
In existing session keeping method, the holding that conversated by the way of cookie is, it is necessary to will keep mark to add Into request cookie, that is to say, that need the request to transmission to handle, flow is cumbersome;It is in addition, disabled in cookie Scene in, client can not by keep mark be added to request cookie in, also can not just realize session keep.
Therefore, how to realize that session is kept, reduce session and keep handling process, and how in field disabled cookie It is one of technical problem urgently to be resolved hurrily to realize that session is kept under scape.
The content of the invention
The embodiment of the present invention provides a kind of session keeping method, device and electronic equipment, to solve in the prior art Words keep handling process complicated and how to realize that session is kept under the disabled scenes of cookie.
In a first aspect, the embodiment of the present invention provides a kind of session keeping method, including:
The access request that client is sent is received, is included in the access request and is used to indicate to need the holding that conversates Parameter;
Extraction is described be used to indicating needing conversating holding parameter parameter value;And
According to the parameter value of storage and the corresponding relation of server identification, it is determined that being taken corresponding to the parameter value extracted Business device mark;And
The access request is transmitted to server corresponding to the server identification determined, by the server pair The access request is handled.
It is preferred that methods described, in addition to:
If not extracting the parameter value of the parameter for the holding that indicates to need to conversate, the access request is forwarded To any server, trigger the server and the parameter in the access request is being assigned after receiving the access request Value, and processing is carried out to the access request and is met with a response result, and the parameter value that assignment is obtained is carried in the response As a result in and feed back;
The response results of server transmission are received, and extract the parameter value;And
The server identification of the server is determined, and is established between the server identification of the parameter value and the server Corresponding relation;And
The response results are transmitted to the client.
It is preferred that the parameter for being used to indicate to need to conversate holding determines in accordance with the following methods:
Several characters, or the unified resource from the access request are chosen from the request body of the access request Several characters are chosen in Locator URL address;
Several characters described in selection are defined as the parameter for the holding that indicates to need to conversate.
Preferably, the server identification includes server internet protocol IP address and the port numbers of server.
Second aspect, the embodiment of the present invention provide a kind of session holding meanss, including:
Receiving unit, for receiving the access request of client transmission, included in the access request and be used to indicate to need Conversate the parameter of holding;
Extraction unit, the parameter value of the parameter for extracting the holding that is used to indicating needing conversating;
Determining unit, for the parameter value and the corresponding relation of server identification according to storage, it is determined that extracts is described Server identification corresponding to parameter value;
First retransmission unit, for the access request to be transmitted to service corresponding to the server identification determined Device, the access request is handled by the server.
It is preferred that described device, in addition to:
Second retransmission unit, if not extracting the parameter for the holding that indicates to need to conversate for the extraction unit Parameter value, then the access request is transmitted to any server, triggers the server after the access request is received Assignment is carried out to the parameter in the access request, and processing is carried out to the access request and is met with a response result, and will be assigned The parameter value being worth to is carried in the response results and fed back;
Second receiving unit, for receiving the response results of server transmission, and extract the parameter value;
Unit is established, for determining the server identification of the server, and establishes the clothes of the parameter value and the server Corresponding relation between device mark of being engaged in;
3rd retransmission unit, for the response results to be transmitted into the client.
It is preferred that the parameter for being used to indicate to need to conversate holding determines in accordance with the following methods:From described Choose several characters in the request body of access request, or from the uniform resource position mark URL address of the access request Middle several characters of selection;Several characters described in selection are defined as the parameter for the holding that indicates to need to conversate.
Preferably, the server identification includes server internet protocol IP address and the port numbers of server.
The third aspect, the embodiment of the present invention provide a kind of nonvolatile computer storage media, and being stored with computer can hold Row instruction, the computer executable instructions are used for the session keeping method for performing the application offer.
Fourth aspect, the embodiment of the present invention provide a kind of electronic equipment, including:
At least one processor;And
The memory being connected with least one processor communication;Wherein,
The memory storage has can be by the instruction of at least one computing device, and the instruction is by described at least one Individual computing device, so that at least one processor is able to carry out the session keeping method of the application offer.
Beneficial effect of the present invention:
The embodiment of the present invention provides a kind of session keeping method, device and electronic equipment, receives what client was sent first Access request, the parameter for the holding that is used to indicating needing conversating is included in the access request;Then extraction is described is used to refer to Show needs conversate holding parameter parameter value;And according to the parameter value of storage and the corresponding relation of server identification, really Surely server identification corresponding to the parameter value extracted;Then the access request is transmitted to the service determined Server corresponding to device mark, is handled the access request by the server.It is possible thereby to realizing will carry together The access request of one parameter value is transmitted to same server and handled, and meeting can be achieved without being handled access request Words are kept, and flow is simple;In addition, session keeping method provided by the invention, is used to indicate using including in the access request The parameter value of parameter of holding of needing to conversate realizes that session is kept, rather than what is used in the prior art will keep mark envelope Realize that session is kept in request cookie, so method provided by the invention can be applied in field disabled cookie Jing Zhong, solve the problems, such as not realizing that session is kept under the disabled scenes of cookie in the prior art.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification Obtain it is clear that or being understood by implementing the present invention.The purpose of the present invention and other advantages can be by the explanations write Specifically noted structure is realized and obtained in book, claims and accompanying drawing.
Brief description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, forms the part of the present invention, this hair Bright schematic description and description is used to explain the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 a are the schematic flow sheet for the session keeping method that the embodiment of the present invention one provides;
Fig. 1 b are that server is handled the access request in the session keeping method that the embodiment of the present invention one provides Schematic flow sheet;
Fig. 2 is the schematic flow sheet for the session keeping method that the embodiment of the present invention two provides;
Fig. 3 is the structural representation for the session holding meanss that the embodiment of the present invention three provides;
Fig. 4 is the hardware architecture diagram of the electronic equipment for the implementation session keeping method that the embodiment of the present invention five provides.
Embodiment
The embodiment of the present invention provides a kind of session keeping method, device and electronic equipment, receives what client was sent first Access request, the parameter for the holding that is used to indicating needing conversating is included in the access request;Then extraction is described is used to refer to Show needs conversate holding parameter parameter value;And according to the parameter value of storage and the corresponding relation of server identification, really Surely server identification corresponding to the parameter value extracted;Then the access request is transmitted to the service determined Server corresponding to device mark, is handled the access request by the server.It is possible thereby to realizing will carry together The access request of one parameter value is transmitted to same server and handled, and meeting can be achieved without being handled access request Words are kept, and flow is simple;In addition, session keeping method provided by the invention, is used to indicate using including in the access request The parameter value of parameter of holding of needing to conversate realizes that session is kept, rather than what is used in the prior art will keep mark envelope Realize that session is kept in request cookie, so method provided by the invention can be applied in field disabled cookie Jing Zhong, solve the problems, such as not realizing that session is kept under the disabled scenes of cookie in the prior art.
The implementation process of session keeping method provided in an embodiment of the present invention approximately as:To utilize certain shopping client, Such as do shopping exemplified by APP (Application, using) places an order and illustrate, when user utilizes single under the shopping client, Yong Hu Purchase can be clicked on during selected purchase product, sends a purchase request equivalent to load-balancing device, load-balancing device connects After receiving purchase request, due to appointing the parameter for the holding that conversates with client, then load-balancing device The parameter value of the parameter for the holding that indicates to need to conversate directly is extracted from the request, if extracting the parameter value, Then by the parameter value being locally stored and the corresponding relation of server identification, server identification corresponding to the parameter value is determined, then Forward the request to server corresponding to the server identification determined.Purchase request is handled by the server, and Response results are fed back into load-balancing device, then the shopping client is transmitted to by load-balancing device.The shopping visitor of user Family end, which can be switched to, has clapped to obtain commodity interface, and this interface needs user to add address, equal equivalent to load when adding address The equipment that weighs sends addition Address requests.After load-balancing device receives the request, due to keeping the parameter value of parameter can be automatic Carried in Address requests are added, therefore, load-balancing device can equally extract described after addition Address requests are received Parameter value, server identification corresponding to the parameter value is then found again, and the addition Address requests are transmitted to processing purchase Buy the server of request.After the server process request, the response results of the request are fed back into load-balancing device, then by Load-balancing device is transmitted to shopping client, can show that successful interface, Ran Houyong are added in address on client end interface of doing shopping Family can is clicked on and paid, and request is paid equivalent to being sent to load-balancing device, this lookup service of load-balancing device The process that the process of device searched server with last time is similar, will not be repeated here.Load-balancing device finds above-mentioned same service After device, request will be paid and be transmitted to the server, payment request is handled by the server and fed back to result Load-balancing device, then shopping client is transmitted to by load-balancing device, shopping client, which can be shown, to be paid successfully or pays Failure printed words, thus realize that the request for the holding that needs to conversate is sent into same server is handled using parameter value.
In addition, if load-balancing device is upon receipt of the purchase request, does not extract and described be used for instruction and need to carry out The parameter value for the parameter that session is kept, then the purchase request is transmitted to any server and handled, the server is being located Can meet with a response result when managing purchase request.Due to it is provided in an embodiment of the present invention be used for conversate holding parameter be from Buy what is chosen in the request body or URL addresses of request, for the server after purchase request is received, handling the purchase please Assignment can be carried out to the parameter, the parameter value carrying that assignment obtains then is fed back into load balancing in response results sets when asking Standby, load-balancing device extracts the parameter value that the assignment obtains after the response results are received from the response results. Because server had registered the server identification for identification server on load-balancing device in advance, therefore, load is equal Weighing apparatus equipment can establish the corresponding relation of the parameter value that the assignment obtains and server identification, then deposit the corresponding relation Store up session to keep in list, while the response results of server feedback are transmitted to shopping client, so that shopping client Send addition Address requests next time, the parameter value of the parameter for the holding that is used to indicating needing to conversate directly carried in the request, Thus load-balancing device can extract the parameter value and find server identification corresponding to the parameter value, and then this is added Address requests are added to be transmitted to server corresponding to the server identification, the server and the server of last time processing purchase request To be same, realize that session is kept with this.Further, since the parameter value for the parameter for the holding that indicates to need to conversate be from Extract, be not also just placed in request cookie in request body or URL addresses, therefore method provided by the invention can be with Realize that session is kept under the disabled scenes of cookie.
The preferred embodiments of the present invention are illustrated below in conjunction with Figure of description, it will be appreciated that described herein Preferred embodiment is merely to illustrate and explain the present invention, and is not intended to limit the present invention, and in the case where not conflicting, this hair The feature in embodiment and embodiment in bright can be mutually combined.
Embodiment one
As shown in Figure 1a, for the embodiment of the present invention one provide session keeping method schematic flow sheet, can include with Lower step:
S11, receive the access request that client is sent.
Wherein, the parameter for the holding that is used to indicating needing to conversate is included in the access request.
When it is implemented, the parameter of the holding that is used to indicating needing to conversate can be arbitrary, can be according to reality Border application determines.If for example, the client is Mobile banking APP, the parameter can be dse_sessionID.
It is preferred that the parameter for being used to indicate to need to conversate holding determines in accordance with the following methods:
Step 1:Choose several characters from the request body of the access request, or from the access request Several characters are chosen in uniform resource position mark URL address;
Step 2:Several characters described in selection are defined as the parameter for the holding that indicates to need to conversate.
When it is implemented, when client is based on the transmission request of http agreements, load-balancing device can be from the http request Request body in choose several characters as the parameter for the holding that indicates to need to conversate, then arrange with client The parameter that good session is kept.Further, it is also possible to from network address URL, (Uniform Resource Locator, unified resource position Symbol) in choose several characters and be used as and be used for instruction and need to conversate the parameter of holding.
Specifically, also illustrated by taking certain shopping APP as an example, load-balancing device can send more according to shopping APP The same section that statistical induction goes out in repeatedly request in secondary related request, several characters work is then chosen from same section For the parameter for the holding that indicates to need to conversate.
Because the parameter for being used to indicate to need to conversate holding in the embodiment of the present invention is directly to be selected from access request Take, without being packaged in request cookie, therefore method provided by the invention can be in scene disabled cookie Under realize session keep;In addition, session keeping method provided by the invention, avoids the operation handled access request, Simplify session and keep flow.
S12, judge whether to extract the holding that is used to indicating needing conversating parameter parameter value, if it is Perform step S13;Otherwise step S15 is performed.
When it is implemented, when client sends access request first, the instruction that is used for included in the access request needs Conversate the typically no value of parameter of holding, therefore occurs not extract and described be used to indicating that needs to conversate holding Parameter parameter value situation, in this case perform step S15, i.e., the access request is handled by any server, due to This request is sends first, therefore this request can be handled by any background server, is kept without conversating. When client sends the back-call request related to access request first, then the clothes by handling access request first are needed Device of being engaged in handles back-call request, it is therefore desirable to which conversated holdings, then server is asked receiving back-call After asking, the parameter value of the parameter for the holding that indicates to need to conversate can be extracted from back-call request, so Step S13 and S14 is performed afterwards to realize that session is kept.
S13, according to the parameter value of storage and the corresponding relation of server identification, it is determined that the parameter value that extracts is corresponding Server identification.
When it is implemented, when step S12 judged results are to be, show load-balancing device from the access request The parameter value of the parameter of the holding that is used to indicating needing conversating is extracted, list is kept due to session has been locally stored, The list is used to store the corresponding relation between parameter value and server identification, and therefore, load-balancing device can be according to extraction The parameter value arrived, and session keep list, determine server identification corresponding to the parameter value that extracts.
It is preferred that the server identification includes server internet protocol IP address and the port numbers of server.
Specifically, server ip address can cause load-balancing device to find the service for handling the access request Device, but because server has multiple port numbers, related access request needs to be sent to server through same port numbers, because This described server identification also includes port numbers, that is to say, that also needs to exactly send the access request by port numbers To server.
By the use of server ip address and port numbers as server identification, when the access that same time multiple client is sent During request, the access request that multiple client is sent may be sent to a server by responsible balancing equipment, but not logical The same port numbers for crossing server are sent, it is possible thereby to avoid mistake occur during the request of server process multiple client transmission By mistake the occurrence of.
Specifically, it is responsible for the meeting for being used to store corresponding relation between parameter value and server identification stored in balancing equipment Words keep list to may be referred to shown in table 1:
Table 1
Parameter value Server identification
4naRpYKe4287p45e1C6Y IP1+ ports 1
0dG2kz8NW32KbVMV3oo8 IP1+ ports 2
68Yzxe32vmPV663 IP2+ ports 1
…… ……
S14, the access request is transmitted to server corresponding to the server identification determined, by the service Device is handled the access request.
After determining server identification corresponding to the parameter value that extracts in step s 13, load-balancing device root According to IP address and port numbers, the access request is transmitted to server corresponding to the server identification determined, by the clothes Business device handles the access request.
S15, the access request is transmitted to any server.
When it is implemented, when step S12 judged result is no, show that load-balancing device does not extract described be used for Indicate to need to conversate holding parameter parameter value, it can be understood as the parameter value of the parameter is sky, then shows to receive Access request may be access request first, it is also possible to be the access request of holding of need not conversating, either which kind of Situation, the access request can be transmitted to any server and be handled.
It should be noted that any server do not imply that any server can, enter by taking shopping online as an example Row explanation, if client is certain shopping APP, any server is one in the server for referring to handle the shopping service It is individual.
For example, what client sent is access request first, then after load-balancing device receives the access request, fail Extract the parameter value of the parameter for the holding that indicates to need to conversate, then load-balancing device will described in access request first Any background server is transmitted to be handled.Specifically, after selection platform server when, may be born according to current server Load situation is selected.
When it is implemented, after the access request is transmitted into any server in step S15, the server can be according to Flow implementation shown in Fig. 1 b, may comprise steps of:
S21, assignment is being carried out to the parameter in the access request after receiving the access request.
S22, processing is carried out to the access request meet with a response result.
S23, the parameter value that assignment obtains is carried in the response results and feeds back to load-balancing device.
When it is implemented, server after the access request is received, on the one hand extracts institute from the access request State the parameter value of the parameter for the holding that indicates to need to conversate, find the parameter value as sky, then preset value or using from Define random number and assignment is carried out to the parameter, for example, the parameter value is 4naRpYKe4287p45e1C6Y.On the other hand, The access request is handled and the result that meets with a response, (such as parameter value is the parameter value for then obtaining assignment 4naRpYKe4287p45e1C6Y) it is put into the parameter and returns to load-balancing device.For example, the access request is http Request, for instruction need to conversate holding parameter be dse_session ID exemplified by illustrate, its form can be with Shown in reference table 2:
Table 2
From above-mentioned table 2, do not have parameter value in request 1 in dse_session ID, then need that step S15 will be performed And the step of step S21~S23.And ask 2 in dse_session ID there is parameter value, then need processing step S13 and The step of S14, corresponding server is handed into request 2 and handled, to realize that session is kept.
In addition, for request 1, when load-balancing device is handed to any server processing request 1, for the request The form of 1 response results 1 may be referred to shown in table 3:
Table 3
In table 3, server is handled in obtained response results 1 request 1, value=%q ... %q ellipsis In be server be parameter dse_session ID assigned values.
Load-balancing device performs following after the response results for the server feedback for performing step S21~S23 are received Process:The parameter value is extracted from the response results;It is then determined that the server identification of the server, and establish the ginseng Corresponding relation between numerical value and the server identification of the server;And the response results are transmitted to the client.
When it is implemented, the access request sent based on client, in order to cause client transmission next time and this During the request of access request correlation, it can realize that session is kept, i.e., can be objective by handling the server process of this access request The next access request that family end is sent, load-balancing device is after the response results of this access request are received, from institute State the parameter value that the parameter for the holding that indicates to need to conversate is extracted in response results.Because server has loaded in advance The server identification for identification server is registered on balancing equipment, therefore load-balancing device can be readily available processing The server identification of the server of this access request, the parameter value and the server that then load-balancing device foundation is extracted Corresponding relation between mark, and keep list using the corresponding relation more new session established.Load-balancing device also need to by The response results feed back to the client, so that during the client next access request of transmission, directly by the response results In be used to indicating needing to conversate the parameter of holding and parameter value is carried in next access request, and then cause load balancing After equipment receives next access request, the parameter of the parameter for the holding that indicates to need to conversate can be therefrom extracted Value, then keep determining server identification corresponding to the parameter value in list from session, and by the next access request Server corresponding to the server identification determined is transmitted to, session thus can be achieved and keep.
It should be noted that the client in the embodiment of the present invention can be, but not limited to as based on C/S (Client/ Server, client/server) framework client and based on B/S (Broswer/Server, browser/server) framework Client, the client computer can be APP etc..Send to access to load-balancing device in the client based on B/S frameworks and ask , it is necessary to add the parameter for the holding that indicates to need to conversate into the request header of access request before asking, subsequently perform again Session keeping method provided by the invention, repeat part and repeat no more.
The session keeping method that the embodiment of the present invention one provides, receives the access request that client is sent, and the access please The parameter for the holding that is used to indicating needing to conversate is included in asking;Then extraction is described is used to indicate to need the holding that conversates The parameter value of parameter;And according to the parameter value of storage and the corresponding relation of server identification, it is determined that the parameter value extracted Corresponding server identification;Then the access request is transmitted to server corresponding to the server identification determined, The access request is handled by the server.The access request for carrying same parameters value is turned it is possible thereby to realize Issue same server to be handled, session holding can be achieved without being handled access request, flow is simple;This Outside, session keeping method provided by the invention, it is used to indicate to need the holding that conversates using including in the access request The parameter value of parameter realize session keep, rather than use in the prior art by keep mark be encapsulated in request cookie Realize that session is kept, so method provided by the invention can be applied in the disabled scenes of cookie, efficiently solve existing The problem of session is kept can not be realized by having under the disabled scenes of cookie in technology.
Embodiment two
The present invention is explained further in the embodiment of the present invention two on the basis of embodiment one, and the embodiment of the present invention two is with client Session keeping method provided by the invention is described exemplified by interaction between end, load-balancing device and server, wherein, the present invention The session keeping method of offer can apply in load-balancing device, can such as increase a session in load-balancing device Module is kept, keeps module to perform session keeping method provided by the invention by the session, or in load-balancing device Central Plains There is the function of increase execution session keeping method provided by the invention in module, for convenience, the present invention is with load balancing The newly-increased session of equipment keeps illustrating exemplified by module, and the client is APP.With reference to shown in figure 2, implement for the present invention The schematic flow sheet for the session keeping method that example two provides, may comprise steps of:
S31, load-balancing device choose several characters from the request body of the access request, or from the visit Ask in the uniform resource position mark URL address of request and choose several characters.
When it is implemented, it is to keep module to perform step S31 by the session in load-balancing device.
Several characters described in selection are defined as being used to indicate that needs conversate holding by S32, load-balancing device Parameter.
When it is implemented, several characters as described in the session holding module in load-balancing device by selection are defined as Parameter for the holding that indicates to need to conversate.
Specifically, step S31~S32 implementation may be referred to saying for the relevant portion of embodiment one in the embodiment of the present invention two It is bright, repeat part and repeat no more.
After the parameter for the holding that indicates to need to conversate is determined, the process such as step S33 that session is kept is performed Shown in~S314.
S33, client send first time access request to load-balancing device.
S34, load-balancing device the parameter for not extracting the holding that is used to indicating needing conversating parameter value When, the first time access request is transmitted to any server.
S35, server carry out assignment after the first time access request is received to the parameter in the access request, And processing is carried out to the access request and is met with a response result.
The parameter value that assignment obtains is carried in the response results and feeds back to load-balancing device by S36, server.
S37, load-balancing device receive the response results of server transmission, and extract the parameter value;And The server identification of the server is determined, and the corresponding pass established between the parameter value and the server identification of the server System.
S38, load-balancing device forward the response results to client.
When it is implemented, the step S33~S38 of the embodiment of the present invention two implementation may be referred to step S15 in embodiment one And the implementation of the part such as step S21~S23, repeat part step and repeat.
S39, client send n-th access request to load-balancing device, and N is the integer more than 1.
S310, load-balancing device the parameter for extracting the holding that is used to indicating needing conversating parameter value When, according to the parameter value of storage and the corresponding relation of server identification, it is determined that server corresponding to the parameter value extracted Mark.
It is corresponding that the n-th access request is transmitted to the server identification determined by S311, load-balancing device Server.
S312, server are receiving the n-th access request post processing n-th access request and obtained corresponding Response results.
The response results of the n-th access request are fed back to load-balancing device by S313, server.
S314, load-balancing device send the response results of the n-th access request to the client.
Step S39~S314 implementation may be referred to the reality of step S11~S14 in embodiment one in the embodiment of the present invention two Apply, repeat part step and repeat.
The embodiment of the present invention two provide session keeping method, load-balancing device predefine out for instruction need into The parameter kept is talked about by guild, and then client is sending access request to load-balancing device, and load-balancing device is receiving After the access request, if extracting the parameter value of the parameter of the holding that is used to indicating needing conversating, according to depositing The parameter value of storage and the corresponding relation of server identification, it is determined that server identification corresponding to the parameter value extracted;And will The access request is transmitted to server corresponding to the server identification determined, please to the access by the server Ask and handled.If load-balancing device does not extract the parameter of the parameter of the holding that is used to indicating needing conversating Value, then be transmitted to any server by the access request, trigger the server after the access request is received to described Parameter in access request carries out assignment, and processing is carried out to the access request and is met with a response result, and assignment is obtained Parameter value carry and in the response results and feed back;The response results of server transmission are received, and described in extraction Parameter value;And determine the server identification of the server, and establish the parameter value and the server server identification it Between corresponding relation;And the response results are transmitted to the client.Using method provided by the invention, using described The parameter value that the parameter for the holding that is used to indicating needing to conversate is included in access request realizes that session is kept, rather than existing skill What is used in art will keep mark to be encapsulated in request cookie to realize that session is kept, so method provided by the invention can be with Apply in the disabled scenes of cookie, session can not be realized under the disabled scenes of cookie in the prior art by efficiently solving The problem of holding.
Embodiment three
Based on same inventive concept, a kind of session holding meanss are additionally provided in the embodiment of the present invention, due to said apparatus The principle solved the problems, such as is similar to session keeping method, therefore the implementation of said apparatus may refer to the implementation of method, repetition Place repeats no more.
As shown in figure 3, the structural representation of the session holding meanss provided for the embodiment of the present invention three, including:Receive single Member 41, extraction unit 42, the retransmission unit 44 of determining unit 43 and first, wherein:
Receiving unit 41, for receiving the access request of client transmission, included in the access request and be used to indicate to need Conversate the parameter of holding;
Extraction unit 42, the parameter value of the parameter for extracting the holding that is used to indicating needing conversating;
Determining unit 43, for the parameter value and the corresponding relation of server identification according to storage, it is determined that the institute extracted State server identification corresponding to parameter value;
First retransmission unit 44, for the access request to be transmitted to clothes corresponding to the server identification determined Business device, is handled the access request by the server.
It is preferred that described device, in addition to:
Second retransmission unit, if not extracting the parameter for the holding that indicates to need to conversate for the extraction unit Parameter value, then the access request is transmitted to any server, triggers the server after the access request is received Assignment is carried out to the parameter in the access request, and processing is carried out to the access request and is met with a response result, and will be assigned The parameter value being worth to is carried in the response results and fed back;
Second receiving unit, for receiving the response results of server transmission, and extract the parameter value;
Unit is established, for determining the server identification of the server, and establishes the clothes of the parameter value and the server Corresponding relation between device mark of being engaged in;
3rd retransmission unit, for the response results to be transmitted into the client.
It is preferred that the parameter for being used to indicate to need to conversate holding determines in accordance with the following methods:From described Choose several characters in the request body of access request, or from the uniform resource position mark URL address of the access request Middle several characters of selection;Several characters described in selection are defined as the parameter for the holding that indicates to need to conversate.
Preferably, the server identification includes server internet protocol IP address and the port numbers of server.
For convenience of description, above each several part is divided by function describes respectively for each module (or unit).Certainly, exist The function of each module (or unit) can be realized in same or multiple softwares or hardware when implementing of the invention.For example, this The session holding meanss that inventive embodiments three provide can be arranged in load-balancing device, and session is realized by load-balancing device Keep.
Example IV
The embodiment of the present application three provides a kind of nonvolatile computer storage media, the computer-readable storage medium storage There are computer executable instructions, the computer executable instructions can perform the session holding side in above-mentioned any means embodiment Method.
Embodiment five
Fig. 4 is the hardware architecture diagram of the electronic equipment for the implementation session keeping method that the embodiment of the present invention five provides, As shown in figure 4, the electronic equipment includes:
One or more processors 510 and memory 520, in Fig. 4 by taking a processor 510 as an example.
Performing the electronic equipment of session keeping method can also include:Input unit 530 and output device 540.
Processor 510, memory 520, input unit 530 and output device 540 can pass through bus or other modes Connect, in Fig. 4 exemplified by being connected by bus.
Memory 520 is used as a kind of non-volatile computer readable storage medium storing program for executing, available for storage non-volatile software journey Sequence, non-volatile computer executable program and module, the program as corresponding to the session keeping method in the embodiment of the present application Instruction/module/unit is (for example, receiving unit 41, extraction unit 42, the retransmission unit of determining unit 43 and first shown in accompanying drawing 3 44).Processor 510 is stored in non-volatile software program, instruction and module/unit in memory 520 by operation, from And the various function application and data processing of execute server or intelligent terminal, that is, realize that the session of above method embodiment is protected Hold method.
Memory 520 can include storing program area and storage data field, wherein, storing program area can store operation system Application program required for system, at least one function;Storage data field can store to be created according to using for session holding meanss Data etc..In addition, memory 520 can include high-speed random access memory, nonvolatile memory, example can also be included Such as at least one disk memory, flush memory device or other non-volatile solid state memory parts.In certain embodiments, deposit Reservoir 520 is optional including that can pass through network connection relative to the remotely located memory of processor 510, these remote memories To session holding meanss.The example of above-mentioned network includes but is not limited to internet, intranet, LAN, mobile radio communication And combinations thereof.
Input unit 530 can receive the numeral or character information of input, and produce and set with the user of session holding meanss Put and the input of key signals that function control is relevant.Output device 540 may include the display devices such as display screen.
One or more of modules are stored in the memory 520, when by one or more of processors During 510 execution, the session keeping method in above-mentioned any means embodiment is performed.
The said goods can perform the method that the embodiment of the present application is provided, and possesses the corresponding functional module of execution method and has Beneficial effect.Not ins and outs of detailed description in the present embodiment, reference can be made to the method that the embodiment of the present application is provided.
The electronic equipment of the embodiment of the present application exists in a variety of forms, includes but is not limited to:
(1) mobile communication equipment:The characteristics of this kind equipment is that possess mobile communication function, and to provide speech, data Communicate as main target.This Terminal Type includes:Smart mobile phone, multimedia handset, feature mobile phone, and low-end mobile phone etc..
(2) super mobile personal computer equipment:This kind equipment belongs to the category of personal computer, there is calculating and processing work( Can, typically also possess mobile Internet access characteristic.
(3) portable entertainment device:This kind equipment can show and play content of multimedia.The kind equipment includes:Audio, Video player, handheld device, e-book, and intelligent toy and portable car-mounted navigation equipment.
(4) server:The equipment for providing the service of calculating, the composition of server are total including processor, hard disk, internal memory, system Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, therefore in processing energy Power, stability, reliability, security, scalability, manageability etc. require higher.
(5) other electronic installations with data interaction function.
Embodiment six
The embodiment of the present application six provides a kind of computer program product, wherein, the computer program product includes depositing The computer program on non-transient computer readable storage medium storing program for executing is stored up, the computer program includes programmed instruction, wherein, when When described program instruction is computer-executed, the computer is set to perform any one of the application above method embodiment session guarantor Hold method.
The session holding meanss that embodiments herein is provided can be realized by computer program.Those skilled in the art It should be appreciated that above-mentioned Module Division mode is only one kind in numerous Module Division modes, if being divided into other moulds Block or non-division module, all should be within the protection domain of the application as long as session holding meanss have above-mentioned function.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation Property concept, then can make other change and modification to these embodiments.So appended claims be intended to be construed to include it is excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out the essence of various changes and modification without departing from the present invention to the present invention God and scope.So, if these modifications and variations of the present invention belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising including these changes and modification.

Claims (10)

  1. A kind of 1. session keeping method, it is characterised in that including:
    The access request that client is sent is received, the ginseng for the holding that is used to indicating needing conversating is included in the access request Number;
    Extraction is described be used to indicating needing conversating holding parameter parameter value;And
    According to the parameter value of storage and the corresponding relation of server identification, it is determined that server corresponding to the parameter value extracted Mark;And
    The access request is transmitted to server corresponding to the server identification determined, by the server to described Access request is handled.
  2. 2. the method as described in claim 1, it is characterised in that also include:
    If not extracting the parameter value of the parameter for the holding that indicates to need to conversate, the access request is transmitted to and appointed One server, trigger the server and assignment is being carried out to the parameter in the access request after receiving the access request, with And processing is carried out to the access request and is met with a response result, and the parameter value that assignment is obtained is carried in the response results And feed back;
    The response results of server transmission are received, and extract the parameter value;And
    The server identification of the server is determined, and is established corresponding between the parameter value and the server identification of the server Relation;And
    The response results are transmitted to the client.
  3. 3. method as claimed in claim 1 or 2, it is characterised in that the parameter of the holding that is used to indicating needing to conversate Determine in accordance with the following methods:
    Several characters are chosen from the request body of the access request, or are positioned from the unified resource of the access request Symbol URL chooses several characters in address;
    Several characters described in selection are defined as the parameter for the holding that indicates to need to conversate.
  4. 4. method as claimed in claim 3, it is characterised in that the server identification is with including server internet protocol IP Location and the port numbers of server.
  5. A kind of 5. session holding meanss, it is characterised in that including:
    Receiving unit, for receiving the access request of client transmission, included in the access request needs to carry out for instruction The parameter that session is kept;
    Extraction unit, the parameter value of the parameter for extracting the holding that is used to indicating needing conversating;
    Determining unit, for the parameter value and the corresponding relation of server identification according to storage, it is determined that the parameter extracted Server identification corresponding to value;
    First retransmission unit, for the access request to be transmitted to server corresponding to the server identification determined, The access request is handled by the server.
  6. 6. device as claimed in claim 5, it is characterised in that also include:
    Second retransmission unit, if not extracting the ginseng of the parameter for the holding that indicates to need to conversate for the extraction unit Numerical value, then the access request is transmitted to any server, triggers the server after the access request is received to institute State parameter in access request and carry out assignment, and processing is carried out to the access request and is met with a response result, and assignment is obtained To parameter value carry and in the response results and feed back;
    Second receiving unit, for receiving the response results of server transmission, and extract the parameter value;
    Unit is established, for determining the server identification of the server, and establishes the server of the parameter value and the server Corresponding relation between mark;
    3rd retransmission unit, for the response results to be transmitted into the client.
  7. 7. the device as described in claim 5 or 6, it is characterised in that the parameter of the holding that is used to indicating needing to conversate Determine in accordance with the following methods:Choose several characters from the request body of the access request, or from the access Several characters are chosen in the uniform resource position mark URL address of request;Several characters described in selection are defined as being used for Indicate to need to conversate the parameter of holding.
  8. 8. device as claimed in claim 7, it is characterised in that the server identification is with including server internet protocol IP Location and the port numbers of server.
  9. 9. a kind of nonvolatile computer storage media, is stored with computer executable instructions, it is characterised in that the computer Executable instruction is used to perform the method as described in Claims 1-4 any claim.
  10. 10. a kind of electronic equipment, it is characterised in that including:
    At least one processor;And
    The memory being connected with least one processor communication;Wherein,
    The memory storage has can be by the instruction of at least one computing device, and the instruction is by least one place Manage device to perform, so that at least one processor is able to carry out the method as described in Claims 1-4 any claim.
CN201710861038.1A 2017-09-21 2017-09-21 A kind of session keeping method, device and electronic equipment Pending CN107733995A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710861038.1A CN107733995A (en) 2017-09-21 2017-09-21 A kind of session keeping method, device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710861038.1A CN107733995A (en) 2017-09-21 2017-09-21 A kind of session keeping method, device and electronic equipment

Publications (1)

Publication Number Publication Date
CN107733995A true CN107733995A (en) 2018-02-23

Family

ID=61207754

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710861038.1A Pending CN107733995A (en) 2017-09-21 2017-09-21 A kind of session keeping method, device and electronic equipment

Country Status (1)

Country Link
CN (1) CN107733995A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664343A (en) * 2018-05-09 2018-10-16 顺丰科技有限公司 A kind of stateful call method and device of micro services
CN108737570A (en) * 2018-06-22 2018-11-02 北京奇艺世纪科技有限公司 A kind of information-pushing method, apparatus and system
CN109150745A (en) * 2018-10-26 2019-01-04 新华三信息安全技术有限公司 A kind of message processing method and device
CN110086886A (en) * 2019-05-14 2019-08-02 北京天融信网络安全技术有限公司 Dynamic session keeping method and device
CN110535976A (en) * 2019-09-27 2019-12-03 杭州迪普科技股份有限公司 A kind of session keeping method and device
CN113206877A (en) * 2021-04-29 2021-08-03 工银科技有限公司 Session keeping method and device
CN113259429A (en) * 2021-05-11 2021-08-13 鸬鹚科技(深圳)有限公司 Session keeping control method, device, computer equipment and medium
CN114584602A (en) * 2022-03-01 2022-06-03 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588390A (en) * 2009-06-24 2009-11-25 杭州华三通信技术有限公司 Improve the method and the load-balancing device of Collective qualification service system service viscosity
CN101783771A (en) * 2010-03-24 2010-07-21 杭州华三通信技术有限公司 Method and equipment for realizing load balance continuity
CN102104483A (en) * 2009-12-18 2011-06-22 杭州华三通信技术有限公司 Single sign-on method, system and load balancing equipment based on load balance
CN106231607A (en) * 2016-09-21 2016-12-14 北京佰才邦技术有限公司 The method of a kind of resource distribution and base station

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588390A (en) * 2009-06-24 2009-11-25 杭州华三通信技术有限公司 Improve the method and the load-balancing device of Collective qualification service system service viscosity
CN102104483A (en) * 2009-12-18 2011-06-22 杭州华三通信技术有限公司 Single sign-on method, system and load balancing equipment based on load balance
CN101783771A (en) * 2010-03-24 2010-07-21 杭州华三通信技术有限公司 Method and equipment for realizing load balance continuity
CN106231607A (en) * 2016-09-21 2016-12-14 北京佰才邦技术有限公司 The method of a kind of resource distribution and base station

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664343A (en) * 2018-05-09 2018-10-16 顺丰科技有限公司 A kind of stateful call method and device of micro services
CN108737570A (en) * 2018-06-22 2018-11-02 北京奇艺世纪科技有限公司 A kind of information-pushing method, apparatus and system
CN109150745B (en) * 2018-10-26 2022-06-21 新华三信息安全技术有限公司 Message processing method and device
CN109150745A (en) * 2018-10-26 2019-01-04 新华三信息安全技术有限公司 A kind of message processing method and device
CN110086886A (en) * 2019-05-14 2019-08-02 北京天融信网络安全技术有限公司 Dynamic session keeping method and device
CN110086886B (en) * 2019-05-14 2021-12-31 北京天融信网络安全技术有限公司 Dynamic session holding method and device
CN110535976A (en) * 2019-09-27 2019-12-03 杭州迪普科技股份有限公司 A kind of session keeping method and device
CN110535976B (en) * 2019-09-27 2021-09-21 杭州迪普科技股份有限公司 Session maintaining method and device
CN113206877A (en) * 2021-04-29 2021-08-03 工银科技有限公司 Session keeping method and device
CN113259429A (en) * 2021-05-11 2021-08-13 鸬鹚科技(深圳)有限公司 Session keeping control method, device, computer equipment and medium
CN113259429B (en) * 2021-05-11 2023-12-05 鸬鹚科技(深圳)有限公司 Session maintenance management and control method, device, computer equipment and medium
CN114584602A (en) * 2022-03-01 2022-06-03 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium
CN114584602B (en) * 2022-03-01 2023-08-29 百果园技术(新加坡)有限公司 Session state management method, system, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107733995A (en) A kind of session keeping method, device and electronic equipment
CN103001973B (en) Log-in control method based on Quick Response Code, system and device
CN104380278B (en) Equipment, system and method for client-side management session continuity
KR101821511B1 (en) Data processing method based on instant messaging or social applications, and device thereof
CN106933871B (en) Short link processing method and device and short link server
CN106156133B (en) The method, apparatus and system that control table substance is submitted again
CN101783771A (en) Method and equipment for realizing load balance continuity
CN104640114B (en) A kind of verification method and device of access request
CN104780221B (en) Medium-sized and small enterprises intellectual property synthetic service platform system
CN103973741A (en) Method and device for performing remote debugging in cloud system
US10063490B2 (en) Method and system of operating an online application service in a deployment environment to facilitate run-time experimentation with user interface configurations
CN108183975A (en) A kind of method and system of domain name mapping
CN102790772B (en) The processing method of Cookie data, server and client side
CN111212156B (en) Network connection method and device
CN107786621A (en) A kind of user information management method, access processing method and device and system
CN104935521B (en) For realizing the Whole load equalizing method and server of mixed scheduling
CN108390955A (en) Domain Name acquisition method, Website access method and server
CN101997822A (en) Streaming media content delivery method, system and equipment
CN110198530A (en) Exempt from scheduling processing method, device, equipment and the storage medium of traffic service
CN104618388B (en) Fast registration login method and corresponding resetting server, information server
CN103297462B (en) The verification method and device of a kind of business object
CN109561054A (en) A kind of data transmission method, controller and access device
CN107171889A (en) Network application interface test method and device and electronic equipment
CN107409149A (en) The client-server data of mixing provide
CN107347015A (en) A kind of recognition methods of content distributing network, apparatus and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180223