Data flow processing method and device
11165716 · 2021-11-02
Assignee
Inventors
Cpc classification
G06F2009/45595
PHYSICS
Y02D30/00
GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
H04L47/24
ELECTRICITY
International classification
G06F9/455
PHYSICS
Abstract
This application provide a data flow processing method and a device. A host determines a priority corresponding to a first data flow to be sent to a switch, and adds the priority to the first data flow to generate a second data flow that includes the priority. The host sends the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow. A host assigns a priority to a data flow, and the switch does not need to determine whether the data flow is an elephant flow or a mouse flow, thereby saving hardware resources of the switch. The switch does not need to determine the priority of the data flow, thereby processing the data flow in a timely manner.
Claims
1. A data flow processing method, comprising: receiving, by a host, a priority list from a switch, wherein the priority list comprises priority values respectively corresponding to different priorities in a one-to-one corresponding manner; determining, by the host according to the priority list, a priority value of a priority corresponding to an application layer port corresponding to a first data flow to be sent to the switch; adding, by the host, the priority value of the priority corresponding to the application layer port to the first data flow to generate a second data flow that comprises the priority; and sending, by the host, the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow.
2. The method according to claim 1, wherein determining the priority corresponding to the first data flow to be sent to the switch comprises determining, by the host according to a priority correspondence table, the priority corresponding to the application layer port.
3. The method according to claim 2, wherein before determining the priority corresponding to the first data flow to be sent to the switch, the method further comprises: obtaining, by the host, a historical data flow that is corresponding to each application layer port and that is recorded by the host; and determining, by the host based on the historical data flow corresponding to the application layer port, a priority corresponding to each application layer port, and generating the priority correspondence table.
4. The method according to claim 1, wherein receiving the priority list from the switch comprises: receiving, by the host, an extended Link Layer Discovery Protocol (LLDP) packet from the switch, wherein the extended LLDP packet comprises at least two differentiated service code point (DSCP) values supported by the switch, and the at least two DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
5. The method according to claim 3, wherein determining the priority corresponding to each application layer port based on the historical data flow corresponding to the application layer port comprises: determining, by the host for each application layer port, a sum of historical data flows corresponding to the application layer port; sorting, by the host, all application layer ports in descending order according to sizes of the sums of the historical data flows of all the application layer ports, to obtain an application layer port sequence; and determining, by the host, that a priority corresponding to the first N application layer ports in the application layer port sequence is a first level, and determining that a priority corresponding to application layer ports in the application layer port sequence other than the first N application layer ports is a second level, wherein the second level is higher than the first level, and N is a positive integer.
6. A data flow processing method, comprising: sending, by a switch, a priority list to a host, wherein the priority list comprises priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch; receiving, by the switch, a second data flow from the host, wherein the second data flow is generated after the host determines a priority corresponding to a first data flow to be sent to the switch and adds the priority to the first data flow; and processing, by the switch, the second data flow according to the priority of the second data flow.
7. The method according to claim 6, wherein sending the priority list to the host comprises: sending, by the switch, an extended Link Layer Discovery Protocol (LLDP) packet to the host, wherein the extended LLDP packet comprises at least two differentiated service code point (DSCP) values supported by the switch, and the at least two DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
8. The method according to claim 6, wherein processing the second data flow according to the priority of the second data flow comprises: placing, by the switch according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority.
9. A host, comprising a memory and a processor; the memory stores instructions; the processor is configured to execute the instructions to: receive a priority list from a switch, wherein the priority list comprises priority values respectively corresponding to different priorities in a one-to-one corresponding manner; determine, according to the priority list, a priority value of a priority corresponding to an application layer port corresponding to a first data flow to be sent to the switch; add the priority value of the priority corresponding to the application layer port to the first data flow to generate a second data flow that comprises the priority; and send the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow.
10. The host according to claim 9, wherein the processor is configured to execute the instructions to determine, according to a priority correspondence table, the priority corresponding to the application layer port.
11. The host according to claim 10, wherein the processor is configured to execute the instructions to: before determining the priority corresponding to the first data flow to be sent to the switch, obtain a historical data flow that is corresponding to each application layer port and that is recorded by the host; and determine, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generate the priority correspondence table.
12. The host according to claim 9, wherein the processor is configured to execute the instructions to: receive an extended Link Layer Discovery Protocol (LLDP) packet from the switch, wherein the extended LLDP packet comprises at least two differentiated service code point (DSCP) values supported by the switch, and the at least two DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
13. The host according to claim 11, wherein the processor is configured to execute the instructions to: determine, for each application layer port, a sum of historical data flows corresponding to the application layer port; sort all application layer ports in descending order according to sizes of the sums of the historical data flows of all the application layer ports, to obtain an application layer port sequence; and determine that a priority corresponding to the first N application layer ports in the application layer port sequence is a first level, and determine that a priority corresponding to application layer ports in the application layer port sequence other than the first N application layer ports is a second level, wherein the second level is higher than the first level, and N is a positive integer.
14. A switch, comprising a memory and a processor; the memory stores instructions; the processor is configured to execute the instructions to: send a priority list to a host, wherein the priority list comprises priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch; receive a second data flow from the host, wherein the second data flow is generated after the host determines a priority corresponding to a first data flow to be sent to the switch and adds the priority to the first data flow; and process the second data flow according to the priority of the second data flow.
15. The switch according to claim 14, wherein the processor is configured to execute the instructions to: send an extended Link Layer Discovery Protocol (LLDP) packet to the host, wherein the extended LLDP packet comprises at least two differentiated service code point (DSCP) values supported by the switch, and the at least two DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
16. The switch according to claim 14, wherein the processor is configured to execute the instructions to: place, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority.
17. The method according to claim 4, wherein the LLDP packet includes a type/length/value (TLV) element including an information table containing the at least two DCSP values.
18. The method according to claim 7, wherein the LLDP packet includes a type/length/value (TLV) element including an information table containing the at least two DCSP values.
19. The host according to claim 12, wherein the LLDP packet includes a type/length/value (TLV) element including an information table containing the at least two DCSP values.
20. The switch according to claim 15, wherein the LLDP packet includes a type/length/value (TLV) element including an information table containing the at least two DCSP values.
Description
BRIEF DESCRIPTION OF DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
DESCRIPTION OF EMBODIMENTS
(18) Embodiments of this application are applied to various types of communications systems or another system that may occur in the future.
(19)
(20) The QoS policy is described herein. When network congestion occurs, all data flows that are being transmitted on the network may be discarded. In this case, to meet different service quality requirements of a user for different applications, a network is required to allocate and schedule resources for different applications according to the requirements of the user, that is, provide different service quality for different data flows. For example, an important data flow with a high real-time requirement is preferably processed. However, for an ordinary data flow with a low real-time requirement, a lower processing priority is provided, and a packet of the ordinary data flow is preferably discarded in a case of network congestion. Such a processing method is one QoS policy. In conclusion, the QoS policy means assigning different levels of transmission priorities to different types of data flows, further identifying relative importance of different types of data flows, and providing differentiated transmission services for the data flows based on mechanisms provided by a network device, such as various priority forwarding policies and congestion avoidance.
(21) Currently, an elephant flow that requires large bandwidth but does not have a strict time constraint occupies about 80% of total traffic in the data center network (DCN). In contrast, usually a mouse flow is very latency-sensitive due to a short service life, and the mouse flow has a deadline constraint that is ultimately defined by a service level agreement (SLA) between a cloud provider and a customer. Because a latency of the mouse flow significantly affects user experience, special processing is required for the mouse flow. Currently, different priorities are usually assigned to the mouse flow and the elephant flow, and a priority of the mouse flow is higher than a priority of the elephant flow.
(22) However, in the prior art, to achieve a flow-based statistics feature, a flow table needs to be deployed on the switch. When the switch processes many data flows, the flow table occupies many hardware resources of the switch. Because the switch determines, in a data transmission process, whether a data flow is an elephant flow or a mouse flow, when the switch determines that the data flow is an elephant flow, some data of the elephant flow has been transmitted, that is, whether a data flow is an elephant flow or a mouse flow cannot be determined in time in the identifying method. As a result, the elephant flow has occupied bandwidth of the mouse flow, and the mouse flow is affected.
(23)
(24)
(25)
(26) S101. A host determines a priority corresponding to a first data flow to be sent to a switch.
(27) In this embodiment, the host is a server or a virtual machine. This embodiment is executed by the host.
(28) First, in the non-virtualization scenario shown in
(29) S102. The host adds the priority to the first data flow to generate a second data flow that includes the priority.
(30) In this embodiment, in the non-virtualization scenario shown in
(31) For the switch and the host, the first data flow and the second data flow are essentially a same data flow because they have a same quintuple. In this application, only for the purpose of convenient description, the data flow before the priority is added is referred to as the first data flow, and the data flow after the priority is added is referred to as the second data flow.
(32) S103. The host sends the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow.
(33) In this embodiment, in the non-virtualization scenario shown in
(34) In the foregoing steps, in the virtualization scenario shown in
(35)
(36) S11. A server determines a priority corresponding to a first data flow to be sent to a switch.
(37) S12. The server adds the priority to the first data flow to generate a second data flow.
(38) S13. The server sends the second data flow to the switch.
(39) S14. The switch processes the second data flow according to the priority of the second data flow.
(40) For a process shown in
(41)
(42) S21. A virtual machine determines a priority corresponding to a first data flow to be sent to a switch.
(43) S22. The virtual machine adds the determined priority to the first data flow to generate a second data flow.
(44) S23. The virtual machine sends the second data flow to the switch by using a virtual switch.
(45) S24. The switch processes the second data flow in a priority order represented by the priority of the second data flow.
(46) For a process shown in
(47) In this embodiment, the host determines the priority corresponding to the first data flow to be sent to the switch; the host adds the priority to the first data flow to generate the second data flow that includes the priority; and the host sends the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow. The host is a server in the non-virtualization scenario, and the host is a virtual machine in the virtualization scenario. Therefore, before the server or the virtual machine sends the data flow to the switch, the server or the virtual machine assigns a priority to the data flow, so that the switch does not need to collect flow-based statistics about packets to determine whether the data flow is an elephant flow or a mouse flow, and hardware resources of the switch can be saved. In addition, because the server or the virtual machine sends the data flow configured with the priority to the switch, the switch may process, for example, transmit, the data flow in the priority order represented by the priority in the data flow, and then the switch does not need to determine the priority of the data flow, thereby preventing the elephant flow from occupying bandwidth of the mouse flow, and processing the data flow in a timely manner.
(48)
(49) S201. A host obtains a historical data flow that is corresponding to each application layer port and that is recorded by the host.
(50) This embodiment is executed by the host, and the host is a server or a virtual machine.
(51) For a same server or virtual machine, a same application layer port means a same service. For example, a File Transfer Protocol (FTP) service, a Hypertext Transfer Protocol (HTTP) service, and a database service separately have fixed application layer ports. To be specific, on the same server or virtual machine, the same application layer port has a similar data flow behavior. In this application, an application layer port refers to an application layer port number. Different protocols at an application layer have different application layer port numbers. Then, on a physical host or a server, if an application layer port presents an elephant flow behavior in historical data transmission, the application layer port is also likely to present the elephant flow behavior in the future. Based on this principle, in this solution, processes in S201 and S202 are used to determine a priority of the data flow, and then determine an elephant flow and a mouse flow.
(52) First, in the non-virtualization scenario shown in
(53) S202. The host determines, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generates a priority correspondence table.
(54) The priority correspondence table is used to record the priority corresponding to each application layer port.
(55) Determining the priority corresponding to each application layer port specifically includes the following:
(56) The host determines, for each application layer port, a sum of historical data flows corresponding to the application layer port; the host sorts all application layer ports in descending order according to sizes of the sums of the data flows of all the application layer ports, to obtain an application layer port sequence; and the host determines that a priority corresponding to the first N application layer ports in the application layer port sequence is a first level, and determines that a priority corresponding to application layer ports in the application layer port sequence other than the first N application layer ports is a second level, where the second level is higher than the first level, and N is a positive integer.
(57) In this embodiment, in the non-virtualization scenario shown in
(58) For example, the server collects statistics about 10000 data flows that occurred on the server, and the server needs to determine, for each application layer port, a sum of historical data flows of the application layer port. The server then sorts all the application layer ports in descending order according to sizes of the sums of the data flows of all the application layer ports, as shown in the application layer port sequence in Table 1, to obtain a sequence of application layer ports with different application layer port numbers keys. A UDP/TCP port represents a source application layer port/a destination application layer port. The server determines that a priority corresponding to the top 10% application layer ports is the elephant flow level, and a priority corresponding to remaining application layer ports is the mouse flow level. In addition, the server determines that the priority of the mouse flow level is higher than the priority of the elephant flow level.
(59) TABLE-US-00001 TABLE 1 Application layer port sequence Application layer port number key (UDP/TCP port) Sum of data flows (Bytes) 50010 1024M 53762 824M 21 624M . . . . . .
(60) S203. The host receives a priority list sent by a switch, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch.
(61) Specifically, S203 includes the following: The host receives an extended LLDP packet sent by the switch.
(62) The extended LLDP packet includes a Link Layer Discovery Protocol data unit (LLDPDU), the LLDPDU includes an optional type/length/value (TLV), the optional TLV includes an information table, and the information table includes a type identifier of the optional TLV, a name of the optional TLV, and at least two DSCP values supported by the switch, where the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(63) In this embodiment, in the non-virtualization scenario shown in
(64) Specifically, the LLDP is first described. Nowadays, because a variety of network devices exist and configuration is complex, a standard information exchange platform needs to be set, so that network devices from different vendors can discover each other and exchange respective system and configuration information in a network. Then, the LLDP is provided. The LLDP provides a standard link layer discovery manner. The LLDP means that the network device organizes information such as primary capability information, a management address, a device identifier, and an interface identifier of the network device into different TLVs and encapsulates the TLVs into an LLDPDU. The current network device then advertises an LLDP packet carrying the LLDPDU to a neighbor network device directly connected to the current network device. After the neighbor network device receives the information, the neighbor network device saves the information in a form of a standard management information base (MIB), so that a network management system can query and determine a link communication status.
(65) There is an idle optional TLV in the LLDPDU in the LLDP packet. A TLV is a primary data format of the LLDPDU, and a format of a TLV data type is shown in Table 2.
(66) TABLE-US-00002 TABLE 2 Format of TLV data type TLV type Length of TLV data part TLV data part (7 bits) (9 bits) (0 bytes to 511 bytes)
(67) Among values of the TLV type, 127 and 0 to 8 are dedicated values specified in existing specifications, and 9 to 126 are reserved values, as shown in
(68) TABLE-US-00003 TABLE 3 Definition of TLV types TLV type (Type) TLV name (Name) Mandatory or not 0 End of LLDPDU Mandatory 1 Chassis ID Mandatory 2 Port ID Mandatory 3 Time to live Mandatory 4 Port description Optional 5 System name Optional 6 System description Optional 7 System capabilities Optional 8 Management address Optional 9 to 126 Reserved for future standardization — 127 Organizationally specific TLVs Optional
(69) In the non-virtualization scenario shown in
(70) TABLE-US-00004 TABLE 4 Information table Type Name Content (DSCP value) 125 Support DSCP priorities that can be priority list supported by the switch
(71) For a definition of the content in the information table of Table 4, refer to RFC 791 (requests for comments, RFC). In RFC 791, the first three bits of a type of service (TOS) field indicate IP precedence. The three bits can be used to indicate eight priorities, that is, IP priority fields. The three bits may be applied to flow classification, and a larger value indicates a higher priority. IP precedence may be used to mark eight types of services, and application types of IP precedence are as follows: 7 Reserved 6 Reserved 5 Voice 4 Video conference 3 Call signal 2 High-priority data 1 Medium-priority data 0 Best-effort service data
(72) In this way, the switch may obtain a new LLDP packet, for example, obtain an LLDP packet in Table 5, as shown in Table 5.
(73) TABLE-US-00005 TABLE 5 LLDP packet Destination Source Time To End of MAC MAC Ether Chassis Port ID Live Optional LLDPDU address address Type ID TLV TLV TLV TLV TLV Destination Source 0x88 cc A B C D Indicate MAC MAC end of the LLDP
(74) The switch then sends the extended LLDP packet to the server, so that the server receives and saves the extended LLDP packet sent by the switch.
(75) S204. The host determines a priority corresponding to a first data flow to be sent to the switch.
(76) S204 specifically includes the following:
(77) The host determines an application layer port corresponding to the first data flow; and the host determines, according to the priority correspondence table, a priority corresponding to the application layer port.
(78) In this embodiment, in the non-virtualization scenario shown in
(79) S205. The host adds the priority to the first data flow to generate a second data flow that includes the priority.
(80) S205 specifically includes the following:
(81) The host determines, according to the priority list, a priority value of the priority corresponding to the application layer port; and the host adds the priority value of the priority corresponding to the application layer port to the first data flow.
(82) In this embodiment, in the non-virtualization scenario shown in
(83) S206. The host sends the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow.
(84) In this embodiment, in the non-virtualization scenario shown in
(85) In the foregoing steps, in the virtualization scenario shown in
(86)
(87) S31. A server obtains a historical data flow that is corresponding to each application layer port and that is recorded by the server.
(88) S32. The server determines, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generates a priority correspondence table.
(89) S33. The server receives a priority list sent by a switch, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch.
(90) S33 specifically includes the following: The server receives an extended LLDP packet sent by the switch, where the extended LLDP packet includes an LLDPDU, the LLDPDU includes an optional TLV, the optional TLV includes an information table, and the information table includes a type identifier of the optional TLV, a name of the optional TLV, and at least two DSCP values supported by the switch, where the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(91) S34. The server determines a priority corresponding to a first data flow to be sent to the switch.
(92) S35. The server adds the priority to the first data flow to generate a second data flow that includes the priority. S35 specifically includes the following:
(93) The server determines, according to the priority list, a priority value of the priority corresponding to the application layer port; and the server adds the priority value of the priority corresponding to the application layer port to the first data flow, where the priority value may be specifically a DSCP value.
(94) S36. The server sends the second data flow to the switch.
(95) S37. The switch places, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority.
(96) For a process shown in
(97)
(98) S41. A virtual machine obtains a historical data flow that is corresponding to each application layer port and that is recorded by the virtual machine.
(99) S42. The virtual machine determines, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generates a priority correspondence table.
(100) S43. A switch sends a priority list to a virtual switch by using a network adapter, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch.
(101) S43 specifically includes the following: The switch sends an extended LLDP packet to the virtual switch by using the network adapter, where the extended LLDP packet includes an LLDPDU, the LLDPDU includes an optional TLV, the optional TLV includes an information table, and the information table includes a type identifier of the optional TLV, a name of the optional TLV, and at least two DSCP values supported by the switch, where the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner, that is, the priority list may include the at least two DSCP values.
(102) S44. The virtual switch sends the priority list to each virtual machine connected to the virtual switch.
(103) S45. The virtual machine determines a priority corresponding to a first data flow to be sent to the switch.
(104) S46. The virtual machine adds the priority to the first data flow to generate a second data flow that includes the priority.
(105) S46 specifically includes the following:
(106) The virtual machine determines, according to the priority list, a priority value of the priority corresponding to the application layer port; and the virtual machine adds the priority value of the priority corresponding to the application layer port to the first data flow.
(107) S47. The virtual machine sends the second data flow to the switch by sequentially using the virtual switch and the network adapter.
(108) S48. The switch places, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority.
(109) For a process shown in
(110) In this embodiment, the host obtains the historical data flow that is corresponding to each application layer port and that is recorded by the host. The host determines the priority of each application layer port according to the historical data flow corresponding to the application layer port, and generates the priority correspondence table. The host receives the priority list sent by the switch, and the host determines, according to the priority correspondence table, the priority value of the priority corresponding to the application layer port and the DSCP values in the priority list. The host adds the priority value of the priority corresponding to the application layer port to the first data flow corresponding to the application layer port, to generate the second data flow that includes the priority. The host sends the second data flow to the switch, so that the switch processes the second data flow according to the priority in the second data flow. The server or the virtual machine analyzes the historical data flow of each application layer port to determine the priority of each application layer port. Therefore, before the server or the virtual machine sends the first data flow from the application layer port to the switch, the server or the virtual machine allocates the priority to the first data flow, so that the switch does not need to collect flow-based statistics about packets to determine whether the first data flow is an elephant flow or a mouse flow, thereby saving hardware resources of the switch. In addition, the switch sends the priority list to the server or the virtual machine. The server or the virtual machine may configure different priority values for data flows from different application layer ports according to the priority list. Then, the server or the virtual machine sends the second data flow configured with the priority value to the switch, and the switch places the second data flow into the data queue corresponding to the priority value according to the priority value in the second data flow. Therefore, after the switch receives the second data flow configured with the priority value, the switch may process, for example, transmit or discard, the data flow in a priority order represented by the priority value in the second data flow, and the switch does not need to determine the priority of the data flow, thereby preventing the elephant flow from occupying bandwidth of the mouse flow, and processing data flows in a timely manner.
(111)
(112) S301. A switch receives a second data flow sent by a host, where the second data flow is generated after the host determines a priority corresponding to a first data flow to be sent to the switch and adds the priority to the first data flow.
(113) S302. The switch processes the second data flow according to the priority of the second data flow.
(114) For a process of this embodiment, refer to the processes in
(115) In this embodiment, the switch receives the second data flow sent by the host, where the second data flow is generated after the host determines the priority corresponding to the first data flow to be sent to the switch and adds the priority to the first data flow. The switch processes the second data flow according to the priority of the second data flow. The host is a server in a non-virtualization scenario, and the host is a virtual machine in a virtualization scenario. Therefore, before the server or the virtual machine sends a data flow to the switch, the server or the virtual machine assigns a priority to the data flow, so that the switch does not need to collect flow-based statistics about packets to determine whether the data flow is an elephant flow or a mouse flow, and hardware resources of the switch can be saved. In addition, because the server or the virtual machine sends the data flow configured with the priority to the switch, the switch may directly process, for example, transmit or discard, the data flow in a priority order represented by the priority in the data flow, and then the switch does not need to determine the priority of the data flow, thereby preventing the elephant flow from occupying bandwidth of the mouse flow.
(116)
(117) S401. A switch sends a priority list to a host, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch.
(118) S401 specifically includes the following: The switch sends an extended LLDP packet to the host, where the extended LLDP packet includes an LLDPDU, the LLDPDU includes an optional TLV, the optional TLV includes an information table, and the information table includes a type identifier of the optional TLV, a name of the optional TLV, and at least two DSCP values supported by the switch, where the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner, that is, the priority list may include the at least two DSCP values.
(119) S402. The switch receives a second data flow sent by the host, where the second data flow is generated after the host determines a priority corresponding to a first data flow to be sent to the switch and adds the priority to the first data flow.
(120) S403. The switch processes the second data flow according to the priority of the second data flow.
(121) S403 specifically includes the following: The switch places, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority.
(122) For a process and a beneficial effect of this embodiment, refer to descriptions in
(123)
(124) The determining module 151 may perform step S101 of the method shown in
(125)
(126) The determining module 151 is specifically configured to: determine an application layer port corresponding to a first data flow; and determine, according to a priority correspondence table, a priority corresponding to the application layer port.
(127) The determining module 151 may perform step S204 of the method shown in
(128) The obtaining module 161 is configured to: before the determining module 151 determines a priority corresponding to a data flow to be sent to a switch, obtain a historical data flow that is corresponding to each application layer port and that is recorded by the host. The obtaining module 161 may perform step S201 of the method shown in
(129) The analysis module 162 is configured to: determine, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generate the priority correspondence table. The analysis module 162 may perform step S202 of the method shown in
(130) The receiving module 163 is configured to: before the obtaining module 161 obtains the historical data flow that is corresponding to each application layer port and that is recorded by the host, receive a priority list sent by the switch, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner and supported by the switch. The receiving module 163 may perform step S203 of the method shown in
(131) Correspondingly, the generation module 152 is specifically configured to: determine, according to the priority list, a priority value of the priority corresponding to the application layer port; and add the priority value of the priority corresponding to the application layer port to the first data flow.
(132) The generation module 152 may perform step S205 of the method shown in
(133) When receiving the priority list sent by the switch, the receiving module 163 is specifically configured to: receive an extended LLDP packet sent by the switch.
(134) The extended LLDP packet includes at least two DSCP values supported by the switch, and the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(135) In an implementation, the analysis module 162 is specifically configured to: determine, for each application layer port, a sum of historical data flows corresponding to the application layer port; sort all application layer ports in descending order according to sizes of the sums of the data flows of all the application layer ports, to obtain an application layer port sequence; and determine that a priority corresponding to the first N application layer ports in the application layer port sequence is a first level, and determine that a priority corresponding to application layer ports in the application layer port sequence other than the first N application layer ports is a second level, where the second level is higher than the first level, and N is a positive integer.
(136) The host in the embodiment shown in
(137)
(138) The switch in the embodiment shown in
(139)
(140) When sending the priority list to the host, the sending module 181 is specifically configured to: send an extended LLDP packet to the host, where the extended LLDP packet includes at least two DSCP values supported by the switch, and the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(141) The processing module 172 is specifically configured to: place, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority. The processing module 172 may perform step S403 of the method shown in
(142) The switch in the embodiment shown in
(143)
(144) The processor 263 is configured to: determine a priority corresponding to a first data flow to be sent to a switch; add the priority to the first data flow to generate a second data flow that includes the priority; and send the second data flow to the switch, so that the switch processes the second data flow according to the priority of the second data flow. In this case, the processor 263 may implement functions of the determining module 151, the generation module 152, and the sending module 153 in the host shown in
(145) Further, the processor 263 is specifically configured to: determine an application layer port corresponding to the first data flow; and determine, according to a priority correspondence table, a priority corresponding to the application layer port. In this case, the processor 263 may implement a function of the determining module 151 in the host shown in
(146) Further, the processor 263 is specifically configured to: before determining the priority corresponding to the first data flow to be sent to the switch, obtain a historical data flow that is corresponding to each application layer port and that is recorded by the host; and determine, based on the historical data flow corresponding to each application layer port, a priority corresponding to the application layer port, and generate the priority correspondence table. In this case, the processor 263 may implement a function of the obtaining module 161 in the host shown in
(147) Further, the processor 263 is specifically configured to: before obtaining the historical data flow that is corresponding to each application layer port and that is recorded by the host, receive a priority list sent by the switch, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner. Correspondingly, the processor 263 is specifically configured to: determine, according to the priority list, a priority value of the priority corresponding to the application layer port; and add the priority value of the priority corresponding to the application layer port to the first data flow. In this case, the processor 263 may implement functions of the receiving module 163 and the generation module 152 in the host shown in
(148) Further, the processor 263 is specifically configured to receive an extended LLDP packet sent by the switch, where the extended LLDP packet includes at least two DSCP values supported by the switch, and the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(149) Further, the processor 263 is specifically configured to: determine, for each application layer port, a sum of historical data flows corresponding to the application layer port; sort all application layer ports in descending order according to sizes of the sums of the data flows of all the application layer ports, to obtain an application layer port sequence; and determine that a priority corresponding to the first N application layer ports in the application layer port sequence is a first level, and determine that a priority corresponding to application layer ports in the application layer port sequence other than the first N application layer ports is a second level, where the second level is higher than the first level, and N is a positive integer. In this case, the processor 263 may implement a function of the analysis module 162 in the host shown in
(150) The host in the embodiment shown in
(151) Alternatively, the processor 263 may be a controller, and is represented as a “controller/processor 263” in
(152) Alternatively, the processor 263, such as a central processing unit (CPU), may be configured as one or more integrated circuits that perform the foregoing methods, for example, one or more application-specific integrated circuits (ASIC), one or more digital signal processors (DSP), one or more field-programmable gate arrays (FPGA), or the like. The memory 264 may be one memory, or may be a general term for a plurality of storage elements.
(153)
(154) The processor 273 is configured to: receive a second data flow sent by a host, where the second data flow is generated after the host determines a priority corresponding to a first data flow to be sent to the switch and adds the priority to the first data flow; and process the second data flow according to the priority of the second data flow. In this case, the processor 273 may implement functions of the receiving module 171 and the processing module 172 in the switch shown in
(155) Further, the processor 273 is specifically configured to send a priority list to the host before receiving the second data flow sent by the host, where the priority list includes priority values respectively corresponding to different priorities in a one-to-one corresponding manner. In this case, the processor 273 may implement a function of the sending module 181 in the switch shown in
(156) Further, the processor 273 is specifically configured to send an extended LLDP packet to the host, where the extended LLDP packet includes at least two DSCP values supported by the switch, and the DSCP values are respectively corresponding to different priorities in a one-to-one corresponding manner.
(157) Further, the processor 273 is specifically configured to place, according to the priority of the second data flow, the second data flow into a data queue corresponding to the priority. In this case, the processor 273 may implement a function of the processing module 172 in the switch shown in
(158) The switch in the embodiment shown in
(159) Alternatively, the processor 273 may be a controller, and is represented as a “controller/processor 273” in
(160) The processor 273, such as a CPU, may be alternatively configured as one or more integrated circuits that implement the foregoing methods. The memory 274 may be one memory, or may be a general term for a plurality of storage elements.
(161) All or some of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When software is used to implement the embodiments, the embodiments may be implemented completely or partially in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedure or functions according to the embodiments of this application are all or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a 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 to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line) or a wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible to a computer, or a data storage device, such as a server or a data center, integrating one or more usable media.