CN108769196B - Session creation method and device - Google Patents

Session creation method and device Download PDF

Info

Publication number
CN108769196B
CN108769196B CN201810532383.5A CN201810532383A CN108769196B CN 108769196 B CN108769196 B CN 108769196B CN 201810532383 A CN201810532383 A CN 201810532383A CN 108769196 B CN108769196 B CN 108769196B
Authority
CN
China
Prior art keywords
session
network device
network
processed
message
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
CN201810532383.5A
Other languages
Chinese (zh)
Other versions
CN108769196A (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.)
New H3C Security Technologies Co Ltd
Original Assignee
New H3C Security 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 New H3C Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN201810532383.5A priority Critical patent/CN108769196B/en
Publication of CN108769196A publication Critical patent/CN108769196A/en
Application granted granted Critical
Publication of CN108769196B publication Critical patent/CN108769196B/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/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a session creating method and a session creating device, wherein the method comprises the following steps: receiving a message to be processed; under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from a network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: a device in the network device set except the first network device, wherein the target session is: a session corresponding to the message to be processed; if the determined equipment is first network equipment, establishing a target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment. By applying the scheme provided by the embodiment of the application to the session creation, the condition of load imbalance among network devices can be reduced.

Description

Session creation method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a session creation method and apparatus.
Background
In the networking of the active/standby mode, two network devices are usually set to participate in packet forwarding, where one device is called a master device and one device is called a standby device. In practical application, in order to make the networking in the active/standby mode have a powerful function when forwarding a message, a dual-master function of a session is usually started, that is, the standby device and the master device participate in message forwarding together, so that the resources of the network device can be fully utilized on the premise that the networking ensures high reliability, and the load capacity of the networking is improved.
In a specific application process, in order to ensure normal message forwarding, after a message is received, a session needs to be created for the message, and then the message is forwarded according to the created session. In the prior art, when a session is created based on a hash algorithm, generally, after the host device and the standby device receive a packet, if the received packet is found to belong to a first packet of a new service, the hash algorithm is used to perform hash processing on the received packet, then, according to a result of the hash processing, one device is selected from the host device and the standby device, and the selected device creates the session of the received packet, thereby completing the session creation.
Although the above method can complete session creation and balance the task of creating a session between the primary and secondary devices according to the hash processing result, the above method only considers load balancing between the primary and secondary devices from the local point of creating a new session, and from the point of view of overall processing service of the primary and secondary devices, the above method is liable to cause load imbalance between the primary and secondary devices.
Disclosure of Invention
An object of the embodiments of the present application is to provide a session creation method and apparatus, so as to reduce the situation of load imbalance between network devices. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application discloses a session creation method, which is applied to a first network device in a network device set, and the method includes:
receiving a message to be processed;
under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from the network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is, in the network device set except for the first network device: a session corresponding to the message to be processed;
if the determined equipment is the first network equipment, establishing the target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
In a second aspect, an embodiment of the present application discloses a session creating apparatus, applied to a first network device in a network device set, where the apparatus includes:
the message receiving module is used for receiving a message to be processed;
a first device determining module, configured to determine, according to a first session quantity and each second session quantity, a device for creating a target session from the network device set when it is determined that the to-be-processed packet belongs to a first packet of a new service, where the first session quantity is: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is, in the network device set except for the first network device: a session corresponding to the message to be processed;
a session creating module, configured to create the target session according to the to-be-processed packet if the determined device is the first network device;
and the message sending module is used for sending the message to be processed to the determined equipment if the determined equipment is not the first network equipment.
In a third aspect, an embodiment of the present application discloses a network device as a first network device, where the first network device is: a network device of a set of network devices, the first network device comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the steps of the session creation method provided by the embodiment of the application are realized.
In a fourth aspect, an embodiment of the present application provides a machine-readable storage medium, where the machine-readable storage medium is a storage medium in a first network device, where the first network device is: a network device of a set of network devices, the machine-readable storage medium having stored therein machine-executable instructions that, when invoked and executed by a processor, cause the processor to: the steps of the session creation method provided by the embodiment of the application are realized.
As can be seen from the above, in the solution provided in the embodiment of the present application, after receiving a to-be-processed packet, when it is determined that the to-be-processed packet belongs to a first packet of a new service, a device for creating a target session is determined from a network device set according to the first session number and each second session number, and the determined device creates the target session. Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a session creation method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another session creation method provided in the embodiment of the present application;
fig. 3 is a schematic diagram of a network structure according to an embodiment of the present application;
fig. 4 is a schematic diagram of another network structure provided in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a session creation apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another session creation apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Because the situation of load imbalance among network devices is easily caused when a session is created by applying the scheme provided by the prior art, in order to solve the technical problem, the embodiment of the application provides a session creation method and a session creation device.
In an embodiment of the present application, a session creating method is provided, which is applied to a first network device in a network device set, and the method includes:
receiving a message to be processed;
under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from a network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: a device in the network device set except the first network device, wherein the target session is: a session corresponding to the message to be processed;
if the determined equipment is first network equipment, establishing a target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
The following describes a session creation method provided by the embodiments of the present application with specific embodiments.
Fig. 1 is a flowchart illustrating a session creating method according to an embodiment of the present application, where the method is applied to a first network device.
Wherein, the first network equipment is: a network device of the set of network devices.
In an embodiment of the present application, in networking based on the active/standby mode, the network device set may include a master device and a standby device. In the active/standby mode, one master device may correspond to one standby device, or may correspond to more than one standby device.
In addition, networking based on the main/standby mode can also have an enhanced function of a double main function of a session. Under the above dual main functions, both the main device and the standby device can be used for forwarding messages. That is, when one master device corresponds to one slave device, both the master device and the slave device can forward messages; when one main device corresponds to more than one standby device, the main device and the corresponding more than one standby device can perform message forwarding.
In another embodiment of the present application, the network device set may further include at least two network devices that do not distinguish between the master mode and the standby mode, but at least two network devices in the network device set both need to forward a service, that is, at least two network devices in the network device set both are used to forward a packet.
Specifically, the session creating method includes:
s101: and receiving a message to be processed.
S102: and under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating the target session from the network equipment set according to the first session quantity and each second session quantity.
Wherein the first session number is: the session created by the first network device in the session currently exists on the first network device, and the second number of sessions is: the session created by the second network device in the session currently exists on the second network device, and the second network device is: the target session of the devices in the network device set except the first network device is as follows: and the conversation corresponding to the message to be processed.
In this embodiment, the first network device may be a master device or a standby device.
In an embodiment of the present application, to ensure that the first network device can normally forward the packet, the first network device itself stores a session table, where session information is stored. Based on this, when determining whether the message to be processed belongs to the first message of the new service, the first network device may first determine whether session information corresponding to the message to be processed exists in a session table stored in the first network device, and if not, may determine that the message to be processed is the first message of the new service.
In addition, when the session table stored in the first network device itself does not have the session information corresponding to the message to be processed, the message to be processed may also be referred to as a first packet flow.
For one device in the network device set, after creating the session, the device performs session synchronization, that is, synchronizes the created session to other devices in the network device set. Thus, each device locally stores the sessions created by itself and the sessions created and synchronized by other devices. Based on this, the "session currently existing on the first network device" includes: the session created by the first network device is synchronized with the session synchronized by each second network device.
In view of that the device may store the session locally, when each device in the network device set receives a packet of the first packet that does not belong to the new service, the device may forward the packet according to the session created by itself or the session created and synchronized by another device.
In an embodiment of the present application, when determining a device for creating a target session from the network device set according to the first session number and each second session number, the device with the smallest creation session number may be determined as the device for creating the target session from the network device set according to the first session number and each second session number.
The first number of sessions can reflect the loading of the first network device, i.e., a larger first number of sessions indicates a higher loading of the first network device, and conversely a smaller first number of sessions indicates a lower loading of the first network device.
Similar to the first session number, each second session number can reflect the load condition of each second network device, that is, the larger the second session number is, the higher the load of the second network device corresponding to the second session number is, and conversely, the smaller the second session number is, the lower the load of the second network device corresponding to the second session number is.
Based on the above description, when determining the device for creating the target session, the device with the minimum number of created sessions currently exists is preferentially selected from the network device set, that is, the device with low load in the network device set is preferentially selected, which is beneficial to balancing the load among the devices in the network device set.
Assume that the set of network devices includes: for the master device a, the total number of currently existing sessions is: 15, wherein the number of sessions created by the master device a is: 10, the number of sessions created and synchronized by the standby device B to the master device a is: 5, 10 is greater than 5, it may be determined that device B is the device used to create the target session.
Further, it is assumed that the set of network devices includes: for the master device C, the slave device D, the slave device E, and the slave device F, the total number of currently existing sessions is: 20, wherein the number of sessions created by the master C is: 5, the number of sessions created by the device D is: 4, the number of sessions created by the standby device E is: 8, the number of sessions created by the standby device F is: 3, then the device with the least number of existing sessions is created as: and the standby equipment F is determined to be equipment for creating the target session.
In another embodiment of the present application, when determining a device for creating a target session from a network device set according to the first session number and each second session number, a first preset number of network devices may be selected from the network device set according to the first session number and each second session number in an order from a smaller session number to a larger session number, and a device for creating the target session may be determined from the selected network devices according to a data processing capability and/or an operating state of the network devices. The first preset number may be self-defined, and the embodiment is not particularly limited.
The data processing capability of the network device may be represented by the performance of each hardware in the network device, for example, the performance of a CPU, the performance of a memory, and the like.
The working state of the network device may be understood as how busy the network device is, for example, may be represented by a frequency at which the network device receives a message, may be represented by a ratio of occupied resources such as a processor and a memory of the network device, and the like. In one implementation, the operational state of a network device may be represented in both a busy and an idle state.
Specifically, when determining the device for creating the target session from the selected network devices according to the data processing capability and/or the operating state of the network devices, the device with the strongest performance in the selected devices may be determined as the device for creating the target session, or the device in the idle state in the selected devices may be determined as the device for creating the target session, and so on. Of course, this embodiment may also select the device with the strongest performance from the devices in the idle state to create the target session, or select a device in the idle state from the devices with the strongest performance to create the target session.
It can be seen that, when determining the device for creating the target session in the solution provided by this embodiment, the performance and/or the operating state of the device are also considered in addition to the number of sessions currently existing and created by the device, so that a device capable of creating the target session in time can be selected.
S103: if the determined equipment is first network equipment, establishing a target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
Specifically, the above-identified device may include the following two cases:
in the first case: the determined device is the first network device, and in this case, since the first network device has received the message to be processed, when creating the target session, the first network device directly creates the target session according to the message to be processed;
in the second case: in this case, when creating the target session, the first network device first sends the message to be processed to the determined second network device, and then the second network device creates the target session according to the received message to be processed. That is to say, in this case, the purpose of the first network device sending the message to be processed to the determined second network device is: and informing the determined second network equipment to create the target session.
In an embodiment of the present application, a session creation rule may be set in advance for each network device in a network set: when receiving messages sent by other network devices in the network set, actively triggering the session creation function. That is, on the basis of the rule, after the second network device receives the message to be processed sent by the first network device, the second network device actively creates the target session.
In another embodiment of the present application, the first network device may send, in addition to sending the to-be-processed packet to the second network device, an instruction for instructing the second network device to create the target session to the second network device, so that the second network device creates the target session after receiving the instruction.
In other embodiments, the rule triggering the network device to create the session may also be: and receiving a message in a preset format, wherein the preset format can be customized. The first network device may encapsulate the message to be processed into a message in a predetermined format, decapsulate the message in the predetermined format when the message received by the second network device is the message in the predetermined format, and create the target session according to the obtained message to be processed.
The rule that triggers the network device to create a session may also be: and identifying a preset identifier of a reserved field in the message to be processed, wherein the preset identifier is used for indicating the network equipment receiving the message to be processed to establish a corresponding session according to the message to be processed. The first network device may fill a predetermined identifier in a reserved field in the past message to be processed, and send the filled message to the second network device. And after the second network equipment analyzes the message, the second network equipment identifies the preset identification and creates the target session according to the obtained message to be processed.
As can be seen from the above, in the scheme provided in this embodiment, after receiving the to-be-processed packet, the first network device determines, according to the first session number and each second session number, a device for creating a target session from the network device set, and creates the target session by using the determined device, in the case that it is determined that the to-be-processed packet belongs to the first packet of the new service. Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
In an embodiment of the present application, referring to fig. 2, a flowchart of another method for a first network device to perform session creation is provided, where the method includes the following steps.
S201: and receiving a message to be processed.
S202: and under the condition that the message to be processed is judged to belong to the first message of the new service, judging whether each device in the network device set has the condition of unbalanced load, if so, executing the step S203, and if not, executing the step S204.
In an embodiment of the present application, when determining whether each device in the network device set has a load imbalance, the determination may be performed according to the number of the first sessions and the number of the second sessions.
Specifically, the difference between the first session number and each second session number may be obtained first, and then whether each device in the network device set has a condition of unbalanced load may be determined according to the obtained difference and a preset session number threshold. That is, whether each device in the network device set has a load imbalance condition may be determined according to a difference between the first session number and each second session number, and a preset session number threshold.
In an embodiment of the present application, when determining whether each device in the network device set has a condition of unbalanced load according to the obtained difference and a preset session number threshold, the determining may be performed in the following manners:
the first method is as follows: and judging whether the obtained difference values are all larger than a preset session number threshold value, if so, judging that the load of each device in the network device set is unbalanced.
The second method comprises the following steps: and judging whether the obtained difference values have difference values larger than a preset session number threshold value, if so, judging that the load of each device in the network device set is unbalanced.
The third method comprises the following steps: and judging whether the number of the obtained difference values larger than a preset session number threshold value reaches a preset number or not, and if so, judging that the load of each device in the network device set is unbalanced.
In the present application, the above-mentioned example is only used for explanation, and the method for determining whether each device in the network device set has a load imbalance is not limited to the above-mentioned three methods.
Still taking the network device set comprising the master device a and the standby device B mentioned in the foregoing S102 as an example, the first session number is the number of sessions created by the master device a, the second session number is the number of sessions created by the standby device B, and then the difference between the first session number and the second session number is: assuming that the preset session number threshold is 20, if 5 is less than 20, it may be determined that there is no load imbalance between the master device a and the standby device B in the network device set.
In an embodiment of the application, the session number threshold may be: a value determined from the information characterizing the data processing capabilities of the first network device. Specifically, the information characterizing the data processing capability of the first network device may include: at least one of the CPU performance, the memory performance, and the like of the first network device. As can be seen from this embodiment, the session number thresholds are device-dependent, that is, the session number thresholds corresponding to devices with different data processing capabilities are different.
When determining the threshold of the number of sessions according to the information characterizing the data processing capability of the first network device, it may be: the stronger the data processing capability, the larger the session number threshold, the weaker the data processing capability, and the smaller the session number threshold.
For example, the memory performance is represented by the size of the memory, the size of the memory may be segmented in advance, and a corresponding session number threshold is set for each segment, such as:
the memory range is: when [ a, b) indicates that the data processing capability of the network device is weak, the corresponding session number threshold is: e;
the memory range is: when [ b, c), the data processing capability of the network device is equal, and the corresponding session number threshold is: f;
the memory range is: when [ c, d ] shows that the data processing capability of the network device is strong, the corresponding session number threshold is: g.
wherein a is more than b and less than c and less than d, and e is more than f and less than g.
After the memory size of the first network device is determined based on the above situation, the memory range to which the memory size belongs is determined, and then the session number threshold corresponding to the determined memory range is determined as the session number threshold corresponding to the first network device.
The present application is described only by way of example, and is not limited to the embodiment.
Specifically, it may also be determined whether each device in the network device set has a load imbalance according to fluctuation information, where the fluctuation information is used to represent a fluctuation condition of a sequence formed by the first session number and each second session number.
For example, the fluctuation information may be: the variance of the sequence formed by the first session number and each second session number, and the fluctuation information may be: the difference between the maximum and minimum values in the sequence formed by the first number of sessions and the respective second number of sessions, and so on.
Assume that the first number of sessions is: 5, the second session numbers are respectively: 4. 8, 3 and 5. Then
5. 4, 8, 3, 5 are the mean values: (5+4+8+3+5)/5 ═ 5.
The fluctuation information may be: 5. 4, 8, 3, 5 are:
Figure BDA0001677485400000111
in addition, the maximum value of the sequences formed by 5, 4, 8, 3 and 5 is: 8, the minimum value is: 3,
the fluctuation information may be: maximum-minimum-8-3-5.
Specifically, when determining whether each device in the network device set has a load imbalance according to the fluctuation information, it may be determined whether the fluctuation information is smaller than a preset fluctuation value, and if so, it may be determined that each device in the network device set has a load imbalance. The preset fluctuation value may be set empirically, and the present embodiment is not particularly limited.
In summary, in one embodiment of the present application, the load imbalance condition may include at least one of the following:
at least one first difference value which is larger than the threshold value of the session number exists in the difference values of the first session number and the second session numbers;
and the fluctuation information representing the fluctuation conditions of the first session quantity and each second session quantity is greater than a preset fluctuation value.
S203: and determining a device for creating the target session from the network device set according to the first session number and the second session numbers.
The manner of determining the device for creating the target session in this step is the same as that mentioned in the foregoing S102, and is not described herein again.
S204: and determining equipment for creating the target session from the network equipment set according to the message to be processed.
In an embodiment of the present application, when determining a device for creating a target session from a network device set according to a packet to be processed, hash processing may be performed on the packet to be processed first, and then the device for creating the target session is determined from the network device set according to a hash processing result.
Specifically, when the hash processing is performed on the packet to be processed, the hash calculation may be performed on at least one information of a five-tuple or a seven-tuple of the packet to be processed according to a hash algorithm.
Wherein the quintuple comprises: source IP (Internet Protocol, Protocol for interconnecting networks) address, source port, destination IP address, destination port, and transport layer Protocol.
The seven tuples comprise: interface index, source IP address, destination IP address, source port number, destination port number, protocol number, and TOS (Type of service).
In an implementation manner of the present application, when determining a device for creating a target session from a network device set according to a hash processing result, an identifier may be set in advance for each device in the network device set, where the identifiers are integers of [0, the number of network devices ]), then a remainder is obtained by dividing the hash processing result by the number of network devices, and the device with the identifier being the remainder obtained by calculation is determined as a device for creating the target session. Wherein, the number of network devices is: the number of devices contained in the set of network devices.
Still taking the network device set containing the master device a and the slave device B mentioned in the foregoing S102 as an example, the number of network devices is: 2, the identifier marked for the master device a in advance is: 0, the label for device B is: 1, assuming that the remainder obtained by dividing the hash processing result by 2 is 0, the device for creating the target session is the primary device a, and assuming that the remainder obtained by dividing the hash processing result by 2 is 1, the device for creating the target session is the secondary device B.
S205: if the determined equipment is first network equipment, establishing a target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
It should be noted that S201 is the same as S101, and S205 is the same as S103, which are not described again here.
As can be seen from the above, in the solutions provided in the foregoing embodiments, when determining the packet for creating the target session, not only from the perspective that the first session number and each second session number can reflect the entire load condition of the device, but also from the perspective that the packet is received, when reducing the load imbalance among the network devices, because the load balancing is considered from the perspective that the packet is received, the tasks for creating the session corresponding to the subsequently received packet can also be distributed among the network devices in a balanced manner.
The session creation method provided in the embodiment of the present application is described in detail below with reference to the network structure diagrams shown in fig. 3 and fig. 4.
Example one
It is assumed that the network structure shown in fig. 3 is a network structure based on the active/standby mode, and the network structure includes: the networking has a session dual-master function, so that both the master device 1 and the standby device 1 can be used for forwarding messages. The number of sessions currently existing in the master device 1 and the standby device 1 is: 15, in the current existing session, the number of sessions created by the master device 1 is: 10, the number of sessions created by the device 1 is: 5.
taking the case that the master device 1 receives the message to be processed as an example, the session creation method is introduced based on the network structure.
If the main device 1 finds that the session table stored by itself does not have the session information of the message to be processed, it determines that the message to be processed is the first message of the new service.
In the first case, it is assumed that the preset session number threshold is: 2.
since the number of sessions created by the master device 1 in the current existing session is 5, and the number of sessions created by the standby device 1 is 10, where 10-5 is 5, and 5 is greater than the preset session number threshold 2, it indicates that there is a load imbalance between the master device 1 and the standby device 1. The method includes the steps that a device with the minimum existing session number is created in the main device 1 and the standby device 1 to create a session corresponding to a message to be processed, namely, the main device 1 creates a session corresponding to the message to be processed.
In the second case, it is assumed that the preset session number threshold is: the identification of the master device 1 is: 0, the identifier of the device 1 is: 1.
since the number of created sessions of the master device 1 in the currently existing session is 5, and the number of created sessions of the standby device 1 is 10, where 10-5 is 5, and 5 is not greater than the preset session number threshold 8, it is said that the master device 1 and the standby device 1 are load balanced. The primary device 1 performs hash processing on the source IP address of the packet to be processed, and determines that the secondary device 1 is used for creating a session corresponding to the packet to be processed, assuming that a remainder obtained by dividing a hash processing result by the number 2 of the network devices is 1. The main device 1 sends the message to be processed to the standby device 1, and after receiving the message to be processed, the standby device 1 creates a session corresponding to the message to be processed.
Example two
It is assumed that the network structure shown in fig. 4 is a network structure based on the active/standby mode, and the network structure includes: the network comprises a main device 2, a standby device 3, a standby device 4 and a standby device 5, and in addition, the network has a session double-main function, so that the main device 2, the standby device 3, the standby device 4 and the standby device 5 can be used for message forwarding. The number of the currently existing sessions in the master device 2, the standby device 3, the standby device 4 and the standby device 5 is as follows: in the current existing session, the number of sessions created by the master device 2 is: 5, the number of sessions created by the device 2 is: 4, the number of sessions created by the device 3 is: 8, the number of sessions created by the standby device 4 is: 3, the number of sessions created by the device 5 is: 5.
taking the example that the standby device 2 receives the message to be processed, the session creation method is introduced based on the network structure.
If the standby device 2 finds that the session table stored by itself does not have the session information of the message to be processed, it determines that the message to be processed is the first message of the new service.
In a third case, it is assumed that the preset fluctuation value is: 2.
the variance of the number of existing sessions created by each device can be derived from the following equation:
Figure BDA0001677485400000141
since the variance of the number of existing sessions created by each device is 14/5, 14/5 is greater than the preset fluctuation value 2, it can be said that the load imbalance exists among the main device 2, the standby device 3, the standby device 4, and the standby device 5. Selecting to create 4 devices with the least number of existing sessions: main equipment 2, standby equipment 4 and standby equipment 5. Assuming that the standby device 4 with the strongest data processing capability among the primary device 2, the standby device 4, and the standby device 5 is the standby device 4, the standby device 4 creates a session corresponding to a to-be-processed packet, that is, the standby device 4 is selected to create a session corresponding to a to-be-processed packet. The standby device 2 sends the message to be processed to the standby device 4, and the standby device 4 creates a session corresponding to the message to be processed after receiving the message to be processed.
In a fourth case, it is assumed that the preset fluctuation value is: 5, the identification of the master device 2 is: 0, the identifier of the device 2 is: 1, the identifier of the device 3 is: 2, the identifier of the device 4 is: and 3, the identifier of the equipment 5 is as follows: 4.
since the variance of the number of existing sessions created by each device is 14/5, 14/5 is smaller than the preset fluctuation value 5, it can be said that the load of the main device 2, the standby device 3, the standby device 4, and the standby device 5 is balanced. And the standby equipment 2 performs hash processing on the source IP address of the message to be processed, and if the remainder obtained by dividing the hash processing result by the number 5 of the network equipment is 1, the standby equipment 2 is determined to be used for creating the session corresponding to the message to be processed. The standby device 2 directly creates a session corresponding to the message to be processed.
Corresponding to the session processing method, the embodiment of the application also provides a session creating device.
Fig. 5 is a schematic structural diagram of a session creating apparatus according to an embodiment of the present application, where the session creating apparatus is applied to a first network device in a network device set, and the apparatus includes:
a message receiving module 301, configured to receive a message to be processed;
a first device determining module 302, configured to determine, according to a first session quantity and each second session quantity, a device for creating a target session from the network device set when it is determined that the packet to be processed belongs to a first packet of a new service, where the first session quantity is: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is, in the network device set except for the first network device: a session corresponding to the message to be processed;
a session creating module 303, configured to create the target session according to the to-be-processed packet if the determined device is the first network device;
a message sending module 304, configured to send the to-be-processed message to the determined device if the determined device is not the first network device.
In an embodiment of the present application, the first device determining module 302 is specifically configured to determine, according to the first session number and each second session number, a device with the minimum self created session number as a device for creating a target session from the network device set when it is determined that the packet to be processed belongs to a first packet of a new service; or according to the sequence of the number of the sessions from small to large, selecting a first preset number of network devices from the network device set according to the first number of the sessions and the number of the second sessions, and determining a device for creating a target session from the selected network devices according to the data processing capacity and/or the working state of the network devices.
In an embodiment of the present application, the first device determining module 302 is specifically configured to determine whether session information corresponding to the to-be-processed packet exists in a session table stored in the first device determining module, determine, if the to-be-processed packet does not exist, that the to-be-processed packet is a first packet of a new service, and determine, according to the first session number and each second session number, a device used for creating a target session from the network device set.
As can be seen from the above, in the scheme provided in this embodiment, after receiving the to-be-processed packet, the first network device determines, according to the first session number and each second session number, a device for creating a target session from the network device set, and creates the target session by using the determined device, in the case that it is determined that the to-be-processed packet belongs to the first packet of the new service. Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
In an embodiment of the present application, referring to fig. 4, a schematic structural diagram of another session processing apparatus is provided, and compared with the foregoing embodiment shown in fig. 6, in this embodiment, the apparatus further includes:
a load determining module 305, configured to determine whether each device in the network device set has a condition of unbalanced load before the first device determining module 302 determines a device when it is determined that the to-be-processed packet belongs to a first packet of a new service, if so, trigger the first device determining module 302, and if not, trigger the second device determining module 306;
the second device determining module 306 is configured to determine, according to the to-be-processed packet, a device used for creating the target session from the network device set.
In an embodiment of the application, the load determining module 305 may be specifically configured to determine whether each device in the network device set has a load imbalance according to a difference between the first session number and each second session number, and a preset session number threshold; or
The method is specifically configured to determine whether load imbalance exists in each device in the network device set according to fluctuation information, where the fluctuation information is used to characterize a fluctuation condition of a sequence formed by the first session number and each second session number.
In one embodiment of the present application, the load imbalance condition may include at least one of:
at least one first difference value which is larger than the threshold value of the session number exists in the difference values of the first session number and the second session numbers;
and the fluctuation information representing the fluctuation conditions of the first session quantity and each second session quantity is greater than a preset fluctuation value.
In an embodiment of the present application, the second device determining module 305 may include:
the hash processing unit is used for carrying out hash processing on the message to be processed;
and the equipment determining unit is used for determining the equipment for creating the target session from the network equipment set according to the hash processing result.
As can be seen from the above, in the solutions provided in the foregoing embodiments, when determining the packet for creating the target session, not only from the perspective that the first session number and each second session number can reflect the entire load condition of the device, but also from the perspective that the packet is received, when reducing the load imbalance among the network devices, because the load balancing is considered from the perspective that the packet is received, the tasks for creating the session corresponding to the subsequently received packet can also be distributed among the network devices in a balanced manner.
Corresponding to the above session creation method, an embodiment of the present application further provides a network device, as a first network device, where the first network device is: a network device of a set of network devices, the first network device comprising: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the session creation method provided by the embodiment of the application is realized.
In an embodiment of the present application, a session creation method is provided, which is applied to a first network device in a network device set, and the method includes:
receiving a message to be processed;
under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from the network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is a device in the network device set except the first network device: a session corresponding to the message to be processed;
if the determined equipment is the first network equipment, establishing the target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
It should be noted that the processor is caused by machine executable instructions to implement other embodiments of the session creation method, which are the same as the embodiments mentioned in the foregoing method embodiments and are not described herein again.
The machine-readable storage medium may include a Random Access Memory (RAM) and a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the machine-readable storage medium may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
As can be seen from the above, in the scheme provided in this embodiment, after receiving the to-be-processed packet, the first network device determines, according to the first session number and each second session number, a device for creating a target session from the network device set, and creates the target session by using the determined device, in the case that it is determined that the to-be-processed packet belongs to the first packet of the new service. Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
Corresponding to the session creation method, an embodiment of the present application further provides a machine-readable storage medium, where the machine-readable storage medium is a storage medium in a first network device, where the first network device is: a network device of a set of network devices, the machine-readable storage medium having stored therein machine-executable instructions that, when invoked and executed by a processor, cause the processor to: the session creation method provided by the embodiment of the application is realized.
In an embodiment of the present application, a session creation method is provided, which is applied to a first network device in a network device set, and the method includes:
receiving a message to be processed;
under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from the network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is a device in the network device set except the first network device: a session corresponding to the message to be processed;
if the determined equipment is the first network equipment, establishing the target session according to the message to be processed; and if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment.
It should be noted that other embodiments of the session creation method, which are similar to the embodiments mentioned in the previous embodiments of the method, are implemented by the processor according to the machine executable instructions, and are not described herein again.
As can be seen from the above, in the solution provided in this embodiment, by executing the machine-executable instruction stored in the machine-readable storage medium, after receiving the packet to be processed, and in a case that it is determined that the packet to be processed belongs to the first packet of the new service, the first network device determines, according to the first session number and each second session number, a device for creating the target session from the network device set, and creates the target session by using the determined device. Since the first session number and the second session number respectively reflect: since the session created by the first network device and the sessions created by the second network devices in the session currently exist, and the load situation of each network device can be reflected from the overall view of the device, the target session created by the determined device can reduce the load imbalance among the network devices.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus, network device and machine-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some portions of the description of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (10)

