CN113206877A - Session keeping method and device - Google Patents

Session keeping method and device Download PDF

Info

Publication number
CN113206877A
CN113206877A CN202110473670.5A CN202110473670A CN113206877A CN 113206877 A CN113206877 A CN 113206877A CN 202110473670 A CN202110473670 A CN 202110473670A CN 113206877 A CN113206877 A CN 113206877A
Authority
CN
China
Prior art keywords
service
server
session
service request
identifier
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
CN202110473670.5A
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.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
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 Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110473670.5A priority Critical patent/CN113206877A/en
Publication of CN113206877A publication Critical patent/CN113206877A/en
Pending legal-status Critical Current

Links

Images

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/141Setup of application sessions
    • 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
    • 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)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a session holding method and a session holding device, which can be used in the financial field or other technical fields. The method comprises the following steps: receiving service requests sent by each client; if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one; and sending the service request to the service server for processing. The device is used for executing the method. The session maintaining method and the session maintaining device provided by the embodiment of the invention improve the reliability of service processing.

Description

Session keeping method and device
Technical Field
The invention relates to the technical field of network communication, in particular to a session holding method and device.
Background
At present, a single server cannot process the access of a plurality of users due to insufficient performance, and needs to provide services through a plurality of servers, and at the moment, the access of the users can be reasonably distributed in the plurality of servers by applying a load balancing technology.
In practical applications, in some service scenarios, a Session (Session) is required to be maintained between the client and the server to record various information of the client. However, due to the use of the load balancing technology, when the client initiates access again after a session is performed between the client and the server, the session is often allocated to another server for processing, so that the session between the client and the server cannot be maintained, and the service processing fails. Therefore, how to provide a session maintaining method to enable the client and the server to maintain the session and avoid the failure of service processing caused by the failure of session maintaining becomes an important issue to be solved in the field.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a session maintaining method and apparatus, which can at least partially solve the problems in the prior art.
In one aspect, the present invention provides a session maintaining method, including:
receiving service requests sent by each client;
if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one;
and sending the service request to the service server for processing.
In another aspect, the present invention provides a session holding apparatus, comprising:
the receiving module is used for receiving the service requests sent by the clients;
a determining module, configured to obtain an access identifier according to a session identifier after the service request includes the session identifier, and determine a service server that processes the service request according to the access identifier; the access identifiers correspond to the service servers one by one;
and the sending module is used for sending the service request to the service server for processing.
In yet another aspect, the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the session holding method according to any of the above embodiments are implemented.
In a further aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the session holding method according to any one of the embodiments described above.
The session maintaining method and the session maintaining device provided by the embodiment of the invention can receive the service requests sent by each client, obtain the access identifier according to the session identifier if the service requests comprise the session identifier, determine the service server for processing the service requests according to the access identifier, send the service requests to the service server for processing, realize the session maintenance between the client and the service server through the access identifier, and improve the reliability of service processing.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a schematic structural diagram of a service processing system according to a first embodiment of the present invention.
Fig. 2 is a flowchart illustrating a session maintaining method according to a second embodiment of the present invention.
Fig. 3 is a flowchart illustrating a session maintaining method according to a third embodiment of the present invention.
Fig. 4 is a flowchart illustrating a session maintaining method according to a fourth embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a conversation maintaining apparatus according to a fifth embodiment of the present invention.
Fig. 6 is a schematic structural diagram of a session holding apparatus according to a sixth embodiment of the present invention.
Fig. 7 is a schematic structural diagram of a session holding apparatus according to a seventh embodiment of the present invention.
Fig. 8 is a schematic structural diagram of a session holding apparatus according to an eighth embodiment of the present invention.
Fig. 9 is a schematic structural diagram of a session holding apparatus according to a ninth embodiment of the present invention.
Fig. 10 is a schematic structural diagram of a session holding apparatus according to a tenth embodiment of the present invention.
Fig. 11 is a schematic physical structure diagram of an electronic device according to an eleventh embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
In order to facilitate understanding of the technical solutions provided in the present application, the following briefly describes the research background of the technical solutions in the present application. In some application scenarios requiring a login status, a Session is required to be maintained between the client and the service server to record various information of the client. For example, in an anti-money laundering system, a client and a service server often need to complete the processing of a service through multiple interaction processes. Since the above-mentioned multiple interactive processes are closely related, the service server often needs to obtain the processing results of the last or last several interactive processes when performing a certain interactive step of these interactive processes, which requires that all these related interactive processes are completed by one service server and cannot be dispersed to different service servers for processing, otherwise, the service processing fails. Therefore, the embodiment of the present invention provides a session maintaining method, which enables a session to be maintained between a client and a service server, so as to ensure successful service processing.
Fig. 1 is a schematic structural diagram of a service processing system according to a first embodiment of the present invention, and as shown in fig. 1, the service processing system according to the embodiment of the present invention includes a load balancing main server 1, a load balancing standby server 2, a plurality of clients 3, and a plurality of service servers 4, where:
each client 3 is in communication connection with the load balancing main server 1, the load balancing main server 1 is in communication connection with the load balancing standby server 2, and each service server 4 is in communication connection with the load balancing main server 1. The client 3 includes, but is not limited to, a desktop, a notebook, a tablet, and the like.
The load balancing main server 1 is configured to execute the session holding method provided by the embodiment of the present invention. Each client 3 sends a service request to the load balancing main server 1, and the load balancing main server 1 distributes the service request sent by each client 3 to each service server 4 for processing. The service server 4 processes the received service request and returns the processing result of the service request to the corresponding client 3 through the load balancing main server 1. The load balancing main server 1 and the load balancing standby server 2 can realize load balancing through open source software Nginx and a session maintaining method provided by the embodiment of the invention.
The following describes a specific implementation process of the session holding method according to an embodiment of the present invention, by taking a load balancing primary server (hereinafter referred to as a primary server) as an execution subject.
Fig. 2 is a schematic flow chart of a session maintaining method according to a second embodiment of the present invention, and as shown in fig. 2, the session maintaining method according to the embodiment of the present invention includes:
s201, receiving service requests sent by various clients;
specifically, a user may send a service request to a main server through a client, and the main server may receive the service request. The service request is set according to actual needs, and the embodiment of the present invention is not limited.
For example, the service request is a login request, a payment request, a request to add an item to a shopping cart, and the like.
S202, if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one;
specifically, after receiving the service request, the main server may determine whether the service request includes a session identifier, and if the service request includes the session identifier, may obtain an access identifier according to the session identifier. Then, a corresponding service server is inquired according to the access identifier, and the inquired service server corresponding to the access identifier is used as a server for processing the service request. The access identification corresponds to the service server one by one, and the corresponding relation between the access identification and the service server is pre-stored.
For example, the main server may perform hash operation on the session identifier to obtain an access identifier. The hash algorithm used in the hash operation is set according to actual needs, and the embodiment of the present invention is not limited.
S203, the service request is sent to the server for processing.
Specifically, the main server sends the access request to a service server corresponding to the access identifier, and after receiving the service request, the service server corresponding to the access identifier processes the service request and then returns a processing result of the service request to the main server. And the main server returns the processing result of the service request to the corresponding client.
The session maintaining method provided by the embodiment of the invention can receive the service requests sent by each client, and if the service requests comprise the session identifiers, the access identifiers are obtained according to the session identifiers, the service server for processing the service requests is determined according to the access identifiers, and the service requests are sent to the service server for processing, so that the session maintenance between the client and the service server is realized through the access identifiers, and the reliability of service processing is improved.
On the basis of the foregoing embodiments, further, the obtaining an access identifier according to the session identifier further includes:
and carrying out hash operation on the session identifier, and taking the obtained hash value as the access identifier.
Specifically, the main server performs hash operation on the session identifier through a hash algorithm to obtain a hash value, and then uses the obtained hash value as the access identifier. The hash algorithm may be a hash algorithm or MD5, and the selection is performed according to actual needs, which is not limited in the embodiment of the present invention.
On the basis of the foregoing embodiments, further, the session holding method provided in the embodiment of the present invention further includes:
and if the service request does not comprise the session identification, distributing a service server for processing the service request according to a preset load balancing strategy.
Specifically, if the main server does not obtain the session identifier from the service request, the service server that processes the service request may be allocated according to a load balancing policy, that is, the service server that processes the service request is determined according to the load balancing policy, and then the service request is sent to the service server for processing. The load balancing policy is preset and is set according to actual needs, and the embodiment of the invention is not limited.
For example, the load balancing policy is to sequentially distribute service requests to each service server.
Fig. 3 is a schematic flow chart of a session maintaining method according to a third embodiment of the present invention, and as shown in fig. 3, on the basis of the foregoing embodiments, further, the session maintaining method according to the embodiment of the present invention further includes:
s301, receiving a processing result and Cookie information of the service request, which are returned by the service server for distributing the service request; wherein, the Cookie information comprises a session identifier;
specifically, after receiving the service request, the service server that allocates the service request processes the service request to obtain a processing result of the service request. The service server for distributing the service request also generates Cookie information for the client corresponding to the service request, wherein the Cookie information comprises a session identification (Session ID). And the service server which distributes the service request returns the processing result of the service request and the Cookie information to the main server. And the main server receives the processing result of the service request and the Cookie information. The specific generation process of the Cookie information is the prior art, and is not described herein again.
S302, carrying out hash operation on the session identifier to obtain a hash value, and using the hash value as an access identifier to correspond to the server for distributing the service request.
Specifically, the main server obtains the SessionID from the Cookie information, and then performs hash operation on the SessionID through a hash algorithm, so as to obtain a hash value. And the main server takes the hash value as an access identifier, corresponds the hash value to the server for distributing the service request and records the hash value to the local. The hash algorithm may be a hash algorithm or MD5, and the selection is performed according to actual needs, which is not limited in the embodiment of the present invention.
And S303, returning the processing result of the service request and the Cookie information to the corresponding client.
Specifically, the main server returns the processing result of the service request and the Cookie information to the corresponding client. When the client sends a service request to the main server, the service request carries Cookie information, and the main server can obtain the session identifier from the Cookie.
Fig. 4 is a schematic flow chart of a session maintaining method according to a fourth embodiment of the present invention, and as shown in fig. 4, on the basis of the foregoing embodiments, further, the session maintaining method according to the embodiment of the present invention further includes:
s401, performing health check on each service server to obtain a health check result of each service server;
specifically, the main server may perform health check on each service server periodically to obtain a health check result of each service server. And the health check result is normal or abnormal, the normal indicates that the corresponding service server can normally communicate, and the abnormal indicates that the corresponding service server cannot communicate.
For example, the main server sends a heartbeat message to each service server every 3 seconds, and if the feedback information of the service server is not received within a set time, the health check result of the service server is recorded as abnormal. And if the feedback information of the service server is received within the set time, recording the health check result of the service server as abnormal. The setting time is set according to actual needs, for example, 1 second, and the embodiment of the present invention is not limited.
S402, updating a business server list according to the health check result of each business server.
Specifically, the main server may count a health check result of each service server for a first preset number of consecutive times, and if the health check results of the service servers for the first preset number of consecutive times are all abnormal, the service server may be removed from the service server list, and the service server that has removed the service server list may not send the service allocation request. The main server may count health check results of each service server for a second preset number of consecutive times, and add the service server to the service server list if the health check results of the service server for the second preset number of consecutive times are all normal and the service server is not in the service server list. The service server list is preset and comprises each service server. And the main server distributes each service request to the service servers in the service server list based on a load balancing strategy. The first preset times and the second preset times are set according to actual needs, and the embodiment of the invention is not limited.
On the basis of the foregoing embodiments, further, the session holding method provided in the embodiment of the present invention further includes:
and if the load balancing process is unavailable, restarting the load balancing process.
Specifically, the main server may start a load balancing process, where the load balancing process is used to distribute each service request to each service server through a load balancing policy, and to implement session maintenance between the client and the service server. The main server may periodically detect whether the load balancing process exists, and if the load balancing process is not detected, which indicates that the load balancing process is unavailable, the main server may restart the load balancing process.
For example, the main server may detect the load balancing process through keepalive software, and when the load balancing process is started and normally operates, the main server may detect that the load balancing process exists through the keepalive software, and if the load balancing process is unavailable, the load balancing process may not be detected.
On the basis of the foregoing embodiments, further, the session holding method provided in the embodiment of the present invention further includes:
and if the load process is unsuccessfully restarted, stopping sending heartbeat information to the load balancing standby server so as to switch the load balancing standby server into the load balancing main server.
Specifically, after restarting the load balancing process, the main server detects whether the load balancing process exists, and if the load balancing process is not detected yet, the restart of the load process fails. The main server stops sending heartbeat information to the load balancing standby server, and if the load balancing standby server does not receive the heartbeat information sent by the main server within a set time, a preset switching program is started to take over the IP resources and services of the main server to become the load balancing main server.
When the load balancing process of the original main server returns to normal, heartbeat information is sent to the original load balancing standby server, and after the original load balancing standby server receives the heartbeat information, the IP resources and services which are taken over before are released and switched into the load balancing standby server.
Fig. 5 is a schematic structural diagram of a session holding apparatus according to a fifth embodiment of the present invention, and as shown in fig. 5, the session holding apparatus according to the embodiment of the present invention includes a receiving module 501, a determining module 502, and a sending module 503, where:
the receiving module 501 is configured to receive service requests sent by each client; the determining module 502 is configured to, after the service request includes a session identifier, obtain an access identifier according to the session identifier, and determine a service server that processes the service request according to the access identifier; the access identifiers correspond to the service servers one by one; the sending module 503 is configured to send the service request to the service server for processing.
Specifically, a user may send a service request to the receiving module 501 through a client, and the receiving module 501 receives the service request. The service request is set according to actual needs, and the embodiment of the present invention is not limited.
After receiving the service request, the determining module 502 may determine whether the service request includes a session identifier, and if the service request includes the session identifier, obtain an access identifier according to the session identifier. Then, a corresponding service server is inquired according to the access identifier, and the inquired service server corresponding to the access identifier is used as a server for processing the service request. The access identification corresponds to the service server one by one, and the corresponding relation between the access identification and the service server is pre-stored.
The sending module 503 sends the access request to the service server corresponding to the access identifier, and after receiving the service request, the service server corresponding to the access identifier processes the service request, and then returns a processing result of the service request to the sending module 503. The sending module 503 returns the processing result of the service request to the corresponding client.
The session holding device provided by the embodiment of the invention can receive the service requests sent by each client, and if the service requests comprise the session identifiers, the session holding device obtains the access identifiers according to the session identifiers, determines the service server for processing the service requests according to the access identifiers, and sends the service requests to the service server for processing, so that the session holding between the client and the service server is realized through the access identifiers, and the reliability of service processing is improved.
On the basis of the foregoing embodiments, further, the determining module 502 is specifically configured to:
and carrying out hash operation on the session identifier, and taking the obtained hash value as the access identifier.
Fig. 6 is a schematic structural diagram of a session holding apparatus according to a sixth embodiment of the present invention, as shown in fig. 6, on the basis of the foregoing embodiments, further, the session holding apparatus further includes an allocating module 504, where:
the allocating module 504 is configured to allocate a service server that processes the service request according to a preset load balancing policy after the service request does not include the session identifier.
Fig. 7 is a schematic structural diagram of a session holding apparatus according to a seventh embodiment of the present invention, and as shown in fig. 7, on the basis of the foregoing embodiments, further, the session holding apparatus according to the embodiment of the present invention further includes a processing result receiving module 505, a hash operation module 506, and a return module 507, where:
the processing result receiving module 505 is configured to receive a processing result and Cookie information for the service request, which are returned by the service server that allocates the service request; wherein, the Cookie information comprises a session identifier; the hash operation module 506 is configured to perform hash operation on the session identifier to obtain a hash value, and use the hash value as an access identifier to correspond to the server that allocates the service request; the returning module 507 is configured to return the processing result of the service request and the Cookie information to the corresponding client.
Fig. 8 is a schematic structural diagram of a session holding apparatus according to an eighth embodiment of the present invention, and as shown in fig. 8, on the basis of the foregoing embodiments, further, the session holding apparatus according to the embodiment of the present invention further includes a health check module 508 and an update module 509, where:
the health check module 508 is used for carrying on the health check to every business server, obtain the health check result of every business server; the update module 509 updates the service server list according to the health check result of each service server.
Fig. 9 is a schematic structural diagram of a session holding apparatus according to a ninth embodiment of the present invention, and as shown in fig. 9, on the basis of the foregoing embodiments, further, the session holding apparatus according to the embodiment of the present invention further includes a restart module 510, where:
and if the load balancing process is unavailable, restarting the load balancing process.
Fig. 10 is a schematic structural diagram of a session holding apparatus according to a tenth embodiment of the present invention, and as shown in fig. 10, on the basis of the foregoing embodiments, further, the session holding apparatus according to the embodiment of the present invention further includes a stopping module 511, where:
the stopping module 511 is configured to, after the failure of restarting the load balancing process, stop sending heartbeat information to the load balancing standby server, so that the load balancing standby server is switched to the load balancing main server.
The embodiment of the apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing flows of the above method embodiments, and the functions of the apparatus are not described herein again, and refer to the detailed description of the above method embodiments.
It should be noted that the session holding method and apparatus provided in the embodiment of the present invention may be used in the financial field, and may also be used in any technical field other than the financial field.
Fig. 11 is a schematic physical structure diagram of an electronic device according to an eleventh embodiment of the present invention, and as shown in fig. 11, the electronic device may include: a processor (processor)1101, a communication Interface (Communications Interface)1102, a memory (memory)1103 and a communication bus 1104, wherein the processor 1101, the communication Interface 1102 and the memory 1103 are communicated with each other via the communication bus 1104. The processor 1101 may call logic instructions in the memory 1103 to perform the following method: receiving service requests sent by each client; if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one; and sending the service request to the service server for processing.
In addition, the logic instructions in the memory 1103 can be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising: receiving service requests sent by each client; if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one; and sending the service request to the service server for processing.
The present embodiment provides a computer-readable storage medium, which stores a computer program, where the computer program causes the computer to execute the method provided by the above method embodiments, for example, the method includes: receiving service requests sent by each client; if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one; and sending the service request to the service server for processing.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In the description herein, reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," "an example," "a particular example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A session maintenance method, comprising:
receiving service requests sent by each client;
if the service request comprises a session identifier, obtaining an access identifier according to the session identifier, and determining a service server for processing the service request according to the access identifier; the access identifiers correspond to the service servers one by one;
and sending the service request to the service server for processing.
2. The method of claim 1, wherein obtaining an access identifier according to the session identifier further comprises:
and carrying out hash operation on the session identifier, and taking the obtained hash value as the access identifier.
3. The method of claim 1, further comprising:
and if the service request does not comprise the session identification, distributing a service server for processing the service request according to a preset load balancing strategy.
4. The method of claim 3, further comprising:
receiving a processing result and Cookie information of the service request, which are returned by a service server for distributing the service request; wherein, the Cookie information comprises a session identifier;
performing hash operation on the session identifier to obtain a hash value, and using the hash value as an access identifier to correspond to the server for distributing the service request;
and returning the processing result of the service request and the Cookie information to the corresponding client.
5. The method of claim 1, further comprising:
performing health check on each service server to obtain the health check result of each service server;
and updating the service server list according to the health check result of each service server.
6. The method of any of claims 1 to 5, further comprising:
and if the load balancing process is unavailable, restarting the load balancing process.
7. The method of claim 6, further comprising:
and if the load balancing process is unsuccessfully restarted, stopping sending heartbeat information to the load balancing standby server so as to switch the load balancing standby server into the load balancing main server.
8. A session-holding apparatus, comprising:
the receiving module is used for receiving the service requests sent by the clients;
a determining module, configured to obtain an access identifier according to a session identifier after the service request includes the session identifier, and determine a service server that processes the service request according to the access identifier; the access identifiers correspond to the service servers one by one;
and the sending module is used for sending the service request to the service server for processing.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110473670.5A 2021-04-29 2021-04-29 Session keeping method and device Pending CN113206877A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110473670.5A CN113206877A (en) 2021-04-29 2021-04-29 Session keeping method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110473670.5A CN113206877A (en) 2021-04-29 2021-04-29 Session keeping method and device

