CN109510878B - Long connection session keeping method and device - Google Patents

Long connection session keeping method and device Download PDF

Info

Publication number
CN109510878B
CN109510878B CN201811581099.3A CN201811581099A CN109510878B CN 109510878 B CN109510878 B CN 109510878B CN 201811581099 A CN201811581099 A CN 201811581099A CN 109510878 B CN109510878 B CN 109510878B
Authority
CN
China
Prior art keywords
session
client
message
table entry
entry
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.)
Active
Application number
CN201811581099.3A
Other languages
Chinese (zh)
Other versions
CN109510878A (en
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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201811581099.3A priority Critical patent/CN109510878B/en
Publication of CN109510878A publication Critical patent/CN109510878A/en
Application granted granted Critical
Publication of CN109510878B publication Critical patent/CN109510878B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
    • 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/1027Persistence of sessions during 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/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

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)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a long connection session maintaining method and a long connection session maintaining device, which are used for load balancing equipment, wherein the method comprises the following steps: establishing a first session for a client and a first server; creating a first session holding table item, and recording the corresponding relation between the client and the first server; after the first session is disconnected and before the first session maintaining table item is aged, sending a session maintaining table item keep-alive message to the client for detecting the connection state; and if the connection of the client side is normal, updating the aging time of the session maintenance table entry. The invention establishes a session maintenance table item updating mechanism, not only reduces the process of repeatedly establishing connection by the client through session maintenance, but also avoids service errors caused by redistributing the server by a load balancer when the client accesses the server again after the session maintenance aging time is exceeded under the condition that the connection of the client is long, and in addition, the session maintenance table item aging mechanism still exists, and can avoid the problem that equipment resources are occupied because the session table items are not aged for a long time.

Description