1. A session creation method, applied to a first network device in a set of network devices, the method comprising:
receiving a message to be processed;
under the condition that the message to be processed belongs to the first message of the new service, determining equipment for creating a target session from the network equipment set according to the first session quantity and each second session quantity, wherein the first session quantity is as follows: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is, in the network device set except for the first network device: a session corresponding to the message to be processed;
if the determined equipment is the first network equipment, establishing the target session according to the message to be processed; if the determined equipment is not the first network equipment, sending the message to be processed to the determined equipment;
before determining, according to the first session quantity and each second session quantity, a device for creating a target session from the network device set, when it is determined that the packet to be processed belongs to a first packet of a new service, the method further includes:
judging whether each device in the network device set has the condition of unbalanced load;
if yes, executing the step of determining equipment for creating the target session from the network equipment set according to the first session quantity and each second session quantity;
and if the target session does not exist, determining equipment for creating the target session from the network equipment set according to the message to be processed.
2. The method of claim 1, wherein the determining whether the devices in the network device set have unbalanced loads comprises:
judging whether each device in the network device set has a condition of load imbalance or not according to the difference value between the first session quantity and each second session quantity and a preset session quantity threshold value; or
And judging whether each device in the network device set has a condition of load imbalance according to fluctuation information, wherein the fluctuation information is used for representing the fluctuation condition of a sequence formed by the first session quantity and each second session quantity.
3. The method of claim 1, wherein the load imbalance condition comprises at least one of:
at least one first difference value which is larger than the threshold value of the session number exists in the difference values of the first session number and the second session numbers;
and the fluctuation information representing the fluctuation conditions of the first session quantity and each second session quantity is greater than a preset fluctuation value.
4. The method according to claim 1, wherein the determining, from the set of network devices, a device for creating the target session according to the packet to be processed comprises:
carrying out Hash processing on the message to be processed;
and determining the equipment for creating the target session from the network equipment set according to the hash processing result.
5. The method according to any one of claims 1 to 4,
the determining, from the set of network devices, a device for creating a target session according to the first session number and the respective second session numbers includes:
determining the device with the minimum self-created session number as the device for creating the target session from the network device set according to the first session number and each second session number; or according to the sequence of the number of the sessions from small to large, selecting a first preset number of network devices from the network device set according to the first number of the sessions and the number of the second sessions, and determining a device for creating a target session from the selected network devices according to the data processing capacity and/or the working state of the network devices;
or
Judging that the message to be processed is the first message of the new service in the following mode:
judging whether session information corresponding to the message to be processed exists in a session table stored by the terminal;
if not, the message to be processed is judged to be the first message of the new service.
6. A session creation apparatus, applied to a first network device in a set of network devices, the apparatus comprising:
the message receiving module is used for receiving a message to be processed;
a first device determining module, configured to determine, according to a first session quantity and each second session quantity, a device for creating a target session from the network device set when it is determined that the to-be-processed packet belongs to a first packet of a new service, where the first session quantity is: the sessions created by the first network device in the currently existing sessions, and the second number of sessions is: a session created by a second network device in the currently existing session, where the second network device is: the target session is, in the network device set except for the first network device: a session corresponding to the message to be processed;
a session creating module, configured to create the target session according to the to-be-processed packet if the determined device is the first network device;
a message sending module, configured to send the to-be-processed message to the determined device if the determined device is not the first network device;
a load determining module, configured to determine whether each device in the network device set has a condition of unbalanced load before the first device determining module determines the device when it is determined that the to-be-processed packet belongs to a first packet of a new service, if so, trigger the first device determining module, and if not, trigger the second device determining module;
and the second device determining module is configured to determine, according to the to-be-processed packet, a device for creating the target session from the network device set.
7. The apparatus of claim 6, wherein the load determining module,
the network device set is specifically configured to determine whether each device in the network device set has a condition of load imbalance according to a difference between the first session number and each second session number, and a preset session number threshold; or
The method is specifically configured to determine whether load imbalance exists in each device in the network device set according to fluctuation information, where the fluctuation information is used to characterize a fluctuation condition of a sequence formed by the first session number and each second session number.
8. The apparatus of claim 6, wherein the load imbalance condition comprises at least one of:
at least one first difference value which is larger than the threshold value of the session number exists in the difference values of the first session number and the second session numbers;
and the fluctuation information representing the fluctuation conditions of the first session quantity and each second session quantity is greater than a preset fluctuation value.
9. The apparatus of claim 6, wherein the second device determination module comprises:
the hash processing unit is used for carrying out hash processing on the message to be processed;
and the equipment determining unit is used for determining the equipment for creating the target session from the network equipment set according to the hash processing result.
10. The apparatus according to any one of claims 6 to 9, wherein the first device determining module is specifically configured to, when it is determined that the packet to be processed belongs to a first packet of a new service, determine, according to the first session number and each second session number, a device with a minimum number of sessions created by itself from the network device set as a device for creating a target session; or according to the sequence of the number of the sessions from small to large, selecting a first preset number of network devices from the network device set according to the first number of the sessions and the number of the second sessions, and determining a device for creating a target session from the selected network devices according to the data processing capacity and/or the working state of the network devices; or
The first device determining module is specifically configured to determine whether session information corresponding to the to-be-processed packet exists in a session table stored in the first device determining module, determine, if the session information does not exist, that the to-be-processed packet is a first packet of a new service, and determine, according to the first session number and each second session number, a device for creating a target session from the network device set.
CN201810532383.5A 2018-05-29 2018-05-29 Session creation method and device Active CN108769196B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810532383.5A CN108769196B (en) 2018-05-29 2018-05-29 Session creation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810532383.5A CN108769196B (en) 2018-05-29 2018-05-29 Session creation method and device

