WO2021017578A1 - 报文发送方法、装置及存储介质 - Google Patents

报文发送方法、装置及存储介质 Download PDF

Info

Publication number
WO2021017578A1
WO2021017578A1 PCT/CN2020/090728 CN2020090728W WO2021017578A1 WO 2021017578 A1 WO2021017578 A1 WO 2021017578A1 CN 2020090728 W CN2020090728 W CN 2020090728W WO 2021017578 A1 WO2021017578 A1 WO 2021017578A1
Authority
WO
WIPO (PCT)
Prior art keywords
path
entry
message
time
policy table
Prior art date
Application number
PCT/CN2020/090728
Other languages
English (en)
French (fr)
Inventor
侯杰
刘冰
冯晨昕
李振斌
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021017578A1 publication Critical patent/WO2021017578A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/38Flow based routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/24Multipath
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/302Route determination based on requested QoS
    • H04L45/306Route determination based on the nature of the carried application

Definitions

  • This application relates to the field of communication technology, and in particular to a method, device and storage medium for sending messages.
  • network devices In the field of communications, network devices usually exchange information through messages. In this way, messages need to be sent between network devices. Currently, there may be multiple paths for a message. At this time, in order to achieve the effect of load balancing, it is usually necessary to select a path from the multiple paths to send the message.
  • the related technology is mainly based on the five-tuple information of the message, selecting a path from the multiple paths through ECMP (Equal Cost Multipath)/UCMP (UN-equal Cost Multipath) , And then send the message according to the selected path.
  • ECMP Equal Cost Multipath
  • UCMP Universal-equal Cost Multipath
  • This application provides a message sending method, device and storage medium, which can solve the problem that the split ratio on multiple paths in the related technology does not match the split ratio expected by ECMP/UCMP, and the occurrence of multiple elephant flows being allocated to the same On one path, the problem of unbalanced load is caused.
  • the technical solution is as follows:
  • a method for sending a message is provided. There are multiple paths between a first network device and a second network device, and the first network device sends the data to the second network device in a load sharing manner based on the multiple paths.
  • the network device sends a data stream, and the method includes:
  • the first network device receives a message, where the message is a message included in the data stream;
  • the first network device determines whether the data stream is an elephant stream
  • the first network device determines a first path through a first path policy table, and the first path is one of the multiple paths;
  • the first path policy table is used to describe the sending path of the elephant flow among all data flows sent to the second network device via the multiple paths, and the first path policy table includes a plurality of table entries , The path indicated by each entry is selected from the multiple paths through a weighted round-robin algorithm;
  • the first network device sends the message via the first path.
  • the path indicated by the entry in the first path policy table is selected from the above-mentioned multiple paths through a weighted round-robin algorithm, that is, the path indicated by the entry in the first path policy table is through polling
  • the method is selected from the above multiple paths.
  • multiple paths can be polled by polling. Therefore, after sending the packet according to the path in the table entry corresponding to the data flow, load balancing can be achieved effect.
  • the entry in the first path policy table is used to indicate the mapping relationship between flow identifiers, path information, and entry matching time, and the entry matching time refers to the last time the entry was matched. time;
  • the determining the first path through the first path strategy table includes:
  • the path indicated by the path information in the entry corresponding to the data flow is determined as the first path.
  • the stream identifier can be used to uniquely indicate a data stream.
  • a data stream can include one or more packets, and the quintuple information of the one or more packets is the same.
  • one or more packets with the same quintuple information can constitute A data stream.
  • the flow identifier of this data flow can be the quintuple information of the message included in this data flow, or it can be the quintuple information of the message included in this data flow. Obtained after processing. Therefore, the first network device may query the first path policy table according to the quintuple information of the message, so as to determine whether there is an entry corresponding to the data flow to which the message belongs in the first path policy table.
  • the method before the determining the path indicated by the path information in the table entry corresponding to the data stream as the first path, the method further includes:
  • an aging condition can be set for the entry in the first path policy table.
  • the time difference between the matching time of the entry in the entry corresponding to the data flow and the current time can be determined, if the time difference If it is less than the first time threshold, it can indicate that the entry corresponding to the data flow does not meet the aging condition.
  • the path indicated by the path information in the entry corresponding to the data flow can be determined as the first path and pass through the first path.
  • a path sends the message.
  • the method further includes:
  • a path is selected from the multiple paths according to a weighted round-robin algorithm, and the selected path is used as the first path.
  • the time difference between the entry matching time in the entry corresponding to the data flow and the current time is greater than or equal to the first time threshold, it can indicate that the entry corresponding to the data flow meets the aging condition, that is, the data flow
  • the corresponding entry has expired at the current time, so the path indicated by the path information in the entry corresponding to the data stream cannot be determined as the first path.
  • the entry corresponding to the data flow in the first path policy table can be deleted. Then, according to the weighted round-robin algorithm, a path is selected from the above multiple paths, the selected path is determined as the first path, and the message is sent via the first path.
  • the method further includes:
  • a path is selected from the multiple paths according to a weighted round-robin algorithm, and the selected path is used as the first path.
  • the weighted round-robin algorithm can be selected from the multiple A path is selected from the paths, and the selected path is used as the first path.
  • the method further includes:
  • an entry corresponding to the data flow is added to the first path policy table.
  • the first path policy table After selecting a path according to the weighted round-robin algorithm, in order to facilitate the subsequent rapid determination of the first path, you can add it to the first path policy table according to the quintuple information of the message, the selected path and the current time The entry corresponding to this data stream. In this way, the next time a packet of the data flow is received, the first path can be determined directly from the first path policy table, instead of using a weighted round-robin algorithm to determine the first path, which can save time and improve the message Sending efficiency.
  • the method further includes:
  • the above determination of whether an entry in the first path policy table meets the aging condition is triggered when a certain message is sent, and there is an entry corresponding to the data flow to which this message belongs in the first path policy table. , That is, it is triggered when a certain entry in the first path policy table matches a packet. However, if a certain entry in the first path policy table does not match the message, then this entry is always retained in the first path policy table, which may cause memory occupation. Therefore, in the embodiment of the present application, it is also possible to periodically determine the time difference between the entry matching time and the current time in each entry included in the first path policy table, and then delete the time difference greater than Or an entry equal to the first time threshold. In this way, the entries in the first path policy table that have not been matched and meet the aging condition can also be deleted.
  • the entry in the first path policy table is used to indicate the mapping relationship between flow identification, path information, entry matching time, switching flag bit and deletion flag bit, and the entry matching time refers to The time when the entry was last matched;
  • the determining the first path through the first path strategy table includes:
  • the switch flag bit in the entry corresponding to the data flow is the first value
  • the deletion flag in the entry corresponding to the data flow If the bit is the second value, the path indicated by the path information in the table entry corresponding to the data stream is determined as the first path.
  • the initial state of all data flows is considered to be mouse flow, and it takes a certain amount of time to recognize elephant flow.
  • some data streams may be elephant streams, but the initial state is still processed as mouse streams.
  • this data stream may be recognized as an elephant stream.
  • the path of the data stream initially used as a mouse stream may be different from the path currently used as an elephant stream. If the path is switched directly, it may be The order of the packets in this data stream is disturbed. Therefore, the entry included in the first path policy table can include a switch flag bit. The switch flag bit is used to determine whether it is currently necessary to send according to the path indicated by the path information in the table entry. This message, that is, whether path switching is currently required.
  • the switch flag bit is used to indicate whether to send the message according to the path indicated by the path information in the table entry, and the value of the switch flag bit can be the first value or the second value.
  • the switch flag bit is the first value, it can be determined that the message can be sent according to the path indicated by the path information in this entry.
  • the switch flag bit in a certain table item is the second value, it can be determined that the The packet is sent on the path indicated by the path information in the table entry.
  • the delete flag is used to indicate whether the entry is the entry to be deleted, and the value of the delete flag can also be the first value or the second value.
  • the delete flag in a certain entry is the first value, It can be determined that this entry is the entry to be deleted, and when the delete flag bit in a certain entry is the second value, it can be determined that this entry is not the entry to be deleted.
  • the path indicated by the entry in the first path policy table is selected from the above-mentioned multiple paths through a weighted round-robin algorithm, that is, the path indicated by the entry in the first path policy table is through polling
  • the method is selected from the above multiple paths.
  • multiple paths can be polled by polling. Therefore, after sending the message according to the path indicated by the path information in the table entry corresponding to the data flow, that is Can achieve the effect of load balancing.
  • the delete flag bit is used to indicate whether the entry is the entry to be deleted, in other words, the switch flag bit It is used to indicate whether the current path can be safely switched, and there will be no out-of-sequence of the message.
  • the delete flag bit is used to indicate whether the entry is currently valid. Therefore, when the switch flag bit in the entry corresponding to the data stream is the first When the delete flag bit in the entry corresponding to the data stream is the second value, it can be determined that the path can be safely switched without out-of-order messages, and the entry corresponding to the data stream is currently Effective. In this way, after sending the message according to the path indicated by the path information in the table entry corresponding to the data flow, not only will there be no out-of-sequence of the message, but also the effect of load balancing can be achieved.
  • the method further includes:
  • the switch flag position in the entry corresponding to the data stream is set to the first value, and use the path indicated by the path information in the entry corresponding to the data stream as The first path.
  • the switch flag position in the table entry corresponding to the data stream can be set to the first A value, the path indicated by the path information in the table entry corresponding to the data stream is taken as the first path, and the message is sent via the first path.
  • the delete flag bit in the entry corresponding to the data stream must be the second value. Therefore, as long as the data stream corresponds to the If the switch flag bit in the entry is the second value, then you can directly determine the match time of the entry in the entry corresponding to the data stream and the current value regardless of the value of the delete flag in the entry corresponding to the data stream. The time difference between times.
  • the method further includes:
  • the deletion flag in the entry corresponding to the data flow is the first value, it is determined that the entry in the entry corresponding to the data flow The time difference between the item matching time and the current time;
  • the entry in the first path policy table is set with an aging condition. In this way, when the entry corresponding to the data flow exists in the first path policy table, the value of the deletion flag in the entry corresponding to the data flow can be determined, if the deletion flag in the entry corresponding to the data flow is If the value is the first value, it can indicate that the entry corresponding to the data stream is the entry to be deleted. At this time, the time difference between the matching time of the entry in the entry corresponding to the data stream and the current time can be determined.
  • the time difference is greater than or equal to the first time threshold, then it can indicate that the entry corresponding to the data flow meets the aging condition, that is, the entry corresponding to the data flow has expired at the current time, and then the data flow cannot be corresponded to The path in the table entry sends the message. At this time, the entry corresponding to the data flow in the first path policy table can be deleted.
  • the time difference may indicate that the entry corresponding to the data stream does not meet the aging condition. In this case, the entry corresponding to the data stream may not be deleted first.
  • the message after the message is received, it further includes:
  • the entry corresponding to the data stream is added to the first path policy table, wherein the switch flag bit in the currently added entry is And the delete flag is the second value.
  • the method further includes:
  • a path is determined in the manner of ECMP/Unequal-Cost Route UCMP;
  • the position of the switching flag in the table entry corresponding to the data stream is set to the first value.
  • the path determined according to the ECMP/UCMP method is the same as the path determined according to the weighted round-robin algorithm, then it can be determined that there is no problem of secure handover, that is, there is no problem of message disorder, and the data can be directly
  • the switch flag position in the entry corresponding to the stream is the first value.
  • the method further includes:
  • this application uses other technologies to identify elephant streams, and a data stream was identified as an elephant stream at the previous time, the data stream may not be an elephant stream at the next time. Therefore, this application is determining a certain data stream. After the stream is an elephant stream, you can continue to identify the data stream to determine whether the data stream is still an elephant stream in the future. If it is determined that the data stream is no longer an elephant stream, the time difference between the table entry matching time in the table entry corresponding to the data stream and the current time is determined. If the time difference is greater than or equal to the second time threshold, it can indicate that the path can be switched safely at present. At this time, the entry corresponding to the data flow in the first path policy table can be directly deleted.
  • the method further includes:
  • the delete flag position in the entry corresponding to the data flow in the first path policy table can be set to the first Value, do not delete first.
  • the method further includes:
  • some entries may not meet the conditions of the safe switching path and are not directly deleted. Instead, the position of the delete flag in the entry is set to the first value. If these entries are kept in the first path policy table, it may cause memory usage. Therefore, in the embodiment of the present application, it is also possible to periodically determine the time difference between the entry matching time and the current time in the entry whose deletion flag bit is the first value in the first path strategy table. If the time difference is greater than or equal to the first time threshold, then delete the entry whose deletion flag is the first value in the first path policy table. In this way, the entries in the first path policy table that do not meet the conditions of the safe switching path at the beginning can be deleted in this way later.
  • the method further includes:
  • the entry matching time in the entry included in the first path policy table refers to the time when the entry was matched for the last time, when the path indicated by the path information in the entry corresponding to the data flow is determined as the first After sending the message via the first path, the matching time of the entry in the entry corresponding to the data flow in the first path policy table can be updated to the current time.
  • a message sending device in a second aspect, is provided, and the message sending device has the function of realizing the behavior of the message sending method in the first aspect.
  • the message sending device includes at least one module, and the at least one module is used to implement the message sending method provided in the first aspect.
  • a network device in a third aspect, includes a processor and a memory, and the memory is configured to store a program for executing the message sending method provided in the first aspect above, and to store a program for implementing the first Data involved in the message sending method provided by the aspect.
  • the processor is configured to execute a program stored in the memory.
  • the operating device of the storage device may further include a communication bus, which is used to establish a connection between the processor and the memory.
  • a computer-readable storage medium stores instructions, which when run on a computer, cause the computer to execute the message sending method described in the first aspect.
  • a computer program product containing instructions which when running on a computer, causes the computer to execute the message sending method described in the first aspect.
  • the technical solution provided by this application can bring at least the following beneficial effects: Since the first path policy table is used to describe the path of the elephant flow among all the data flows sent to the second network device via the multiple paths, the first path policy table The path indicated by the entry in the table is selected from the above-mentioned multiple paths through a weighted round-robin algorithm. Therefore, if the data flow to which the packet belongs is an elephant flow, and there is a packet to which the packet belongs in the first path policy table The entry corresponding to the data stream, then the message can be sent according to the path indicated by the path information in the entry corresponding to the data stream. Generally, multiple paths can be polled through polling.
  • the elephant stream The packets included in the flow are sent according to the path determined by the weighted round-robin method. In this way, when the elephant flow realizes load balancing, it can be ensured that the distribution ratio on multiple paths is close to the expected distribution ratio of ECMP/UCMP or equal.
  • Fig. 1 is a schematic diagram of a Service-Aware-based SR-TE network architecture provided by an embodiment of the present application
  • Figure 2 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of a method for sending a message according to an embodiment of the present application
  • FIG. 4 is a flowchart of another message sending method provided by an embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a message sending apparatus provided by an embodiment of the present application.
  • the first network device there are multiple paths between the first network device and the second network device, and the first network device can communicate with the second network device through any one of the multiple paths.
  • the first network device usually needs to select a path from the multiple paths to communicate with the second network device. That is, the first network device usually needs to select a path from the multiple paths and send a data stream to the second network device.
  • This method can also be called load sharing.
  • FIG. 1 is a schematic diagram of a service-aware-based segment routing traffic engineering (Segment Routing-Traffic Engineering, SR-TE) network architecture according to an embodiment of the present application.
  • the network architecture includes a first network device 101, a second network device 102, multiple intermediate devices 103, and a controller 104.
  • the first network device 101 may report network topology information to the controller 104 through Border Gateway Protocol-Link State (BGP-LS), and the network topology information refers to the first network device 101 and the second network Topology information of the network composed of the device 102 and multiple intermediate devices 103.
  • Border Gateway Protocol-Link State BGP-LS
  • the controller 104 may determine multiple paths between the first network device 101 and the second network device 102 based on the network topology information reported by the first network device 101 (for example, the two paths shown by the solid line and the dashed line in FIG. 1 ) And the distribution ratio of the multiple paths, and issue the distribution ratio of the multiple paths and the multiple paths to the first network device 101, so that the first network device 101 follows the multiple paths and the multiple paths
  • the data stream is sent at a split ratio.
  • the controller 104 may also collect from the first network device 101 the traffic of the data streams sent through each of the multiple paths, based on The traffic of the data stream sent by each path in each path is optimized according to the configured bandwidth optimization strategy for the multiple paths and the distribution ratio of the multiple paths, and the optimized results are displayed to the user.
  • the optimized multiple paths and the distribution ratio of the multiple paths can be issued to the first network device 101, so that the first network device 101 follows the optimized multiple paths and the multiple paths
  • the data stream is sent at a split ratio.
  • the first network The device 101 can send data streams according to the method provided in the embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a network device according to an embodiment of the present application.
  • the network device may be any network device in FIG. 1.
  • the network device includes at least one processor 201, a communication bus 202, a memory 203, and at least one communication interface 204.
  • the processor 201 may be a general-purpose central processing unit (Central Processing Unit, CPU), a network processor (NP), a microprocessor, or may be one or more integrated circuits for implementing the solution of the present application, for example, a dedicated integration Circuit (application-specific integrated circuit, ASIC), programmable logic device (programmable logic device, PLD) or a combination thereof.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • the above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
  • the communication bus 202 is used to transfer information between the aforementioned components.
  • the communication bus 202 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the memory 203 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, or it can be a random access memory (RAM) or can store information and instructions.
  • Other types of dynamic storage devices can also be Electrically Erasable Programmable Read-Only Memory (EEPROM), CD-ROM (Compact Disc Read-Only Memory, CD-ROM) or other optical disk storage , CD storage (including compressed CDs, laser disks, CDs, digital universal CDs, Blu-ray CDs, etc.), disk storage media or other magnetic storage devices, or can be used to carry or store desired program codes in the form of instructions or data structures And any other media that can be accessed by the computer, but not limited to this.
  • the memory 203 may exist independently and is connected to the processor 201 through the communication bus 202.
  • the memory 203 may also be integrated with the processor 201.
  • the communication interface 204 uses any device such as a transceiver for communicating with other devices or communication networks.
  • the communication interface 204 includes a wired communication interface, and may also include a wireless communication interface.
  • the wired communication interface may be, for example, an Ethernet interface.
  • the Ethernet interface can be an optical interface, an electrical interface or a combination thereof.
  • the wireless communication interface may be a wireless local area network (Wireless Local Area Networks, WLAN) interface, a cellular network communication interface, or a combination thereof.
  • WLAN wireless Local Area Networks
  • the processor 201 may include one or more CPUs, such as CPU0 and CPU1 as shown in FIG. 2.
  • the network device may include multiple processors, such as the processor 201 and the processor 205 as shown in FIG. 2.
  • processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU).
  • the processor here may refer to one or more devices, circuits, and/or processing cores for processing data (such as computer program instructions).
  • the network device may further include an output device 206 and an input device 207.
  • the output device 206 communicates with the processor 201 and can display information in a variety of ways.
  • the output device 206 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc.
  • the input device 207 communicates with the processor 201, and can receive user input in a variety of ways.
  • the input device 207 may be a mouse, a keyboard, a touch screen device, or a sensor device.
  • the memory 203 is used to store the program code 210 for executing the solution of the present application, and the processor 201 can execute the program code 210 stored in the memory 203. That is, the network device can implement the message sending method provided in the embodiment of Fig. 3 or Fig. 4 below through the processor 201 and the program code 210 in the memory 203.
  • FIG. 3 is a flowchart of a method for sending a message according to an embodiment of the present application.
  • the method is applied to the first network device, and the method is implemented based on Service-Aware technology.
  • this method there are multiple paths between the first network device and the second network device, and the first network device sends the data stream to the second network device in a load sharing manner based on the multiple paths.
  • the method includes the following steps.
  • Step 301 The first network device receives a message, and the message is a message included in the data stream.
  • the message can be a message sent by other network devices except the first network device and the second network device, or it can be generated by the first network device itself and to be sent to the second network device. Message.
  • Step 302 The first network device determines whether the data stream is an elephant stream.
  • a message usually carries the stream bandwidth of the data stream to which it belongs, and whether the stream bandwidth of the data stream is greater than or equal to the bandwidth threshold can determine whether the data stream is an elephant stream or a mouse stream. That is, in some embodiments, the first network device can determine whether the stream bandwidth of the data stream is greater than or equal to the bandwidth threshold, and if the stream bandwidth of the data stream is greater than or equal to the bandwidth threshold, it is determined that the data stream is an elephant. flow. If the stream bandwidth of the data stream is less than the bandwidth threshold, it is determined that the data stream is not an elephant stream, in other words, it can also be determined that the data stream is a mouse stream.
  • elephant flow can be called a large flow
  • mouse flow can also be called a small flow
  • a message contains a message header
  • the message header can include tuple information, such as quadruple information, quintuple information, seven-tuple information, and so on.
  • tuple information such as quadruple information, quintuple information, seven-tuple information, and so on.
  • the header of the message can include seven-tuple information.
  • the data stream to which the message belongs is a mouse stream
  • the message header can include quintuple information.
  • the first network device can determine whether the quintuple information or the seven-tuple information carried in the header of the message, and if the seven-tuple information is carried in the header of the message, determine that the data stream is large Like stream. If the header of the message carries quintuple information, it is determined that the data stream is not an elephant stream, in other words, it can also be determined that the data stream is a mouse stream.
  • the header of the message can include quintuple information.
  • the message The header of the message can include quadruple information.
  • the first network device can determine whether the quintuple information or the quadruple information carried in the header of the message, and if the quintuple information is carried in the header of the message, it determines that the data flow is large. Like stream. If the header of the message carries the quadruple information, it is determined that the data stream is not an elephant stream, in other words, it can also be determined that the data stream is a mouse stream.
  • the quadruple information may include a source Internet Protocol (IP) address, a source port, a destination IP address, and a destination port.
  • IP Internet Protocol
  • the quintuple information may include source IP address, source port, destination IP address, destination port, and protocol number.
  • the seven-tuple information may include a source media access control (Medium Access Control, MAC) address, a destination MAC address, a source IP address, a destination IP address, a source port, a destination port, and a protocol number.
  • MAC Medium Access Control
  • the source MAC address, source IP address, and source port are the MAC address, IP address, and port of the first network device, and the destination MAC address
  • the destination IP address and destination port are the MAC address, IP address, and port of the second network device
  • the protocol number is the number of the protocol used when the first network device communicates with the second network device.
  • the embodiment of the present application can not only determine whether the data stream is an elephant stream, but also other methods. For example, it can be judged by the business type to which the data stream belongs. That is, when the service type to which the data stream belongs is a webpage type, it can be determined that the data stream is a mouse stream, and when the service type to which the data stream belongs is a video type, it can be determined that the data stream is an elephant stream.
  • the first network device may determine the first path through the first path policy table according to the tuple information of the message.
  • the tuple information of the message can be four-tuple information, five-tuple information, seven-tuple information, etc., regardless of whether the tuple information of the message is four-tuple information, five-tuple information or seven-tuple information.
  • the method for determining the first path through the first path policy table is the same. Next, taking quintuple information as an example, the method of determining the first path through the first path strategy table is described.
  • Step 303 If the data flow is an elephant flow, the first network device queries the first path policy table according to the quintuple information of the message.
  • the first path policy table is used to describe the path of the elephant flow in all data flows sent to the second network device via the multiple paths, that is, the first path policy table is only used to describe the path of the elephant flow, and The path of the rat flow is not described.
  • the first path strategy table only works on the elephant flow, but not on the mouse flow.
  • the first path strategy table includes a plurality of table items, and the path indicated by each table item is selected from the plurality of paths through a weighted round-robin algorithm.
  • the entry in the first path policy table is used to indicate the mapping relationship between the flow identifier, the path information and the entry matching time, and the entry matching time refers to the time when the entry is matched for the last time.
  • the first path strategy table may be as shown in Table 1 below.
  • the path information in Table 1 may represent different meanings.
  • the path information in Table 1 represents the device identification of the next hop device.
  • the path information in Table 1 represents the identifier of the tunnel or the ingress interface of the tunnel. That is, no matter which routing protocol the first network device uses, the path information in Table 1 can be used to indicate the path for sending the message.
  • the stream identifier can be used to uniquely indicate a data stream.
  • a data stream can include one or more packets, and the quintuple information of the one or more packets is the same.
  • one or more packets with the same quintuple information can constitute A data stream.
  • the flow identifier of this data flow can be the quintuple information of the message included in this data flow, or it can be the quintuple information of the message included in this data flow. Obtained after processing. Therefore, the first network device may query the first path policy table according to the quintuple information of the message, so as to determine whether there is an entry corresponding to the data flow to which the message belongs in the first path policy table.
  • the first network device may directly associate the quintuple information of the packet with the first path policy table.
  • the flow identifiers in the included entries are compared. If there is an entry in the first path policy table that has the same flow identifier as the quintuple information of the message, then it can be determined that the first path policy table belongs to the message If there is no entry corresponding to the data flow to which the packet belongs, it can be determined that there is no entry corresponding to the data flow to which the packet belongs in the first path policy table.
  • the first network device may use the same processing method to obtain the packet.
  • the five-tuple information is processed.
  • the processing result is compared with the flow identifier in the entry included in the first path policy table. If there is an entry in the first path policy table with the same flow identifier as the processing result, then the first path policy table can be determined There is an entry corresponding to the data flow to which the packet belongs; otherwise, it can be determined that there is no entry corresponding to the data flow to which the packet belongs in the first path policy table.
  • Step 304 If there is an entry corresponding to the data flow in the first path policy table, the first network device determines the path indicated by the path information in the entry corresponding to the data flow as the first path, and passes through the first path. The path sends the message.
  • the path indicated by the path information in the table entry corresponding to the data stream may be directly determined as the first path, and sent to the message via the first path.
  • the path indicated by the entry in the first path policy table is selected from the above-mentioned multiple paths through a weighted round-robin algorithm, that is, the path indicated by the entry in the first path policy table is through polling
  • the method is selected from the above multiple paths.
  • multiple paths can be polled by polling. Therefore, after sending the packet according to the path in the table entry corresponding to the data flow, load balancing can be achieved effect.
  • the embodiment of the present application sets an aging condition for the entry in the first path policy table. In this way, when it is determined that there is an entry corresponding to the data flow to which the packet belongs in the first path policy table, the time difference between the matching time of the entry in the entry corresponding to the data flow and the current time can be determined, if the time difference If it is less than the first time threshold, it can indicate that the entry corresponding to the data flow does not meet the aging condition. At this time, the path indicated by the path information in the entry corresponding to the data flow can be determined as the first path and pass through the first path. A path sends the message.
  • the entry matching time in the entry included in the first path policy table refers to the time when the entry was matched for the last time, when the path indicated by the path information in the entry corresponding to the data flow is determined as the first After sending the message via the first path, the matching time of the entry in the entry corresponding to the data flow in the first path policy table can be updated to the current time.
  • the time difference between the entry matching time in the entry corresponding to the data flow and the current time is greater than or equal to the first time threshold, it can indicate that the entry corresponding to the data flow meets the aging condition, that is, the data flow
  • the corresponding entry has expired at the current time, so the path indicated by the path information in the entry corresponding to the data stream cannot be determined as the first path.
  • the entry corresponding to the data flow in the first path policy table can be deleted. Then, according to the weighted round-robin algorithm, a path is selected from the above multiple paths, the selected path is determined as the first path, and the message is sent via the first path.
  • the data stream is still an elephant stream at the current time, after selecting a path from the above-mentioned multiple paths according to the weighted round-robin algorithm, it can also be based on the 5-tuple information of the message, the selected path and the current At time, the entry corresponding to the data flow is added to the first path policy table.
  • the first path strategy table is used to describe the sending flow of the elephant flow in all data flows sent to the second network device via the above multiple paths, and each entry in the first path strategy table The indicated path is selected from the above-mentioned multiple paths through a weighted round-robin algorithm.
  • the path corresponding to the data stream in the deleted entry may be the same or different from the path currently selected according to the weighted round-robin algorithm.
  • the first time threshold can be set based on experience.
  • the above determination of whether an entry in the first path policy table meets the aging condition is triggered when a certain message is sent, and there is an entry corresponding to the data flow to which this message belongs in the first path policy table. , That is, it is triggered when a certain entry in the first path policy table matches a packet. However, if a certain entry in the first path policy table does not match the message, then this entry is always retained in the first path policy table, which may cause memory occupation. Therefore, in the embodiment of the present application, it is also possible to periodically determine the time difference between the entry matching time and the current time in each entry included in the first path policy table, and then delete the time difference greater than Or an entry equal to the first time threshold. In this way, the entries in the first path policy table that have not been matched and meet the aging condition can also be deleted.
  • the above step 304 is how to determine the first path when there is an entry corresponding to the data flow to which the packet belongs in the first path policy table, and send the packet via the first path.
  • the first path can be determined through the following step 305, and the first path can be sent via the first path. Message.
  • Step 305 If there is no entry corresponding to the data flow in the first path policy table, the first network device selects a path from the multiple paths according to the weighted round-robin algorithm, and uses the selected path as the first path , Send the message via the first path.
  • the above steps 303-305 are the process of how to send the message when the data stream is an elephant stream.
  • a path can be selected from the foregoing multiple paths in the manner of ECMP/UCMP, and the message is sent according to the selected path.
  • the entries in the first path policy table indicate The path is selected from the above-mentioned multiple paths through the weighted round-robin algorithm, and the entry in the first path policy table is used to indicate the mapping relationship between the flow identifier, the path information, and the entry matching time. Therefore, if the report The data flow to which the message belongs is an elephant flow, and there is an entry corresponding to the data flow to which the message belongs in the first path policy table, then it can be sent according to the path indicated by the path information in the entry corresponding to the data flow The message. Generally, multiple paths can be polled through polling.
  • the stream bandwidth of the mouse stream itself is relatively small, it has little impact on the split ratio, while the stream bandwidth of the elephant stream is usually larger and has a greater impact on the split ratio. Therefore, in the embodiment of the application, The messages included in the mouse flow are sent according to the path determined in the original way, and the messages included in the elephant flow are sent according to the path determined by the weighted round-robin method. In this way, when the elephant flow achieves load balancing, It can be ensured that the split ratio on multiple paths is close to or equal to the split ratio expected by ECMP/UCMP.
  • FIG. 4 is a flowchart of a method for sending a message according to an embodiment of the present application.
  • the method is applied to the first network device, and the method is implemented based on the Flow-Aware technology.
  • this method there are multiple paths between the first network device and the second network device, and the first network device sends the data stream to the second network device in a load sharing manner based on the multiple paths.
  • the method includes the following steps.
  • Step 401 The first network device receives a message, which is a message included in the data stream.
  • This step is similar to the above step 301.
  • Step 402 The first network device determines whether the data stream is an elephant stream.
  • the initial state of all data flows is considered to be a rat flow, and the identification of an elephant flow takes a certain amount of time. That is, other technologies need to be used to identify the elephant flow alone.
  • a variety of methods can be used to identify elephant flows. For example, in some embodiments, when the first packet of a data stream is received, the number of packets received for this data stream within the reference time starting from the receiving time of the first packet can be counted. If this If the quantity is greater than or equal to the quantity threshold, then the data stream can be determined to be an elephant stream.
  • the data stream can be determined to be a rat stream.
  • the number of packets that need to be sent within the reference time for a certain data stream can be determined randomly. If the number is greater than or equal to the number threshold, then the data stream can be determined to be an elephant stream. . If this number is less than the number threshold, then the data stream can be determined to be a rat stream.
  • the data flow can also be used to determine whether the data flow is an elephant flow or a mouse flow. flow. For example, in some embodiments, when the first packet of a data flow is received, the traffic size of the data flow received within the reference time starting from the receiving time of the first packet can be counted. If the size is greater than or equal to the flow threshold, then the data flow can be determined to be an elephant flow. If the statistical traffic size is less than the traffic threshold, then the data flow can be determined to be a rat flow.
  • a certain data stream can be randomly selected to determine the amount of traffic that this data stream needs to send within the reference time. If the determined traffic size is greater than or equal to the traffic threshold, then the data stream can be determined to be an elephant stream. . If the determined flow rate is less than the flow threshold, then the data flow can be determined to be a rat flow.
  • a message contains a message header
  • the message header can include tuple information, such as quadruple information, quintuple information, seven-tuple information, and so on.
  • tuple information such as quadruple information, quintuple information, seven-tuple information, and so on.
  • the header of the message can include seven-tuple information.
  • the data stream to which the message belongs is a mouse stream
  • the message header can include quintuple information.
  • the first network device can determine whether the quintuple information or the seven-tuple information carried in the header of the message, and if the seven-tuple information is carried in the header of the message, determine that the data stream is large Like stream. If the header of the message carries quintuple information, it is determined that the data stream is not an elephant stream, in other words, it can also be determined that the data stream is a mouse stream.
  • the header of the message can include quintuple information.
  • the message The header of the message can include quadruple information.
  • the first network device can determine whether the quintuple information or the quadruple information carried in the header of the message, and if the quintuple information is carried in the header of the message, it determines that the data flow is large. Like stream. If the header of the message carries the quadruple information, it is determined that the data stream is not an elephant stream, in other words, it can also be determined that the data stream is a mouse stream.
  • the elephant flow can be called a large flow, and the mouse flow can also be called a small flow.
  • the four-tuple information may include source IP address, source port, destination IP address, and destination port.
  • the quintuple information may include source IP address, source port, destination IP address, destination port, and protocol number.
  • the seven-tuple information may include source MAC address, destination MAC address, source IP address, destination IP address, source port, destination port, and protocol number.
  • the source MAC address, source IP address, and source port are the MAC address, IP address, and port of the first network device, and the destination MAC address
  • the destination IP address and the destination port are the MAC address, IP address, and port of the second network device
  • the protocol number is the number of the protocol used when the first network device communicates with the second network device.
  • the embodiment of the present application can not only determine whether the data stream is an elephant stream, but also other methods. For example, it can be judged by the business type to which the data stream belongs. That is, when the service type to which the data stream belongs is a webpage type, it can be determined that the data stream is a mouse stream, and when the service type to which the data stream belongs is a video type, it can be determined that the data stream is an elephant stream.
  • the first network device may determine the first path through the first path policy table according to the tuple information of the message.
  • the tuple information of the message can be four-tuple information, five-tuple information, seven-tuple information, etc., regardless of whether the tuple information of the message is four-tuple information, five-tuple information or seven-tuple information.
  • the method for determining the first path through the first path policy table is the same. Next, taking quintuple information as an example, the method of determining the first path through the first path strategy table is described.
  • Step 403 If the data flow is an elephant flow, the first network device queries the first path policy table according to the quintuple information of the message.
  • the first path policy table is used to describe the path of the elephant flow in all data flows sent to the second network device via the multiple paths, that is, the first path policy table is only used to describe the path of the elephant flow, and The path of the rat flow is not described.
  • the first path strategy table only works on the elephant flow, but not on the mouse flow.
  • the first path strategy table includes a plurality of table items, and the path indicated by each table item is selected from the plurality of paths through a weighted round-robin algorithm.
  • the entry in the first path policy table is used to indicate the flow identification, path information, entry matching time, the mapping relationship between the switch flag bit and the delete flag bit.
  • the entry matching time refers to the last time the entry was matched. On time.
  • the first path strategy table may be as shown in Table 2 below.
  • the path information in Table 2 may represent different meanings. For details, refer to the description of step 303 above. However, no matter which routing protocol the first network device uses, the path information in Table 2 can be used to indicate the path for sending the message.
  • the initial state of all data streams is considered to be the rat stream, and the identification of the elephant stream takes a certain amount of time.
  • some data streams may be elephant streams, but the initial state is still processed as mouse streams.
  • this data stream may be recognized as an elephant stream.
  • the path of the data stream initially used as a mouse stream may be different from the path currently used as an elephant stream. If the path is switched directly, it may be The order of the packets in this data stream is disturbed. Therefore, in the embodiment of the present application, the entry included in the first path policy table may include a switch flag bit, and the switch flag bit is used to determine whether it is necessary to follow the path in the table entry. The message is sent on the path indicated by the information, that is, whether path switching is currently required.
  • the switch flag bit is used to indicate whether to send the message according to the path indicated by the path information in the table entry, and the value of the switch flag bit can be the first value or the second value.
  • the switch flag bit is the first value, it can be determined that the message can be sent according to the path indicated by the path information in this entry.
  • the switch flag bit in a certain table item is the second value, it can be determined that the The packet is sent on the path indicated by the path information in the table entry.
  • the delete flag is used to indicate whether the entry is the entry to be deleted, and the value of the delete flag can also be the first value or the second value.
  • the delete flag in a certain entry is the first value, It can be determined that this entry is the entry to be deleted, and when the delete flag bit in a certain entry is the second value, it can be determined that this entry is not the entry to be deleted.
  • the first value can be 0 or 1
  • the second value can also be 0 or 1
  • 0 or 1 is an example, and the first value and the second value may also be other values.
  • the embodiment of the present application does not introduce the same content in this step as the foregoing step 303.
  • Step 404 If there is an entry corresponding to the data stream in the first path policy table, the switch flag bit in the entry corresponding to the data stream is the first value, and the deletion flag bit in the entry corresponding to the data stream is With the second value, the first network device determines the path indicated by the path information in the table entry corresponding to the data stream as the first path, and sends the message via the first path.
  • the switch flag bit in the entry corresponding to the data flow can be determined And the value of the delete flag bit, if the switch flag bit in the entry corresponding to the data stream is the first value, and the delete flag bit in the entry corresponding to the data stream is the second value, it can indicate that the current
  • the packet is sent on the path indicated by the path information in the entry corresponding to the data stream, and the entry corresponding to the data stream is not the entry to be deleted. In this way, the path in the entry corresponding to the data stream can be directly
  • the path indicated by the information is determined to be the first path, and the message is sent via the first path.
  • the path indicated by the entry in the first path policy table is selected from the above-mentioned multiple paths through a weighted round-robin algorithm, that is, the path indicated by the entry in the first path policy table is through polling
  • the method is selected from the above multiple paths.
  • multiple paths can be polled by polling. Therefore, after sending the message according to the path indicated by the path information in the table entry corresponding to the data flow, that is Can achieve the effect of load balancing.
  • the delete flag bit is used to indicate whether the entry is the entry to be deleted, in other words, the switch flag bit It is used to indicate whether the current path can be safely switched, and there will be no out-of-sequence of the message.
  • the delete flag bit is used to indicate whether the entry is currently valid. Therefore, when the switch flag bit in the entry corresponding to the data stream is the first When the delete flag bit in the entry corresponding to the data stream is the second value, it can be determined that the path can be safely switched without out-of-order messages, and the entry corresponding to the data stream is currently Effective. In this way, after sending the message according to the path indicated by the path information in the table entry corresponding to the data flow, not only will there be no out-of-sequence of the message, but also the effect of load balancing can be achieved.
  • the entry corresponding to the data flow can be determined The time difference between the matching time of the entry in and the current time. If the time difference is greater than or equal to the second time threshold, it can indicate that the current path can be safely switched without out-of-sequence of messages.
  • the switch flag position in the table entry corresponding to the data stream can be set to the first A value, the path indicated by the path information in the table entry corresponding to the data stream is taken as the first path, and the message is sent via the first path.
  • the previous path refers to the path determined by ECMP/UCMP according to the quintuple information of the message when the data stream is used as a mouse stream.
  • the delete flag bit in the entry corresponding to the data stream must be the second value. Therefore, as long as the data stream corresponds to the If the switch flag bit in the entry is the second value, then you can directly determine the match time of the entry in the entry corresponding to the data stream and the current value regardless of the value of the delete flag in the entry corresponding to the data stream. The time difference between times.
  • the second time threshold can be determined by the transmission time of the above-mentioned multiple paths to the message, that is, for the same message, the time required for the above-mentioned multiple paths to send the message can be determined, and then every two paths can be determined. For the transmission time difference of the path, the largest transmission time difference is determined as the second time threshold.
  • the second time threshold may also be greater than the maximum transmission time difference.
  • the second time threshold can also be set in other ways, for example, the second time threshold can be set through experience, as long as there is no out-of-order message.
  • the second time threshold and the first time threshold may be the same or different.
  • the first time threshold may be greater than the second time threshold.
  • the entry match time in the entry included in the first path policy table refers to the time when the entry was last matched, when the path indicated by the path information in the entry corresponding to the data flow is taken as the first After sending the message via the first path, the entry matching time in the entry corresponding to the data flow in the first path policy table can be updated to the current time.
  • the embodiment of the present application sets an aging condition for the entry in the first path policy table. In this way, when the entry corresponding to the data flow exists in the first path policy table, the value of the deletion flag in the entry corresponding to the data flow can be determined, if the deletion flag in the entry corresponding to the data flow is If the value is the first value, it can indicate that the entry corresponding to the data stream is the entry to be deleted. At this time, the time difference between the matching time of the entry in the entry corresponding to the data stream and the current time can be determined.
  • the time difference is greater than or equal to the first time threshold, then it can indicate that the entry corresponding to the data flow meets the aging condition, that is, the entry corresponding to the data flow has expired at the current time, and then the data flow cannot be corresponded to The path in the table entry sends the message. At this time, the entry corresponding to the data flow in the first path policy table can be deleted. If the time difference is less than the first time threshold, it may indicate that the entry corresponding to the data flow does not meet the aging condition. At this time, the entry corresponding to the data flow may not be deleted first.
  • the delete flag bit in the entry corresponding to the data stream is the first value, then the entry corresponding to the data stream is the entry to be deleted. At this time, you can ignore the corresponding entry of the data stream.
  • the value of the switch flag bit in the entry directly determines the time difference between the matching time of the entry in the entry corresponding to the data stream and the current time.
  • the above step 404 is how to determine the first path when there is an entry corresponding to the data flow to which the packet belongs in the first path policy table, and send the packet via the first path.
  • the first path can be determined through the following step 305, and the first path can be sent via the first path. Message.
  • Step 405 If there is no entry corresponding to the data flow in the first path policy table, the first network device selects a path from the multiple paths according to the weighted round-robin algorithm, and uses the selected path as the first path , Send the message via the first path.
  • One path can be selected from the above-mentioned multiple paths according to the weighted round-robin algorithm.
  • the entry corresponding to the data stream can be added to the first path policy table.
  • the switch flag bit in the currently added entry and The delete flag bit is the second value. That is, the initial values of the switch flag bit and the delete flag bit in the entry included in the first path policy entry are both the second value.
  • the first path strategy table is used to describe the sending flow of the elephant flow in all data flows sent to the second network device via the above multiple paths, and each entry in the first path strategy table The indicated path is selected from the above-mentioned multiple paths through a weighted round-robin algorithm.
  • the switch flag bit in the entry corresponding to the data stream is still the second value.
  • the embodiment of the application is determining a certain After a data stream is an elephant stream, you can continue to identify the data stream to determine whether the data stream is still an elephant stream in the future. If it is determined that the data stream is no longer an elephant stream, the time difference between the table entry matching time in the table entry corresponding to the data stream and the current time is determined. If the time difference is greater than or equal to the second time threshold, it can indicate that the path can be switched safely at present. At this time, the entry corresponding to the data flow in the first path policy table can be directly deleted. If the time difference is less than the second time threshold, it can indicate that the message will be out of order after the current path switching. Therefore, the delete flag position in the entry corresponding to the data flow in the first path policy table can be set to the first Value, do not delete first.
  • some entries may not meet the conditions of the safe switching path and are not directly deleted. Instead, the position of the delete flag in the entry is set to the first value. If these entries are kept in the first path policy table, it may cause memory usage. Therefore, in the embodiment of the present application, it is also possible to periodically determine the time difference between the entry matching time and the current time in the entry whose deletion flag bit is the first value in the first path strategy table. If the time difference is greater than or equal to the first time threshold, then delete the entry whose deletion flag is the first value in the first path policy table. In this way, the entries in the first path policy table that do not meet the conditions of the safe switching path at the beginning can be deleted in this way later.
  • the above steps 403-405 are the process of how to send the message when the data stream is an elephant stream.
  • the data stream is a mouse stream
  • one path can be selected from the above multiple paths in the ECMP/UCMP manner, and the message is sent according to the selected path.
  • the entries in the first path policy table indicate The path is selected from the above-mentioned multiple paths through a weighted round-robin algorithm, and the entries in the first path policy table are used to indicate the flow identification, path information, entry matching time, switching flag bit and delete flag bit.
  • the packet can be sent according to the path indicated by the path information in the entry corresponding to the data stream.
  • the packet can be sent according to the path indicated by the path information in the entry corresponding to the data stream.
  • the stream bandwidth of the mouse stream itself is relatively small, it has little impact on the split ratio, while the stream bandwidth of the elephant stream is usually larger and has a greater impact on the split ratio. Therefore, in the embodiment of the application, The messages included in the mouse flow are sent according to the path determined in the original way, and the messages included in the elephant flow are sent according to the path determined by the weighted round-robin method. In this way, when the elephant flow achieves load balancing, It can be ensured that the split ratio on multiple paths is close to or equal to the split ratio expected by ECMP/UCMP.
  • FIG. 5 is a schematic structural diagram of a message sending apparatus provided by an embodiment of the present application.
  • the message sending apparatus may be implemented as part or all of the first network device by software, hardware, or a combination of both.
  • the device includes: a receiving module 501, a judgment module 502, a first determining module 503, and a sending module 504.
  • the receiving module 501 is configured to execute step 301 in the embodiment shown in FIG. 3 or step 401 in the embodiment shown in FIG. 4;
  • the judgment module 502 is configured to execute step 302 in the embodiment shown in FIG. 3 or step 402 in the embodiment shown in FIG. 4;
  • the first determining module 503 is used to perform the steps of determining the first path through the first path strategy table in steps 303-304 in the embodiment shown in FIG. 3, or is used to perform step 403 in the embodiment shown in FIG. 4 Step 404 to determine the first path through the first path strategy table.
  • the sending module 504 is used to execute the steps of sending messages via the first path in steps 303-304 in the embodiment shown in FIG. 3, or is used to execute the steps 403-404 in the embodiment shown in FIG. A path to send messages.
  • the entry in the first path policy table is used to indicate the mapping relationship between the flow identifier, the path information and the entry matching time, and the entry matching time refers to the time when the entry is matched for the last time;
  • the first determining module 503 includes:
  • the first query submodule is used to query the first path policy table according to the quintuple information of the message
  • the first determining submodule is configured to determine the path indicated by the path information in the table entry corresponding to the data flow as the first path if there is an entry corresponding to the data flow in the first path policy table.
  • the device further includes:
  • the second determining module is used to determine the time difference between the table item matching time and the current time in the table item corresponding to the data stream;
  • the triggering module is configured to trigger the first determining module 503 to determine the path indicated by the path information in the entry corresponding to the data stream as the first path if the time difference is less than the first time threshold.
  • the device further includes:
  • the first deleting module is configured to delete the entry corresponding to the data flow in the first path policy table if the time difference is greater than or equal to the first time threshold;
  • the selection module is used to select a path from the multiple paths according to the weighted round-robin algorithm, and use the selected path as the first path.
  • the first determining module 503 further includes:
  • the selection sub-module is configured to select a path from the multiple paths according to the weighted round-robin algorithm if there is no entry corresponding to the data flow in the first path policy table, and use the selected path as the first path.
  • the first determining module 503 further includes:
  • the add submodule is used to add the entry corresponding to the data flow in the first path policy table according to the quintuple information of the message, the selected path and the current time.
  • the device further includes:
  • the third determining module is configured to periodically determine the time difference between the entry matching time and the current time in each entry included in the first path strategy table;
  • the second deletion module is configured to delete entries in the first path policy table whose time difference is greater than or equal to the first time threshold.
  • the entry in the first path policy table is used to indicate the flow identifier, path information, entry matching time, the mapping relationship between the switch flag bit and the delete flag bit, and the entry matching time refers to the last time the entry The time that was matched;
  • the first determining module 503 includes:
  • the second query submodule is used to query the first path policy table according to the quintuple information of the message
  • the second determining submodule is used for if there is an entry corresponding to the data flow in the first path policy table, the switch flag bit in the entry corresponding to the data flow is the first value, and the entry corresponding to the data flow is If the deletion flag bit is the second value, the path indicated by the path information in the entry corresponding to the data stream is determined as the first path.
  • the first determining module 503 further includes:
  • the third determining submodule is configured to determine the table corresponding to the data flow if there is an entry corresponding to the data flow in the first path policy table, and the switching flag in the entry corresponding to the data flow is the second value The time difference between the matching time of the entry in the entry and the current time;
  • the setting sub-module is used to if the time difference is greater than or equal to the second time threshold, the switch flag position in the entry corresponding to the data stream is the first value, and the path information in the entry corresponding to the data stream is indicated As the first path.
  • the first determining module 503 further includes:
  • the fourth determining submodule is configured to determine the table corresponding to the data flow if there is an entry corresponding to the data flow in the first path policy table, and the deletion flag in the entry corresponding to the data flow is the first value The time difference between the matching time of the entry in the entry and the current time;
  • the delete sub-module is configured to delete the entry corresponding to the data flow in the first path policy table if the time difference is greater than or equal to the first time threshold.
  • the device further includes:
  • the selection module is configured to select a path from the multiple paths according to a weighted round-robin algorithm if there is no entry corresponding to the data flow in the first path policy table;
  • the adding module is used to add the entry corresponding to the data flow in the first path policy table according to the quintuple information of the message, the selected path, and the current time. Among them, the switch flag in the currently added entry The bit and the delete flag bit are the second value.
  • the device further includes:
  • the fourth determining module is configured to determine a path according to the quintuple information of the message and in the manner of equal-cost routing ECMP/non-equal-cost routing UCMP;
  • the first setting module is configured to, if the path determined according to the ECMP/UCMP method is the same as the path determined according to the weighted round-robin algorithm, the position of the switching flag in the table entry corresponding to the data stream is the first value.
  • the device further includes:
  • the fifth determining module is configured to determine the time difference between the entry matching time and the current time in the entry corresponding to the data stream if it is determined that the data stream is no longer an elephant stream;
  • the third deleting module is configured to delete the entry corresponding to the data flow in the first path policy table if the time difference is greater than or equal to the second time threshold.
  • the device further includes:
  • the second setting module is configured to, if the time difference is less than the second time threshold, set the deletion flag position in the entry corresponding to the data flow in the first path policy table to the first value.
  • the device further includes:
  • the sixth determining module is configured to periodically determine the time difference between the entry matching time and the current time in the entry whose deletion flag is the first value in the first path strategy table;
  • the fourth deleting module is configured to delete the entry whose deletion flag is the first value in the first path policy table if the time difference is greater than or equal to the first time threshold.
  • the device further includes:
  • the update module is used to update the entry matching time in the entry corresponding to the data flow in the first path policy table to the current time.
  • the entries in the first path policy table indicate The path is selected from the above-mentioned multiple paths through a weighted round-robin algorithm. Therefore, if the data flow to which the packet belongs is an elephant flow, and there is an entry corresponding to the data flow to which the packet belongs in the first path policy table , Then the message can be sent according to the path indicated by the path information in the entry corresponding to the data stream. Generally, multiple paths can be polled through polling.
  • the elephant stream The packets included in the flow are sent according to the path determined by the weighted round-robin method. In this way, when the elephant flow realizes load balancing, it can be ensured that the distribution ratio on multiple paths is close to the expected distribution ratio of ECMP/UCMP or equal.
  • the message sending device provided in the above embodiment sends a message
  • only the division of the above functional modules is used as an example for illustration. In actual applications, the above functions can be allocated by different functional modules as needed.
  • the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the message sending device provided in the foregoing embodiment and the message sending method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium can be a magnetic medium (for example: floppy disk, hard disk, tape), optical medium (for example: Digital Versatile Disc (DVD)) or semiconductor medium (for example: Solid State Disk (SSD)) Wait.
  • the computer-readable storage medium mentioned in this application may be a non-volatile storage medium, in other words, it may be a non-transitory storage medium.