Long connection session keeping method and device
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a long connection session maintaining method and apparatus.
Background
With the rapid development of server cluster technology, in order to improve the performance and load capacity of servers, server load balancing devices are widely applied to server clusters, and access traffic is distributed to each server in a balanced manner through a built-in scheduling algorithm. Meanwhile, when load balancing is performed, the relevance of the interaction process between the client and the server needs to be identified, and it is ensured that access requests associated with the same user are distributed to the same server, and this mechanism is generally called session (session) maintenance.
For example, in most e-commerce application systems or other online systems requiring user identity authentication, a user and a server often need to go through multiple interactions to complete a transaction or a request, because the several interactions are closely related, when the server performs a certain interaction step of the interactions, the server often needs to know the processing result of the previous interaction step or the previous interaction steps, which requires that all the related interactions are completed by the same server, and session maintenance is realized, but the related interactions cannot be distributed by a load balancer to different servers. Session maintenance is one of the most common problems of load balancing and is also a relatively complex problem.
For the current server load balancing device, one important parameter in session maintenance based on the source IP is the connection timeout value, and the load balancer sets a time value as the timeout value for each session in the maintenance state. If the interval time from the last completion of a session to the next arrival of the session is less than the timeout value, the load balancer keeps the new connection session; if the interval is greater than the timeout value, the load balancer will consider the new connection as a new session and then re-perform the load balancing scheduling. For example the following application scenarios: a financial application is a long connection because when a client needs to fill in a large amount of form data, a client user will spend several minutes or even tens of minutes to fill in form related information after the client establishes a connection with a server. However, when the user finally fills up the information required by the form, the user clicks the "submit" button, and as a result, the connection timeout value is already exceeded, the load balancing device will perform load balancing again and distribute the load balancing device to another server, which may cause the application to malfunction, and all the work of the client user needs to be resumed, which causes great inconvenience and loss to the user.
Disclosure of Invention
In view of the above, the present application provides a long connection session maintaining method and apparatus to achieve session maintenance that is not limited to a connection timeout value.
Specifically, the method is realized through the following technical scheme:
a long connection session holding method for a load balancing device, the method comprising:
establishing a first session for a client and a first server;
creating a first session holding table entry for the first session, wherein the first session holding table entry records the corresponding relationship between the client and the first server;
after the first session is disconnected and before the first session maintaining table item is aged, sending a session maintaining table item keep-alive message to the client, wherein the session maintaining table item keep-alive message is used for detecting the connection state of the client;
and if the client side is determined to be normally connected according to the reply of the client side to the keep-alive message, updating the aging time of the first session keeping table entry.
A long connection session holding apparatus for a load balancing device, the apparatus comprising:
the session management unit is used for establishing a first session for the client and the first server;
a session holding table entry management unit, configured to create a first session holding table entry for the first session, where the first session holding table entry records a correspondence between the client and the first server; updating the aging time of the first session holding table entry;
a detecting unit, configured to send a keep-alive packet for a session keep-alive entry to the client after the first session is disconnected and before the first session keep-alive entry ages, where the keep-alive packet for the session keep-alive entry is used to detect a connection state of the client; and if the client is determined to be normally connected according to the reply of the client to the keep-alive message, triggering the session maintenance table item management unit to update the aging time of the first session maintenance table item.
As can be seen from the above technical solutions provided by the present application, in the present solution, before the first session maintaining table entry ages, the load balancing device sends a session maintaining table entry keep-alive message for detecting the connection state of the client to the client, and then determines that the connection of the client is normal according to a reply to the keep-alive message from the client, if the connection of the client is normal, it represents that the long connection session needs to be maintained continuously, and the first session maintaining table entry cannot be aged, so that the aging time of the first session maintaining table entry is updated. The scheme establishes a session maintenance table item updating mechanism, completes the updating of the session maintenance table item by detecting the client, even if the interval time of two messages sent by the client exceeds the connection timeout value, the session maintenance table item can still exist as long as the client is normally connected, thereby not only reducing the process of repeatedly establishing the connection by the client through session maintenance, but also avoiding the service error caused by the redistribution of the server due to the load balancer when the client accesses the server again after exceeding the session maintenance aging time under the condition that the connection of the client is long, in addition, the mechanism of session maintenance table item aging still exists, and avoiding the problem of insufficient performance of the load balancer caused by the occupation of equipment resources due to the fact that the session table item is not aged for a long time.
Drawings
FIG. 1 is a flow chart illustrating a long connection session holding method according to the present application;
FIG. 2 is a flow chart illustrating a long connection session holding method according to the present application;
fig. 3 is a flowchart illustrating a process of receiving a message from a client according to the present application;
fig. 4 is a flowchart illustrating a process of receiving a message from a client according to the present application;
fig. 5 is a schematic diagram of a long connection session holding apparatus shown in the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Referring to fig. 1, fig. 1 is a flowchart illustrating a long connection session maintaining method according to the present application. The method can be used for load balancing equipment. The method comprises the following steps:
step S101, a first session is established for the client and the first server.
The first session is a new session. For example, the client C1 accesses the virtual service, establishes a new session with a load balancing device (or load balancer), and the load balancing device is dispatched to a real server S1 through a load balancing dispatching algorithm.
The load balancing scheduling algorithm has the function of reasonably distributing the service flow to the back-end server according to different service environments, server conditions and the like, so that the normal, stable and efficient operation of the back-end server is guaranteed. By way of example, the general algorithms are mainly: polling, weighted polling, minimum connection, weighted minimum connection, etc., and will not be described in detail herein.
Step S102, creating a first session holding table entry for the first session, where the first session holding table entry records a corresponding relationship between the client and the first server.
The following description will be given by taking simple session maintenance (also referred to as source address-based session maintenance, IP-based session maintenance) as an example. The simple session maintenance means that the load balancer uses the source address of the access request as the basis for judging the associated session during load balancing, and all the access requests from the same IP address are maintained on one server during load balancing. One important parameter in simple session maintenance is the connection timeout value, which the load balancer sets for each session in the maintenance state. If the interval time from the last completion of a session to the next arrival of the session is less than the timeout value, the load balancer keeps the session of the connection again; but if the interval is greater than the timeout value, the load balancer will consider the new connection as a new session and then load balance it.
The load balancer realizes the session maintenance through the session maintenance table entry. And the load balancer stores the information of the client and the scheduled real server as a session maintenance table entry so as to ensure that the next session can be scheduled to the same real server within the aging time of the session maintenance table entry. As an example, the session holding table entry may contain the following 5 items such as the client IP, as shown in table 1:
TABLE 1
Client IP Client port Virtual service IP Real server IP Real server port
10.30.6.88 4500 120.11.120.24 2.6.122.100 4500
Step S103, after the first session is disconnected and before the first session maintaining table item is aged, sending a session maintaining table item keep-alive message to the client, wherein the session maintaining table item keep-alive message is used for detecting the connection state of the client.
If the first session is not disconnected and still exists, the session holding table entry does not work or needs not to be enabled, because the message is sent to the server in the session directly after the message comes, and the problem of session holding is not involved.
The session keep table entry keep-alive messages are similar to a heartbeat mechanism. After the first session is disconnected, that is, when the client is in an inactive state for a short time, the load balancer may send a session keep table entry keep-alive message to actively detect the state of the client, thereby determining whether the session keep table entry should be aged and deleted.
The specific form of the session keep table keep-alive message is not limited in this embodiment, and those skilled in the art can select and design the message according to different needs/different scenarios, and these choices and designs can be used herein without departing from the spirit and scope of the present invention. As an example, the keep-alive message may use a keep _ alive message in the TCP protocol.
As an example, in this embodiment or some other embodiments of the present invention, before the first session holding entry is aged, specifically, the following may be used:
and when the first preset time is left at the moment when the first session keeping table entry is deleted.
For example, the first preset duration may be 1S, that is, the keep-alive message may be sent to the client 1S before aging.
And step S104, if the client is determined to be normally connected according to the reply of the client to the keep-alive message, updating the aging time of the first session keeping table entry.
If the client connection can be determined to be normal, although no session exists currently, the session holding table entry cannot be aged, otherwise, the normal service connection is affected, and therefore, the aging time of the session holding table entry needs to be updated.
As an example, in this embodiment or some other embodiments of the present invention, the updating the aging time of the first session holding entry may specifically include:
and resetting the aging time of the first session holding table entry to a second preset time length and restarting aging countdown according to the second preset time length.
The second preset duration, i.e. the timeout value, can be selected and designed by those skilled in the art according to different requirements/different scenarios, and the embodiment of the present invention is not limited thereto.
Referring to fig. 2, in this embodiment or some other embodiments of the present invention, after sending a session keep table entry keep-alive message to the client, the method may further include:
step S201, if the connection of the client is not determined to be normal when the first session maintaining table entry is aged or within a third preset time after the session maintaining table entry keep-alive message is sent to the client, deleting the first session maintaining table entry.
For example, the load balancer may extract the session holding table entry from the aging time queue, stop aging, and send a keep-alive message to detect, and delete the first session holding table entry if it is determined that the connection of the client is normal because no effective reply of the client is received within a third preset time period. Or after sending the keep-alive message, the session maintaining table still continues to perform the aging countdown before, and when the aging time is reached, the connection of the client is still not determined to be normal, the first session maintaining table is deleted.
It can be seen that the aging mechanism is not abolished, the aging mechanism for maintaining the table entry still exists, but the session maintaining table entry is updated and then added into the aging queue again, so as to prevent the session maintaining table entry from existing forever, when it is determined that the client is not normally connected, the maintaining table entry should be deleted, otherwise the session maintaining table entry will occupy the device resource without aging for a long time, and further the problem of insufficient performance of the load balancer is caused.
In this embodiment of the present invention, before the first session maintaining table entry ages, the load balancing device sends a session maintaining table entry keep-alive packet for detecting the connection state of the client to the client, and then determines that the connection of the client is normal according to a reply to the keep-alive packet from the client, if the connection of the client is normal, it represents that the long connection session needs to be continuously maintained, and the first session maintaining table entry cannot be aged, so that the aging time of the first session maintaining table entry is updated. The scheme establishes a session maintenance table item updating mechanism, completes the updating of the session maintenance table item by detecting the client, even if the interval time of two messages sent by the client exceeds the connection timeout value, the session maintenance table item can still exist as long as the client is normally connected, thereby not only reducing the process of repeatedly establishing the connection by the client through session maintenance, but also avoiding the service error caused by the redistribution of the server due to the load balancer when the client accesses the server again after exceeding the session maintenance aging time under the condition that the connection of the client is long, in addition, the mechanism of session maintenance table item aging still exists, and avoiding the problem of insufficient performance of the load balancer caused by the occupation of equipment resources due to the fact that the session table item is not aged for a long time.
The above mainly describes the case that the load balancing device updates the aging time of the session maintenance entry by active probing. The situation of the message sent by the client is further described below.
Referring to fig. 3, in this embodiment or some other embodiments of the present invention, the method may further include the following steps:
step S301, when receiving a packet sent by the client, querying whether a second session exists, where the second session is a session corresponding to the packet.
It is to be understood that the second session may be the first session or may not be determined according to a specific message.
Step S302, if the second session exists, the aging time of the second session is updated.
Besides the aging time of the session holding table entry, the session itself also has the aging time, which is not described in detail here.
Further, if the second session exists, whether the message sent by the client is a reply message of a session maintenance table item keep-alive message is judged;
if the message is not a reply message of the keep-alive message, sending the message to a second server, wherein the second server is a server corresponding to the second session;
if the message is a reply message of the keep-alive message, the message does not need to be sent to the second server, because the message is easy to know to be irrelevant to the service.
Step S303, if the second session does not exist, establishing the second session.
Further, after establishing the second session, there may be:
inquiring whether a second session holding table item exists;
if the second session holding table entry does not exist, creating the second session holding table entry;
and if the second session maintenance entry already exists, updating the aging time of the second session maintenance entry.
And then, sending the message to a second server.
As an example, the situation of a message sent by a client can be seen in fig. 4, which includes the following steps:
step S401, the client sends a message.
The message may be a service message or a reply message of a keep-alive message, such as a keep _ alive message.
Step S402, it is queried whether a session exists.
Whether a session corresponding to the packet currently exists can be determined according to the identifier (e.g., quintuple) of the packet.
If a session exists, the process proceeds to step S403, and if a session does not exist, the process proceeds to step S406.
Step S403, the session aging time is updated.
Step S404, judging whether the message is a reply message of the keep-alive message.
And if the message is the reply message of the keep-alive message, jumping to the step S407, and if the message is not the reply message of the keep-alive message, entering the step S405.
Step S405, the message is transmitted quickly.
The message may be sent to the corresponding server in a message fast-forwarding manner, i.e., step S410 is performed.
Step S406, a session is established.
Step S407, it is queried whether a session holding entry exists.
If the session holding table entry of the new session already exists, step S409 is entered; if the session holding entry for the new session does not exist, step S408 is entered.
Step S408, establishing a session holding table entry. Then, the process proceeds to step S410.
Step S409, the aging time of the session holding table entry is updated. Then, the process proceeds to step S410.
Step S410, the server receives the message. It should be noted that if the packet is a reply packet of the keep-alive packet, there is no step of the server receiving the packet actually.
The flow ends.
In this embodiment of the present invention, before the first session maintaining table entry ages, the load balancing device sends a session maintaining table entry keep-alive packet for detecting the connection state of the client to the client, and then determines that the connection of the client is normal according to a reply to the keep-alive packet from the client, if the connection of the client is normal, it represents that the long connection session needs to be continuously maintained, and the first session maintaining table entry cannot be aged, so that the aging time of the first session maintaining table entry is updated. The scheme establishes a session maintenance table item updating mechanism, completes the updating of the session maintenance table item by detecting the client, even if the interval time of two messages sent by the client exceeds the connection timeout value, the session maintenance table item can still exist as long as the client is normally connected, thereby not only reducing the process of repeatedly establishing the connection by the client through session maintenance, but also avoiding the service error caused by the redistribution of the server due to the load balancer when the client accesses the server again after exceeding the session maintenance aging time under the condition that the connection of the client is long, in addition, the mechanism of session maintenance table item aging still exists, and avoiding the problem of insufficient performance of the load balancer caused by the occupation of equipment resources due to the fact that the session table item is not aged for a long time.
Referring to fig. 5, fig. 5 is a schematic diagram of a long connection session holding apparatus shown in the present application. The apparatus may be used in a load balancing device. The apparatus may include:
a session management unit 501, configured to establish a first session for a client and a first server.
A session holding table entry management unit 502, configured to create a first session holding table entry for the first session, where the first session holding table entry records a corresponding relationship between the client and the first server; and updating the aging time of the first session holding table entry.
A detecting unit 503, configured to send a keep-alive packet for the session keep-alive entry to the client after the first session is disconnected and before the first session keep-alive entry ages, where the keep-alive packet for the session keep-alive entry is used to detect a connection state of the client; and if the client is determined to be normally connected according to the reply of the client to the keep-alive message, triggering the session maintenance table item management unit to update the aging time of the first session maintenance table item.
As an example, in this embodiment or some other embodiments of the present invention, before the first session holding entry ages, specifically:
and when the first preset time is left at the moment when the first session keeping table entry is deleted.
For example, in this embodiment or some other embodiments of the present invention, when the session holding entry management unit updates the aging time of the first session holding entry, the session holding entry management unit is specifically configured to:
and resetting the aging time of the first session holding table entry to a second preset time length and restarting aging countdown according to the second preset time length.
By way of example, in this embodiment or some other embodiments of the present invention, the session holding table entry management unit is further configured to:
and if the connection of the client is not determined to be normal when the first session maintaining table entry is aged or within a third preset time after the session maintaining table entry keep-alive message is sent to the client, deleting the first session maintaining table entry.
As an example, in this embodiment or some other embodiments of the present invention, the session management unit is further configured to:
when a message sent by the client is received, whether a second session exists is inquired, wherein the second session is a session corresponding to the message; updating the aging time of the second session if the second session exists; establishing the second session if the second session does not exist.
As an example, in this embodiment or some other embodiments of the present invention, the session management unit is further configured to:
if the second session exists, judging whether the message sent by the client is a reply message of a session keeping table item keep-alive message; and if the message is not a reply message of the keep-alive message, sending the message to a second server, wherein the second server is a server corresponding to the second session.
By way of example, in this embodiment or some other embodiments of the present invention, the session holding table entry management unit is further configured to:
after the session management unit establishes the second session, inquiring whether a second session holding table item exists; if the second session holding table entry does not exist, creating the second session holding table entry; and if the second session maintenance entry already exists, updating the aging time of the second session maintenance entry.
In this embodiment of the present invention, before the first session maintaining table entry ages, the load balancing device sends a session maintaining table entry keep-alive packet for detecting the connection state of the client to the client, and then determines that the connection of the client is normal according to a reply to the keep-alive packet from the client, if the connection of the client is normal, it represents that the long connection session needs to be continuously maintained, and the first session maintaining table entry cannot be aged, so that the aging time of the first session maintaining table entry is updated. The scheme establishes a session maintenance table item updating mechanism, completes the updating of the session maintenance table item by detecting the client, even if the interval time of two messages sent by the client exceeds the connection timeout value, the session maintenance table item can still exist as long as the client is normally connected, thereby not only reducing the process of repeatedly establishing the connection by the client through session maintenance, but also avoiding the service error caused by the redistribution of the server due to the load balancer when the client accesses the server again after exceeding the session maintenance aging time under the condition that the connection of the client is long, in addition, the mechanism of session maintenance table item aging still exists, and avoiding the problem of insufficient performance of the load balancer caused by the occupation of equipment resources due to the fact that the session table item is not aged for a long time.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (14)