Publications (2)

Publication Number Publication Date
CN108769196A CN108769196A (en) 2018-11-06
CN108769196B true CN108769196B (en) 2021-07-09

Family

ID=64003684

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810532383.5A Active CN108769196B (en) 2018-05-29 2018-05-29 Session creation method and device

Country Status (1)

Country Link
CN (1) CN108769196B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109639590B (en) * 2019-01-15 2022-08-30 网宿科技股份有限公司 Data transmission method for realizing load balance of non-equivalent line and routing node equipment
CN115150448B (en) * 2022-06-14 2023-08-25 北京车网科技发展有限公司 Session data processing method, system, storage medium and electronic equipment
CN115955439B (en) * 2023-03-13 2023-05-23 苏州浪潮智能科技有限公司 Data message transmission control method, system, device and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105144108A (en) * 2013-03-07 2015-12-09 微软技术许可有限责任公司 Service-based load-balancing management of processes on remote hosts

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9888064B2 (en) * 2015-02-11 2018-02-06 International Business Machines Corporation Load-balancing input/output requests in clustered storage systems
US9979656B2 (en) * 2015-12-07 2018-05-22 Oracle International Corporation Methods, systems, and computer readable media for implementing load balancer traffic policies

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105144108A (en) * 2013-03-07 2015-12-09 微软技术许可有限责任公司 Service-based load-balancing management of processes on remote hosts