Landscapes

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

Abstract

本申请公开了一种报文发送方法、装置及存储介质,属于通信技术领域。该方法包括:接收报文,判断报文所属的数据流是否为大象流;如果是大象流,则通过第一路径策略表确定第一路径,第一路径策略表用于描述经由多条路径发送给第二网络设备的所有数据流中大象流的发送路径,第一路径策略表包括的每个表项所指示的路径是通过加权轮询算法从多条路径中选择的;经由第一路径发送该报文。由于第一路径策略表中的表项所指示的路径是通过加权轮询的方式确定的,因此,通过第一路径发送报文后,不会出现多条大象流被分配到同一条路径上的问题,而且还可以保证多条路径上的分流比例与ECMP/UCMP所期望的分流比例接近或者相等。

Description

报文发送方法、装置及存储介质
本申请要求于2019年07月31日提交国家知识产权局、申请号为201910698687.3、发明名称为“报文发送方法、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,特别涉及一种报文发送方法、装置及存储介质。
背景技术
在通信领域中,网络设备之间通常是通过报文进行信息交互。这样,就需要在网络设备之间发送报文。目前,对于一个报文,可能存在多条路径,此时,为了实现负载均衡的效果,通常需要从该多条路径中选择出一条路径来发送该报文。
相关技术主要是根据报文的五元组信息,通过ECMP(Equal Cost Multipath,等价路由)/UCMP(UN-equal Cost Multipath,非等价路由)的方式,从该多条路径中选择一条路径,进而按照选择出的路径发送报文。
但是这种方式中,五元组信息相同的报文都会通过同一条路径来发送,导致多条路径上的分流比例与ECMP/UCMP所期望的分流比例不符,而且,还可能出现多条大象流被分配到同一条路径上,造成负载不均衡的问题。
发明内容
本申请提供了一种报文发送方法、装置及存储介质,可以解决相关技术中多条路径上的分流比例与ECMP/UCMP所期望的分流比例不符,以及出现多条大象流被分配到同一条路径上,造成负载不均衡的问题。所述技术方案如下:
第一方面,提供了一种报文发送方法,第一网络设备与第二网络设备之间存在多条路径,所述第一网络设备基于所述多条路径以负载分担方式向所述第二网络设备发送数据流,所述方法包括:
所述第一网络设备接收报文,所述报文为所述数据流包括的一个报文;
所述第一网络设备判断所述数据流是否为大象流;
如果所述数据流是大象流,则所述第一网络设备通过第一路径策略表确定第一路径,所述第一路径为所述多条路径中的一条路径;
其中,所述第一路径策略表用于描述经由所述多条路径发送给所述第二网络设备的所有数据流中大象流的发送路径,所述第一路径策略表包括多个表项,每个表项所指示的路径是通过加权轮询算法从所述多条路径中选择的;
所述第一网络设备经由所述第一路径发送所述报文。
由于第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,也即是,第一路径策略表中的表项所指示的路径是通过轮询的方式,从上述多条路径中选择出的。而且通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径发送该报文之后,即可实现负载均衡的效果。
可选地,所述第一路径策略表中的表项用于指示流标识、路径信息与表项匹配时间之间的映射关系,所述表项匹配时间是指表项最后一次被匹配上的时间;
所述通过第一路径策略表确定第一路径,包括:
根据所述报文的五元组信息查询所述第一路径策略表;
如果所述第一路径策略表中存在所述数据流对应的表项,则将所述数据流对应的表项 中的路径信息所指示的路径确定为所述第一路径。
需要说明的,流标识可以用来唯一指示一条数据流。而且通常情况下,一条数据流可以包括一个或多个报文,且这一个或多个报文的五元组信息相同,换句话说,五元组信息相同的一个或多个报文可以构成一条数据流。这样,对于一条数据流来说,这条数据流的流标识可以为这条数据流包括的报文的五元组信息,也可以是对这条数据流包括的报文的五元组信息进行处理后得到的。因此,第一网络设备可以根据该报文的五元组信息查询第一路径策略表,从而确定第一路径策略表中是否存在该报文所属的数据流对应的表项。
可选地,所述将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径之前,还包括:
确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
如果所述时间差小于第一时间阈值,则执行将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径的操作。
在某些情况下,如果在上一时间,一个数据流被认为是大象流,且上一时间与当前时间之间的时长较长,那么在当前时间,这个数据流就不一定是大象流,因此,可以针对第一路径策略表中的表项设置有老化条件。这样,当确定第一路径策略表中存在该报文所属的数据流对应的表项时,可以确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差,如果该时间差小于第一时间阈值,那么可以表明该数据流对应的表项不满足老化条件,此时,可以将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文。
可选地,所述确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差之后,还包括:
如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中所述数据流对应的表项;
按照加权轮询算法从所述多条路径中选择出一条路径,将选择出的路径作为所述第一路径。
如果该数据流对应的表项中的表项匹配时间与当前时间之间的时间差大于或等于第一时间阈值,那么可以表明该数据流对应的表项满足老化条件,也即是,该数据流对应的表项在当前时间已经失效,那么就不能将该数据流对应的表项中的路径信息所指示的路径确定为第一路径。此时,可以删除第一路径策略表中该数据流对应的表项。然后,按照加权轮询算法从上述多条路径中选择出一条路径,将选择出的路径确定为第一路径,并经由第一路径发送该报文。
可选地,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
如果所述第一路径策略表中不存在所述数据流对应的表项,则按照加权轮询算法从所述多条路径中选择出一条路径,将选择出的路径作为所述第一路径。
在该数据流为大象流的情况下,如果第一路径策略表中不存在该数据流对应的表项,此时,为了实现负载均衡的效果,可以按照加权轮询算法从所述多条路径中选择出一条路径,将选择出的路径作为所述第一路径。
可选地,所述按照加权轮询算法从所述多条路径中选择出一条路径之后,还包括:
根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项。
在按照加权轮询算法选择出一条路径之后,为了便于后续快速地确定出第一路径,可以根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项。这样,在下次接收到该数据流的报文时,可以直接从第一路径策略表中确定第一路径,而不需要通过加权轮询算法来确定第一路径,从而可以节省时间,提高报文发送效率。
可选地,所述方法还包括:
周期性地确定所述第一路径策略表包括的每个表项中的表项匹配时间与当前时间之间的时间差;
删除所述第一路径策略表中所述时间差大于或等于第一时间阈值的表项。
值得注意的是,上述确定第一路径策略表中的表项是否满足老化条件是在发送某个报文,且第一路径策略表中存在这个报文所属的数据流对应的表项时触发的,也即是,在第一路径策略表中的某个表项匹配上报文时触发。但是,如果第一路径策略表中的某个表项一直未匹配上报文,那么,第一路径策略表中一直保留这个表项,可能会造成内存的占用。因此,在本申请实施例中,还可以周期性地确定第一路径策略表包括的每个表项中的表项匹配时间与当前时间之间的时间差,然后删除第一路径策略表中时间差大于或等于第一时间阈值的表项。这样,对于第一路径策略表中一直未匹配上报文,且满足老化条件的表项也可以删除。
可选地,所述第一路径策略表中的表项用于指示流标识、路径信息、表项匹配时间、切换标志位与删除标志位之间的映射关系,所述表项匹配时间是指表项最后一次被匹配上的时间;
所述通过第一路径策略表确定第一路径,包括:
根据所述报文的五元组信息查询所述第一路径策略表;
如果所述第一路径策略表中存在所述数据流对应的表项、所述数据流对应的表项中的切换标志位为第一数值,且所述数据流对应的表项中的删除标志位为第二数值,则将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径。
在Flow-Aware技术中,所有的数据流初始状态都认为是老鼠流,大象流的识别需要一定的时间。这样,可能有的数据流为大象流,但是初始状态还是作为老鼠流进行处理的。但是,经过一段时间之后,这个数据流可能会被识别为大象流,此时,这个数据流初始作为老鼠流的路径和当前作为大象流的路径可能不同,如果直接进行路径切换的话,可能打乱这个数据流中的报文的顺序,因此,第一路径策略表包括的表项中可以包括切换标志位,通过切换标志位确定当前是否需要按照表项中的路径信息所指示的路径发送该报文,也即是,当前是否需要进行路径的切换。
也即是,切换标志位用于指示是否按照表项中的路径信息所指示的路径发送该报文,且切换标志位的取值可以为第一数值或者第二数值,当某个表项中的切换标志位为第一数值时,可以确定能够按照这个表项中的路径信息所指示的路径发送报文,当某个表项中的切换标志位为第二数值时,可以确定不能按照这个表项中的路径信息所指示的路径发送报文。
删除标志位用于指示表项是否为待删除的表项,且删除标志位的取值也可以为第一数值或者第二数值,当某个表项中的删除标志位为第一数值时,可以确定这个表项为待删除的表项,当某个表项中的删除标志位为第二数值时,可以确定这个表项不是待删除的表项。
由于第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,也即是,第一路径策略表中的表项所指示的路径是通过轮询的方式,从上述多条路径中选择出的。而且通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,即可实现负载均衡的效果。另外,由于切换标志位用于指示是否按照表项中的路径信息所指示的路径发送该报文,删除标志位用于指示该表项是否为待删除的表项,换句话说,切换标志位用于指示当前是否能够安全切换路径,不会出现报文乱序的情况,删除标志位用于指示该表项当前是否有效,因此,当该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值时,可以确定当前可以安全地切换路径,不会出现报文乱序的情况,而且该数据流对应的表项当前有效,这样,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,不仅不会出现报文乱序的情况,还可以实现负载均衡的效果。
可选地,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
如果所述第一路径策略表中存在所述数据流对应的表项,且所述数据流对应的表项中的切换标志位为第二数值,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
如果所述时间差大于或等于第二时间阈值,则将所述数据流对应的表项中的切换标志位置为第一数值,将所述数据流对应的表项中的路径信息所指示的路径作为所述第一路径。
如果该时间差大于或等于第二时间阈值,那么可以表明当前可以安全地切换路径,不会出现报文乱序的情况,此时,可以将该数据流对应的表项中的切换标志位置为第一数值,并将该数据流对应的表项中的路径信息所指示的路径作为第一路径,并经由第一路径发送该报文。
需要说明的是,如果该数据流对应的表项中的切换标志位为第二数值,那么该数据流对应的表项中的删除标志位必然为第二数值,因此,只要该数据流对应的表项中的切换标志位为第二数值,那么就可以不用管该数据流对应的表项中的删除标志位的取值,直接确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。
可选地,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
如果所述第一路径策略表中存在所述数据流对应的表项,且所述数据流对应的表项中的删除标志位为第一数值,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中所述数据流对应的表项。
如果在上一时间,一个数据流被认为是大象流,且上一时间与当前时间之间的时长较长,那么在当前时间,这个数据流就不一定是大象流,因此,可以针对第一路径策略表中的表项设置有老化条件。这样,当第一路径策略表中存在该数据流对应的表项时,可以确定该数据流对应的表项中的删除标志位的取值,如果该数据流对应的表项中的删除标志位为第一数值,那么可以表明该数据流对应的表项为待删除的表项,此时可以确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第一时间阈值,那么可以表明该数据流对应的表项满足老化条件,也即是,该数据流对应的表项在当前时间已经失效,那么就不能按照该数据流对应的表项中的路径发送该报文。此时, 可以删除第一路径策略表中该数据流对应的表项。
进一步地,如果该时间差小于第一时间阈值,那么可以表明该数据流对应的表项不满足老化条件,此时,可以先不删除该数据流对应的表项。
可选地,所述接收报文之后,还包括:
如果所述第一路径策略表中不存在所述数据流对应的表项,则按照加权轮询算法从所述多条路径中选择出一条路径;
根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项,其中,当前添加的表项中的切换标志位和删除标志位为第二数值。
可选地,所述根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项之后,还包括:
根据所述报文的五元组信息,按照等价路由ECMP/非等价路由UCMP的方式,确定一条路径;
如果按照所述ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径相同,则将所述数据流对应的表项中的切换标志位置为第一数值。
如果按照ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径相同,那么可以确定不存在安全切换的问题,也即是,不存在报文乱序的问题,此时可以直接将该数据流对应的表项中的切换标志位置为第一数值。
可选地,所述方法还包括:
如果确定所述数据流不再为大象流,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
如果所述时间差大于或等于第二时间阈值,则删除所述第一路径策略表中所述数据流对应的表项。
由于本申请是通过其他技术来识别大象流,而且,上一时间一个数据流被识别为大象流,下一时间这个数据流可能就不是大象流,因此,本申请在确定某个数据流为大象流之后,还可以继续对这个数据流进行识别,以确定在之后的时间内这个数据流还是否为大象流。如果确定该数据流不再为大象流,则确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第二时间阈值,那么可以表明当前可以安全地进行路径的切换,此时,可以直接删除第一路径策略表中该数据流对应的表项。
可选地,所述确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差之后,还包括:
如果所述时间差小于所述第二时间阈值,则将所述第一路径策略表中所述数据流对应的表项中的删除标志位置为第一数值。
如果该时间差小于第二时间阈值,那么可以表明当前进行路径切换之后会出现报文乱序的情况,因此可以将第一路径策略表中该数据流对应的表项中的删除标志位置为第一数值,先不删除。
可选地,所述方法还包括:
周期性地确定所述第一路径策略表中删除标志位为第一数值的表项中的表项匹配时间与当前时间之间的时间差;
如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中删除标志位 为第一数值的表项。
值得注意的是,在上述过程中,有的表项可能不满足安全切换路径的条件,并没有直接删除,而是将表项中的删除标志位置为第一数值。如果第一路径策略表中一直保留这些表项,可能会造成内存的占用。因此,在本申请实施例中,还可以周期性地确定第一路径策略表中删除标志位为第一数值的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第一时间阈值,则删除第一路径策略表中删除标志位为第一数值的表项。这样,对于第一路径策略表中一开始不满足安全切换路径条件的表项,后面还可以按照这种方式进行删除。
可选地,所述经由所述第一路径发送所述报文之后,还包括:
将所述第一路径策略表中所述数据流对应的表项中的表项匹配时间更新为当前时间。
由于第一路径策略表包括的表项中的表项匹配时间是指表项最后一次被匹配上的时间,因此,当将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文之后,可以将第一路径策略表中该数据流对应的表项中的表项匹配时间更新为当前时间。
第二方面,提供了一种报文发送装置,所述报文发送装置具有实现上述第一方面中报文发送方法行为的功能。所述报文发送装置包括至少一个模块,该至少一个模块用于实现上述第一方面所提供的报文发送方法。
第三方面,提供了一种网络设备,所述网络设备包括处理器和存储器,所述存储器用于存储执行上述第一方面所提供的报文发送方法的程序,以及存储用于实现上述第一方面所提供的报文发送方法所涉及的数据。所述处理器被配置为用于执行所述存储器中存储的程序。所述存储设备的操作装置还可以包括通信总线,该通信总线用于该处理器与存储器之间建立连接。
第四方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的报文发送方法。
第五方面,提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的报文发送方法。
上述第二方面、第三方面、第四方面和第五方面所获得的技术效果与第一方面中对应的技术手段获得的技术效果近似,在这里不再赘述。
本申请提供的技术方案至少可以带来以下有益效果:由于第一路径策略表用于描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的路径,第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,因此,如果该报文所属的数据流为大象流,且第一路径策略表中存在该报文所属的数据流对应的表项,那么可以按照该数据流对应的表项中的路径信息所指示的路径来发送该报文。由于通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,即可实现负载均衡的效果,不会出现多条大象 流被分配到同一条路径上的问题。而且,由于老鼠流本身的流带宽就比较小,对分流比例的影响不大,而大象流的流带宽通常较大,对分流比例的影响较大,因此,在本申请中,将大象流包括的报文按照加权轮询的方式确定的路径进行发送,这样,在大象流实现负载均衡的情况下,可以保证多条路径上的分流比例与ECMP/UCMP所期望的分流比例接近或者相等。
附图说明
图1是本申请实施例提供的一种基于Service-Aware的SR-TE的网络架构的示意图;
图2是本申请实施例提供的一种网络设备的结构示意图;
图3是本申请实施例提供的一种报文发送方法的流程图;
图4是本申请实施例提供的另一种报文发送方法的流程图;
图5是本申请实施例提供的一种报文发送装置的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
在对本申请实施例提供的报文发送方法进行详细解释说明之前,先对本申请实施例涉及的应用场景进行介绍。
在本申请实施例中,第一网络设备和第二网络设备之间存在多条路径,第一网络设备可以通过该多条路径中的任意一条路径与第二网络设备进行通信。但是,为了实现负载均衡的效果,第一网络设备通常需要从该多条路径中选择出一条路径与第二网络设备进行通信。也即是,第一网络设备通常需要从该多条路径中选择一条路径,向第二网络设备发送数据流。这种方式也可以称为负载分担方式。
请参考图1,图1是根据本申请实施例示出的一种基于服务感知(Service-Aware)的分段路由流量工程(Segment Routing-Traffic Engineering,SR-TE)的网络架构的示意图。该网络架构包括第一网络设备101、第二网络设备102、多个中间设备103和控制器104。第一网络设备101可以通过边界网关协议-链路状态(Border Gateway Protocol-Link State,BGP-LS)向控制器104上报网络拓扑信息,该网络拓扑信息是指第一网络设备101、第二网络设备102以及多个中间设备103组成的网络的拓扑信息。控制器104可以基于第一网络设备101上报的网络拓扑信息,确定第一网络设备101与第二网络设备102之间的多条路径(比如,图1中实线和虚线所示的两条路径)和该多条路径的分流比例,并将该多条路径和该多条路径的分流比例下发给第一网络设备101,以使第一网络设备101按照该多条路径和该多条路径的分流比例发送数据流。而且,在通过该多条路径发送数据流的过程中,控制器104还可以从第一网络设备101处采集经由该多条路径中每条路径发送的数据流的流量,基于经由该多条路径中每条路径发送的数据流的流量,按照配置的带宽调优策略,对该多条路径和该多条路径的分流比例进行优化,将优化后的结果展示给用户。当用户确认优化时,可以将优化后的多条路径和该多条路径的分流比例下发给第一网络设备101,以使第一网络设备101按照优化后的多条路径和该多条路径的分流比例发送数据流。
其中,不管第一网络设备101按照优化之前的多条路径和该多条路径的分流比例发送数据流,还是按照优化之后的多条路径和该多条路径的分流比例发送数据流,第一网络设备101都可以按照本申请实施例提供的方法发送数据流。
请参考图2,图2是根据本申请实施例示出的一种网络设备的结构示意图,该网络设备可以是图1中的任一网络设备。该网络设备包括至少一个处理器201、通信总线202、存储器203以及至少一个通信接口204。
处理器201可以是一个通用中央处理器(Central Processing Unit,CPU)、网络处理器(NP)、微处理器、或者可以是一个或多个用于实现本申请方案的集成电路,例如,专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。
通信总线202用于在上述组件之间传送信息。通信总线202可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
存储器203可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,也可以是随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。存储器203可以是独立存在,并通过通信总线202与处理器201相连接。存储器203也可以和处理器201集成在一起。
通信接口204使用任何收发器一类的装置,用于与其它设备或通信网络通信。通信接口204包括有线通信接口,还可以包括无线通信接口。其中,有线通信接口例如可以为以太网接口。以太网接口可以是光接口,电接口或其组合。无线通信接口可以为无线局域网(Wireless Local Area Networks,WLAN)接口,蜂窝网络通信接口或其组合等。
在具体实现中,作为一种实施例,处理器201可以包括一个或多个CPU,如图2中所示的CPU0和CPU1。
在具体实现中,作为一种实施例,网络设备可以包括多个处理器,如图2中所示的处理器201和处理器205。这些处理器中的每一个可以是一个单核处理器(single-CPU),也可以是一个多核处理器(multi-CPU)。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(如计算机程序指令)的处理核。
在具体实现中,作为一种实施例,网络设备还可以包括输出设备206和输入设备207。输出设备206和处理器201通信,可以以多种方式来显示信息。例如,输出设备206可以是液晶显示器(liquid crystal display,LCD)、发光二级管(light emitting diode,LED)显示设备、阴极射线管(cathode ray tube,CRT)显示设备或投影仪(projector)等。输入设备207和处理器201通信,可以以多种方式接收用户的输入。例如,输入设备207可以是鼠标、键盘、触摸屏设备或传感设备等。
在一些实施例中,存储器203用于存储执行本申请方案的程序代码210,处理器201可以执行存储器203中存储的程序代码210。也即是,该网络设备可以通过处理器201以及存 储器203中的程序代码210,来实现下文图3或图4实施例提供的报文发送方法。
接下来对本申请实施例提供的报文发送方法进行详细地解释说明。在本申请中,可以通过两种技术来发送报文。一种是基于Service-Aware技术来发送报文,另一种是基于流感知(Flow-Aware)技术来发送报文。下面将分为两个实施例对这两种技术分别进行说明。
请参考图3,图3是本申请实施例示出的一种报文发送方法的流程图。该方法应用于第一网络设备中,该方法是基于Service-Aware技术实现的。其中,在该方法中,第一网络设备与第二网络设备之间存在多条路径,且第一网络设备基于该多条路径以负载分担方式向第二网络设备发送数据流。该方法包括如下几个步骤。
步骤301:第一网络设备接收报文,该报文为数据流包括的一个报文。
需要说明的一点是,该报文可以是除第一网络设备和第二网络设备之外的其他网络设备发送的报文,也可以为第一网络设备自身生成且待发送给第二网络设备的报文。
步骤302:第一网络设备判断该数据流是否为大象流。
在Service-Aware技术中,报文通常携带有所属数据流的流带宽,通过该数据流的流带宽是否大于或等于带宽阈值,可以确定该数据流是大象流还是老鼠流。也即是,在一些实施例中,第一网络设备可以判断该数据流的流带宽是否大于或等于带宽阈值,如果该数据流的流带宽大于或等于带宽阈值,则确定该数据流为大象流。如果该数据流的流带宽小于带宽阈值,则确定该数据流不为大象流,换句话说,也可以确定该数据流为老鼠流。
需要说明的是,大象流可以称为大流,老鼠流也可以称为小流。
通常情况下,报文包含有报文头,报文头中可以包括元组信息,比如,四元组信息、五元组信息、七元组信息等等。通过报文头中包括的元组信息的数量,可以确定该数据流是大象流还是老鼠流。作为一种示例,当报文所属的数据流为大象流时,该报文的报文头中可以包括七元组信息,当该报文所属的数据流为老鼠流时,该报文的报文头中可以包括五元组信息。这样,第一网络设备可以确定该报文的报文头中携带的五元组信息还是七元组信息,如果该报文的报文头中携带七元组信息,则确定该数据流为大象流。如果该报文的报文头中携带五元组信息,则确定该数据流不为大象流,换句话说,也可以确定该数据流为老鼠流。
作为另一种示例,当报文所属的数据流为大象流时,该报文的报文头中可以包括五元组信息,当该报文所属的数据流为老鼠流时,该报文的报文头中可以包括四元组信息。这样,第一网络设备可以确定该报文的报文头中携带的五元组信息还是四元组信息,如果该报文的报文头中携带五元组信息,则确定该数据流为大象流。如果该报文的报文头中携带四元组信息,则确定该数据流不为大象流,换句话说,也可以确定该数据流为老鼠流。
需要说明的是,四元组信息可以包括源互联网协议(Internet Protocol,IP)地址、源端口、目的IP地址和目的端口。五元组信息可以包括源IP地址、源端口、目的IP地址、目的端口和协议号。七元组信息可以包括源媒体接入控制(Medium Access Control,MAC)地址、目的MAC地址、源IP地址、目的IP地址、源端口、目的端口和协议号。示例性地,假设第一网络设备当前需要向第二网络设备发送报文,那么,源MAC地址、源IP地址和源端口为第一网络设备的MAC地址、IP地址和端口,目的MAC地址、目的IP地址和目的端口为第二网络设备的MAC地址、IP地址和端口,协议号为第一网络设备和第二网络设备通信时所采用的协议的编号。
当然,本申请实施例不仅可以通过上面的方式判断该数据流是否为大象流,还可以通过其他的方式来判断。比如,可以通过该数据流所属的业务类型来判断。即,当该数据流所属的业务类型为网页类时,可以确定该数据流为老鼠流,当该数据流所属的业务类型为视频类时,可以确定该数据流为大象流。
当第一网络设备通过步骤302确定该数据流是大象流之后,第一网络设备可以根据该报文的元组信息,通过第一路径策略表确定第一路径。其中,该报文的元组信息可以为四元组信息、五元组信息、七元组信息等等,且不管该报文的元组信息是四元组信息、五元组信息还是七元组信息,通过第一路径策略表确定第一路径的方法相同。接下来,以五元组信息为例,对通过第一路径策略表确定第一路径的方法进行说明。
步骤303:如果该数据流是大象流,则第一网络设备根据该报文的五元组信息查询第一路径策略表。
第一路径策略表用于描述经由该多条路径发送给第二网络设备的所有数据流中大象流的路径,也即是,第一路径策略表仅仅用来描述大象流的路径,并没有描述老鼠流的路径。通俗地将,第一路径策略表仅对大象流起作用,对老鼠流不起作用。第一路径策略表包括多个表项,每个表项所指示的路径是通过加权轮询算法从该多条路径中选择的。而且,第一路径策略表中的表项用于指示流标识、路径信息与表项匹配时间之间的映射关系,表项匹配时间是指表项最后一次被匹配上的时间。
示例性地,第一路径策略表可以如下述表1所示。其中,当第一网络设备采用不同的路由协议时,表1中的路径信息可以代表不同的含义。作为一种示例,如果第一网络设备采用设备级路由协议,那么,表1中的路径信息代表下一跳设备的设备标识。如果第一网络设备采用隧道级路由协议,那么,表1中的路径信息代表隧道的标识,或者隧道的入接口。也即是,不管第一网络设备采用哪种路由协议,表1中的路径信息都可以用来指示发送该报文的路径。
表1
流标识 路径信息 表项匹配时间
ID1 P1 T1
ID2 P2 T2
...... ...... ......
需要说明的,流标识可以用来唯一指示一条数据流。而且通常情况下,一条数据流可以包括一个或多个报文,且这一个或多个报文的五元组信息相同,换句话说,五元组信息相同的一个或多个报文可以构成一条数据流。这样,对于一条数据流来说,这条数据流的流标识可以为这条数据流包括的报文的五元组信息,也可以是对这条数据流包括的报文的五元组信息进行处理后得到的。因此,第一网络设备可以根据该报文的五元组信息查询第一路径策略表,从而确定第一路径策略表中是否存在该报文所属的数据流对应的表项。
在一些实施例中,如果数据流的流标识为这条数据流包括的报文的五元组信息,那么,第一网络设备可以直接将该报文的五元组信息与第一路径策略表包括的表项中的流标识进行比较,如果第一路径策略表中存在流标识与该报文的五元组信息相同的表项,那么,可以确定第一路径策略表中存在该报文所属的数据流对应的表项,否则,可以确定第一路 径策略表中不存在该报文所属的数据流对应的表项。
在另一些实施例中,如果数据流的流标识是对这条数据流包括的报文的五元组信息进行处理后得到,那么,第一网络设备可以按照相同的处理方法,将该报文的五元组信息进行处理。之后,将处理结果与第一路径策略表包括的表项中的流标识进行比较,如果第一路径策略表中存在流标识与该处理结果相同的表项,那么,可以确定第一路径策略表中存在该报文所属的数据流对应的表项,否则,可以确定第一路径策略表中不存在该报文所属的数据流对应的表项。
步骤304:如果第一路径策略表中存在该数据流对应的表项,则第一网络设备将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文。
如果第一路径策略表中存在该报文所属的数据流对应的表项,那么可以表明该报文所属的数据流为大象流。在这种情况,可以直接将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送给报文。
由于第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,也即是,第一路径策略表中的表项所指示的路径是通过轮询的方式,从上述多条路径中选择出的。而且通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径发送该报文之后,即可实现负载均衡的效果。
在一些实施例中,如果在上一时间,一个数据流被认为是大象流,且上一时间与当前时间之间的时长较长,那么在当前时间,这个数据流就不一定是大象流,因此,本申请实施例针对第一路径策略表中的表项设置有老化条件。这样,当确定第一路径策略表中存在该报文所属的数据流对应的表项时,可以确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差,如果该时间差小于第一时间阈值,那么可以表明该数据流对应的表项不满足老化条件,此时,可以将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文。
由于第一路径策略表包括的表项中的表项匹配时间是指表项最后一次被匹配上的时间,因此,当将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文之后,可以将第一路径策略表中该数据流对应的表项中的表项匹配时间更新为当前时间。
如果该数据流对应的表项中的表项匹配时间与当前时间之间的时间差大于或等于第一时间阈值,那么可以表明该数据流对应的表项满足老化条件,也即是,该数据流对应的表项在当前时间已经失效,那么就不能将该数据流对应的表项中的路径信息所指示的路径确定为第一路径。此时,可以删除第一路径策略表中该数据流对应的表项。然后,按照加权轮询算法从上述多条路径中选择出一条路径,将选择出的路径确定为第一路径,并经由第一路径发送该报文。
由于该数据流在当前时间仍旧为大象流,因此,按照加权轮询算法从上述多条路径中选择出一条路径之后,还可以根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项。这样也可以看出第一路径策略表是用来描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的发送流经,而且第一路径策略表中的每个表项所指示的路径是通过加权轮询算法从上述多条路径中选择的。
需要说明的是,删除的表项中该数据流对应的路径与当前按照加权轮询算法选择出的路径可能相同,也可能不同。另外,第一时间阈值可以根据经验设置。
值得注意的是,上述确定第一路径策略表中的表项是否满足老化条件是在发送某个报文,且第一路径策略表中存在这个报文所属的数据流对应的表项时触发的,也即是,在第一路径策略表中的某个表项匹配上报文时触发。但是,如果第一路径策略表中的某个表项一直未匹配上报文,那么,第一路径策略表中一直保留这个表项,可能会造成内存的占用。因此,在本申请实施例中,还可以周期性地确定第一路径策略表包括的每个表项中的表项匹配时间与当前时间之间的时间差,然后删除第一路径策略表中时间差大于或等于第一时间阈值的表项。这样,对于第一路径策略表中一直未匹配上报文,且满足老化条件的表项也可以删除。
上述步骤304是在第一路径策略表中存在该报文所属的数据流对应的表项时,如何确定第一路径,并经由第一路径发送报文的。但是,在某些情况下,第一路径策略表中可能不存在该报文所属的数据流对应的表项,此时,可以通过下述步骤305确定第一路径,并经由第一路径发送该报文。
步骤305:如果第一路径策略表中不存在该数据流对应的表项,则第一网络设备按照加权轮询算法从该多条路径中选择出一条路径,将选择出的路径作为第一路径,经由第一路径发送该报文。
与上述同理,在第一路径策略表中不存在该报文所属的数据流对应的表项的情况下,当按照加权轮询算法从上述多条路径中选择出一条路径之后,也可以根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项。
上述步骤303-305是在该数据流为大象流的情况下如何发送该报文的过程。当通过上述步骤302确定该数据流为老鼠流时,可以按照ECMP/UCMP的方式从上述多条路径中选择出一条路径,根据选择出的路径发送该报文。
在本申请实施例中,由于第一路径策略表用于描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的路径,第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,且第一路径策略表中的表项用于指示流标识、路径信息与表项匹配时间之间的映射关系,因此,如果该报文所属的数据流为大象流,且第一路径策略表中存在该报文所属的数据流对应的表项,那么可以按照该数据流对应的表项中的路径信息所指示的路径来发送该报文。由于通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,即可实现负载均衡的效果,不会出现多条大象流被分配到同一条路径上的问题。而且,由于老鼠流本身的流带宽就比较小,对分流比例的影响不大,而大象流的流带宽通常较大,对分流比例的影响较大,因此,在本申请实施例中,将老鼠流包括的报文按照原有的方式确定的路径进行发送,将大象流包括的报文按照加权轮询的方式确定的路径进行发送,这样,在大象流实现负载均衡的情况下,可以保证多条路径上的分流比例与ECMP/UCMP所期望的分流比例接近或者相等。
请参考图4,图4是本申请实施例示出的一种报文发送方法的流程图,该方法应用于第一网络设备中,该方法是基于Flow-Aware技术实现的。其中,在该方法中,第一网络设备与第二网络设备之间存在多条路径,且第一网络设备基于该多条路径以负载分担方式向第二网络设备发送数据流。该方法包括如下几个步骤。
步骤401:第一网络设备接收报文,该报文为数据流包括的一个报文。
本步骤与上述步骤301类似,具体可以参考上述步骤301的描述,本申请实施例对此不再赘述。
步骤402:第一网络设备判断该数据流是否为大象流。
在Flow-Aware技术中,由于报文中不会携带所属的数据流的流带宽,因此,所有的数据流初始状态都认为是老鼠流,而大象流的识别需要一定的时间。也即是,需要单独通过其他的技术来识别大象流。目前可以采用多种方法进行大象流的识别。比如,在一些实施例中,可以在接收到一个数据流的首个报文时,可以统计从首个报文的接收时间开始的参考时间内接收到这个数据流的报文的数量,如果这个数量大于或等于数量阈值,那么可以确定这个数据流为大象流。如果这个数量小于数量阈值,那么可以确定这个数据流为老鼠流。在另一些实施例中,可以随机针对某个数据流,确定这个数据流在参考时间内需要发送的报文的数量,如果这个数量大于或等于数量阈值,那么可以确定这个数据流为大象流。如果这个数量小于数量阈值,那么可以确定这个数据流为老鼠流。
需要说明的是,上面是通过报文的数量来确定数据流是大象流还是老鼠流,在其他一些实施例中,也可以通过这个数据流的流量大小来确定数据流是大象流还是老鼠流。比如,在一些实施例中,可以在接收到一个数据流的首个报文时,可以统计从首个报文的接收时间开始的参考时间内接收到这个数据流的流量大小,如果统计的流量大小大于或等于流量阈值,那么可以确定这个数据流为大象流。如果统计的流量大小小于流量阈值,那么可以确定这个数据流为老鼠流。在另一些实施例中,可以随机针对某个数据流,确定这个数据流在参考时间内需要发送的流量大小,如果确定的流量大小大于或等于流量阈值,那么可以确定这个数据流为大象流。如果确定的流量大小小于流量阈值,那么可以确定这个数据流为老鼠流。
通常情况下,报文包含有报文头,报文头中可以包括元组信息,比如,四元组信息、五元组信息、七元组信息等等。通过报文头中包括的元组信息的数量,可以确定该数据流是大象流还是老鼠流。作为一种示例,当报文所属的数据流为大象流时,该报文的报文头中可以包括七元组信息,当该报文所属的数据流为老鼠流时,该报文的报文头中可以包括五元组信息。这样,第一网络设备可以确定该报文的报文头中携带的五元组信息还是七元组信息,如果该报文的报文头中携带七元组信息,则确定该数据流为大象流。如果该报文的报文头中携带五元组信息,则确定该数据流不为大象流,换句话说,也可以确定该数据流为老鼠流。
作为另一种示例,当报文所属的数据流为大象流时,该报文的报文头中可以包括五元组信息,当该报文所属的数据流为老鼠流时,该报文的报文头中可以包括四元组信息。这样,第一网络设备可以确定该报文的报文头中携带的五元组信息还是四元组信息,如果该报文的报文头中携带五元组信息,则确定该数据流为大象流。如果该报文的报文头中携带四元组信息,则确定该数据流不为大象流,换句话说,也可以确定该数据流为老鼠流。
需要说明的是,大象流可以称为大流,老鼠流也可以称为小流。四元组信息可以包括源IP地址、源端口、目的IP地址和目的端口。五元组信息可以包括源IP地址、源端口、目的IP地址、目的端口和协议号。七元组信息可以包括源MAC地址、目的MAC地址、源IP地址、目的IP地址、源端口、目的端口和协议号。示例性地,假设第一网络设备当前需要向第二网络设备发送报文,那么,源MAC地址、源IP地址和源端口为第一网络设备的MAC地址、IP地址和端口,目的MAC地址、目的IP地址和目的端口为第二网络设备的MAC地址、 IP地址和端口,协议号为第一网络设备和第二网络设备通信时所采用的协议的编号。
当然,本申请实施例不仅可以通过上面的方式判断该数据流是否为大象流,还可以通过其他的方式来判断。比如,可以通过该数据流所属的业务类型来判断。即,当该数据流所属的业务类型为网页类时,可以确定该数据流为老鼠流,当该数据流所属的业务类型为视频类时,可以确定该数据流为大象流。
当第一网络设备通过步骤402确定该数据流是大象流之后,第一网络设备可以根据该报文的元组信息,通过第一路径策略表确定第一路径。其中,该报文的元组信息可以为四元组信息、五元组信息、七元组信息等等,且不管该报文的元组信息是四元组信息、五元组信息还是七元组信息,通过第一路径策略表确定第一路径的方法相同。接下来,以五元组信息为例,对通过第一路径策略表确定第一路径的方法进行说明。
步骤403:如果该数据流是大象流,则第一网络设备根据该报文的五元组信息查询第一路径策略表。
第一路径策略表用于描述经由该多条路径发送给第二网络设备的所有数据流中大象流的路径,也即是,第一路径策略表仅仅用来描述大象流的路径,并没有描述老鼠流的路径。通俗地将,第一路径策略表仅对大象流起作用,对老鼠流不起作用。第一路径策略表包括多个表项,每个表项所指示的路径是通过加权轮询算法从该多条路径中选择的。而且,第一路径策略表中的表项用于指示流标识、路径信息、表项匹配时间、切换标志位与删除标志位之间的映射关系,表项匹配时间是指表项最后一次被匹配上的时间。
示例性地,第一路径策略表可以如下述表2所示。其中,当第一网络设备采用不同的路由协议时,表2中的路径信息可以代表不同的含义。具体可以参考上述步骤303的描述。但是,不管第一网络设备采用哪种路由协议,表2中的路径信息都可以用来指示发送该报文的路径。
表2
流标识 路径信息 表项匹配时间 切换标志位 删除标志位
ID1 P1 T1 0 0
ID2 P2 T2 0 0
...... ...... ...... ...... ......
基于上述描述,在Flow-Aware技术中,所有的数据流初始状态都认为是老鼠流,大象流的识别需要一定的时间。这样,可能有的数据流为大象流,但是初始状态还是作为老鼠流进行处理的。但是,经过一段时间之后,这个数据流可能会被识别为大象流,此时,这个数据流初始作为老鼠流的路径和当前作为大象流的路径可能不同,如果直接进行路径切换的话,可能打乱这个数据流中的报文的顺序,因此,本申请实施例中,第一路径策略表包括的表项中可以包括切换标志位,通过切换标志位确定当前是否需要按照表项中的路径信息所指示的路径发送该报文,也即是,当前是否需要进行路径的切换。
也即是,切换标志位用于指示是否按照表项中的路径信息所指示的路径发送该报文,且切换标志位的取值可以为第一数值或者第二数值,当某个表项中的切换标志位为第一数值时,可以确定能够按照这个表项中的路径信息所指示的路径发送报文,当某个表项中的切换标志位为第二数值时,可以确定不能按照这个表项中的路径信息所指示的路径发送报 文。
删除标志位用于指示表项是否为待删除的表项,且删除标志位的取值也可以为第一数值或者第二数值,当某个表项中的删除标志位为第一数值时,可以确定这个表项为待删除的表项,当某个表项中的删除标志位为第二数值时,可以确定这个表项不是待删除的表项。
其中,第一数值可以为0或者1,第二数值也可以为0或者1,且当第一数值为0时,第二数值可以为1,当第一数值为1时,第二数值可以为0。当然,0或者1是一种示例,第一数值和第二数值也可以为其他的数值。
另外,本申请实施例对本步骤中与上述步骤303相同的内容不做介绍,具体可以参考上述步骤303的描述。
步骤404:如果第一路径策略表中存在该数据流对应的表项、该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值,则第一网络设备将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文。
由于该报文所属的数据流为大象流,因此,当第一路径策略表中存在该报文所属的数据流对应的表项时,可以确定该数据流对应的表项中的切换标志位和删除标志位的取值,如果该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值,那么可以表明当前可以按照该数据流对应的表项中的路径信息所指示的路径发送该报文,且该数据流对应的表项不是待删除的表项,这样,可以直接将该数据流对应的表项中的路径信息所指示的路径确定为第一路径,并经由第一路径发送该报文。
由于第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,也即是,第一路径策略表中的表项所指示的路径是通过轮询的方式,从上述多条路径中选择出的。而且通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,即可实现负载均衡的效果。另外,由于切换标志位用于指示是否按照表项中的路径信息所指示的路径发送该报文,删除标志位用于指示该表项是否为待删除的表项,换句话说,切换标志位用于指示当前是否能够安全切换路径,不会出现报文乱序的情况,删除标志位用于指示该表项当前是否有效,因此,当该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值时,可以确定当前可以安全地切换路径,不会出现报文乱序的情况,而且该数据流对应的表项当前有效,这样,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,不仅不会出现报文乱序的情况,还可以实现负载均衡的效果。
在一些实施例中,如果第一路径策略表中存在该数据流对应的表项,且该数据流对应的表项中的切换标志位为第二数值,那么可以确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第二时间阈值,那么可以表明当前可以安全地切换路径,不会出现报文乱序的情况,此时,可以将该数据流对应的表项中的切换标志位置为第一数值,并将该数据流对应的表项中的路径信息所指示的路径作为第一路径,并经由第一路径发送该报文。如果该时间差小于第二时间阈值,那么可以表明当前切换路径后,可能会出现报文乱序的情况,此时,不进行路径的切换,也即是,还是按照之前的路径发送该报文。其中,之前的路径是指该数据流作为老鼠流时,根据该报文的五元组信息,按照ECMP/UCMP确定的路径。
需要说明的是,如果该数据流对应的表项中的切换标志位为第二数值,那么该数据流对应的表项中的删除标志位必然为第二数值,因此,只要该数据流对应的表项中的切换标志位为第二数值,那么就可以不用管该数据流对应的表项中的删除标志位的取值,直接确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。
另外,第二时间阈值可以通过上述多条路径对报文的传输时间确定,也即是,对于同一个报文,可以确定上述多条路径发送该报文所需的时间,然后确定每两条路径的传输时间差,将最大的传输时间差确定为第二时间阈值。当然,第二时间阈值也可以大于最大的传输时间差。或者,也可以通过其他的方式设置第二时间阈值,比如,通过经验设置第二时间阈值,只要不会出现报文乱序的情况即可。
值得注意的是,第二时间阈值与第一时间阈值可能相同,也可能不同。当第二时间阈值与第一时间阈值不同时,第一时间阈值可以大于第二时间阈值。
由于第一路径策略表包括的表项中的表项匹配时间是指表项最后一次被匹配上的时间,因此,当将该数据流对应的表项中的路径信息所指示的路径作为第一路径,并经由第一路径发送该报文之后,可以将第一路径策略表中该数据流对应的表项中的表项匹配时间更新为当前时间。
在一些实施例中,如果在上一时间,一个数据流被认为是大象流,且上一时间与当前时间之间的时长较长,那么在当前时间,这个数据流就不一定是大象流,因此,本申请实施例针对第一路径策略表中的表项设置有老化条件。这样,当第一路径策略表中存在该数据流对应的表项时,可以确定该数据流对应的表项中的删除标志位的取值,如果该数据流对应的表项中的删除标志位为第一数值,那么可以表明该数据流对应的表项为待删除的表项,此时可以确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第一时间阈值,那么可以表明该数据流对应的表项满足老化条件,也即是,该数据流对应的表项在当前时间已经失效,那么就不能按照该数据流对应的表项中的路径发送该报文。此时,可以删除第一路径策略表中该数据流对应的表项。如果该时间差小于第一时间阈值,那么可以表明该数据流对应的表项不满足老化条件,此时,可以先不删除该数据流对应的表项。
需要说明的是,如果该数据流对应的表项中的删除标志位为第一数值,那么该数据流对应的表项即为待删除的表项,此时,可以不用管该数据流对应的表项中的切换标志位的取值,直接确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。
上述步骤404是在第一路径策略表中存在该报文所属的数据流对应的表项时,如何确定第一路径,并经由第一路径发送报文的。但是,在某些情况下,第一路径策略表中可能不存在该报文所属的数据流对应的表项,此时,可以通过下述步骤305确定第一路径,并经由第一路径发送该报文。
步骤405:如果第一路径策略表中不存在该数据流对应的表项,则第一网络设备按照加权轮询算法从该多条路径中选择出一条路径,将选择出的路径作为第一路径,经由第一路径发送该报文。
当通过步骤401接收到报文之后,按照上述方法确定该报文所属的数据流为大象流且第一路径策略表中不存在该数据流对应的表项时,为了实现负载均衡的目的,可以按照加权轮询算法从上述多条路径中选择出一条路径。
之后,可以根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表 中添加该数据流对应的表项,其中,当前添加的表项中的切换标志位和删除标志位为第二数值。也即是,第一路径策略表项包括的表项中的切换标志位和删除标志位的初值均为第二数值。这样也可以看出第一路径策略表是用来描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的发送流经,而且第一路径策略表中的每个表项所指示的路径是通过加权轮询算法从上述多条路径中选择的。
当根据报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项之后,还可以根据报文的五元组信息,按照ECMP/UCMP的方式,确定该报文的路径。如果按照ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径相同,那么可以确定不存在安全切换的问题,也即是,不存在报文乱序的问题,此时可以直接将该数据流对应的表项中的切换标志位置为第一数值。如果按照ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径不同,那么可以确定存在安全切换的问题,也即是,存在报文乱序的问题,此时可以不做任何操作,也即是,该数据流对应的表项中的切换标志位还是第二数值。
由于本申请是通过其他技术来识别大象流,而且,上一时间一个数据流被识别为大象流,下一时间这个数据流可能就不是大象流,因此,本申请实施例在确定某个数据流为大象流之后,还可以继续对这个数据流进行识别,以确定在之后的时间内这个数据流还是否为大象流。如果确定该数据流不再为大象流,则确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第二时间阈值,那么可以表明当前可以安全地进行路径的切换,此时,可以直接删除第一路径策略表中该数据流对应的表项。如果该时间差小于第二时间阈值,那么可以表明当前进行路径切换之后会出现报文乱序的情况,因此可以将第一路径策略表中该数据流对应的表项中的删除标志位置为第一数值,先不删除。
值得注意的是,在上述过程中,有的表项可能不满足安全切换路径的条件,并没有直接删除,而是将表项中的删除标志位置为第一数值。如果第一路径策略表中一直保留这些表项,可能会造成内存的占用。因此,在本申请实施例中,还可以周期性地确定第一路径策略表中删除标志位为第一数值的表项中的表项匹配时间与当前时间之间的时间差。如果该时间差大于或等于第一时间阈值,则删除第一路径策略表中删除标志位为第一数值的表项。这样,对于第一路径策略表中一开始不满足安全切换路径条件的表项,后面还可以按照这种方式进行删除。
上述步骤403-405是在该数据流为大象流的情况下如何发送该报文的过程。当通过上述步骤402确定该数据流为老鼠流时,可以按照ECMP/UCMP的方式从上述多条路径中选择出一条路径,根据选择出的路径发送该报文。
在本申请实施例中,由于第一路径策略表用于描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的路径,第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,且第一路径策略表中的表项用于指示流标识、路径信息、表项匹配时间、切换标志位与删除标志位之间的映射关系,因此,如果该报文所属的数据流为大象流、第一路径策略表中存在该报文所属的数据流对应的表项、该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值,那么可以按照该数据流对应的表项中的路径信息所指示的路径来发送该报文。由于通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项 中的路径发送该报文之后,即可实现负载均衡的效果,不会出现多条大象流被分配到同一条路径上的问题。而且,由于老鼠流本身的流带宽就比较小,对分流比例的影响不大,而大象流的流带宽通常较大,对分流比例的影响较大,因此,在本申请实施例中,将老鼠流包括的报文按照原有的方式确定的路径进行发送,将大象流包括的报文按照加权轮询的方式确定的路径进行发送,这样,在大象流实现负载均衡的情况下,可以保证多条路径上的分流比例与ECMP/UCMP所期望的分流比例接近或者相等。
图5是本申请实施例提供的一种报文发送装置的结构示意图,该报文发送装置可以由软件、硬件或者两者的结合实现成为第一网络设备的部分或者全部。第一网络设备与第二网络设备之间存在多条路径,第一网络设备基于该多条路径以负载分担方式向第二网络设备发送数据流。参见图5,该装置包括:接收模块501、判断模块502、第一确定模块503和发送模块504。
接收模块501,用于执行上述图3所示实施例中的步骤301或图4所示实施例中的步骤401;
判断模块502,用于执行上述图3所示实施例中的步骤302或图4所示实施例中的步骤402;
第一确定模块503,用于执行上述图3所示实施例中的步骤303-304中通过第一路径策略表确定第一路径的步骤,或者用于执行图4所示实施例中的步骤403-404中通过第一路径策略表确定第一路径的步骤。
发送模块504,用于执行上述图3所示实施例中的步骤303-304中经由第一路径发送报文的步骤,或者用于执行图4所示实施例中的步骤403-404中经由第一路径发送报文的步骤。
可选地,第一路径策略表中的表项用于指示流标识、路径信息与表项匹配时间之间的映射关系,表项匹配时间是指表项最后一次被匹配上的时间;
第一确定模块503包括:
第一查询子模块,用于根据该报文的五元组信息查询第一路径策略表;
第一确定子模块,用于如果第一路径策略表中存在该数据流对应的表项,则将该数据流对应的表项中的路径信息所指示的路径确定为第一路径。
可选地,该装置还包括:
第二确定模块,用于确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
触发模块,用于如果该时间差小于第一时间阈值,则触发第一确定模块503将该数据流对应的表项中的路径信息所指示的路径确定为第一路径。
可选地,该装置还包括:
第一删除模块,用于如果该时间差大于或等于第一时间阈值,则删除第一路径策略表中该数据流对应的表项;
选择模块,用于按照加权轮询算法从该多条路径中选择出一条路径,将选择出的路径作为第一路径。
可选地,第一确定模块503还包括:
选择子模块,用于如果第一路径策略表中不存在该数据流对应的表项,则按照加权轮询算法从该多条路径中选择出一条路径,将选择出的路径作为第一路径。
可选地,第一确定模块503还包括:
添加子模块,用于根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项。
可选地,该装置还包括:
第三确定模块,用于周期性地确定第一路径策略表包括的每个表项中的表项匹配时间与当前时间之间的时间差;
第二删除模块,用于删除第一路径策略表中时间差大于或等于第一时间阈值的表项。
可选地,第一路径策略表中的表项用于指示流标识、路径信息、表项匹配时间、切换标志位与删除标志位之间的映射关系,表项匹配时间是指表项最后一次被匹配上的时间;
第一确定模块503包括:
第二查询子模块,用于根据该报文的五元组信息查询第一路径策略表;
第二确定子模块,用于如果第一路径策略表中存在该数据流对应的表项、该数据流对应的表项中的切换标志位为第一数值,且该数据流对应的表项中的删除标志位为第二数值,则将该数据流对应的表项中的路径信息所指示的路径确定为第一路径。
可选地,第一确定模块503还包括:
第三确定子模块,用于如果第一路径策略表中存在该数据流对应的表项,且该数据流对应的表项中的切换标志位为第二数值,则确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
置位子模块,用于如果该时间差大于或等于第二时间阈值,则将该数据流对应的表项中的切换标志位置为第一数值,将该数据流对应的表项中的路径信息所指示的路径作为第一路径。
可选地,第一确定模块503还包括:
第四确定子模块,用于如果第一路径策略表中存在该数据流对应的表项,且该数据流对应的表项中的删除标志位为第一数值,则确定该数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
删除子模块,用于如果该时间差大于或等于第一时间阈值,则删除第一路径策略表中该数据流对应的表项。
可选地,该装置还包括:
选择模块,用于如果第一路径策略表中不存在该数据流对应的表项,则按照加权轮询算法从该多条路径中选择出一条路径;
添加模块,用于根据该报文的五元组信息、选择出的路径和当前时间,在第一路径策略表中添加该数据流对应的表项,其中,当前添加的表项中的切换标志位和删除标志位为第二数值。
可选地,该装置还包括:
第四确定模块,用于根据所述报文的五元组信息,按照等价路由ECMP/非等价路由UCMP的方式,确定一条路径;
第一置位模块,用于如果按照ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径相同,则将该数据流对应的表项中的切换标志位置为第一数值。
可选地,该装置还包括:
第五确定模块,用于如果确定该数据流不再为大象流,则确定该数据流对应的表项中 的表项匹配时间与当前时间之间的时间差;
第三删除模块,用于如果该时间差大于或等于第二时间阈值,则删除第一路径策略表中该数据流对应的表项。
可选地,该装置还包括:
第二置位模块,用于如果该时间差小于第二时间阈值,则将第一路径策略表中该数据流对应的表项中的删除标志位置为第一数值。
可选地,该装置还包括:
第六确定模块,用于周期性地确定第一路径策略表中删除标志位为第一数值的表项中的表项匹配时间与当前时间之间的时间差;
第四删除模块,用于如果该时间差大于或等于第一时间阈值,则删除第一路径策略表中删除标志位为第一数值的表项。
可选地,该装置还包括:
更新模块,用于将第一路径策略表中该数据流对应的表项中的表项匹配时间更新为当前时间。
在本申请实施例中,由于第一路径策略表用于描述经由上述多条路径发送给第二网络设备的所有数据流中大象流的路径,第一路径策略表中的表项所指示的路径是通过加权轮询算法从上述多条路径中选择的,因此,如果该报文所属的数据流为大象流,且第一路径策略表中存在该报文所属的数据流对应的表项,那么可以按照该数据流对应的表项中的路径信息所指示的路径来发送该报文。由于通常情况下,通过轮询的方式可以做到多条路径都能被轮询到的情况,因此,按照该数据流对应的表项中的路径信息所指示的路径发送该报文之后,即可实现负载均衡的效果,不会出现多条大象流被分配到同一条路径上的问题。而且,由于老鼠流本身的流带宽就比较小,对分流比例的影响不大,而大象流的流带宽通常较大,对分流比例的影响较大,因此,在本申请中,将大象流包括的报文按照加权轮询的方式确定的路径进行发送,这样,在大象流实现负载均衡的情况下,可以保证多条路径上的分流比例与ECMP/UCMP所期望的分流比例接近或者相等。
需要说明的是:上述实施例提供的报文发送装置在发送报文时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的报文发送装置与报文发送方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络或其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如:同轴电缆、光纤、数据用户线(Digital Subscriber Line,DSL))或无线(例如:红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计 算机能够存取的任何可用介质,或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如:软盘、硬盘、磁带)、光介质(例如:数字通用光盘(Digital Versatile Disc,DVD))或半导体介质(例如:固态硬盘(Solid State Disk,SSD))等。值得注意的是,本申请提到的计算机可读存储介质可以为非易失性存储介质,换句话说,可以是非瞬时性存储介质。
以上所述为本申请提供的实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (18)

  1. 一种报文发送方法,其特征在于,第一网络设备与第二网络设备之间存在多条路径,所述第一网络设备基于所述多条路径以负载分担方式向所述第二网络设备发送数据流,所述方法包括:
    所述第一网络设备接收报文,所述报文为所述数据流包括的一个报文;
    所述第一网络设备判断所述数据流是否为大象流;
    如果所述数据流是大象流,则所述第一网络设备通过第一路径策略表确定第一路径,所述第一路径为所述多条路径中的一条路径;
    其中,所述第一路径策略表用于描述经由所述多条路径发送给所述第二网络设备的所有数据流中大象流的发送路径,所述第一路径策略表包括多个表项,每个表项所指示的路径是通过加权轮询算法从所述多条路径中选择的;
    所述第一网络设备经由所述第一路径发送所述报文。
  2. 如权利要求1所述的方法,其特征在于,所述第一路径策略表中的表项用于指示流标识、路径信息与表项匹配时间之间的映射关系,所述表项匹配时间是指表项最后一次被匹配上的时间;
    所述通过第一路径策略表确定第一路径,包括:
    根据所述报文的五元组信息查询所述第一路径策略表;
    如果所述第一路径策略表中存在所述数据流对应的表项,则将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径。
  3. 如权利要求2所述的方法,其特征在于,所述将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径之前,还包括:
    确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
    如果所述时间差小于第一时间阈值,则执行将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径的操作。
  4. 如权利要求3所述的方法,其特征在于,所述确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差之后,还包括:
    如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中所述数据流对应的表项;
    按照加权轮询算法从所述多条路径中选择出一条路径,将选择出的路径作为所述第一路径。
  5. 如权利要求2所述的方法,其特征在于,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
    如果所述第一路径策略表中不存在所述数据流对应的表项,则按照加权轮询算法从所述多条路径中选择出一条路径,将选择出的路径作为所述第一路径。
  6. 如权利要求4或5所述的方法,其特征在于,所述按照加权轮询算法从所述多条路 径中选择出一条路径之后,还包括:
    根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项。
  7. 如权利要求2-6任一所述的方法,其特征在于,所述方法还包括:
    周期性地确定所述第一路径策略表包括的每个表项中的表项匹配时间与当前时间之间的时间差;
    删除所述第一路径策略表中所述时间差大于或等于第一时间阈值的表项。
  8. 如权利要求1所述的方法,其特征在于,所述第一路径策略表中的表项用于指示流标识、路径信息、表项匹配时间、切换标志位与删除标志位之间的映射关系,所述表项匹配时间是指表项最后一次被匹配上的时间;
    所述通过第一路径策略表确定第一路径,包括:
    根据所述报文的五元组信息查询所述第一路径策略表;
    如果所述第一路径策略表中存在所述数据流对应的表项、所述数据流对应的表项中的切换标志位为第一数值,且所述数据流对应的表项中的删除标志位为第二数值,则将所述数据流对应的表项中的路径信息所指示的路径确定为所述第一路径。
  9. 如权利要求8所述的方法,其特征在于,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
    如果所述第一路径策略表中存在所述数据流对应的表项,且所述数据流对应的表项中的切换标志位为第二数值,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
    如果所述时间差大于或等于第二时间阈值,则将所述数据流对应的表项中的切换标志位置为第一数值,将所述数据流对应的表项中的路径信息所指示的路径作为所述第一路径。
  10. 如权利要求8所述的方法,其特征在于,所述根据所述报文的五元组信息查询所述第一路径策略表之后,还包括:
    如果所述第一路径策略表中存在所述数据流对应的表项,且所述数据流对应的表项中的删除标志位为第一数值,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
    如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中所述数据流对应的表项。
  11. 如权利要求8所述的方法,其特征在于,所述接收报文之后,还包括:
    如果所述第一路径策略表中不存在所述数据流对应的表项,则按照加权轮询算法从所述多条路径中选择出一条路径;
    根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项,其中,当前添加的表项中的切换标志位和删除标志位为第二数值。
  12. 如权利要求11所述的方法,其特征在于,所述根据所述报文的五元组信息、选择出的路径和当前时间,在所述第一路径策略表中添加所述数据流对应的表项之后,还包括:
    根据所述报文的五元组信息,按照等价路由ECMP/非等价路由UCMP的方式,确定一条路径;
    如果按照所述ECMP/UCMP方式确定的路径与按照加权轮询算法确定的路径相同,则将所述数据流对应的表项中的切换标志位置为第一数值。
  13. 如权利要求8-12任一所述的方法,其特征在于,所述方法还包括:
    如果确定所述数据流不再为大象流,则确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差;
    如果所述时间差大于或等于第二时间阈值,则删除所述第一路径策略表中所述数据流对应的表项。
  14. 如权利要求13所述的方法,其特征在于,所述确定所述数据流对应的表项中的表项匹配时间与当前时间之间的时间差之后,还包括:
    如果所述时间差小于所述第二时间阈值,则将所述第一路径策略表中所述数据流对应的表项中的删除标志位置为第一数值。
  15. 如权利要求8-14任一所述的方法,其特征在于,所述方法还包括:
    周期性地确定所述第一路径策略表中删除标志位为第一数值的表项中的表项匹配时间与当前时间之间的时间差;
    如果所述时间差大于或等于第一时间阈值,则删除所述第一路径策略表中删除标志位为第一数值的表项。
  16. 如如权利要求2、3、8或9所述的方法,其特征在于,所述经由所述第一路径发送所述报文之后,还包括:
    将所述第一路径策略表中所述数据流对应的表项中的表项匹配时间更新为当前时间。
  17. 一种报文发送装置,应用于第一网络设备,其特征在于,所述第一网络设备与第二网络设备之间存在多条路径,所述第一网络设备基于所述多条路径以负载分担方式向所述第二网络设备发送数据流,所述装置包括:
    接收模块,用于接收报文,所述报文为所述数据流包括的一个报文;
    判断模块,用于判断所述数据流是否为大象流;
    确定模块,用于如果所述数据流是大象流,则通过第一路径策略表确定第一路径,所述第一路径为所述多条路径中的一条路径;
    其中,所述第一路径策略表用于描述经由所述多条路径发送给所述第二网络设备的所有数据流中大象流的发送路径,所述第一路径策略表包括多个表项,每个表项所指示的路径是通过加权轮询算法从所述多条路径中选择的;
    发送模块,用于经由所述第一路径发送所述报文。
  18. 一种计算机可读存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-16任一所述的方法的步骤。