1. A long connection session holding method, wherein the method is used for a load balancing device, and wherein the method comprises the following steps:
establishing a first session for a client and a first server;
creating a first session holding table entry for the first session, wherein the first session holding table entry records the corresponding relationship between the client and the first server;
after the first session is disconnected and before the first session maintaining table item is aged, sending a session maintaining table item keep-alive message to the client, wherein the session maintaining table item keep-alive message is used for detecting the connection state of the client;
and if the client side is determined to be normally connected according to the reply of the client side to the keep-alive message, updating the aging time of the first session keeping table entry.
2. The method of claim 1, wherein before the first session holding entry ages, specifically:
and when the first preset time is left at the moment when the first session keeping table entry is deleted.
3. The method of claim 1, wherein the updating the aging time of the first session holding entry comprises:
and resetting the aging time of the first session holding table entry to a second preset time length and restarting aging countdown according to the second preset time length.
4. The method of claim 1, wherein after sending a session keep table entry keep-alive message to the client, the method further comprises:
and if the connection of the client is not determined to be normal when the first session maintaining table entry is aged or within a third preset time after the session maintaining table entry keep-alive message is sent to the client, deleting the first session maintaining table entry.
5. The method of claim 1, further comprising:
when a message sent by the client is received, whether a second session exists is inquired, wherein the second session is a session corresponding to the message;
updating the aging time of the second session if the second session exists;
establishing the second session if the second session does not exist.
6. The method of claim 5, further comprising:
if the second session exists, judging whether the message sent by the client is a reply message of a session keeping table item keep-alive message;
and if the message is not a reply message of the keep-alive message, sending the message to a second server, wherein the second server is a server corresponding to the second session.
7. The method of claim 5, wherein after establishing the second session, the method further comprises:
inquiring whether a second session holding table item exists;
if the second session holding table entry does not exist, creating the second session holding table entry;
and if the second session maintenance entry already exists, updating the aging time of the second session maintenance entry.
8. A long connection session holding apparatus, wherein the apparatus is used for a load balancing device, the apparatus comprising:
the session management unit is used for establishing a first session for the client and the first server;
a session holding table entry management unit, configured to create a first session holding table entry for the first session, where the first session holding table entry records a correspondence between the client and the first server; updating the aging time of the first session holding table entry;
a detecting unit, configured to send a keep-alive packet for a session keep-alive entry to the client after the first session is disconnected and before the first session keep-alive entry ages, where the keep-alive packet for the session keep-alive entry is used to detect a connection state of the client; and if the client is determined to be normally connected according to the reply of the client to the keep-alive message, triggering the session maintenance table item management unit to update the aging time of the first session maintenance table item.
9. The apparatus of claim 8, wherein before the first session holding entry ages, specifically:
and when the first preset time is left at the moment when the first session keeping table entry is deleted.
10. The apparatus according to claim 8, wherein the session holding entry management unit, when updating the aging time of the first session holding entry, is specifically configured to:
and resetting the aging time of the first session holding table entry to a second preset time length and restarting aging countdown according to the second preset time length.
11. The apparatus of claim 8, wherein the session hold table entry management unit is further configured to:
and if the connection of the client is not determined to be normal when the first session maintaining table entry is aged or within a third preset time after the session maintaining table entry keep-alive message is sent to the client, deleting the first session maintaining table entry.
12. The apparatus of claim 8, wherein the session management unit is further configured to:
when a message sent by the client is received, whether a second session exists is inquired, wherein the second session is a session corresponding to the message; updating the aging time of the second session if the second session exists; establishing the second session if the second session does not exist.
13. The apparatus of claim 12, wherein the session management unit is further configured to:
if the second session exists, judging whether the message sent by the client is a reply message of a session keeping table item keep-alive message; and if the message is not a reply message of the keep-alive message, sending the message to a second server, wherein the second server is a server corresponding to the second session.
14. The apparatus of claim 12, wherein the session hold table entry management unit is further configured to:
after the session management unit establishes the second session, inquiring whether a second session holding table item exists; if the second session holding table entry does not exist, creating the second session holding table entry; and if the second session maintenance entry already exists, updating the aging time of the second session maintenance entry.
CN201811581099.3A 2018-12-24 2018-12-24 Long connection session keeping method and device Active CN109510878B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811581099.3A CN109510878B (en) 2018-12-24 2018-12-24 Long connection session keeping method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811581099.3A CN109510878B (en) 2018-12-24 2018-12-24 Long connection session keeping method and device