Also Published As

Publication number Publication date
CN108769196A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
US11036529B2 (en) Network policy implementation with multiple interfaces
CN105610632B (en) Virtual network equipment and related method
CN112868206A (en) Method, system and computer readable medium for providing service broker functionality in a telecommunications network core using a service based architecture
CN108769196B (en) Session creation method and device
JP2023549681A (en) Methods, systems, and computer-readable media for rank processing for network capability selection
US11616724B2 (en) Packet transmission method and apparatus
CN110191066B (en) Method, equipment and system for determining maximum transmission unit (PMTU)
EP3709664A1 (en) Stream pushing method, system and server
CN112351083B (en) Service processing method and network service system
CN112822724B (en) Message forwarding method and device
CN106713378B (en) Method and system for providing service by multiple application servers
US10693785B2 (en) Method and system for forwarding data, virtual load balancer, and readable storage medium
CN110798400B (en) Message forwarding method and device
US9479596B2 (en) Pairing internal network identifier with external network identifier
US11950125B2 (en) Consistent Quality of Service policy in a software defined enterprise
CN113691385A (en) Message processing and advertising method and device, network bridge node, source device and medium
CN111404839B (en) Message processing method and device
CN114363351A (en) Proxy connection suppression method, network architecture and proxy server
CN112995320B (en) Load sharing method and system under UPF (unified Power flow) expansion based on flow table
CN111935108B (en) Cloud data security access control method and device, electronic device and storage medium
CN112511438A (en) Method and device for forwarding message by using flow table and computer equipment
CN106209634B (en) Learning method and device of address mapping relation
US11575601B2 (en) Network device and packet processing method using same
CN114900860B (en) Edge computing method and device for mobile terminal, edge computing server and medium
WO2023246118A1 (en) Message forwarding method and apparatus, and storage medium and electronic apparatus

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