PCT/CN2020/090728 2019-07-31 2020-05-17 报文发送方法、装置及存储介质 WO2021017578A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910698687.3A CN112311674B (zh) 2019-07-31 2019-07-31 报文发送方法、装置及存储介质
CN201910698687.3 2019-07-31

Publications (1)

Publication Number Publication Date
WO2021017578A1 true WO2021017578A1 (zh) 2021-02-04

Family

ID=74229989

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/090728 WO2021017578A1 (zh) 2019-07-31 2020-05-17 报文发送方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN112311674B (zh)
WO (1) WO2021017578A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113890905A (zh) * 2021-06-16 2022-01-04 荣耀终端有限公司 通道切换方法、电子设备及存储介质
WO2024021990A1 (zh) * 2022-07-27 2024-02-01 华为技术有限公司 一种路径确定的方法及相关设备

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116781624A (zh) * 2022-03-08 2023-09-19 华为技术有限公司 一种下发路由表的方法及相关装置
CN117640503B (zh) * 2024-01-22 2024-04-30 北京天维信通科技股份有限公司 融合BRouter技术与智能路径技术的流量优化方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487676A (zh) * 2016-10-27 2017-03-08 盛科网络(苏州)有限公司 一种基于大象流的动态ecmp芯片实现方法
CN108092914A (zh) * 2016-11-21 2018-05-29 华为技术有限公司 网络流量负载均衡调度方法和装置
WO2018096286A1 (fr) * 2016-11-25 2018-05-31 Orange Détermination de nœuds relais régénérateurs compris dans une ligne de transmission d'un réseau optique
CN108881010A (zh) * 2018-07-13 2018-11-23 北京瀚海星云科技有限公司 基于损益评估的拥塞路径调整方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119313A (zh) * 2007-09-14 2008-02-06 杭州华三通信技术有限公司 一种负载分担方法和设备
CN101478480B (zh) * 2009-01-05 2012-07-04 中国人民解放军信息工程大学 一种实现负载均衡的方法及装置
US8588082B2 (en) * 2009-09-23 2013-11-19 Ixia Network testing using control plane and data plane convergence
CN103716208B (zh) * 2013-12-31 2017-06-30 北京邮电大学 支持大象流的网络管理方法、系统、交换机和网络
CN106411733B (zh) * 2016-09-08 2019-05-31 重庆邮电大学 一种基于链路实时负载的sdn动态负载均衡调度方法
CN107846445A (zh) * 2017-09-20 2018-03-27 南京邮电大学 一种基于sdn的服务器负载均衡方法
CN109787913B (zh) * 2019-03-15 2022-07-01 北京工业大学 一种基于sdn的数据中心网络动态负载均衡方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487676A (zh) * 2016-10-27 2017-03-08 盛科网络(苏州)有限公司 一种基于大象流的动态ecmp芯片实现方法
CN108092914A (zh) * 2016-11-21 2018-05-29 华为技术有限公司 网络流量负载均衡调度方法和装置
WO2018096286A1 (fr) * 2016-11-25 2018-05-31 Orange Détermination de nœuds relais régénérateurs compris dans une ligne de transmission d'un réseau optique
CN108881010A (zh) * 2018-07-13 2018-11-23 北京瀚海星云科技有限公司 基于损益评估的拥塞路径调整方法

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113890905A (zh) * 2021-06-16 2022-01-04 荣耀终端有限公司 通道切换方法、电子设备及存储介质
CN113890905B (zh) * 2021-06-16 2022-11-22 荣耀终端有限公司 通道切换方法、电子设备及存储介质
WO2024021990A1 (zh) * 2022-07-27 2024-02-01 华为技术有限公司 一种路径确定的方法及相关设备