Publications (2)

Publication Number Publication Date
CN109510878A CN109510878A (en) 2019-03-22
CN109510878B true CN109510878B (en) 2021-12-24

Family

ID=65755256

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811581099.3A Active CN109510878B (en) 2018-12-24 2018-12-24 Long connection session keeping method and device

Country Status (1)

Country Link
CN (1) CN109510878B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110071925B (en) * 2019-04-25 2021-01-15 腾讯科技(深圳)有限公司 Data transmission method and corresponding server and computer readable storage medium
CN111163160A (en) * 2019-12-27 2020-05-15 杭州迪普科技股份有限公司 Keep-alive method and system for session table entry
CN113114570B (en) * 2020-01-13 2023-04-07 阿里巴巴集团控股有限公司 Control method, device and system of flow table item
CN114500633B (en) * 2022-01-27 2023-11-03 北京百度网讯科技有限公司 Data forwarding method, related device, program product and data transmission system
CN114973480A (en) * 2022-05-24 2022-08-30 甘肃省卫生健康统计信息中心(西北人口信息中心) Health code service bearing capacity expansion method
CN114866442B (en) * 2022-05-31 2023-05-26 杭州迪普科技股份有限公司 8583 protocol-based cross-virtual service session maintenance test method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1946062A (en) * 2006-10-10 2007-04-11 华为数字技术有限公司 Method and system for keep-alive conversation table in NAT device
CN101026567A (en) * 2007-01-29 2007-08-29 华为技术有限公司 Address repeat listing keeping-alive method and system
CN104378230A (en) * 2014-11-06 2015-02-25 上海斐讯数据通信技术有限公司 System and method for improving stability of Telnet server
CN108076149A (en) * 2017-12-15 2018-05-25 杭州迪普科技股份有限公司 Session keeping method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101820382B (en) * 2009-02-28 2013-02-27 华为技术有限公司 Method, device and system for announcing information of network address translation equipment
CN104144159B (en) * 2014-06-26 2016-04-13 腾讯科技(深圳)有限公司 Intelligent heartbeat keepalive method and intelligent heartbeat keep-alive system
CN105120495B (en) * 2015-09-09 2018-10-02 北京京东尚科信息技术有限公司 A kind of information push method and system of intelligent mobile terminal
CN105610913A (en) * 2015-12-22 2016-05-25 用友网络科技股份有限公司 Heartbeat keep-alive method and apparatus for long connection in communication network
CN105939345A (en) * 2016-04-25 2016-09-14 杭州迪普科技有限公司 Management method and device of protocol table item timer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1946062A (en) * 2006-10-10 2007-04-11 华为数字技术有限公司 Method and system for keep-alive conversation table in NAT device
CN101026567A (en) * 2007-01-29 2007-08-29 华为技术有限公司 Address repeat listing keeping-alive method and system
CN104378230A (en) * 2014-11-06 2015-02-25 上海斐讯数据通信技术有限公司 System and method for improving stability of Telnet server
CN108076149A (en) * 2017-12-15 2018-05-25 杭州迪普科技股份有限公司 Session keeping method and device