Publications (1)

Publication Number Publication Date
CN113206877A true CN113206877A (en) 2021-08-03

Family

ID=77029330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110473670.5A Pending CN113206877A (en) 2021-04-29 2021-04-29 Session keeping method and device

Country Status (1)

Country Link
CN (1) CN113206877A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338689A (en) * 2021-12-30 2022-04-12 中国工商银行股份有限公司 Session holding method, apparatus, device, medium, and program product
CN114880662A (en) * 2022-07-12 2022-08-09 北京安华金和科技有限公司 Process-based database audit processing method and device
CN114928661A (en) * 2022-05-31 2022-08-19 杭州迪普科技股份有限公司 Session keeping method and device
WO2023035836A1 (en) * 2021-09-09 2023-03-16 华为技术有限公司 Message processing method and related apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140006578A1 (en) * 2012-06-29 2014-01-02 Rodolfo Kohn Device, system, and method for client-governed session persistency between one or more clients and servers of a data center
CN107360251A (en) * 2017-08-16 2017-11-17 中国工商银行股份有限公司 Method, system and the load balancing apparatus that session is kept
CN107733995A (en) * 2017-09-21 2018-02-23 北京信安世纪科技股份有限公司 A kind of session keeping method, device and electronic equipment
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140006578A1 (en) * 2012-06-29 2014-01-02 Rodolfo Kohn Device, system, and method for client-governed session persistency between one or more clients and servers of a data center
CN107360251A (en) * 2017-08-16 2017-11-17 中国工商银行股份有限公司 Method, system and the load balancing apparatus that session is kept
CN107733995A (en) * 2017-09-21 2018-02-23 北京信安世纪科技股份有限公司 A kind of session keeping method, device and electronic equipment
CN110839084A (en) * 2019-11-19 2020-02-25 中国建设银行股份有限公司 Session management method, device, equipment and medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023035836A1 (en) * 2021-09-09 2023-03-16 华为技术有限公司 Message processing method and related apparatus
CN114338689A (en) * 2021-12-30 2022-04-12 中国工商银行股份有限公司 Session holding method, apparatus, device, medium, and program product
CN114928661A (en) * 2022-05-31 2022-08-19 杭州迪普科技股份有限公司 Session keeping method and device
CN114880662A (en) * 2022-07-12 2022-08-09 北京安华金和科技有限公司 Process-based database audit processing method and device
CN114880662B (en) * 2022-07-12 2022-09-23 北京安华金和科技有限公司 Database audit processing method and device based on process