Also Published As

Publication number Publication date
CN112311674B (zh) 2022-02-25
CN112311674A (zh) 2021-02-02

Similar Documents

Publication Publication Date Title
WO2021017578A1 (zh) 报文发送方法、装置及存储介质
US20130003549A1 (en) Resilient Hashing for Load Balancing of Traffic Flows
US11316774B2 (en) Path selection method and apparatus
US8913613B2 (en) Method and system for classification and management of inter-blade network traffic in a blade server
US7539133B2 (en) Method and apparatus for preventing congestion in load-balancing networks
JP4951717B2 (ja) バックアップリソースを選択する方法、システム
US9602428B2 (en) Method and apparatus for locality sensitive hash-based load balancing
WO2018161735A1 (zh) 父节点选择方法及网络节点
WO2022127475A1 (zh) 数据传输方法、装置、电子设备及存储介质
US20210352018A1 (en) Traffic Balancing Method and Apparatus
WO2020062268A1 (zh) 在网络中的负载均衡和报文重排序方法及装置
WO2016029345A1 (zh) 网络流的信息统计方法和装置
WO2021139216A1 (zh) 一种流量传输的方法、节点和系统
WO2023116580A1 (zh) 路径切换方法、装置、网络设备、以及网络系统
CN111585911B (zh) 数据中心网络流量负载的均衡方法
US20220393934A1 (en) Determining the impact of network events on network applications
US20170295074A1 (en) Controlling an unknown flow inflow to an sdn controller in a software defined network (sdn)
US20200044956A1 (en) Data Transmission Method and Apparatus
US8467311B2 (en) Method and system for avoiding flooding of packets in switches
WO2019165855A1 (zh) 一种报文传输的方法及装置
WO2015039616A1 (zh) 一种报文处理方法及设备
CN108075955B (zh) 骨干网的数据处理方法及装置
CN110784406B (zh) 功率感知的动态自适应片上网络阈值路由方法
WO2022007653A1 (zh) 一种端到端路径发现和使用方法及装置
WO2022022251A1 (zh) 流量限速方法、相关网络设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20846019

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20846019

Country of ref document: EP

Kind code of ref document: A1