Also Published As

Publication number Publication date
CN109510878A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
CN109510878B (en) Long connection session keeping method and device
US10791168B1 (en) Traffic aware network workload management system
US10999201B2 (en) Dynamic advertisement routing
US11934868B2 (en) Systems and methods for scheduling tasks
CN109218355B (en) Load balancing engine, client, distributed computing system and load balancing method
US11888756B2 (en) Software load balancer to maximize utilization
EP2647174B1 (en) System and method to distribute application traffic to servers based on dynamic service response time
US20180205787A1 (en) Load Balanced Network File Accesses
US9032073B1 (en) Operational status of network nodes
CN110365748B (en) Service data processing method and device, storage medium and electronic device
CN110753131A (en) Microservice distributed current limiting method and device, storage medium and electronic equipment
CN108933829A (en) A kind of load-balancing method and device
US9264337B2 (en) Service monitoring system, service monitoring method, and non-transitory computer-readable recording medium
US10944655B2 (en) Data verification based upgrades in time series system
JP6272190B2 (en) Computer system, computer, load balancing method and program thereof
US9104488B2 (en) Support server for redirecting task results to a wake-up server
US10439901B2 (en) Messaging queue spinning engine
CN102281190A (en) Networking method for load balancing apparatus, server and client access method
CN109672711B (en) Reverse proxy server Nginx-based http request processing method and system
CN107105013B (en) File processing method, server, terminal and system
CN113014611B (en) Load balancing method and related equipment
CN110740162A (en) Communication link establishing method, device, electronic equipment and medium
US20160344582A1 (en) Call home cluster
US10986172B2 (en) Configurable connection reset for customized load balancing
US9110739B2 (en) Subscribing to multiple resources through a common connection

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
GR01 Patent grant
GR01 Patent grant