Similar Documents

Publication Publication Date Title
WO2020177533A1 (en) Electronic invoice identifier allocation method, and electronic ticket generating method, device and system
CN113206877A (en) Session keeping method and device
CN111338773B (en) Distributed timing task scheduling method, scheduling system and server cluster
US9201644B2 (en) Distributed update service
CN111338774B (en) Distributed timing task scheduling system and computing device
US20160036924A1 (en) Providing Higher Workload Resiliency in Clustered Systems Based on Health Heuristics
CN108681777B (en) Method and device for running machine learning program based on distributed system
CN111641515B (en) VNF life cycle management method and device
CN110888858B (en) Database operation method and device, storage medium and electronic device
CN111858054B (en) Resource scheduling system and method based on edge computing in heterogeneous environment
US11687354B2 (en) Virtual machine management using onboarding operations and openstack control
CN106790092B (en) Remote procedure call server control system and method
US9104488B2 (en) Support server for redirecting task results to a wake-up server
US10802896B2 (en) Rest gateway for messaging
CN113366802A (en) State controller operating in KUBERNETES system and method for operating the same
JP2016526723A (en) Managing client access to multiple computing systems
US20070265976A1 (en) License distribution in a packet data network
KR101402367B1 (en) Efficient and cost-effective distributed call admission control
CN112559461A (en) File transmission method and device, storage medium and electronic equipment
CN112416594A (en) Micro-service distribution method, electronic equipment and computer storage medium
CN108874947B (en) Data processing system and data processing method
CN110569124A (en) Task allocation method and device
US20150006728A1 (en) Producer system selection
CN112351077B (en) Application service operation method, system, device and storage medium
CN111835809B (en) Work order message distribution method, work order message distribution device, server and storage medium

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

Application publication date: 20210803

RJ01 Rejection of invention patent application after publication