WO2021254474A1 - Network measurement method and apparatus - Google Patents

Network measurement method and apparatus Download PDF

Info

Publication number
WO2021254474A1
WO2021254474A1 PCT/CN2021/100828 CN2021100828W WO2021254474A1 WO 2021254474 A1 WO2021254474 A1 WO 2021254474A1 CN 2021100828 W CN2021100828 W CN 2021100828W WO 2021254474 A1 WO2021254474 A1 WO 2021254474A1
Authority
WO
WIPO (PCT)
Prior art keywords
time window
host
index
switch
stream
Prior art date
Application number
PCT/CN2021/100828
Other languages
French (fr)
Chinese (zh)
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 WO2021254474A1 publication Critical patent/WO2021254474A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing

Definitions

  • This application relates to the field of communication technology, and in particular to a network measurement method and device.
  • a network measurement system is usually used to monitor the data center.
  • the network measurement system needs to have both low resource overhead and complete accuracy.
  • Low resource overhead means that different network entities have different constraints on resources such as central processing unit (CPU), memory, and bandwidth.
  • CPU central processing unit
  • the network measurement system guarantees data packets in the network when these constraints are met. It can be forwarded normally.
  • Network entities include, for example, hosts, switches, etc., where the host has rich resources, but the network has poor visibility, and packet processing is slow; the switch has high throughput and low latency, but has limited resources.
  • Complete accuracy means that the network measurement system can track all the traffic of all network entities, that is, no information will be lost; moreover, the flow key and flow value of each flow tracked are the same as the actual flow key and flow value.
  • the flow The key can uniquely identify a flow, and the flow value is the measurement result of the flow, for example, the size of the flow, the number of packets included in the flow, and so on.
  • low resource overhead and full accuracy are mutually exclusive, that is, full accuracy cannot be satisfied when low resource overhead is achieved, and low resource overhead cannot be satisfied when full accuracy is achieved.
  • a network measurement system can use the following two methods to measure data centers.
  • the first method is to use approximate algorithms, which include Sketch technology, top-k counting and sampling algorithms. Take Sketch technology as an example.
  • Sketch technology is based on a sketch-based measurement technology that maps massive high-latitude data information to a small linear subspace (usually two-dimensional), which is composed of a specific data structure. . That is, by designing a specific mapping method and data structure, the operation of the original high-dimensional space can be better maintained in a smaller linear subspace.
  • the second method is to use event matching.
  • Event matching refers to selecting the flow that the user needs from the original flow according to the network measurement task issued by the user in advance, that is, collecting, processing and transmitting the flow that the user needs, which can reduce the measurement flow. quantity.
  • This application provides a network measurement method and device, which are used to ensure that in the network measurement process, both low resource overhead and complete accuracy can be achieved.
  • this application provides a network measurement method.
  • the method includes a source host acquiring a host index, a first time window, and a switch index corresponding to the stream to be sent, and adding the host index, the switch index, and the first packet to the first message.
  • Time window get the second message, send the second message to the destination host through the switch corresponding to the switch index, and update the flow value corresponding to the host index and the first time window according to the second message, the first message Any message included for the flow.
  • the source host can obtain the flow value and flow key of each flow initiated, and add the first time window to the first message, which can ensure that the same message is in the entire network (from the source host to the switch to the destination).
  • the host is located in the same time window during the forwarding process. Regardless of whether the time window maintained locally by the switch or the destination host is consistent with the first time window, all the first packets of a flow are used in the entire network transmission process.
  • the first time window field in the second message determines the flow value that needs to be updated. In this way, the complete accuracy of the flow can be achieved, and the respective resource advantages of the host and the switch can be fully utilized.
  • the second message carries a host index
  • the host index is relatively small
  • the memory occupied by the second message received by the switch is also relatively small; moreover, the switch does not need to record the flow key, only the flow value needs to be updated, thus Helps achieve low resource overhead.
  • the source host may add the host index, and/or, switch index, and/or, the first time window between the Ethernet header of the first message and the network protocol IP header to obtain The second message.
  • the network layer and the transport layer of the host do not need to verify the content between the Ethernet packet header and the IP packet header, thereby saving the overhead caused by the verification.
  • the stream value recorded corresponding to the host index and the first time window can be added by 1; or, the source host also The size of the second packet may be added to the host index and the flow value recorded corresponding to the first time window.
  • the source host when updating the stream value recorded corresponding to the host index and the first time window, may determine the first record slot group corresponding to the first time window according to the first time window, and the first The recording slot group includes multiple recording slots; the source host determines the first recording slot corresponding to the host index in the first recording slot group according to the host index; the source host adds 1 to the stream value recorded in the first recording slot, or The flow value recorded in the first recording slot plus the size of the second packet.
  • the source host when the source host obtains the host index corresponding to the stream to be sent, it can perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the determined position Index for the host. In this way, it helps to save the storage space of the stream key.
  • the source host may determine the local time window as the first time window.
  • the source host may also receive a third message from the controller, and the third message includes a second time window; if the source host determines that the second time window is greater than the local time window, the local time window Update to the second time window.
  • the source host determines that the local time window enters a new time window, it can update the local time window to the new time window and send the new time window to the controller.
  • the source host and the controller interact with their respective local time windows, which helps to realize the time window synchronization between the source host and the controller in the entire network.
  • the source host may determine the M switch indexes that the controller divides for the source host in advance, the M switch indexes are different from each other, and M is an integer greater than 1; the source host is from the M switch indexes, Select N switch indexes, determine the N switch indexes as the switch indexes of the flow to be sent, and N is an integer greater than 1 and less than or equal to M.
  • the source host Since the source host obtains the switch index corresponding to the flow is pre-allocated by the controller, it helps to eliminate conflicts between the flows of different source hosts on the switch forwarding; moreover, the controller divides the switch index for the source host in advance, and the source host It is not necessary to request the controller to allocate a switch index for the initiated flow every time a flow is initiated, thereby saving the cost of message interaction between the source host and the controller.
  • the present application provides a network measurement method.
  • the method includes a switch receiving a second message from a source host, the second message including a host index, a first time window, and a switch index; the switch corresponds to the switch index; the switch The second message is forwarded to the destination host; the switch updates the flow value recorded corresponding to the switch index and the first time window according to the second message.
  • the switch index and the flow value recorded corresponding to the first time window may be increased by 1; or, the switch may also add 1 to the flow value recorded corresponding to the switch index and the first time window.
  • the switch when the switch updates the flow value recorded corresponding to the switch index and the first time window, it may determine the second record slot group corresponding to the first time window according to the first time window, and the second record The slot group includes a plurality of recording slots; the switch determines the second recording slot corresponding to the switch index in the second recording slot group according to the switch index; the switch adds 1 to the flow value recorded in the second recording slot, or adds the second record The flow value recorded by the slot plus the size of the second message.
  • the present application provides a network measurement method.
  • the method includes a destination host receiving a second message from a source host forwarded by a switch.
  • the second message includes a host index, a first time window, and a switch index.
  • the host index and the stream value recorded corresponding to the first time window may be increased by 1; The index and the flow value recorded corresponding to the first time window plus the size of the second message.
  • the third record slot group corresponding to the first time window may be determined according to the first time window, and the third The record slot group includes multiple record slots; the destination host determines the third record slot corresponding to the host index in the third record slot group according to the host index; the destination host adds 1 to the stream value recorded in the third record slot, or The flow value recorded in the third recording slot plus the size of the second packet.
  • the local time window may be updated to the first time window.
  • the destination host may also receive a third message from the controller, and the third message includes a second time window; if the destination host determines that the second time window is greater than the local time window, the local The time window is updated to the second time window.
  • the destination host determines that the local time window enters a new time window, it can update the local time window to the new time window and send the new time window to the controller.
  • the present application provides a network measurement method.
  • the method includes that at the end of the first time window, the controller obtains the first flow value recorded corresponding to the host index and the first time window from the source host for the flow to be measured, and Obtain the second flow value recorded corresponding to the host index and the first time window from the destination host; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the controller determines the first flow value and the second flow value When they are inconsistent, it is determined that packet loss occurs in the flow.
  • the controller obtains the flow values recorded on the network source host and the destination host once, which helps to reduce the bandwidth pressure of the controller. Moreover, for the flow to be measured, it can be determined whether packet loss occurs according to the first flow value recorded on the source host and the second flow value recorded on the destination host.
  • the controller when the controller obtains the first stream value recorded corresponding to the host index and the first time window from the source host for the stream to be measured, it may first determine the first stream value corresponding to the first time window in the source host. A record slot group; and then determine the first record slot corresponding to the host index in the first record slot group, and then determine the first stream value recorded in the first record slot.
  • the controller when the controller obtains the second stream value recorded corresponding to the host index and the first time window from the destination host, it may first determine the third record slot group corresponding to the first time window in the destination host; The third recording slot corresponding to the host index is determined in the slot group, and then the second stream value recorded in the third recording slot is determined.
  • the controller may also determine the second record slot group in the switch corresponding to the first time window; the switch is used to forward the stream from the source host to the destination host; the controller is in the second record slot Determine the N second recording slots corresponding to the switch index of the switch in the group, and determine the third stream values recorded in the N second recording slots, where N is an integer greater than 1; the controller according to the first stream value, the second stream value The flow value and N third flow values determine the number of lost packets of the flow on the switch.
  • the controller may divide switch indexes that are different from each other for the source host and the destination host.
  • the controller may also broadcast a third message to the source host and the destination host, and the third message includes the second time window.
  • the controller receives a new time window from the source host or the destination host; if the controller determines that the received new time window is larger than the local time window, it can update the local time window to the new time window.
  • the source host, destination host, and controller interact with their respective local time windows, which helps to achieve time window synchronization among entities in the entire network.
  • the present application provides a network measurement device that has the function of realizing the source host in the first aspect mentioned above, or is used to realize the function of the switch in the second aspect mentioned above, or is used to realize the third aspect mentioned above
  • This function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more devices or modules corresponding to the above-mentioned functions.
  • the device may be a source host, a switch, or a destination host.
  • the device may include: a communication interface and a processor.
  • the processor may be configured to support the communication device to perform the corresponding functions of the terminal device shown above, and the communication interface is used to support the communication between the communication device and the network device and other terminal devices.
  • the communication interface can be an independent receiver, an independent transmitter, a communication interface with integrated transceiver functions, or an interface circuit.
  • the communication device may further include a memory, the memory may be coupled with the processor, and the memory may be coupled with the processor, and the memory may store necessary program instructions and data of the communication device.
  • the device may be a source host, and the beneficial effects can be referred to the description of the first aspect above, which will not be repeated here.
  • the processor is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and add the host index, the switch index, and the first time window to the first message to obtain the second message.
  • a message is any message included in the flow;
  • the communication interface is used to send a second message to the destination host through the switch corresponding to the switch index; the processor is also used to update the host index and the first message according to the second message.
  • the time window corresponds to the recorded flow value.
  • the processor is specifically configured to add the host index, and/or, switch index, and/or, the first time window between the Ethernet header of the first message and the network protocol IP header , Get the second message.
  • the processor is specifically configured to add 1 to the host index and the stream value recorded corresponding to the first time window; or, to add the host index and the stream value recorded corresponding to the first time window to the second report.
  • the size of the text is specifically configured to add 1 to the host index and the stream value recorded corresponding to the first time window; or, to add the host index and the stream value recorded corresponding to the first time window to the second report.
  • the processor is specifically configured to determine the first recording slot group corresponding to the first time window according to the first time window, the first recording slot group includes a plurality of recording slots; according to the host index, The first recording slot corresponding to the host index is determined in the first recording slot group; the stream value recorded in the first recording slot is increased by 1, or the stream value recorded in the first recording slot is added to the size of the second packet.
  • the processor is specifically configured to perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the position as the host index.
  • the device may be a switch, and the beneficial effects can be referred to the description of the second aspect above, which will not be repeated here.
  • the communication interface is used to receive a second message from the source host, the second message includes the host index, the first time window and the switch index, and the second message is forwarded to the destination host, and the switch corresponds to the switch index; processing The device is used to update the flow value recorded corresponding to the switch index and the first time window according to the second message.
  • the processor is specifically configured to add 1 to the switch index and the flow value recorded corresponding to the first time window; or, to add the second packet to the switch index and the flow value recorded corresponding to the first time window the size of.
  • the processor is specifically configured to determine a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group includes multiple recording slots; according to the switch index, The second recording slot corresponding to the switch index is determined in the second recording slot group; the flow value recorded in the second recording slot is increased by 1, or the flow value recorded in the second recording slot is added to the size of the second packet.
  • the device may be a destination host, and the beneficial effects can be referred to the description of the third aspect above, which will not be repeated here.
  • the communication interface is used to receive the second message from the source host forwarded by the switch.
  • the second message includes the host index, the first time window, and the switch index; the switch corresponds to the switch index; the processor is used to update and The host index and the first time window correspond to the recorded stream value.
  • the processor is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
  • the processor is specifically configured to determine a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including multiple recording slots; according to the host index, The third recording slot corresponding to the host index is determined in the third recording slot group; the stream value recorded in the third recording slot is increased by 1, or the stream value recorded in the third recording slot is added to the size of the second packet.
  • the device may be a controller, and the beneficial effects can be referred to the description of the fourth aspect above, which will not be repeated here.
  • the processor cooperates with the communication interface to end the first time window, obtain the first stream value corresponding to the host index and the first time window from the source host for the stream to be measured, and obtain the host index and the first stream value from the destination host.
  • a time window corresponds to the recorded second flow value; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the processor is used to determine that when the first flow value and the second flow value are inconsistent, determine that the flow has packet loss .
  • the communication interface is specifically used to obtain from the source host the correspondence between the record slot and the stream value corresponding to the first record slot group corresponding to the first time window; the processor is specifically used to determine the index to the host Corresponding to the first recording slot, and determine the first stream value corresponding to the first recording slot; the communication interface is specifically used to obtain the corresponding relationship between the recording slot and the stream value corresponding to the third recording slot group corresponding to the first time window from the destination host ; The processor is specifically configured to determine the third recording slot corresponding to the host index, and determine the second stream value corresponding to the third recording slot.
  • the communication interface is also used to obtain the correspondence between the recording slot and the flow value corresponding to the second recording slot group corresponding to the first time window from the switch; the processor is also used to determine the correspondence with the switch index And determine the third flow value corresponding to the N second recording slots, and determine the number of lost packets in the switch according to the first flow value, the second flow value and the N third flow value, N is an integer greater than 1.
  • the present application provides a network measurement device that has the function of realizing the source host in the first aspect mentioned above, or is used to realize the function of the switch in the second aspect mentioned above, or is used to realize the third aspect mentioned above
  • This function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules or modules corresponding to the above-mentioned functions.
  • the device may be a source host, a switch, or a destination host.
  • the device may include a processing module and a transceiver module. These modules can perform the corresponding functions of the terminal device in the above method example. For details, refer to the method example The detailed description is not repeated here.
  • the device may be a source host, and the beneficial effects can be referred to the description of the first aspect above, which will not be repeated here.
  • the processing module is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and add the host index, the switch index, and the first time window to the first message to obtain the second message.
  • the message is any message included in the flow;
  • the transceiver module is used to send a second message to the destination host through the switch corresponding to the switch index;
  • the processing module is also used to update the host index and the first time window corresponding to the second message The recorded stream value.
  • the processing module is specifically configured to: add the host index, and/or, switch index, and/or, the first time window to one of the Ethernet header of the first message and the network protocol IP header In time, the second message is obtained.
  • the processing module is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
  • the processing module is specifically configured to determine the first recording slot group corresponding to the first time window according to the first time window, the first recording slot group includes a plurality of recording slots; according to the host index, The first recording slot corresponding to the host index is determined in the first recording slot group; the stream value recorded in the first recording slot is increased by 1, or the stream value recorded in the first recording slot is added to the size of the second packet.
  • the processing module is specifically configured to perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the position as the host index.
  • the device may be a switch, and the beneficial effects can be referred to the description of the second aspect above, which will not be repeated here.
  • the transceiver module is used to receive a second message from the source host, the second message includes the host index, the first time window and the switch index, and forwards the second message to the destination host, the switch corresponds to the switch index; processing The module is used to update the flow value recorded corresponding to the switch index and the first time window according to the second message.
  • the processing module is specifically configured to add 1 to the switch index and the flow value recorded corresponding to the first time window; or, to add the second packet to the switch index and the flow value recorded corresponding to the first time window the size of.
  • the processing module is specifically configured to determine a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group includes multiple recording slots; according to the switch index, The second recording slot corresponding to the switch index is determined in the second recording slot group; the flow value recorded in the second recording slot is increased by 1, or the flow value recorded in the second recording slot is added to the size of the second packet.
  • the device may be a destination host, and the beneficial effects can be referred to the description of the third aspect above, which will not be repeated here.
  • the transceiver module is used to receive a second message from the source host forwarded by the switch, the second message includes a host index, a first time window, and a switch index; the switch corresponds to the switch index; the processing module is used to respond to the second message , Update the stream value recorded corresponding to the host index and the first time window.
  • the processing module is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
  • the processing module is specifically configured to determine a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including multiple recording slots; according to the host index, The third recording slot corresponding to the host index is determined in the third recording slot group; the stream value recorded in the third recording slot is increased by 1, or the stream value recorded in the third recording slot is added to the size of the second packet.
  • the device may be a controller, and the beneficial effects can be referred to the description of the fourth aspect above, which will not be repeated here.
  • the processing module cooperates with the transceiver module to end the first time window, obtain from the source host the first stream value recorded corresponding to the host index and the first time window for the flow to be measured, and obtain the host index from the destination host The second flow value recorded corresponding to the first time window; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the processing module is also used to determine that the first flow value and the second flow value are inconsistent, to determine that the flow occurs Packet loss.
  • the processing module is specifically configured to determine the first recording slot group corresponding to the first time window in the source host; determine the first recording slot corresponding to the host index in the first recording slot group, and Determine the first stream value recorded in the first recording slot; determine the third recording slot group in the destination host corresponding to the first time window; determine the third recording slot corresponding to the host index in the third recording slot group, and determine the first The second stream value recorded in the three recording slots.
  • the processing module is also used to determine a second record slot group corresponding to the first time window in the switch, and the switch is used to forward the stream from the source host to the destination host; in the second record slot group Determine the N second recording slots corresponding to the switch index, and determine the third stream value recorded by the N second recording slots, and determine the stream according to the first stream value, the second stream value, and the N third stream values
  • N is an integer greater than 1.
  • the present application provides a communication system, which includes a source host, a switch, a destination host, and a controller.
  • the source host can be used to execute any method in the first aspect or the first aspect
  • the switch can be used to execute any method in the second aspect or the second aspect
  • the destination host can be used to execute the method described above.
  • the controller can be used to execute any one of the foregoing fourth or fourth aspects.
  • the present application provides a computer-readable storage medium in which a computer program or instruction is stored.
  • the device executes the first aspect or the first aspect described above.
  • the method in any possible implementation of the first aspect, or causes the device to execute the second aspect or any possible implementation of the second aspect, or causes the device to execute the third aspect or any possible implementation of the third aspect
  • the method in the implementation manner, or the apparatus is caused to execute the fourth aspect or the method in any possible implementation manner of the fourth aspect.
  • the present application provides a computer program product, the computer program product includes a computer program or instruction, when the computer program or instruction is executed by a network measurement device, realize the above-mentioned first aspect or any possible realization of the first aspect
  • the method in the method, or the method in any possible implementation manner of the foregoing second aspect or the second aspect, or the method in any possible implementation manner of the foregoing third aspect or the third aspect, or the foregoing fourth aspect Aspect or any possible implementation of the fourth aspect.
  • Figure 1a is a schematic diagram of a strong consistency model provided by this application.
  • Figure 1b is a schematic diagram of a weak consistency model provided by this application.
  • Figure 1c is a schematic diagram of a nearly strong consistency model provided by this application.
  • Figure 2 is a schematic diagram of the architecture of a network measurement system provided by this application.
  • Figure 3a is a schematic diagram of a module deployed in a host provided by this application.
  • FIG. 3b is a schematic diagram of a module deployed in a switch provided by this application.
  • FIG. 4 is a schematic diagram of the method flow of a network measurement method provided by this application.
  • FIG. 5 is a schematic diagram of the structure of a second message provided by this application.
  • FIG. 6 is a schematic flowchart of a method for synchronizing a time window provided by this application.
  • FIG. 7 is a schematic diagram of the method flow of another time window synchronization method provided by this application.
  • FIG. 8 is a schematic structural diagram of a network measurement device provided by this application.
  • FIG. 9 is a schematic structural diagram of a network measurement device provided by this application.
  • Hash table also known as hash table, is a data structure that is directly accessed based on the key value. In other words, access records by mapping the key code value to a location in the table to speed up the search. This mapping function is called a hash function, and the array storing records is called a hash table.
  • Consistency models include strong consistency models, weak consistency models and nearly strong consistency models.
  • the strong consistency model means that the boundaries of the time window (referring to a period of time or time slice) of each entity in the network are aligned, and all entities in the network observe the same message within the same time window.
  • Figure 1a Refer to the schematic diagram of a strong consistency model shown in Figure 1a.
  • the weak consistency model synchronizes the time windows between each entity in a best-effort manner.
  • the time windows between each entity may be staggered, and different entities may observe the same in different time windows.
  • For a message refer to the schematic diagram of a weak consistency model shown in Figure 1b.
  • Nearly strong consistency model means that strong consistency can be guaranteed most of the time, and weak consistency can be guaranteed in extreme time (tens of microseconds). Please refer to the schematic diagram of a nearly strong consistency model shown in Figure 1c. .
  • the quintuple usually refers to a source network protocol (Internet protocol, IP) address, source port, destination IP address, destination port, and transport layer protocol (such as transfer control protocol (TCP)).
  • IP Internet protocol
  • TCP transfer control protocol
  • the five-tuple can distinguish different streams.
  • 192.168.1.1 10000 TCP 121.14.88.76 80 constitutes a five-tuple, which means that a communication device with an IP address of 192.168.1.1 uses port 10000, using TCP protocol, and an IP address of 121.14.88.76, port Connect for 80 communication devices.
  • Fig. 2 is a schematic diagram of the architecture of a network measurement system applicable to this application.
  • the network measurement system may include a host, a switch, and a controller.
  • Fig. 2 takes the network measurement system including three switches 101 and four hosts 102 as an example.
  • the host 102 has abundant memory resources and can flexibly implement various measurement algorithms.
  • the switch 101 can achieve ultra-high throughput (e.g., up to one million megabits per second) and ultra-low processing delay (up to sub-microseconds).
  • the controller can coordinate all entities in the network, such as the host 102 and the switch 101, to obtain a global network view.
  • the controller may be a logical entity or an independent physical device, and may also be integrated in all hosts 102 and switches 101 in the entire network. If the controller is an independent physical device, the controller can be separately connected to the switch 101 and the host 102 in the entire network.
  • network measurement system shown in FIG. 2 is only a schematic diagram, and the network measurement system may also include other devices, such as relay devices, which are not shown in FIG. 2. This application does not limit the number of hosts, switches, and controllers included in the network measurement system.
  • FIG. 3a a schematic diagram of a module deployed in a host provided by this application.
  • a number of slot groups are maintained on the host, and each slot group includes at least one slot.
  • the host includes an exit groove area and an entry groove area.
  • the exit groove area includes a groove group A and a groove group B
  • the entry groove area includes a groove group.
  • One time window corresponds to one record slot group, that is, in this time window, all stream value updates only use the corresponding record slot group. For example, time window 1 corresponds to record slot group A, time window 2 corresponds to record slot group B, time window 3 corresponds to record slot group C, and time window 4 corresponds to record slot group D.
  • the host may include a stream key tracking module, a stream matching module, a stream value update module, and a time window synchronization module.
  • the flow key tracking module is used to perform flow key tracking operations on the flow (active flow) initiated by the host. For example, if the host initiates a new flow, the flow key tracking module can determine the flow key (such as a five-tuple) of the flow. And store the stream key in the hash table.
  • the flow matching module is used to match packets of a flow, that is, packets of the same flow are matched to the flow.
  • the stream value update module may include an exit record slot area and an entry record slot area.
  • the flow value update module is used to record the flow value of the flow sent by the source host.
  • the recording slot group A is used to record the stream value of each stream sent by the source host in the time window 1
  • the recording slot group B is used to record the stream value of each stream sent by the source host in the time window 2.
  • the flow value update module can be used to record the flow value of each flow received by the destination host.
  • the recording slot group C is used to record the flow value of each stream received by the destination host in the time window 3
  • the recording slot group D is used to record the flow value of each stream received by the destination host in the time window 4.
  • the time window synchronization module is used to synchronize the time windows of the host and other entities in the network (for example, other hosts or switches). It should be noted that the host has abundant physical resources, and it is usually guaranteed that one stream corresponds to one recording slot.
  • FIG. 3b a schematic diagram of modules deployed in a switch provided in this application.
  • a number of slot groups are maintained on the switch, and each slot group includes at least one slot.
  • the switch includes a recording slot group a and a recording slot group b as an example.
  • One time window corresponds to one record slot group, for example, time window 1 corresponds to record slot group a, and time window 2 corresponds to record slot group b.
  • the recording slot group a can be divided into the time window 1
  • the recording slot group b can be divided into the time window 2.
  • the recording slot group a and the recording slot group b may belong to the flow value update module on the switch, and the flow value update module is used to record the flow value of each flow forwarded by the switch.
  • the recording slot group a is used to record the flow value of each flow forwarded by the switch in the time window 1
  • the recording slot group b is used to record the flow value of each flow forwarded by the switch in the time window 2. It should be understood that the resources of the switch are limited, and multiple streams on the same host can be mapped to the same recording slot.
  • a time window can correspond to a record slot group on the host and a record slot group on the switch.
  • the first time window can correspond to the record slot group A of the host, and correspondingly, the first time window can correspond to the record slot group a of the switch.
  • stream key tracking and stream value update are tightly coupled, that is, the key-value pairs of the stream (that is, the stream key and the stream value) need to be recorded at the same time.
  • the host-based network measurement system lacks detailed information inside the network, the host usually combines the switch to perform network measurement. However, due to the limited storage space of the switch, it is impossible to record all the flows in the network, resulting in the inability to measure the network. The realization is completely accurate.
  • the first time window may correspond to the first record slot group of the source host (for example, record slot group A in FIG. 3a), and the first time window may correspond to the second record slot group of the switch.
  • the record slot group (for example, record slot group a in FIG. 3b) corresponds to the first time window and the third record slot group of the destination host (for example, record slot group C in FIG. 3a).
  • the first time window corresponds to the source Which record slot group of the host corresponds to, which record slot group of the switch corresponds to, and which record slot group of the destination host corresponds to, may be pre-configured.
  • the following is a schematic flowchart of a network measurement method provided by this application with reference to FIG. 4. This method can be applied to the foregoing network measurement system, the host may be the host shown in FIG. 3a, and the switch may be the switch shown in FIG. 3b. The method includes the following steps:
  • Step 401 The source host may obtain the host index, the first time window, and the switch index corresponding to the stream to be sent.
  • the stream key can be a five-tuple of the stream, and the host index can be used as the identifier of the stream to indicate the stream.
  • each time the source host initiates a new stream (that is, an active stream), it can first obtain the stream key (such as a five-tuple) of the stream, and perform a hash operation on the stream key to obtain
  • the position of the stream key in the hash table can be determined as the host index.
  • the source host can call the hash code method to calculate the position of the stream key in the hash table, and the position of the stream key in the hash table can be used as the host index of the stream.
  • 0, 1, and 2 respectively represent the 3 positions of the hash table.
  • perform a hash operation on stream key 1 (the primary key of stream 1) and the result is 0, that is, position 0 in the hash table can be used as the host index of stream 1; perform a hash operation on stream key 2 (the primary key of stream 2).
  • Greek operation the result is 1, that is, the position 1 in the hash table can be used as the host index of stream 2.
  • the hash operation on the stream key 3 (the primary key of stream 3), the result is 2, which is the position in the hash table 2 can be used as the host index of stream 3.
  • each flow may include multiple packets (for the convenience of the description of the scheme, the first packet is taken as an example below), and the source host may store the flow key of each flow in a hash table.
  • Each subsequent message can directly query the hash table to obtain the host index of the flow.
  • the host index of the subsequent message of stream 1 can be directly queried to the hash table shown in Figure 3a to obtain position 0, and the host index of the subsequent message of stream 2 can be directly queried.
  • the hash table shown in 3a obtains position 1, and the host index of subsequent messages of stream 3 can directly query the hash table shown in FIG. 3a to obtain position 2.
  • the controller since the controller has a view of the entire network (that is, the controller can obtain which switches and which hosts are in the entire network), the corresponding switch index can be pre-divided for each host (including the source host) .
  • the controller may divide different switch indexes for different hosts. For example, P switch indexes can be divided for host 1, and P switch indexes are different from each other; for another example, Q switch indexes can be divided for host 2, and Q switch indexes are also different from each other; moreover, host 1 and host 2 The divided switch indexes are also different from each other.
  • the controller may divide M switch indexes for the source host in advance, and the source host may select N switch indexes from the M switch indexes according to the principle of least recently used, and determine the N switch indexes as the switch indexes of the flow to be initiated.
  • M switch indexes are different from each other, M is an integer greater than 1, and N is an integer greater than 1 and less than or equal to M. It should be understood that the number of switch indexes corresponding to different flows may be the same or different, which is not limited in this application.
  • the source host Since the source host obtains the switch index corresponding to the flow is pre-allocated by the controller, it helps to eliminate conflicts between the flows of different source hosts on the switch forwarding; moreover, the controller divides the switch index for the source host in advance, and the source host It is not necessary to request the controller to allocate a switch index for the initiated flow every time a flow is initiated, thereby saving the cost of message interaction between the source host and the controller.
  • the source host may store the obtained N switch indexes of the flow, so that the source host may obtain the switch index corresponding to the first packet in the flow by querying the switch index stored by the source host, so that Ensure that all the first packets generated in the same flow use the same switch index.
  • the source host may determine the local time window maintained locally as the first time window. For details, please refer to the manners in the following four situations shown exemplarily.
  • the first time window may be identified by a specific numerical value. For example, if the length of each time window is 1s, 00:00-00:01 can be determined as the first time window, which can be represented by 1, and 00:02-00:03 can be determined as the second time window, which can be represented by 2. And so on.
  • the source host may add the host index, the switch index, and the first time window to the first message to obtain the second message.
  • a method of embedding a custom protocol in the first message may be used to notify the switch corresponding to the switch index of the above-mentioned host index, switch index, and first time window.
  • the source host may add the host index, and/or, switch index, and/or, the first time window between the Ethernet header and the IP header of the first packet to obtain the second Message.
  • the network layer and the transport layer of the host do not need to verify the content between the Ethernet packet header and the IP packet header, thereby saving the overhead caused by the verification.
  • the source host can embed the switch index, host index, and local time window together between the Ethernet header and the IP header of the first packet to obtain the second packet; or, the source host can also Embed any two of the switch index, host index and local time window together between the Ethernet header and the IP header of the first message, and embed the remaining one between the message data or the message data and the IP header or the Ethernet header Before, the second packet is obtained; or, the source host can also embed any of the switch index, host index, and local time window between the Ethernet header and the IP header of the first packet, and embed the remaining two in the packet. Between the message data or the message data and the IP header or before the Ethernet header, the second message is obtained, which is not limited in this application.
  • FIG. 5 a schematic diagram of the structure of a second message provided in this application.
  • the second message takes the host index, switch index, and first time window added between the Ethernet header and the IP header as an example.
  • the message header includes the Ethernet header, time window, host index, switch index, Take the order of the IP header as an example. It should be understood that this application does not limit the sequence of time window, switch index, and host index. It can be the sequence of time window, host index, and switch index, or the sequence of switch index, host index, and time window, etc., I will not list them all here.
  • Step 403 The source host sends a second packet to the switch corresponding to the switch index.
  • the switch receives the second message from the source host.
  • the source host can send the second packet to the switch; if the switch index corresponds to multiple switches, the source host can send the second packet to each of the multiple switches.
  • Step 404 The source host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
  • Step 403 can be executed first and then step 404 can be executed; step 404 can also be executed first and then step 403 can be executed; or step 403 and step 404 can be executed synchronously.
  • the source host determines the first recording slot group (ie ingress slot group (ingress slot)) according to the first time window, and then determines the host index from the first recording slot group according to the host index Corresponding to the first recording slot, and update the stream value of the first recording slot. That is to say, in the source host, the first record slot group corresponds to the first time window, and the first record slot group includes multiple record slots. Each record slot can correspond to a stream, and each record slot is used to store what the source host has sent. Corresponding to the number or flow value of packets in the flow. It should be understood that the source host may update the flow value of the first recording slot when the source host sends the second packet to the switch, or it may be updated after the source host sends the second packet to the switch, which is not limited in this application.
  • the stream corresponds to the first recording slot in the first recording slot group
  • the first recording slot is used to record the number of first packets sent in the stream as an example, the first The initial flow value of the recording slot is 0.
  • the source host sends the first second packet converted from the first packet in the flow
  • the flow value of the first recording slot can be updated to 1, and the second packet can be sent.
  • the stream value of the first recording slot is updated to 2, and so on, the source host sends a conversion according to the first message in the stream every time The second message obtained will add 1 to the flow value of the first recording slot.
  • take a stream and the stream corresponds to the first recording slot in the first recording slot group, and the first recording slot is used to record the size of the sent stream as an example, the initial value of the first recording slot
  • the source host sends the first second packet (with a size of A1bit) converted from the first packet in the flow, it can update the flow value of the first recording slot to A1, and send the first packet.
  • the stream value of the first recording slot can be updated to A1+A2, and so on, the source host sends a basis for each
  • the second message obtained by converting the first message in the stream will add the size value recorded in the first recording slot to the size of the newly sent second message.
  • Step 405 The switch obtains the first time window and the switch index from the second message.
  • the switch may obtain the first time window and the switch index from the message header of the second message.
  • Step 406 The switch updates the flow value recorded corresponding to the switch index and the first time window according to the second message.
  • the switch determines the second recording slot according to the first time window and the switch index included in the second message, and updates the flow value of the second recording slot.
  • the switch may determine the second recording slot group according to the first time window, determine the second recording slot from the second recording slot group according to the switch index, and update the stream value of the second recording slot . That is to say, in the switch, the second record slot group corresponds to the first time window, and the second record slot group includes multiple record slots. One stream can correspond to one record slot, and each record slot is used to store the data that the switch has received. Corresponding to the number or flow value of packets in the flow. In this way, after receiving each second packet, the switch can update the flow value in the second recording slot corresponding to the flow to which the second packet belongs.
  • the flow value may be the number of packets included in the flow and/or the total size of the flow (or referred to as the total flow). Further, optionally, the flow value may also include the number of syn packets and/or the number of fin packets.
  • the stream corresponds to the second recording slot in the second recording slot group
  • the second recording slot is used to record the number of second packets sent in the stream as an example
  • the second The initial flow value of the recording slot is 0, and the switch receives the first second packet in the flow, and can update the flow value of the second recording slot to 1, and receives the second second packet in the flow
  • the flow value of the second recording slot can be updated to 2, and so on, each time the switch receives a second packet in the flow, it will increase the flow value of the second recording slot by 1.
  • the stream corresponds to the second recording slot in the second recording slot group
  • the second recording slot is used to record the size of the second packet sent in the stream as an example.
  • the initial flow value of the second recording slot is 0, and the switch receives the first second packet (with a size of A1bit) in the flow, and can update the flow value of the second recording slot to A1, and receive the data in the flow
  • the second second packet size is A2bit
  • the flow value of the second recording slot is updated to A1+A2, and so on.
  • Each time the switch receives a second packet in the flow it will The flow value recorded in the second recording slot is added to the size of the new second message sent.
  • the switch index included in the second message may be N, and the second record slot determined from the second record slot group may also be N, and the number of the second record slot in N needs to be updated.
  • the stream value recorded in each second recording slot may update the flow value of the second recording slot after receiving the second message; it may also update the flow value of the second recording slot after forwarding the second message; this application does not limit this.
  • Step 407 The switch sends the second packet to the destination host.
  • the destination host receives the second message from the switch.
  • step 406 can be performed first and then step 407; step 407 can also be performed first and step 406 can be performed; or step 406 and step 407 can be performed synchronously.
  • Step 408 The destination host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
  • the destination host obtains the first time window and the host index from the second message.
  • the host can obtain the first time window and the host index from the header of the second message.
  • the destination host determines the third recording slot from the third recording slot group according to the first time window and the host index, and updates the stream value of the third recording slot.
  • the destination host can determine the third recording slot group according to the first time window; according to the host index, determine the third recording slot from the third recording slot group, and update the stream of the third recording slot value. That is to say, in the destination host, the third recording slot group corresponds to the first time window, the third recording slot group includes multiple recording slots, one stream corresponds to one recording slot, and each recording slot is used to store the data received by the destination host The number or flow value of packets in the corresponding flow. In this way, after receiving each second packet of a flow, the destination host can update the flow value in the third recording slot corresponding to the flow to which the second packet belongs.
  • the second message includes the host index
  • the destination host can directly use the first time window and host index in the second message to locate the corresponding third recording slot to update the third recording slot. Flow value. In this way, the destination host does not need to obtain the stream key, nor does it need to perform a second hash operation to obtain the host index, thereby saving the computing resources of the destination host.
  • the stream corresponds to the third recording slot in the third recording slot group
  • the third recording slot is used to record the number of second packets sent in the stream as an example
  • the third The initial stream value of the recording slot is 0, and the destination host receives the first second packet in the stream, and can update the stream value of the third recording slot to 1, and receives the second second packet in the stream.
  • the flow value of the third recording slot can be updated to 2, and so on, each time the destination host receives a second message in the flow, the flow value of the third recording slot will be incremented by 1.
  • the stream corresponds to the third recording slot in the third recording slot group
  • the third recording slot is used to record the size of the second packet sent in the stream as an example.
  • the initial stream value of the third recording slot is 0, and the destination host receives the first second packet (size A1bit) in the stream, and can update the stream value of the third recording slot to A1, and receive the stream
  • the second second packet (size A2bit) of the third record slot can be updated to A1+A2, and so on, every time the destination host receives a second packet in the stream, it will Add the flow value of the third recording slot to the size of the new second message sent.
  • the source host can also record the size of the first packet.
  • the switch and the destination host can record the size of the second packet after receiving the second packet. The size after subtracting the size of the host index, the size of the switch index, and the size of the first time window.
  • the source host can obtain the flow value and flow key of each flow initiated, and add the first time window to the first message, which can ensure that the same message is in the entire network (from The forwarding process from the source host to the switch to the destination host) are all in the same time window, regardless of whether the time window maintained locally by the switch or the destination host is consistent with the first time window, all the first packets of a flow are in the entire network
  • the first time window field in the second message is used to determine the stream value that needs to be updated. In this way, the complete accuracy of the flow can be achieved, and the respective resource advantages of the host and the switch can be fully utilized.
  • the second message carries a host index
  • the host index is relatively small
  • the memory occupied by the second message received by the switch is also relatively small; moreover, the switch does not need to record the flow key, only the flow value needs to be updated, thus Helps achieve low resource overhead.
  • the manner of determining the first time window in four situations is exemplarily shown.
  • the following takes the source host and the destination host as an example for description.
  • Case 1 The host determines to enter a new time window.
  • the method includes the following steps:
  • the source host may determine to enter a new time window according to the local clock, and determine the new time window as the local time window (local epoch) of the source host.
  • Step 602 The source host sends the new time window to the controller. Accordingly, the controller receives the new time window from the source host.
  • step 603 the controller determines whether the received new time window is larger than the local time window of the controller; if it is larger, execute step 604; if it is not larger, execute step 607.
  • Step 604 The controller updates the local time window of the controller to the new time window, and broadcasts the fourth message to the hosts (source host and destination host) in the entire network.
  • the fourth message may include the new time window. It should be understood that the fourth message is a synchronization message of the time window.
  • Step 605 The destination host obtains the new time window in the fourth message, and determines whether the new time window is greater than the local time window of the destination host; if yes, execute step 606; if not, execute step 609.
  • the source host can determine that the new time window in the fourth message is synchronized with the local time window, and there is no need to update the local time window of the source host.
  • Step 606 The destination host updates the local time window of the destination host to the new time window.
  • the controller By broadcasting the third message through the controller, the time window synchronization of the entire network can be realized. That is, the controller cooperates with the host to coordinate the algorithm of the time window synchronization of the whole network, and realizes a nearly strong consistency model.
  • Step 607 The controller sends the first message to the source host.
  • the first message includes the local time window of the controller, and is used to notify/instruct the source host to update the local time window of the source host to the local time window of the controller carried in the first message of control.
  • Step 608 The source host updates the local time window of the source host to the local time window of the controller.
  • Step 609 The destination host sends the local time window of the destination host to the controller.
  • the controller receives the local time window from the destination host.
  • step 610 the controller determines whether the received local time window of the destination host is greater than the local time window of the controller; if it is greater, step 611 is executed; if it is not greater, step 612 is executed.
  • Step 611 The controller updates the local time window of the controller to the local time window of the destination host, and broadcasts the fifth message to hosts (source host and destination host) in the entire network.
  • the fifth message may include the local time window of the destination host. It should be understood that the fifth message is also a synchronization message of the time window.
  • the hosts in the entire network can determine whether to update the local time window maintained by the host itself according to the relationship between the local time window of the destination host included in the fifth message and the local time window of the host itself.
  • Step 612 The controller sends a second message to the destination host.
  • the second message includes the local time window of the controller, and is used to notify/instruct the destination host to update the local time window of the destination host to the local time window of the controller carried in the second message of control.
  • the source host, the destination host, and the controller interact with their respective local time windows, which helps to realize the synchronization of the time windows of the entities in the entire network.
  • the destination host obtains the first time window in the second message, and if it is determined that the first time window is greater than the local time window of the destination host, then the local time window of the destination host is updated to the first time window.
  • the controller determines to enter a new time window.
  • Fig. 7 for another time window synchronization method provided by this application.
  • the method includes the following steps:
  • step 701 the controller determines to enter a new time window (which may be referred to as a second time window) according to the local clock, and then updates the local time window of the controller to the second time window.
  • a new time window which may be referred to as a second time window
  • Step 702 The controller broadcasts the third message to hosts in the entire network.
  • the third message includes the second time window. It should be understood that the hosts in the entire network include source hosts and destination hosts.
  • step 703 the host determines whether the second time window in the received third message is greater than the local time window of the host; if it is greater than, step 704 is executed; if it is not greater than, step 705 is executed.
  • Step 704 The host updates the local time window of the host to the second time window.
  • Step 705 The host sends the local time window of the host to the controller.
  • the controller receives the host's local time window.
  • Step 706 The controller updates the local time window of the controller to the local time window of the host, and broadcasts the sixth message to the hosts in the entire network.
  • the sixth message includes the local time window of the controller updated by the controller, that is, the received local time window of the host.
  • Case 4 The host receives the second message and the third message at the same time, or receives the second message and the fourth message at the same time.
  • the host can compare the first time window in the second message, the second time window in the third message, and the host’s local time window. If the host’s local time window is the largest, it does not Update; otherwise, update the local time window of the host to the largest time window.
  • the host can compare the first time window in the second message, the new time window in the fourth message, and the host’s local time window. If the host’s local time window is the largest, it will not Update; otherwise, update the local time window of the host to the largest time window.
  • the controller can obtain the flow value of the flow recorded on the source host, destination host, and switch in the time window, and determine whether the flow has lost packets according to the flow value of each flow . Further, optionally, the source host, the destination host, and the switch may all reclaim the recording slot group allocated for the time window. As follows, taking the first time window as an example, the method for the controller to determine whether packet loss occurs, and how the controller determines the process of packet loss if a packet loss occurs.
  • the controller may obtain the first stream value recorded corresponding to the host index and the first time window from the source host, and obtain the first stream value corresponding to the host index and the first time window from the destination host The recorded second stream value; the corresponding relationship between the recording slot and the stream value corresponding to the first recording slot group corresponding to the first time window can be obtained from the source host; the controller determines the first stream value and the second When the flow values are inconsistent, it is determined that packet loss occurs in the flow.
  • the controller determines a first recording slot group in the source host corresponding to the first time window, and determines in the first recording slot group to correspond to the host index And determine the first stream value recorded in the first recording slot; the controller may determine the third recording slot group in the destination host corresponding to the first time window; The third recording slot corresponding to the host index is determined in the third recording slot group, and the second stream value recorded in the third recording slot is determined.
  • the controller determines a second record slot group in the switch corresponding to the first time window, and determines in the second record slot group the switch index corresponding to the switch N second recording grooves, and determining the third stream value respectively recorded in the N second recording grooves, and determining according to the first stream value, the second stream value, and the N third stream values The number of lost packets of the flow at the switch, where N is an integer greater than 1.
  • the controller may respectively obtain the stream key stored in the hash table of the source host in the first time window, the stream value recorded in the first recording slot group of the source host in the first time window, and the switch
  • the stream value recorded in the second slot group in the first time window and the stream value recorded in the third slot group in the first time window by the destination host can determine the first record in the first slot group
  • the stream value recorded by the slot, the stream value recorded by the second slot in the second slot group, and the stream value recorded by the third slot in the third slot group belong to the stream value of the same stream; it can also be understood as control
  • the device can determine the flow value of the same flow in the source host, the flow value in the switch, and the flow value in the destination host.
  • the controller obtains the flow values recorded on all hosts and switches on the network once, which helps to reduce the bandwidth pressure of the controller.
  • the controller sends request messages to hosts and switches in the entire network to request to obtain stream keys, Information such as the flow value; or, after the first time window ends, the hosts and switches in the entire network report the flow information such as the flow key and the flow value recorded in the first time window to the controller.
  • the source host may report to the controller the correspondence between each recording slot (including the first recording slot) and the stream value corresponding to the first recording slot group corresponding to the first time window relation. Furthermore, it can also report the hash value of the stream key recorded in the hash table in the first time window; the destination host can report to the controller each record slot corresponding to the third record slot group corresponding to the first time window (Including the third recording slot) and the corresponding relationship between the stream value; the switch can also report to the controller the relationship between each recording slot (including the second recording slot) and the stream value corresponding to the second recording slot group corresponding to the first time window Correspondence.
  • the controller can perform operations on the hash value of the stream key to obtain the stream key (such as a five-tuple), and determine the source host and the destination host according to the stream key.
  • the stream key such as a five-tuple
  • the controller can obtain the stream key in the source host according to the hash calculation.
  • the controller can also obtain the stream key directly from the source host. This application is not limited.
  • the controller can use the first stream value on the first recording slot group, the third stream value on the second recording slot group, and the third stream value on the third recording slot group according to the stream.
  • the second-rate value infers the packet loss on the switch.
  • the controller can construct a linear equation set, and determine the packet loss on each switch by solving the linear equation set.
  • the source host and the destination host pass through two switches (switch 1 and switch 2), and the variables of the linear equation group can be used to express on the switch 1.
  • the controller may also determine the current total load capacity of the network according to the total flow of each flow.
  • the source host, the switch, the destination host, and the controller include hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application scenarios and design constraints of the technical solution.
  • FIGS. 8 and 9 are schematic structural diagrams of possible network measurement devices provided by this application. These network measurement devices can be used to implement the functions of the source host or switch or the destination host or controller in the foregoing method embodiment, and therefore can also achieve the beneficial effects of the foregoing method embodiment.
  • the network measurement device may be the switch 101 as shown in FIG. 2 or the host 102 as shown in FIG. 2.
  • the network measurement device 800 includes a processing module 801 and a transceiver module 802.
  • the network measurement device 800 is used to implement the functions of the source host or switch or the destination host or controller in the method embodiment shown in FIG. 4, FIG. 6 or FIG. 7 above.
  • the processing module 801 is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and report it in the first report.
  • the host index, switch index, and first time window are added to the text to obtain the second message, the first message is any message included in the flow;
  • the transceiver module 802 is used to send the second message to the destination host through the switch corresponding to the switch index
  • the processing module 801 is also used to update the stream value recorded corresponding to the host index and the first time window according to the second message.
  • the transceiver module 802 is used to receive a second message from the source host, and the second message includes the host index, the first time window, and Switch index, and forward the second message to the destination host, the switch corresponds to the switch index;
  • the processing module 801 is configured to update the flow value corresponding to the switch index and the first time window according to the second message.
  • the transceiver module 802 is used to receive the second packet from the source host forwarded by the switch, and the second packet includes the host index and the first packet.
  • a time window and switch index; the switch corresponds to the switch index; the processing module 801 is configured to update the flow value recorded corresponding to the host index and the first time window according to the second message.
  • the processing module 801 cooperates with the transceiver module 802, and is used to obtain the host index and the first time window at the end of the first time window from the source host.
  • One time window corresponds to the recorded first flow value, and obtains from the destination host the second flow value recorded corresponding to the host index and the first time window; wherein, the flow is sent from the source host to the destination host, and the host index is determined according to the flow; processing module 801 is also used to determine that when the first flow value and the second flow value are inconsistent, determine that packet loss occurs in the flow.
  • processing module 801 and the transceiver module 802 can be directly obtained by referring to the relevant description in the method embodiment shown in FIG. 4, and will not be repeated here.
  • processing module 801 in the embodiment of the present application may be implemented by a processor or processor-related circuit components, and the transceiver module 802 may be implemented by a communication interface or a communication interface-related circuit component.
  • the present application also provides a network measurement device 900.
  • the network measurement device 900 may include a processor 901 and a communication interface 902.
  • the processor 901 and the communication interface 902 are coupled with each other.
  • the communication interface 902 may be an interface circuit or an input/output interface.
  • the network measurement device 900 may further include a memory 903 for storing instructions executed by the processor 901 or storing input data required by the processor 901 to run the instructions or storing data generated after the processor 901 runs the instructions.
  • the processor 901 is used to execute the function of the above-mentioned processing module 801
  • the communication interface 902 is used to execute the function of the above-mentioned transceiving module 802.
  • the processor in the embodiment of the present application may be a central processing unit (central processing unit, CPU), or other general-purpose processors, digital signal processors (digital signal processors, DSP), and application-specific integrated circuits. (application specific integrated circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the method steps in the embodiments of the present application can be implemented by hardware, and can also be implemented by a processor executing software instructions.
  • Software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (programmable ROM) , PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or well-known in the art Any other form of storage medium.
  • An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium.
  • the storage medium may also be an integral part of the processor.
  • the processor and the storage medium may be located in the ASIC.
  • the ASIC can be located in a network device or a terminal device.
  • the processor and the storage medium may also exist as discrete components in the network device or the terminal device.
  • the computer program product includes one or more computer programs or instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, user equipment, or other programmable devices.
  • Computer programs or instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • a computer program or instruction can be downloaded from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired or wireless means.
  • 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 that integrates one or more available media.
  • the usable medium can be a magnetic medium, such as a floppy disk, a hard disk, and a magnetic tape; it can also be an optical medium, such as a digital video disc (digital video disc, DVD); and it can also be a semiconductor medium, such as a solid state drive (SSD). ).
  • At least one refers to one or more, and “multiple” refers to two or more.
  • the following at least one item (a)” or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a).
  • at least one of a, b, or c can mean: a, b, c, "a and b", “a and c", “b and c", or "a and b and c” ", where a, b, and c can be single or multiple.

Landscapes

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

Abstract

The present application provides a network measurement method and apparatus, used for solving the problem in the prior art that complete accuracy and low resource overhead cannot both be achieved in network measurement. The network measurement method comprises: a source host acquires a host index, a first time window, and a switch index corresponding to a stream to be sent, adds to a first packet the host index, the switch index, and the first time window to obtain a second packet, and sends the second packet to a destination host by means of a switch corresponding to the switch index; and updates, according to the second packet, the stream value recorded corresponding to the host index and the first time window, the first packet being any packet comprised in the stream. The addition of the first time window to the second packet enables entities in the entire network to be based on the same time window when updating the stream value of the stream to which the second packet belongs, such that complete accuracy of network measurement can be achieved, and the source host only needs to update the stream value, thereby achieving low resource overhead.

Description

一种网络测量方法及装置Network measurement method and device
相关申请的交叉引用Cross-references to related applications
本申请要求在2020年06月19日提交中国国家知识产权局、申请号为202010565111.2、申请名称为“一种网络测量方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the State Intellectual Property Office of China, the application number is 202010565111.2, and the application name is "a network measurement method and device" on June 19, 2020. The entire content is incorporated herein by reference. Applying.
技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种网络测量方法及装置。This application relates to the field of communication technology, and in particular to a network measurement method and device.
背景技术Background technique
随着数据中心规模的日益庞大,数据中心的设备越来越多,网络链路速率在不断提高,网络流量也在急剧增加。为了及时了解数据中心的性能、是否有异常或是否有故障,通常采用网络测量系统来监控数据中心。网络测量系统需要兼具低资源开销和完全准确性两大特性。低资源开销是指不同的网络实体在中央处理器(central processing unit,CPU)、内存和带宽等资源上存在不同的限制约束,网络测量系统在满足这些约束的条件下,保证网络中的数据包能正常转发。网络实体包括例如主机、交换机等,其中,主机的资源丰富、但网络视野差、报文处理慢;交换机具有高吞吐、低时延,但资源有限。完全准确性是指网络测量系统能跟踪到所有网络实体的所有流量,即不会丢失信息;而且,跟踪的每个流的流键和流值与实际的流键和流值相同,其中,流键可以唯一的标识一条流,流值是对流的测量结果,例如,流的大小、流包括的报文的数量等。通常,低资源开销和完全准确性是互斥的,即实现低资源开销时无法满足完全准确性,实现完全准确性时无法满足低资源开销。As the scale of the data center becomes larger and larger, there are more and more equipment in the data center, the network link rate is continuously increasing, and the network traffic is also increasing sharply. In order to know the performance of the data center in time, whether there is an abnormality or whether there is a fault, a network measurement system is usually used to monitor the data center. The network measurement system needs to have both low resource overhead and complete accuracy. Low resource overhead means that different network entities have different constraints on resources such as central processing unit (CPU), memory, and bandwidth. The network measurement system guarantees data packets in the network when these constraints are met. It can be forwarded normally. Network entities include, for example, hosts, switches, etc., where the host has rich resources, but the network has poor visibility, and packet processing is slow; the switch has high throughput and low latency, but has limited resources. Complete accuracy means that the network measurement system can track all the traffic of all network entities, that is, no information will be lost; moreover, the flow key and flow value of each flow tracked are the same as the actual flow key and flow value. Among them, the flow The key can uniquely identify a flow, and the flow value is the measurement result of the flow, for example, the size of the flow, the number of packets included in the flow, and so on. Generally, low resource overhead and full accuracy are mutually exclusive, that is, full accuracy cannot be satisfied when low resource overhead is achieved, and low resource overhead cannot be satisfied when full accuracy is achieved.
现有技术中,网络测量系统为了平衡资源开销和完全准确性,可采用如下两种方式对数据中心进行测量。方式一是采用近似算法,近似算法包括Sketch技术、top-k计数和采样算法等。以Sketch技术为例说明,Sketch技术是基于概要(sketch based)测量技术将海量高纬数据的信息映射到较小的线性子空间(通常是二维),该线性子空间由特定的数据结构组成。即通过设计特定的映射方法与数据结构,使得原来高维空间的运算在较小的线性子空间得到较好的保持。方式二是采用事件匹配,事件匹配是指根据用户预先下发的网络测量任务,从原始流中选择用户需要的流,即针对用户需要的流进行收集、处理和传输,可减小测量流的数量。In the prior art, in order to balance resource overhead and complete accuracy, a network measurement system can use the following two methods to measure data centers. The first method is to use approximate algorithms, which include Sketch technology, top-k counting and sampling algorithms. Take Sketch technology as an example. Sketch technology is based on a sketch-based measurement technology that maps massive high-latitude data information to a small linear subspace (usually two-dimensional), which is composed of a specific data structure. . That is, by designing a specific mapping method and data structure, the operation of the original high-dimensional space can be better maintained in a smaller linear subspace. The second method is to use event matching. Event matching refers to selecting the flow that the user needs from the original flow according to the network measurement task issued by the user in advance, that is, collecting, processing and transmitting the flow that the user needs, which can reduce the measurement flow. quantity.
然而,方式一因为采用的是近似算法,仍然无法保证完全准确性,而且,概要测量技术的参数设置较为复杂。方式二只关注网络中的部分流量,具有较低的资源开销,但是可能会丢失流的重要信息,特别是用于网络异常检测时,流的完全准确性尤为重要。However, because method one uses an approximate algorithm, it still cannot guarantee complete accuracy, and the parameter setting of the summary measurement technique is more complicated. The second method only focuses on part of the traffic in the network, which has low resource overhead, but may lose important information about the flow, especially when used for network anomaly detection, the complete accuracy of the flow is particularly important.
发明内容Summary of the invention
本申请提供一种网络测量方法及装置,用于保证在网络测量过程中,既可以实现低资源开销,又可实现完全准确性。This application provides a network measurement method and device, which are used to ensure that in the network measurement process, both low resource overhead and complete accuracy can be achieved.
第一方面,本申请提供一种网络测量方法,该方法包括源主机获取待发送流对应的主机索引、第一时间窗口和交换机索引,在第一报文中增加主机索引、交换机索引和第一时间窗口,得到第二报文,通过交换机索引对应的交换机向目的主机发送第二报文,并根据第二报文,更新与主机索引和第一时间窗口对应记录的流值,第一报文为流包括的任意报文。In the first aspect, this application provides a network measurement method. The method includes a source host acquiring a host index, a first time window, and a switch index corresponding to the stream to be sent, and adding the host index, the switch index, and the first packet to the first message. Time window, get the second message, send the second message to the destination host through the switch corresponding to the switch index, and update the flow value corresponding to the host index and the first time window according to the second message, the first message Any message included for the flow.
基于该方案,源主机可以获取发起的每个流的流值和流键,并在第一报文中增加第一时间窗口,可以保证同一报文在全网(从源主机到交换机再到目的主机)的转发过程中都位于同一个时间窗口,不管交换机或目的主机本地维护的时间窗口是否与该第一时间窗口一致,一个流全部第一报文的在全网的传递过程中,都使用第二报文中的第一时间窗口字段确定需要更新的流值。如此,可以实现流的完全准确性,而且可以充分利用主机和交换机的各自的资源优势。进一步,第二报文中携带有主机索引,主机索引比较小,且交换机接收到的第二报文占用的内存也比较小;而且,交换机中不需要记录流键,只需要更新流值,从而有助于实现低资源开销。Based on this scheme, the source host can obtain the flow value and flow key of each flow initiated, and add the first time window to the first message, which can ensure that the same message is in the entire network (from the source host to the switch to the destination). The host) is located in the same time window during the forwarding process. Regardless of whether the time window maintained locally by the switch or the destination host is consistent with the first time window, all the first packets of a flow are used in the entire network transmission process. The first time window field in the second message determines the flow value that needs to be updated. In this way, the complete accuracy of the flow can be achieved, and the respective resource advantages of the host and the switch can be fully utilized. Furthermore, the second message carries a host index, the host index is relatively small, and the memory occupied by the second message received by the switch is also relatively small; moreover, the switch does not need to record the flow key, only the flow value needs to be updated, thus Helps achieve low resource overhead.
在一种可能的实现方式中,源主机可以将主机索引、和/或、交换机索引、和/或、第一时间窗口增加于第一报文的以太网包头与网络协议IP包头之间,得到第二报文。如此,主机的网络层和传输层不需要对以太网包头与IP包头之间的内容进行校验,从而可节省校验造成的开销。In a possible implementation manner, the source host may add the host index, and/or, switch index, and/or, the first time window between the Ethernet header of the first message and the network protocol IP header to obtain The second message. In this way, the network layer and the transport layer of the host do not need to verify the content between the Ethernet packet header and the IP packet header, thereby saving the overhead caused by the verification.
在一种可能的实现方式中,源主机更新与主机索引和第一时间窗口对应记录的流值时,可以通过将主机索引和第一时间窗口对应记录的流值加1;或者,源主机也可以将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, when the source host updates the stream value recorded corresponding to the host index and the first time window, the stream value recorded corresponding to the host index and the first time window can be added by 1; or, the source host also The size of the second packet may be added to the host index and the flow value recorded corresponding to the first time window.
在一种可能的实现方式中,更新与主机索引和第一时间窗口对应记录的流值时,源主机可以根据第一时间窗口,确定与第一时间窗口对应的第一记录槽组,第一记录槽组包括多个记录槽;源主机根据主机索引,在第一记录槽组中确定与主机索引对应的第一记录槽;源主机将第一记录槽记录的流值加1,或者,将第一记录槽记录的流值加第二报文的大小。In a possible implementation, when updating the stream value recorded corresponding to the host index and the first time window, the source host may determine the first record slot group corresponding to the first time window according to the first time window, and the first The recording slot group includes multiple recording slots; the source host determines the first recording slot corresponding to the host index in the first recording slot group according to the host index; the source host adds 1 to the stream value recorded in the first recording slot, or The flow value recorded in the first recording slot plus the size of the second packet.
在一种可能的实现方式中,源主机获取待发送流对应的主机索引时,可以对流的流键进行哈希运算,根据运算结果确定流键在哈希表中的位置,将确定的位置确定为主机索引。如此,有助于节省流键存储的空间。In a possible implementation, when the source host obtains the host index corresponding to the stream to be sent, it can perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the determined position Index for the host. In this way, it helps to save the storage space of the stream key.
在一种可能的实现方式中,源主机可以将本地时间窗口确定为第一时间窗口。In a possible implementation manner, the source host may determine the local time window as the first time window.
在一种可能的实现方式中,源主机还可以接收来自控制器的第三报文,第三报文包括第二时间窗口;若源主机确定第二时间窗口大于本地时间窗口,将本地时间窗口更新为第二时间窗口。In a possible implementation manner, the source host may also receive a third message from the controller, and the third message includes a second time window; if the source host determines that the second time window is greater than the local time window, the local time window Update to the second time window.
在一种可能的实现方式中,若源主机确定本地时间窗口进入新的时间窗口,可以将本地时间窗口更新为新的时间窗口,并向控制器发送新的时间窗口。In a possible implementation manner, if the source host determines that the local time window enters a new time window, it can update the local time window to the new time window and send the new time window to the controller.
通过源主机和控制器交互各自的本地的时间窗口,有助于实现全网中的源主机和控制器之间的时间窗口同步。The source host and the controller interact with their respective local time windows, which helps to realize the time window synchronization between the source host and the controller in the entire network.
在一种可能的实现方式中,源主机可以确定控制器预先为源主机划分的M个交换机索引,M个交换机索引互不相同,M为大于1的整数;源主机从M个交换机索引中,选择N个交换机索引,将N个交换机索引确定为待发送的流的交换机索引,N为大于1且小于或等于M的整数。In a possible implementation manner, the source host may determine the M switch indexes that the controller divides for the source host in advance, the M switch indexes are different from each other, and M is an integer greater than 1; the source host is from the M switch indexes, Select N switch indexes, determine the N switch indexes as the switch indexes of the flow to be sent, and N is an integer greater than 1 and less than or equal to M.
由于源主机获取该流对应的交换机索引是控制器预先分配的,因此,有助于消除不同 源主机的流在交换机转发上发生冲突;而且,控制器预先为源主机划分好交换机索引,源主机不需要每发起一个流都向控制器请求为该发起的流分配交换机索引,从而可节省源主机与控制器之间消息交互的开销。Since the source host obtains the switch index corresponding to the flow is pre-allocated by the controller, it helps to eliminate conflicts between the flows of different source hosts on the switch forwarding; moreover, the controller divides the switch index for the source host in advance, and the source host It is not necessary to request the controller to allocate a switch index for the initiated flow every time a flow is initiated, thereby saving the cost of message interaction between the source host and the controller.
第二方面,本申请提供一种网络测量方法,该方法包括交换机接收来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引;交换机与交换机索引对应;交换机向目的主机转发第二报文;交换机根据第二报文,更新与交换机索引和第一时间窗口对应记录的流值。In a second aspect, the present application provides a network measurement method. The method includes a switch receiving a second message from a source host, the second message including a host index, a first time window, and a switch index; the switch corresponds to the switch index; the switch The second message is forwarded to the destination host; the switch updates the flow value recorded corresponding to the switch index and the first time window according to the second message.
在一种可能的实现方式中,交换机更新与交换机索引和第一时间窗口对应记录的流值时,可以将交换机索引和第一时间窗口对应记录的流值加1;或者,交换机也可以将交换机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, when the switch updates the flow value recorded corresponding to the switch index and the first time window, the switch index and the flow value recorded corresponding to the first time window may be increased by 1; or, the switch may also add 1 to the flow value recorded corresponding to the switch index and the first time window. The index and the flow value recorded corresponding to the first time window plus the size of the second message.
在一种可能的实现方式中,交换机更新与交换机索引和第一时间窗口对应记录的流值时,可以根据第一时间窗口,确定与第一时间窗口对应的第二记录槽组,第二记录槽组包括多个记录槽;交换机根据交换机索引,在第二记录槽组中确定与交换机索引对应的第二记录槽;交换机将第二记录槽记录的流值加1,或者,将第二记录槽记录的流值加第二报文的大小。In a possible implementation manner, when the switch updates the flow value recorded corresponding to the switch index and the first time window, it may determine the second record slot group corresponding to the first time window according to the first time window, and the second record The slot group includes a plurality of recording slots; the switch determines the second recording slot corresponding to the switch index in the second recording slot group according to the switch index; the switch adds 1 to the flow value recorded in the second recording slot, or adds the second record The flow value recorded by the slot plus the size of the second message.
第三方面,本申请提供一种网络测量方法,该方法包括目的主机接收交换机转发的来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引,交换机与交换机索引对应;目的主机根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。In a third aspect, the present application provides a network measurement method. The method includes a destination host receiving a second message from a source host forwarded by a switch. The second message includes a host index, a first time window, and a switch index. The switch and the switch Index correspondence; the destination host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
在一种可能的实现方式中,目的主机更新与主机索引和第一时间窗口对应记录的流值时,可以将主机索引和第一时间窗口对应记录的流值加1;或者,目的主机将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, when the destination host updates the stream value recorded corresponding to the host index and the first time window, the host index and the stream value recorded corresponding to the first time window may be increased by 1; The index and the flow value recorded corresponding to the first time window plus the size of the second message.
在一种可能的实现方式中,目的主机更新与主机索引和第一时间窗口对应记录的流值时,可以根据第一时间窗口,确定与第一时间窗口对应的第三记录槽组,第三记录槽组包括多个记录槽;目的主机根据主机索引,在第三记录槽组中确定与主机索引对应的第三记录槽;目的主机将第三记录槽记录的流值加1,或者,将第三记录槽记录的流值加第二报文的大小。In a possible implementation manner, when the destination host updates the stream value recorded corresponding to the host index and the first time window, the third record slot group corresponding to the first time window may be determined according to the first time window, and the third The record slot group includes multiple record slots; the destination host determines the third record slot corresponding to the host index in the third record slot group according to the host index; the destination host adds 1 to the stream value recorded in the third record slot, or The flow value recorded in the third recording slot plus the size of the second packet.
在一种可能的实现方式中,若目的主机确定第一时间窗口大于本地时间窗口,可以将本地时间窗口更新为第一时间窗口。In a possible implementation manner, if the destination host determines that the first time window is greater than the local time window, the local time window may be updated to the first time window.
在一种可能的实现方式中,目的主机还可以接收来自所控制器的第三报文,第三报文包括第二时间窗口;若目的主机确定第二时间窗口大于本地时间窗口,可以将本地时间窗口更新为第二时间窗口。In a possible implementation manner, the destination host may also receive a third message from the controller, and the third message includes a second time window; if the destination host determines that the second time window is greater than the local time window, the local The time window is updated to the second time window.
在一种可能的实现方式中,若目的主机确定本地时间窗口进入新的时间窗口,可以将本地时间窗口更新为新的时间窗口,并向控制器发送新的时间窗口。In a possible implementation manner, if the destination host determines that the local time window enters a new time window, it can update the local time window to the new time window and send the new time window to the controller.
通过目的主机和控制器交互各自的本地的时间窗口,有助于实现全网中的目的主机和控制器之间的时间窗口同步。Through the destination host and the controller interacting with their respective local time windows, it is helpful to realize the time window synchronization between the destination host and the controller in the entire network.
第四方面,本申请提供一种网络测量方法,该方法包括在第一时间窗口结束,控制器针对要测量的流从源主机获取与主机索引和第一时间窗口对应记录的第一流值,以及从目的主机获取与主机索引和第一时间窗口对应记录的第二流值;其中,流由源主机发送到目的主机,主机索引是根据流确定的;控制器确定第一流值和第二流值不一致时,确定流发生丢包。In a fourth aspect, the present application provides a network measurement method. The method includes that at the end of the first time window, the controller obtains the first flow value recorded corresponding to the host index and the first time window from the source host for the flow to be measured, and Obtain the second flow value recorded corresponding to the host index and the first time window from the destination host; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the controller determines the first flow value and the second flow value When they are inconsistent, it is determined that packet loss occurs in the flow.
基于该方案,通过控制器在第一时间窗口结束后,获取一次网络源主机和目的主机上记录的流值,有助于缓减控制器的带宽压力。而且,针对要测量的流,可以根据源主机上记录的第一流值和目的主机上记录的第二流值,确定是否发生丢包。Based on this solution, after the first time window ends, the controller obtains the flow values recorded on the network source host and the destination host once, which helps to reduce the bandwidth pressure of the controller. Moreover, for the flow to be measured, it can be determined whether packet loss occurs according to the first flow value recorded on the source host and the second flow value recorded on the destination host.
在一种可能的实现方式中,控制器针对要测量的流从源主机获取与主机索引和第一时间窗口对应记录的第一流值时,可以先确定源主机中与第一时间窗口对应的第一记录槽组;再在第一记录槽组中确定与主机索引对应的第一记录槽,然后确定第一记录槽中记录的第一流值。相应的,控制器从目的主机获取与主机索引和第一时间窗口对应记录的第二流值时,可以先确定目的主机中与第一时间窗口对应的第三记录槽组;再在第三记录槽组中确定与主机索引对应的第三记录槽,然后确定第三记录槽中记录的第二流值。In a possible implementation manner, when the controller obtains the first stream value recorded corresponding to the host index and the first time window from the source host for the stream to be measured, it may first determine the first stream value corresponding to the first time window in the source host. A record slot group; and then determine the first record slot corresponding to the host index in the first record slot group, and then determine the first stream value recorded in the first record slot. Correspondingly, when the controller obtains the second stream value recorded corresponding to the host index and the first time window from the destination host, it may first determine the third record slot group corresponding to the first time window in the destination host; The third recording slot corresponding to the host index is determined in the slot group, and then the second stream value recorded in the third recording slot is determined.
在一种可能的实现方式中,控制器还可以确定交换机中与第一时间窗口对应的第二记录槽组;交换机用于将来自源主机的流转发至目的主机;控制器在第二记录槽组中确定与交换机的交换机索引对应的N个第二记录槽,并确定N个第二记录槽中分别记录的第三流值,N为大于1的整数;控制器根据第一流值、第二流值和N个第三流值,确定流在交换机的丢包数量。In a possible implementation, the controller may also determine the second record slot group in the switch corresponding to the first time window; the switch is used to forward the stream from the source host to the destination host; the controller is in the second record slot Determine the N second recording slots corresponding to the switch index of the switch in the group, and determine the third stream values recorded in the N second recording slots, where N is an integer greater than 1; the controller according to the first stream value, the second stream value The flow value and N third flow values determine the number of lost packets of the flow on the switch.
在一种可能的实现方式中,控制器可以为源主机和目的主机分别划分互不相同的交换机索引。In a possible implementation manner, the controller may divide switch indexes that are different from each other for the source host and the destination host.
在一种可能的实现方式中,控制器还可以向源主机和目的主机广播第三报文,第三报文包括第二时间窗口。In a possible implementation manner, the controller may also broadcast a third message to the source host and the destination host, and the third message includes the second time window.
在一种可能的实现方式中,控制器接收来自源主机或目的主机的新的时间窗口;若控制器确定接收到的新的时间窗口大于本地时间窗口,可以将本地时间窗口更新为新的时间窗口。In a possible implementation, the controller receives a new time window from the source host or the destination host; if the controller determines that the received new time window is larger than the local time window, it can update the local time window to the new time window.
通过源主机、目的主机和控制器交互各自的本地的时间窗口,有助于实现全网中的实体之间的时间窗口同步。The source host, destination host, and controller interact with their respective local time windows, which helps to achieve time window synchronization among entities in the entire network.
第五方面,本申请提供一种网络测量装置,该装置具有实现上述第一方面中的源主机的功能,或者用于实现上述第二方面中的交换机的功能,或者用于实现上述第三方面中的目的主机的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的器或模块。In a fifth aspect, the present application provides a network measurement device that has the function of realizing the source host in the first aspect mentioned above, or is used to realize the function of the switch in the second aspect mentioned above, or is used to realize the third aspect mentioned above The function of the destination host in the. This function can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more devices or modules corresponding to the above-mentioned functions.
在一种可能的实现方式中,该装置可以为源主机、交换机或目的主机。该装置可以包括:通信接口和处理器。该处理器可被配置为支持该通信装置执行以上所示终端设备的相应功能,该通信接口用于支持该通信装置与网络设备和其它终端设备等之间的通信。其中,通信接口可以为独立的接收器、独立的发射器、集成收发功能的通信接口、或者是接口电路。可选地,该通信装置还可以包括存储器,该存储器可以与处理器耦合,其保存该通信装置必要的程序指令和数据。In a possible implementation manner, the device may be a source host, a switch, or a destination host. The device may include: a communication interface and a processor. The processor may be configured to support the communication device to perform the corresponding functions of the terminal device shown above, and the communication interface is used to support the communication between the communication device and the network device and other terminal devices. Wherein, the communication interface can be an independent receiver, an independent transmitter, a communication interface with integrated transceiver functions, or an interface circuit. Optionally, the communication device may further include a memory, the memory may be coupled with the processor, and the memory may be coupled with the processor, and the memory may store necessary program instructions and data of the communication device.
在一种可能的实现方式中,该装置可以是源主机,有益效果可参见上述第一方面的描述,此处不再赘述。其中,处理器,用于获取待发送流对应的主机索引、第一时间窗口和交换机索引,并在第一报文中增加主机索引、交换机索引和第一时间窗口,得到第二报文,第一报文为流包括的任意报文;通信接口,用于通过交换机索引对应的交换机向目的主机发送第二报文;处理器,还用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。In a possible implementation manner, the device may be a source host, and the beneficial effects can be referred to the description of the first aspect above, which will not be repeated here. Among them, the processor is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and add the host index, the switch index, and the first time window to the first message to obtain the second message. A message is any message included in the flow; the communication interface is used to send a second message to the destination host through the switch corresponding to the switch index; the processor is also used to update the host index and the first message according to the second message. The time window corresponds to the recorded flow value.
在一种可能的实现方式中,处理器具体用于将主机索引、和/或、交换机索引、和/或、 第一时间窗口增加于第一报文的以太网包头与网络协议IP包头之间,得到第二报文。In a possible implementation manner, the processor is specifically configured to add the host index, and/or, switch index, and/or, the first time window between the Ethernet header of the first message and the network protocol IP header , Get the second message.
在一种可能的实现方式中,处理器,具体用于将主机索引和第一时间窗口对应记录的流值加1;或者,将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation, the processor is specifically configured to add 1 to the host index and the stream value recorded corresponding to the first time window; or, to add the host index and the stream value recorded corresponding to the first time window to the second report. The size of the text.
在一种可能的实现方式中,处理器具体用于根据第一时间窗口,确定与第一时间窗口对应的第一记录槽组,第一记录槽组包括多个记录槽;根据主机索引,在第一记录槽组中确定与主机索引对应的第一记录槽;将第一记录槽记录的流值加1,或者,将第一记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processor is specifically configured to determine the first recording slot group corresponding to the first time window according to the first time window, the first recording slot group includes a plurality of recording slots; according to the host index, The first recording slot corresponding to the host index is determined in the first recording slot group; the stream value recorded in the first recording slot is increased by 1, or the stream value recorded in the first recording slot is added to the size of the second packet.
在一种可能的实现方式中,处理器具体用于对流的流键进行哈希运算,根据运算结果确定流键在哈希表中的位置,将位置确定为主机索引。In a possible implementation manner, the processor is specifically configured to perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the position as the host index.
在另一种可能的实现方式中,该装置可以是交换机,有益效果可参见上述第二方面的描述,此处不再赘述。其中,通信接口,用于接收来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引,并向目的主机转发第二报文,交换机与交换机索引对应;处理器,用于根据第二报文,更新与交换机索引和第一时间窗口对应记录的流值。In another possible implementation manner, the device may be a switch, and the beneficial effects can be referred to the description of the second aspect above, which will not be repeated here. Wherein, the communication interface is used to receive a second message from the source host, the second message includes the host index, the first time window and the switch index, and the second message is forwarded to the destination host, and the switch corresponds to the switch index; processing The device is used to update the flow value recorded corresponding to the switch index and the first time window according to the second message.
在一种可能的实现方式中,处理器具体用于将交换机索引和第一时间窗口对应记录的流值加1;或者,将交换机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, the processor is specifically configured to add 1 to the switch index and the flow value recorded corresponding to the first time window; or, to add the second packet to the switch index and the flow value recorded corresponding to the first time window the size of.
在一种可能的实现方式中,处理器具体用于根据第一时间窗口,确定与第一时间窗口对应的第二记录槽组,第二记录槽组包括多个记录槽;根据交换机索引,在第二记录槽组中确定与交换机索引对应的第二记录槽;将第二记录槽记录的流值加1,或者,将第二记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processor is specifically configured to determine a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group includes multiple recording slots; according to the switch index, The second recording slot corresponding to the switch index is determined in the second recording slot group; the flow value recorded in the second recording slot is increased by 1, or the flow value recorded in the second recording slot is added to the size of the second packet.
在另一种可能的实现方式中,该装置可以是目的主机,有益效果可参见上述第三方面的描述,此处不再赘述。通信接口用于接收交换机转发的来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引;交换机与交换机索引对应;处理器用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。In another possible implementation manner, the device may be a destination host, and the beneficial effects can be referred to the description of the third aspect above, which will not be repeated here. The communication interface is used to receive the second message from the source host forwarded by the switch. The second message includes the host index, the first time window, and the switch index; the switch corresponds to the switch index; the processor is used to update and The host index and the first time window correspond to the recorded stream value.
在一种可能的实现方式中,处理器具体用于将主机索引和第一时间窗口对应记录的流值加1;或者,将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, the processor is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
在一种可能的实现方式中,处理器具体用于根据第一时间窗口,确定与第一时间窗口对应的第三记录槽组,第三记录槽组包括多个记录槽;根据主机索引,在第三记录槽组中确定与主机索引对应的第三记录槽;将第三记录槽记录的流值加1,或者,将第三记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processor is specifically configured to determine a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including multiple recording slots; according to the host index, The third recording slot corresponding to the host index is determined in the third recording slot group; the stream value recorded in the third recording slot is increased by 1, or the stream value recorded in the third recording slot is added to the size of the second packet.
在另一种可能的实现方式中,该装置可以是控制器,有益效果可参见上述第四方面的描述,此处不再赘述。处理器与通信接口协作,用于在第一时间窗口结束,针对要测量的流从源主机获取与主机索引和第一时间窗口对应记录的第一流值,以及从目的主机获取与主机索引和第一时间窗口对应记录的第二流值;其中,流由源主机发送到目的主机,主机索引根据流确定;处理器,用于确定第一流值和第二流值不一致时,确定流发生丢包。In another possible implementation manner, the device may be a controller, and the beneficial effects can be referred to the description of the fourth aspect above, which will not be repeated here. The processor cooperates with the communication interface to end the first time window, obtain the first stream value corresponding to the host index and the first time window from the source host for the stream to be measured, and obtain the host index and the first stream value from the destination host. A time window corresponds to the recorded second flow value; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the processor is used to determine that when the first flow value and the second flow value are inconsistent, determine that the flow has packet loss .
在一种可能的实现方式中,通信接口具体用于从源主机获取与第一时间窗口对应的第一记录槽组对应的记录槽与流值的对应关系;处理器具体用于确定与主机索引对应的第一记录槽,并确定第一记录槽对应的第一流值;通信接口具体用于从目的主机获取与第一时间窗口对应的第三记录槽组对应的记录槽与流值的对应关系;处理器具体用于确定与主机索引对应的第三记录槽,并确定第三记录槽对应的第二流值。In a possible implementation manner, the communication interface is specifically used to obtain from the source host the correspondence between the record slot and the stream value corresponding to the first record slot group corresponding to the first time window; the processor is specifically used to determine the index to the host Corresponding to the first recording slot, and determine the first stream value corresponding to the first recording slot; the communication interface is specifically used to obtain the corresponding relationship between the recording slot and the stream value corresponding to the third recording slot group corresponding to the first time window from the destination host ; The processor is specifically configured to determine the third recording slot corresponding to the host index, and determine the second stream value corresponding to the third recording slot.
在一种可能的实现方式中,通信接口还用于从交换机获取与第一时间窗口对应的第二 记录槽组对应的记录槽与流值的对应关系;处理器还用于确定与交换机索引对应的N个第二记录槽,并确定N个第二记录槽对应的第三流值,并根据第一流值、第二流值和N个第三流值,确定流在交换机的丢包数量,N为大于1的整数。In a possible implementation, the communication interface is also used to obtain the correspondence between the recording slot and the flow value corresponding to the second recording slot group corresponding to the first time window from the switch; the processor is also used to determine the correspondence with the switch index And determine the third flow value corresponding to the N second recording slots, and determine the number of lost packets in the switch according to the first flow value, the second flow value and the N third flow value, N is an integer greater than 1.
第六方面,本申请提供一种网络测量装置,该装置具有实现上述第一方面中的源主机的功能,或者用于实现上述第二方面中的交换机的功能,或者用于实现上述第三方面中的目的主机的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块或模块。In a sixth aspect, the present application provides a network measurement device that has the function of realizing the source host in the first aspect mentioned above, or is used to realize the function of the switch in the second aspect mentioned above, or is used to realize the third aspect mentioned above The function of the destination host in the. This function can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or modules corresponding to the above-mentioned functions.
在一种可能的实施方式中,该装置可为源主机、交换机或目的主机,该装置可以括处理模块和收发模块,这些模块可以执行上述方法示例中终端设备的相应功能,具体参见方法示例中的详细描述,此处不做赘述。In a possible implementation, the device may be a source host, a switch, or a destination host. The device may include a processing module and a transceiver module. These modules can perform the corresponding functions of the terminal device in the above method example. For details, refer to the method example The detailed description is not repeated here.
在一种可能的实现方式中,该装置可以是源主机,有益效果可参见上述第一方面的描述,此处不再赘述。其中,处理模块用于获取待发送流对应的主机索引、第一时间窗口和交换机索引,并在第一报文中增加主机索引、交换机索引和第一时间窗口,得到第二报文,第一报文为流包括的任意报文;收发模块用于通过交换机索引对应的交换机向目的主机发送第二报文;处理模块还用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。In a possible implementation manner, the device may be a source host, and the beneficial effects can be referred to the description of the first aspect above, which will not be repeated here. The processing module is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and add the host index, the switch index, and the first time window to the first message to obtain the second message. The message is any message included in the flow; the transceiver module is used to send a second message to the destination host through the switch corresponding to the switch index; the processing module is also used to update the host index and the first time window corresponding to the second message The recorded stream value.
在一种可能的实现方式中,处理模块具体用于:将主机索引、和/或、交换机索引、和/或、第一时间窗口增加于第一报文的以太网包头与网络协议IP包头之间,得到第二报文。In a possible implementation manner, the processing module is specifically configured to: add the host index, and/or, switch index, and/or, the first time window to one of the Ethernet header of the first message and the network protocol IP header In time, the second message is obtained.
在一种可能的实现方式中,处理模块具体用于将主机索引和第一时间窗口对应记录的流值加1;或者,将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation, the processing module is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
在一种可能的实现方式中,处理模块具体用于根据第一时间窗口,确定与第一时间窗口对应的第一记录槽组,第一记录槽组包括多个记录槽;根据主机索引,在第一记录槽组中确定与主机索引对应的第一记录槽;将第一记录槽记录的流值加1,或者,将第一记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processing module is specifically configured to determine the first recording slot group corresponding to the first time window according to the first time window, the first recording slot group includes a plurality of recording slots; according to the host index, The first recording slot corresponding to the host index is determined in the first recording slot group; the stream value recorded in the first recording slot is increased by 1, or the stream value recorded in the first recording slot is added to the size of the second packet.
在一种可能的实现方式中,处理模块具体用于对流的流键进行哈希运算,根据运算结果确定流键在哈希表中的位置,将位置确定为主机索引。In a possible implementation manner, the processing module is specifically configured to perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the position as the host index.
在另一种可能的实现方式中,该装置可以是交换机,有益效果可参见上述第二方面的描述,此处不再赘述。其中,收发模块,用于接收来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引,并向目的主机转发第二报文,交换机与交换机索引对应;处理模块,用于根据第二报文,更新与交换机索引和第一时间窗口对应记录的流值。In another possible implementation manner, the device may be a switch, and the beneficial effects can be referred to the description of the second aspect above, which will not be repeated here. Among them, the transceiver module is used to receive a second message from the source host, the second message includes the host index, the first time window and the switch index, and forwards the second message to the destination host, the switch corresponds to the switch index; processing The module is used to update the flow value recorded corresponding to the switch index and the first time window according to the second message.
在一种可能的实现方式中,处理模块具体用于将交换机索引和第一时间窗口对应记录的流值加1;或者,将交换机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation manner, the processing module is specifically configured to add 1 to the switch index and the flow value recorded corresponding to the first time window; or, to add the second packet to the switch index and the flow value recorded corresponding to the first time window the size of.
在一种可能的实现方式中,处理模块具体用于根据第一时间窗口,确定与第一时间窗口对应的第二记录槽组,第二记录槽组包括多个记录槽;根据交换机索引,在第二记录槽组中确定与交换机索引对应的第二记录槽;将第二记录槽记录的流值加1,或者,将第二记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processing module is specifically configured to determine a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group includes multiple recording slots; according to the switch index, The second recording slot corresponding to the switch index is determined in the second recording slot group; the flow value recorded in the second recording slot is increased by 1, or the flow value recorded in the second recording slot is added to the size of the second packet.
在另一种可能的实现方式中,该装置可以是目的主机,有益效果可参见上述第三方面的描述,此处不再赘述。其中,收发模块用于接收交换机转发的来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引;交换机与交换机索引对应;处理模 块用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。In another possible implementation manner, the device may be a destination host, and the beneficial effects can be referred to the description of the third aspect above, which will not be repeated here. Wherein, the transceiver module is used to receive a second message from the source host forwarded by the switch, the second message includes a host index, a first time window, and a switch index; the switch corresponds to the switch index; the processing module is used to respond to the second message , Update the stream value recorded corresponding to the host index and the first time window.
在一种可能的实现方式中,处理模块具体用于将主机索引和第一时间窗口对应记录的流值加1;或者,将主机索引和第一时间窗口对应记录的流值加第二报文的大小。In a possible implementation, the processing module is specifically configured to add 1 to the host index and the flow value recorded corresponding to the first time window; or, to add the second packet to the host index and the flow value recorded corresponding to the first time window the size of.
在一种可能的实现方式中,处理模块具体用于根据第一时间窗口,确定与第一时间窗口对应的第三记录槽组,第三记录槽组包括多个记录槽;根据主机索引,在第三记录槽组中确定与主机索引对应的第三记录槽;将第三记录槽记录的流值加1,或者,将第三记录槽记录的流值加第二报文的大小。In a possible implementation manner, the processing module is specifically configured to determine a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including multiple recording slots; according to the host index, The third recording slot corresponding to the host index is determined in the third recording slot group; the stream value recorded in the third recording slot is increased by 1, or the stream value recorded in the third recording slot is added to the size of the second packet.
在另一种可能的实现方式中,该装置可以是控制器,有益效果可参见上述第四方面的描述,此处不再赘述。其中,处理模块与收发模块协作,用于在第一时间窗口结束,针对要测量的流从源主机获取与主机索引和第一时间窗口对应记录的第一流值,以及从目的主机获取与主机索引和第一时间窗口对应记录的第二流值;其中,流由源主机发送到目的主机,主机索引根据流确定;处理模块还用于确定第一流值和第二流值不一致时,确定流发生丢包。In another possible implementation manner, the device may be a controller, and the beneficial effects can be referred to the description of the fourth aspect above, which will not be repeated here. Among them, the processing module cooperates with the transceiver module to end the first time window, obtain from the source host the first stream value recorded corresponding to the host index and the first time window for the flow to be measured, and obtain the host index from the destination host The second flow value recorded corresponding to the first time window; where the flow is sent from the source host to the destination host, and the host index is determined according to the flow; the processing module is also used to determine that the first flow value and the second flow value are inconsistent, to determine that the flow occurs Packet loss.
在一种可能的实现方式中,处理模块具体用于确定源主机中与第一时间窗口对应的第一记录槽组;在第一记录槽组中确定与主机索引对应的第一记录槽,并确定第一记录槽中记录的第一流值;确定目的主机中与第一时间窗口对应的第三记录槽组;在第三记录槽组中确定与主机索引对应的第三记录槽,并确定第三记录槽中记录的第二流值。In a possible implementation, the processing module is specifically configured to determine the first recording slot group corresponding to the first time window in the source host; determine the first recording slot corresponding to the host index in the first recording slot group, and Determine the first stream value recorded in the first recording slot; determine the third recording slot group in the destination host corresponding to the first time window; determine the third recording slot corresponding to the host index in the third recording slot group, and determine the first The second stream value recorded in the three recording slots.
在一种可能的实现方式中,处理模块还用于确定交换机中与第一时间窗口对应的第二记录槽组,交换机用于将来自源主机的流转发至目的主机;在第二记录槽组中确定与交换机索引对应的N个第二记录槽,并确定N个第二记录槽分别记录的第三流值,并根据第一流值、第二流值和N个第三流值,确定流在交换机的丢包数量,N为大于1的整数。In a possible implementation, the processing module is also used to determine a second record slot group corresponding to the first time window in the switch, and the switch is used to forward the stream from the source host to the destination host; in the second record slot group Determine the N second recording slots corresponding to the switch index, and determine the third stream value recorded by the N second recording slots, and determine the stream according to the first stream value, the second stream value, and the N third stream values The number of lost packets on the switch, N is an integer greater than 1.
第七方面,本申请提供一种通信系统,该通信系统包括源主机、交换机、目的主机和控制器。其中,源主机可以用于执行上述第一方面或第一方面中的任意一种方法,交换机可以用于执行上述第二方面或第二方面中的任意一种方法,目的主机可以用于执行上述第三方面或第三方面中的任意一种方法,控制器可以用于执行上述第四方面或第四方面中的任意一种方法。In a seventh aspect, the present application provides a communication system, which includes a source host, a switch, a destination host, and a controller. Wherein, the source host can be used to execute any method in the first aspect or the first aspect, the switch can be used to execute any method in the second aspect or the second aspect, and the destination host can be used to execute the method described above. In the third aspect or any one of the third aspects, the controller can be used to execute any one of the foregoing fourth or fourth aspects.
第八方面,本申请提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序或指令,当计算机程序或指令被网络测量装置执行时,使得该装置执行上述第一方面或第一方面的任意可能的实现方式中的方法、或者使得该装置执行第二方面或第二方面的任意可能的实现方式中的方法、或者使得该装置执行第三方面或第三方面的任意可能的实现方式中的方法、或者使得该装置执行第四方面或第四方面的任意可能的实现方式中的方法。In an eighth aspect, the present application provides a computer-readable storage medium in which a computer program or instruction is stored. When the computer program or instruction is executed by a network measurement device, the device executes the first aspect or the first aspect described above. The method in any possible implementation of the first aspect, or causes the device to execute the second aspect or any possible implementation of the second aspect, or causes the device to execute the third aspect or any possible implementation of the third aspect The method in the implementation manner, or the apparatus is caused to execute the fourth aspect or the method in any possible implementation manner of the fourth aspect.
第九方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机程序或指令,当该计算机程序或指令被网络测量装置执行时,实现上述第一方面或第一方面的任意可能的实现方式中的方法、或者实现上述第二方面或第二方面的任意可能的实现方式中的方法、或者实现上述第三方面或第三方面的任意可能的实现方式中的方法、或者实现上述第四方面或第四方面的任意可能的实现方式中的方法。In a ninth aspect, the present application provides a computer program product, the computer program product includes a computer program or instruction, when the computer program or instruction is executed by a network measurement device, realize the above-mentioned first aspect or any possible realization of the first aspect The method in the method, or the method in any possible implementation manner of the foregoing second aspect or the second aspect, or the method in any possible implementation manner of the foregoing third aspect or the third aspect, or the foregoing fourth aspect Aspect or any possible implementation of the fourth aspect.
附图说明Description of the drawings
图1a为本申请提供的一种强一致性模型的示意图;Figure 1a is a schematic diagram of a strong consistency model provided by this application;
图1b为本申请提供的一种弱一致性模型的示意图;Figure 1b is a schematic diagram of a weak consistency model provided by this application;
图1c为本申请提供的一种近乎强一致性模型的示意图;Figure 1c is a schematic diagram of a nearly strong consistency model provided by this application;
图2为本申请提供的一种网络测量系统的架构示意图;Figure 2 is a schematic diagram of the architecture of a network measurement system provided by this application;
图3a为本申请提供的一种主机内部署的模块示意图;Figure 3a is a schematic diagram of a module deployed in a host provided by this application;
图3b为本申请提供的一种交换机内部署的模块示意图;Figure 3b is a schematic diagram of a module deployed in a switch provided by this application;
图4为本申请提供的一种网络测量方法的方法流程示意图;FIG. 4 is a schematic diagram of the method flow of a network measurement method provided by this application;
图5为本申请提供的一种第二报文的结构示意图;FIG. 5 is a schematic diagram of the structure of a second message provided by this application;
图6为本申请提供的一种时间窗口的同步方法的方法流程示意图;FIG. 6 is a schematic flowchart of a method for synchronizing a time window provided by this application;
图7为本申请提供的另一种时间窗口的同步方法的方法流程示意图;FIG. 7 is a schematic diagram of the method flow of another time window synchronization method provided by this application;
图8为本申请提供的一种网络测量装置的结构示意图;FIG. 8 is a schematic structural diagram of a network measurement device provided by this application;
图9为本申请提供的一种网络测量装置的结构示意图。FIG. 9 is a schematic structural diagram of a network measurement device provided by this application.
具体实施方式detailed description
下面将结合附图,对本申请实施例进行详细描述。The embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
以下,对本申请中的部分用语进行解释说明。需要说明的是,这些解释是为了便于本领域技术人员理解,并不是对本申请所要求的保护范围构成限定。Hereinafter, some terms in this application will be explained. It should be noted that these explanations are for ease of understanding by those skilled in the art, and do not limit the scope of protection required by this application.
1)哈希表1) Hash table
哈希表(Hash table)也称为散列表,是根据关键码值(Key value)直接进行访问的数据结构。也就是说,通过把关键码值映射到表中的一个位置来访问记录,以加快查找的速度。这种映射函数叫做散列函数,存放记录的数组叫做散列表。Hash table, also known as hash table, is a data structure that is directly accessed based on the key value. In other words, access records by mapping the key code value to a location in the table to speed up the search. This mapping function is called a hash function, and the array storing records is called a hash table.
例如,给定表M,存在函数f(key),对任意给定的关键字值key,代入函数后若能得到包含该关键字的记录在表中的地址,则称表M为哈希表,函数f为哈希(Hash)函数。For example, given a table M, there is a function f(key), for any given key value key, if the address of the record in the table containing the key can be obtained after substituting the function into the function, then the table M is called a hash table , The function f is a hash (Hash) function.
2)一致性模型2) Consistency model
一致性模型包括强一致性模型、弱一致性模型和近乎强一致性模型。Consistency models include strong consistency models, weak consistency models and nearly strong consistency models.
强一致性模型是指网络中的各个实体的时间窗口(是指一段时间,或者时间片)的边界是对齐的,并且,网络中的所有实体观测同一个报文是在同一个时间窗口内。参阅图1a所示的一种强一致性模型的示意图。The strong consistency model means that the boundaries of the time window (referring to a period of time or time slice) of each entity in the network are aligned, and all entities in the network observe the same message within the same time window. Refer to the schematic diagram of a strong consistency model shown in Figure 1a.
弱一致性模型会以尽力而为(best-effort)的方式同步每个实体之间的时间窗口,各个实体之间的时间窗口可能会交错,并且不同实体可能会在不同的时间窗口观测到同一个报文,可参阅图1b所示的一种弱一致性模型的示意图。The weak consistency model synchronizes the time windows between each entity in a best-effort manner. The time windows between each entity may be staggered, and different entities may observe the same in different time windows. For a message, refer to the schematic diagram of a weak consistency model shown in Figure 1b.
近乎强一致性模型是指在绝大部分时间都能保证强一致性,在极端的时间内(几十微妙)保证弱一致性,可参阅图1c所示的一种近乎强一致性模型的示意图。Nearly strong consistency model means that strong consistency can be guaranteed most of the time, and weak consistency can be guaranteed in extreme time (tens of microseconds). Please refer to the schematic diagram of a nearly strong consistency model shown in Figure 1c. .
3)五元组3) Five-tuple
五元组通常是指源网络协议(internet protocol,IP)地址、源端口、目的IP地址、目的端口和传输层协议(如传输控制协议(transfer control protocol,TCP))。五元组可以区分不同的流。例如,192.168.1.1 10000 TCP 121.14.88.76 80就构成了一个五元组,表示的是:一个IP地址为192.168.1.1的通信装置通过端口10000,利用TCP协议,和IP地址为121.14.88.76,端口为80的通信装置进行连接。The quintuple usually refers to a source network protocol (Internet protocol, IP) address, source port, destination IP address, destination port, and transport layer protocol (such as transfer control protocol (TCP)). The five-tuple can distinguish different streams. For example, 192.168.1.1 10000 TCP 121.14.88.76 80 constitutes a five-tuple, which means that a communication device with an IP address of 192.168.1.1 uses port 10000, using TCP protocol, and an IP address of 121.14.88.76, port Connect for 80 communication devices.
图2是本申请的可应用的一种网络测量系统的架构示意图。如图2所示,该网络测量系统可包括主机、交换机和控制器。图2以网络测量系统包括三个交换机101和四个主机 102为例。其中,主机102具有丰富的内存资源、可以灵活实现各类测量算法。交换机101可以实现超高的吞吐量(如可达百万兆比特每秒)和超低处理时延(可达亚微秒)。控制器可以协调网络中的所有实体,如主机102和交换机101,可获得全局的网络视野。应理解,控制器可以是一个逻辑实体,也可以是独立的物理设备,还可以集成在全网的全部主机102和交换机101中。若控制器是独立的物理设备,则控制器可与全网中的交换机101和主机102分别连接。Fig. 2 is a schematic diagram of the architecture of a network measurement system applicable to this application. As shown in Figure 2, the network measurement system may include a host, a switch, and a controller. Fig. 2 takes the network measurement system including three switches 101 and four hosts 102 as an example. Among them, the host 102 has abundant memory resources and can flexibly implement various measurement algorithms. The switch 101 can achieve ultra-high throughput (e.g., up to one million megabits per second) and ultra-low processing delay (up to sub-microseconds). The controller can coordinate all entities in the network, such as the host 102 and the switch 101, to obtain a global network view. It should be understood that the controller may be a logical entity or an independent physical device, and may also be integrated in all hosts 102 and switches 101 in the entire network. If the controller is an independent physical device, the controller can be separately connected to the switch 101 and the host 102 in the entire network.
需要说明的是,图2所示的网络测量系统仅是示意图,该网络测量系统中还可以包括其它设备,如还可以包括中继设备,在图2中未画出。本申请对该网络测量系统中包括的主机、交换机和控制器的数量不做限定。It should be noted that the network measurement system shown in FIG. 2 is only a schematic diagram, and the network measurement system may also include other devices, such as relay devices, which are not shown in FIG. 2. This application does not limit the number of hosts, switches, and controllers included in the network measurement system.
如图3a所示,为本申请提供的一种主机内部署的模块示意图。该主机上维护有若干个记录槽(slots)组,每个记录槽组包括至少一个记录槽。在一种可能的实现方式中,主机上包括出口记录槽区域和入口记录槽区域,图3a以出口记录槽区域中包括记录槽组A和记录槽组B,入口记录槽区域中包括记录槽组C和记录槽组D。一个时间窗口对应一个记录槽组,即在该时间窗口内,所有的流值更新只使用对应的这一个记录槽组。例如,时间窗口1对应记录槽组A,时间窗口2对应记录槽组B,时间窗口3对应记录槽组C,时间窗口4对应记录槽组D。进一步,可选地,主机上可包括流键跟踪模块、流匹配模块、流值更新模块和时间窗口同步模块。其中,流键跟踪模块用于对主机发起的流(活跃流)进行流键跟踪操作,例如,主机发起一条新的流,流键跟踪模块可确定该流的流键(如五元组),并将该流键存储在哈希表中。流匹配模块用于对流的报文进行匹配,即将同一流的报文均匹配到该流。流值更新模块可包括出口记录槽区域和入口记录槽区域。当该主机作为源主机时,流值更新模块用于记录该源主机发送的流的流值。示例性地,记录槽组A用于记录时间窗口1内源主机发送的每条流的流值,记录槽组B用于记录时间窗口2内源主机发送的每条流的流值。当该主机作为目的主机时,流值更新模块可用于记录目的主机接收到的每条流的流值。示例性地,记录槽组C用于记录时间窗口3内目的主机接收到的每条流的流值,记录槽组D用于记录时间窗口4内目的主机接收到的每条流的流值。时间窗口同步模块用于同步该主机与网络中其它实体(例如其它主机或交换机)的时间窗口。需要说明的是,主机具有丰富的物理资源,通常可保证一条流对应一个记录槽。As shown in Figure 3a, a schematic diagram of a module deployed in a host provided by this application. A number of slot groups are maintained on the host, and each slot group includes at least one slot. In a possible implementation, the host includes an exit groove area and an entry groove area. In Figure 3a, the exit groove area includes a groove group A and a groove group B, and the entry groove area includes a groove group. C and record slot group D. One time window corresponds to one record slot group, that is, in this time window, all stream value updates only use the corresponding record slot group. For example, time window 1 corresponds to record slot group A, time window 2 corresponds to record slot group B, time window 3 corresponds to record slot group C, and time window 4 corresponds to record slot group D. Further, optionally, the host may include a stream key tracking module, a stream matching module, a stream value update module, and a time window synchronization module. Among them, the flow key tracking module is used to perform flow key tracking operations on the flow (active flow) initiated by the host. For example, if the host initiates a new flow, the flow key tracking module can determine the flow key (such as a five-tuple) of the flow. And store the stream key in the hash table. The flow matching module is used to match packets of a flow, that is, packets of the same flow are matched to the flow. The stream value update module may include an exit record slot area and an entry record slot area. When the host is the source host, the flow value update module is used to record the flow value of the flow sent by the source host. Exemplarily, the recording slot group A is used to record the stream value of each stream sent by the source host in the time window 1, and the recording slot group B is used to record the stream value of each stream sent by the source host in the time window 2. When the host is the destination host, the flow value update module can be used to record the flow value of each flow received by the destination host. Exemplarily, the recording slot group C is used to record the flow value of each stream received by the destination host in the time window 3, and the recording slot group D is used to record the flow value of each stream received by the destination host in the time window 4. The time window synchronization module is used to synchronize the time windows of the host and other entities in the network (for example, other hosts or switches). It should be noted that the host has abundant physical resources, and it is usually guaranteed that one stream corresponds to one recording slot.
如图3b所示,为本申请提供的一种交换机内部署的模块示意图。该交换机上维护有若干个记录槽(slots)组,每个记录槽组包括至少一个记录槽。图3b中以交换机包括记录槽组a和记录槽组b为例。一个时间窗口对应一个记录槽组,例如,时间窗口1对应记录槽组a,时间窗口2对应记录槽组b。也就是说,可以将记录槽组a划分给时间窗口1,将记录槽组b划分给时间窗口2。记录槽组a和记录槽组b可以属于交换机上的流值更新模块,流值更新模块用于记录交换机转发的每条流的流值。示例性地,记录槽组a用于记录时间窗口1内交换机转发的每条流的流值,记录槽组b用于记录时间窗口2内交换机转发的每条流的流值。应理解,交换机的资源有限,同一主机上的多个流可以映射到同一个记录槽上。As shown in Figure 3b, a schematic diagram of modules deployed in a switch provided in this application. A number of slot groups are maintained on the switch, and each slot group includes at least one slot. In FIG. 3b, the switch includes a recording slot group a and a recording slot group b as an example. One time window corresponds to one record slot group, for example, time window 1 corresponds to record slot group a, and time window 2 corresponds to record slot group b. In other words, the recording slot group a can be divided into the time window 1, and the recording slot group b can be divided into the time window 2. The recording slot group a and the recording slot group b may belong to the flow value update module on the switch, and the flow value update module is used to record the flow value of each flow forwarded by the switch. Exemplarily, the recording slot group a is used to record the flow value of each flow forwarded by the switch in the time window 1, and the recording slot group b is used to record the flow value of each flow forwarded by the switch in the time window 2. It should be understood that the resources of the switch are limited, and multiple streams on the same host can be mapped to the same recording slot.
结合上述图3a和图3b,一个时间窗口可对应主机上的一个记录槽组,并对应交换机上的一个记录槽组。当该主机作为源主机时,第一时间窗口可对应该主机的记录槽组A,相应的,第一时间窗口可对应交换机的记录槽组a。Combining the foregoing Figures 3a and 3b, a time window can correspond to a record slot group on the host and a record slot group on the switch. When the host is the source host, the first time window can correspond to the record slot group A of the host, and correspondingly, the first time window can correspond to the record slot group a of the switch.
现有网络测量中,流键跟踪和流值更新是紧密耦合的,即需要同时记录流的键值对(即 流键和流值)。由于只基于主机的网络测量系统缺乏网络内部的细节信息,因此,一般是主机结合交换机进行网络测量,但是由于交换机的存储空间有限,导致无法记录网络中的全部流,从而造成对网络的测量无法实现完全准确。In the existing network measurement, stream key tracking and stream value update are tightly coupled, that is, the key-value pairs of the stream (that is, the stream key and the stream value) need to be recorded at the same time. Because the host-based network measurement system lacks detailed information inside the network, the host usually combines the switch to perform network measurement. However, due to the limited storage space of the switch, it is impossible to record all the flows in the network, resulting in the inability to measure the network. The realization is completely accurate.
鉴于此,本申请提出了一种网络测量方法。在下文的介绍中,为了便于方案的理解,第一时间窗口可与源主机的第一记录槽组(比如是图3a中的记录槽组A)对应,第一时间窗口可与交换机的第二记录槽组(比如是图3b中的记录槽组a)对应,第一时间窗口可与目的主机的第三记录槽组(比如是图3a中的记录槽组C),第一时间窗口与源主机的哪个记录槽组对应、与交换机的哪个记录槽组对应、与目的主机的哪个记录槽组对应,可以是预先配置好的。In view of this, this application proposes a network measurement method. In the following introduction, in order to facilitate the understanding of the solution, the first time window may correspond to the first record slot group of the source host (for example, record slot group A in FIG. 3a), and the first time window may correspond to the second record slot group of the switch. The record slot group (for example, record slot group a in FIG. 3b) corresponds to the first time window and the third record slot group of the destination host (for example, record slot group C in FIG. 3a). The first time window corresponds to the source Which record slot group of the host corresponds to, which record slot group of the switch corresponds to, and which record slot group of the destination host corresponds to, may be pre-configured.
下面参考图4,为本申请提供的一种网络测量方法的流程示意图。该方法可应用于上述网络测量系统中,主机可以是上述图3a所示的主机,交换机可以是上述图3b所示的交换机。该方法包括以下步骤:The following is a schematic flowchart of a network measurement method provided by this application with reference to FIG. 4. This method can be applied to the foregoing network measurement system, the host may be the host shown in FIG. 3a, and the switch may be the switch shown in FIG. 3b. The method includes the following steps:
步骤401,源主机可获取待发送流对应的主机索引、第一时间窗口和交换机索引。Step 401: The source host may obtain the host index, the first time window, and the switch index corresponding to the stream to be sent.
此处,流键可以是流的五元组,主机索引可作为流的标识表示该流。Here, the stream key can be a five-tuple of the stream, and the host index can be used as the identifier of the stream to indicate the stream.
在一种可能的实现方式中,源主机每发起一个新的流(即活跃流),可以先获取该流的流键(如五元组),并对该流键进行哈希运算,可得到流键在哈希表中的位置,可将该流键在哈希表中的位置确定为主机索引。示例性地,源主机可调用hash code方法,计算该流键在哈希表中的位置,并将流键在哈希表中的位置可作为该流的主机索引。In a possible implementation, each time the source host initiates a new stream (that is, an active stream), it can first obtain the stream key (such as a five-tuple) of the stream, and perform a hash operation on the stream key to obtain The position of the stream key in the hash table can be determined as the host index. Exemplarily, the source host can call the hash code method to calculate the position of the stream key in the hash table, and the position of the stream key in the hash table can be used as the host index of the stream.
结合图3a中所示的哈希表,0、1和2分别表示哈希表的3个位置。示例性地,对流键1(流1的主键)进行哈希运算,得到结果为0,即哈希表中的位置0可作为流1的主机索引;对流键2(流2的主键)进行哈希运算,得到结果为1,即哈希表中的位置1可作为流2的主机索引;对流键3(流3的主键)进行哈希运算,得到结果为2,即哈希表中的位置2可作为流3的主机索引。Combined with the hash table shown in Figure 3a, 0, 1, and 2 respectively represent the 3 positions of the hash table. Exemplarily, perform a hash operation on stream key 1 (the primary key of stream 1), and the result is 0, that is, position 0 in the hash table can be used as the host index of stream 1; perform a hash operation on stream key 2 (the primary key of stream 2). Greek operation, the result is 1, that is, the position 1 in the hash table can be used as the host index of stream 2. The hash operation on the stream key 3 (the primary key of stream 3), the result is 2, which is the position in the hash table 2 can be used as the host index of stream 3.
可选地,每个流可能包括多个报文(为了便于方案的说明,下文以第一报文为例),源主机可以将每个流的流键存储在哈希表中,该流的后续每个报文可以直接查询哈希表,从而获得该流的主机索引。结合上述图3a中所示的哈希表,流1的后续报文的主机索引可直接查询图3a中所示的哈希表获得位置0,流2的后续报文的主机索引可以直接查询图3a中所示的哈希表获得位置1,流3的后续报文的主机索引可以直接查询图3a中所示的哈希表获得位置2。Optionally, each flow may include multiple packets (for the convenience of the description of the scheme, the first packet is taken as an example below), and the source host may store the flow key of each flow in a hash table. Each subsequent message can directly query the hash table to obtain the host index of the flow. In combination with the hash table shown in Figure 3a, the host index of the subsequent message of stream 1 can be directly queried to the hash table shown in Figure 3a to obtain position 0, and the host index of the subsequent message of stream 2 can be directly queried. The hash table shown in 3a obtains position 1, and the host index of subsequent messages of stream 3 can directly query the hash table shown in FIG. 3a to obtain position 2.
在一种可能的实现方式中,由于控制器具有全网视野(即控制器可以获取到全网中有哪些交换机和哪些主机),可以预先为各个主机(包括源主机)划分好对应的交换机索引。可选地,控制器可以为不同的主机划分不同的交换机索引。例如,可以为主机1划分P个交换机索引,P个交换机索引互不相同;再例如,可以为主机2划分Q个交换机索引,Q个交换机索引也互不相同;而且,为主机1和主机2划分的交换机索引也互不相同。In a possible implementation, since the controller has a view of the entire network (that is, the controller can obtain which switches and which hosts are in the entire network), the corresponding switch index can be pre-divided for each host (including the source host) . Optionally, the controller may divide different switch indexes for different hosts. For example, P switch indexes can be divided for host 1, and P switch indexes are different from each other; for another example, Q switch indexes can be divided for host 2, and Q switch indexes are also different from each other; moreover, host 1 and host 2 The divided switch indexes are also different from each other.
进一步,控制器可预先为源主机划分M个交换机索引,源主机可按最近最少使用原则从M个交换机索引中选择N个交换机索引,并将N个交换机索引确定为要发起的流的交换机索引,M个交换机索引互不相同,M为大于1的整数,N为大于1且小于或等于M的整数。应理解,不同的流对应的交换机索引的数量可能相同,也可能不相同,本申请对此不做限定。由于源主机获取该流对应的交换机索引是控制器预先分配的,因此,有助于 消除不同源主机的流在交换机转发上发生冲突;而且,控制器预先为源主机划分好交换机索引,源主机不需要每发起一个流都向控制器请求为该发起的流分配交换机索引,从而可节省源主机与控制器之间消息交互的开销。Further, the controller may divide M switch indexes for the source host in advance, and the source host may select N switch indexes from the M switch indexes according to the principle of least recently used, and determine the N switch indexes as the switch indexes of the flow to be initiated. , M switch indexes are different from each other, M is an integer greater than 1, and N is an integer greater than 1 and less than or equal to M. It should be understood that the number of switch indexes corresponding to different flows may be the same or different, which is not limited in this application. Since the source host obtains the switch index corresponding to the flow is pre-allocated by the controller, it helps to eliminate conflicts between the flows of different source hosts on the switch forwarding; moreover, the controller divides the switch index for the source host in advance, and the source host It is not necessary to request the controller to allocate a switch index for the initiated flow every time a flow is initiated, thereby saving the cost of message interaction between the source host and the controller.
可选地,源主机可以将获取的该流的N个交换机索引进行存储,以使得源主机可以通过查询源主机存储的交换机索引来获得该流中的第一报文对应的交换机索引,从而可保证同一流中产生的所有第一报文使用的交换机索引是相同的。Optionally, the source host may store the obtained N switch indexes of the flow, so that the source host may obtain the switch index corresponding to the first packet in the flow by querying the switch index stored by the source host, so that Ensure that all the first packets generated in the same flow use the same switch index.
在一种可能的实现方式中,源主机可将本地维护的本地时间窗口确定为第一时间窗口,具体可参见下述示例性示出的四种情形下的方式。In a possible implementation manner, the source host may determine the local time window maintained locally as the first time window. For details, please refer to the manners in the following four situations shown exemplarily.
示例性的,第一时间窗口可以用具体的数值标识。例如,每个时间窗口的长度是1s,则可将00:00-00:01确定为第一时间窗口,可用1表示;00:02-00:03确定为第二时间窗口,可用2表示,依次类推。Exemplarily, the first time window may be identified by a specific numerical value. For example, if the length of each time window is 1s, 00:00-00:01 can be determined as the first time window, which can be represented by 1, and 00:02-00:03 can be determined as the second time window, which can be represented by 2. And so on.
步骤402,源主机可在第一报文中增加主机索引、交换机索引和第一时间窗口,得到第二报文。In step 402, the source host may add the host index, the switch index, and the first time window to the first message to obtain the second message.
此处,可以利用在第一报文中嵌入自定义协议的方式,将上述主机索引、交换机索引和第一时间窗口通知给交换机索引对应交换机。Here, a method of embedding a custom protocol in the first message may be used to notify the switch corresponding to the switch index of the above-mentioned host index, switch index, and first time window.
在一种可能的实现方式中,源主机可将主机索引、和/或、交换机索引、和/或、第一时间窗口增加于第一报文的以太网包头与IP包头之间,得到第二报文。如此,主机的网络层和传输层不需要对以太网包头与IP包头之间的内容进行校验,从而可节省校验造成的开销。In a possible implementation manner, the source host may add the host index, and/or, switch index, and/or, the first time window between the Ethernet header and the IP header of the first packet to obtain the second Message. In this way, the network layer and the transport layer of the host do not need to verify the content between the Ethernet packet header and the IP packet header, thereby saving the overhead caused by the verification.
在一种可能的实现方式中,源主机可将交换机索引、主机索引和本地时间窗口一起嵌入第一报文的以太网包头与IP包头之间,得到第二报文;或者,源主机也可将交换机索引、主机索引和本地时间窗口中任两个一起嵌入第一报文的以太网包头与IP包头之间,将剩余的一个嵌入报文数据或报文数据与IP包头之间或以太网包头前,得到第二报文;或者,源主机也可将交换机索引、主机索引和本地时间窗口中的任一个嵌入第一报文的以太网包头与IP包头之间,将剩余的两个嵌入报文数据或报文数据与IP包头之间或以太网包头前,得到第二报文,本申请对此不做限定。In a possible implementation, the source host can embed the switch index, host index, and local time window together between the Ethernet header and the IP header of the first packet to obtain the second packet; or, the source host can also Embed any two of the switch index, host index and local time window together between the Ethernet header and the IP header of the first message, and embed the remaining one between the message data or the message data and the IP header or the Ethernet header Before, the second packet is obtained; or, the source host can also embed any of the switch index, host index, and local time window between the Ethernet header and the IP header of the first packet, and embed the remaining two in the packet. Between the message data or the message data and the IP header or before the Ethernet header, the second message is obtained, which is not limited in this application.
如图5所示,为本申请提供的一种第二报文的结构示意图。该第二报文以将主机索引、交换机索引和第一时间窗口均增加在以太网包头与IP包头之间为例,其中,报文头以以太网包头、时间窗口、主机索引、交换机索引、IP包头的顺序为例说明。应理解,本申请对时间窗口、交换机索引和主机索引的前后顺序不做限定,可以是时间窗口、主机索引、交换机索引的顺序,也可以是交换机索引、主机索引、时间窗口的顺序,等,此处不再一一列举。As shown in FIG. 5, a schematic diagram of the structure of a second message provided in this application. The second message takes the host index, switch index, and first time window added between the Ethernet header and the IP header as an example. The message header includes the Ethernet header, time window, host index, switch index, Take the order of the IP header as an example. It should be understood that this application does not limit the sequence of time window, switch index, and host index. It can be the sequence of time window, host index, and switch index, or the sequence of switch index, host index, and time window, etc., I will not list them all here.
步骤403,源主机向交换机索引对应的交换机发送第二报文。相应地,交换机接收来自源主机的第二报文。Step 403: The source host sends a second packet to the switch corresponding to the switch index. Correspondingly, the switch receives the second message from the source host.
此处,若交换机索引对应一个交换机,源主机可向该交换机发送第二报文;若交换机索引对应多个交换机,源主机可向这多个交换机中的每个交换机发送第二报文。Here, if the switch index corresponds to one switch, the source host can send the second packet to the switch; if the switch index corresponds to multiple switches, the source host can send the second packet to each of the multiple switches.
步骤404,源主机根据第二报文更新与主机索引和第一时间窗口对应记录的流值。Step 404: The source host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
需要说明的是,上述步骤403和步骤404之间没有先后顺序,可以先执行步骤403后执行步骤404;也可以先执行步骤404后执行步骤403;也可以步骤403和步骤404同步执行。It should be noted that there is no sequence between the above step 403 and step 404. Step 403 can be executed first and then step 404 can be executed; step 404 can also be executed first and then step 403 can be executed; or step 403 and step 404 can be executed synchronously.
在一种可能的实现方式中,源主机根据第一时间窗口,确定第一记录槽组(即出口记录槽组(ingress slots)),再根据主机索引,从第一记录槽组中确定主机索引对应的第一记录槽,并更新第一记录槽的流值。也就是说源主机中,第一记录槽组对应第一时间窗口,第一记录槽组中包括多个记录槽,每个记录槽可对应一个流,每个记录槽用于存储源主机已发送对应流中的报文的数量值或流量值。应理解,源主机更新第一记录槽的流值可以是源主机向交换机发送第二报文时更新,也可以是源主机向交换机发送第二报文后更新,本申请对此不做限定。In a possible implementation manner, the source host determines the first recording slot group (ie ingress slot group (ingress slot)) according to the first time window, and then determines the host index from the first recording slot group according to the host index Corresponding to the first recording slot, and update the stream value of the first recording slot. That is to say, in the source host, the first record slot group corresponds to the first time window, and the first record slot group includes multiple record slots. Each record slot can correspond to a stream, and each record slot is used to store what the source host has sent. Corresponding to the number or flow value of packets in the flow. It should be understood that the source host may update the flow value of the first recording slot when the source host sends the second packet to the switch, or it may be updated after the source host sends the second packet to the switch, which is not limited in this application.
一种可能的示例中,以一条流、且该流对应第一记录槽组中的第一记录槽、第一记录槽用于记录发送该流中的第一报文的数量为例,第一记录槽的初始流值为0,源主机发送第一个根据该流中的第一报文转换得到的第二报文时,可以将该第一记录槽的流值更新为1,发送第二个根据该流中的第一报文转换得到的第二报文时,将该第一记录槽的流值更新为2,依次类推,源主机每发送一个根据该流中的第一报文转换得到的第二报文,就会将该第一记录槽的流值加1。In a possible example, take a stream, and the stream corresponds to the first recording slot in the first recording slot group, and the first recording slot is used to record the number of first packets sent in the stream as an example, the first The initial flow value of the recording slot is 0. When the source host sends the first second packet converted from the first packet in the flow, the flow value of the first recording slot can be updated to 1, and the second packet can be sent. When a second message is converted according to the first message in the stream, the stream value of the first recording slot is updated to 2, and so on, the source host sends a conversion according to the first message in the stream every time The second message obtained will add 1 to the flow value of the first recording slot.
另一种可能的示例中,以一条流、且该流对应第一记录槽组中的第一记录槽、第一记录槽用于记录已发送该流的大小为例,第一记录槽的初始流值为0,源主机发送第一个根据该流中的第一报文转换得到的第二报文(大小为A1bit)时,可以将该第一记录槽的流值更新为A1,发送第二个根据该流中的第一报文转换得到的第二报文(大小为A2bit)时,可以将该第一记录槽的流值更新为A1+A2,依次类推,源主机每发送一个根据该流中的第一报文转换得到的第二报文,就会将该第一记录槽中记录的大小值加新发送的第二报文的大小。In another possible example, take a stream, and the stream corresponds to the first recording slot in the first recording slot group, and the first recording slot is used to record the size of the sent stream as an example, the initial value of the first recording slot When the flow value is 0, when the source host sends the first second packet (with a size of A1bit) converted from the first packet in the flow, it can update the flow value of the first recording slot to A1, and send the first packet. When two second packets (with the size of A2bit) converted according to the first packet in the stream, the stream value of the first recording slot can be updated to A1+A2, and so on, the source host sends a basis for each The second message obtained by converting the first message in the stream will add the size value recorded in the first recording slot to the size of the newly sent second message.
步骤405,交换机从第二报文中获取第一时间窗口和交换机索引。Step 405: The switch obtains the first time window and the switch index from the second message.
结合图5所示的示例,交换机可从第二报文的报文头中获取第一时间窗口和交换机索引。With reference to the example shown in FIG. 5, the switch may obtain the first time window and the switch index from the message header of the second message.
步骤406,交换机根据第二报文,更新与交换机索引和第一时间窗口对应记录的流值。Step 406: The switch updates the flow value recorded corresponding to the switch index and the first time window according to the second message.
在一种可能的实现方式中,交换机根据第二报文中包括的第一时间窗口和交换机索引,确定第二记录槽,并更新第二记录槽的流值。In a possible implementation manner, the switch determines the second recording slot according to the first time window and the switch index included in the second message, and updates the flow value of the second recording slot.
在一种可能的实现方式中,交换机可以根据第一时间窗口,确定第二记录槽组,根据交换机索引,从第二记录槽组中确定第二记录槽,并更新第二记录槽的流值。也就是说,交换机中,第二记录槽组对应第一时间窗口,第二记录槽组中包括多个记录槽,一个流可对应一个记录槽,每个记录槽用于存储交换机已接收到的对应流中的报文的数量值或流量值。这样,交换机接收到每个第二报文后,就可以更新该第二报文所属流对应的第二记录槽中的流值。In a possible implementation manner, the switch may determine the second recording slot group according to the first time window, determine the second recording slot from the second recording slot group according to the switch index, and update the stream value of the second recording slot . That is to say, in the switch, the second record slot group corresponds to the first time window, and the second record slot group includes multiple record slots. One stream can correspond to one record slot, and each record slot is used to store the data that the switch has received. Corresponding to the number or flow value of packets in the flow. In this way, after receiving each second packet, the switch can update the flow value in the second recording slot corresponding to the flow to which the second packet belongs.
在一种可能的实现方式中,流值可以是流包括的报文的数量和/或流的总大小(或称为总流量)。进一步,可选地,流值还可以包括syn报文数量和/或fin报文数量。In a possible implementation manner, the flow value may be the number of packets included in the flow and/or the total size of the flow (or referred to as the total flow). Further, optionally, the flow value may also include the number of syn packets and/or the number of fin packets.
一种可能的示例中,以一条流、且该流对应第二记录槽组中的第二记录槽、第二记录槽用于记录发送该流中的第二报文的数量为例,第二记录槽的初始流值为0,交换机接收到该流中的第一个第二报文,可以将该第二记录槽的流值更新为1,接收到该流中的第二个第二报文时,可以将该第二记录槽的流值更新为2,依次类推,交换机每接收到一个该流中的第二报文,就会将该第二记录槽的流值加1。In a possible example, take a stream, and the stream corresponds to the second recording slot in the second recording slot group, and the second recording slot is used to record the number of second packets sent in the stream as an example, the second The initial flow value of the recording slot is 0, and the switch receives the first second packet in the flow, and can update the flow value of the second recording slot to 1, and receives the second second packet in the flow When writing, the flow value of the second recording slot can be updated to 2, and so on, each time the switch receives a second packet in the flow, it will increase the flow value of the second recording slot by 1.
另一种可能的示例中,以一条流、且该流对应第二记录槽组中的第二记录槽、第二记 录槽用于记录发送该流中的第二报文的大小为例,第二记录槽的初始流值为0,交换机接收到该流中的第一个第二报文(大小为A1bit),可以将该第二记录槽的流值更新为A1,接收到该流中的第二个第二报文(大小为A2bit),将该第二记录槽的流值更新为A1+A2,依次类推,交换机每接收到该流中的一个第二报文,就会将该第二记录槽中记录的流值加发送新的第二报文的大小。In another possible example, take a stream, and the stream corresponds to the second recording slot in the second recording slot group, and the second recording slot is used to record the size of the second packet sent in the stream as an example. The initial flow value of the second recording slot is 0, and the switch receives the first second packet (with a size of A1bit) in the flow, and can update the flow value of the second recording slot to A1, and receive the data in the flow The second second packet (size is A2bit), the flow value of the second recording slot is updated to A1+A2, and so on. Each time the switch receives a second packet in the flow, it will The flow value recorded in the second recording slot is added to the size of the new second message sent.
需要说明的是,第二报文中包括的交换机索引可能是N个,从第二记录槽组中确定出的第二记录槽也可能是N个,则需要更新N个第二记录槽中的每个第二记录槽记录的流值。另外,交换机可以在接收到第二报文后,更新第二记录槽的流值;也可以在转发第二报文后,更新第二记录槽的流值;本申请对此不做限定。It should be noted that the switch index included in the second message may be N, and the second record slot determined from the second record slot group may also be N, and the number of the second record slot in N needs to be updated. The stream value recorded in each second recording slot. In addition, the switch may update the flow value of the second recording slot after receiving the second message; it may also update the flow value of the second recording slot after forwarding the second message; this application does not limit this.
步骤407,交换机向目的主机发送第二报文。相应地,目的主机接收来自交换机的第二报文。Step 407: The switch sends the second packet to the destination host. Correspondingly, the destination host receives the second message from the switch.
需要说明的是,上述步骤406和步骤407之间没有先后顺序,可以先执行步骤406后执行步骤407;也可以先执行步骤407后执行步骤406;也可以步骤406和步骤407同步执行。It should be noted that there is no sequence between step 406 and step 407. Step 406 can be performed first and then step 407; step 407 can also be performed first and step 406 can be performed; or step 406 and step 407 can be performed synchronously.
步骤408,目的主机根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。Step 408: The destination host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
在一种可能的实现方式中,目的主机从第二报文中获取第一时间窗口和主机索引。结合图5所示的第二报文的结构,主机可从第二报文的报文头中获取第一时间窗口和主机索引。In a possible implementation manner, the destination host obtains the first time window and the host index from the second message. With reference to the structure of the second message shown in FIG. 5, the host can obtain the first time window and the host index from the header of the second message.
进一步,可选地,目的主机根据第一时间窗口和主机索引,从第三记录槽组中确定第三记录槽,并更新第三记录槽的流值。Further, optionally, the destination host determines the third recording slot from the third recording slot group according to the first time window and the host index, and updates the stream value of the third recording slot.
在一种可能的实现方式中,目的主机可根据第一时间窗口,确定第三记录槽组;根据主机索引,从第三记录槽组中确定第三记录槽,并更新第三记录槽的流值。也就是说,目的主机中,第三记录槽组对应第一时间窗口,第三记录槽组中包括多个记录槽,一个流对应一个记录槽,每个记录槽用于存储目的主机已接收到的对应流中的报文的数量值或流量值。这样,目的主机接收到一个流的每个第二报文后,就可以更新该第二报文所属流对应的第三记录槽中的流值。In a possible implementation manner, the destination host can determine the third recording slot group according to the first time window; according to the host index, determine the third recording slot from the third recording slot group, and update the stream of the third recording slot value. That is to say, in the destination host, the third recording slot group corresponds to the first time window, the third recording slot group includes multiple recording slots, one stream corresponds to one recording slot, and each recording slot is used to store the data received by the destination host The number or flow value of packets in the corresponding flow. In this way, after receiving each second packet of a flow, the destination host can update the flow value in the third recording slot corresponding to the flow to which the second packet belongs.
也可以理解为,第二报文中包括主机索引,目的主机可以直接使用第二报文中的第一时间窗口和主机索引定位到对应的第三记录槽上,以更新第三记录槽上的流值。如此,目的主机不需要再获取流键,也不需要再进行二次哈希操作以获取主机索引,从而可节省目的主机的计算资源。It can also be understood that the second message includes the host index, and the destination host can directly use the first time window and host index in the second message to locate the corresponding third recording slot to update the third recording slot. Flow value. In this way, the destination host does not need to obtain the stream key, nor does it need to perform a second hash operation to obtain the host index, thereby saving the computing resources of the destination host.
一种可能的示例中,以一条流、且该流对应第三记录槽组中的第三记录槽、第三记录槽用于记录发送该流中的第二报文的数量为例,第三记录槽的初始流值为0,目的主机接收到该流中的第一个第二报文,可以将该第三记录槽的流值更新为1,接收到该流中的第二个第二报文时,可以将该第三记录槽的流值更新为2,依次类推,目的主机每接收到该流中的一个第二报文,就会将该第三记录槽的流值加1。In a possible example, take a stream, and the stream corresponds to the third recording slot in the third recording slot group, and the third recording slot is used to record the number of second packets sent in the stream as an example, the third The initial stream value of the recording slot is 0, and the destination host receives the first second packet in the stream, and can update the stream value of the third recording slot to 1, and receives the second second packet in the stream. When sending a message, the flow value of the third recording slot can be updated to 2, and so on, each time the destination host receives a second message in the flow, the flow value of the third recording slot will be incremented by 1.
另一种可能的示例中,以一条流、且该流对应第三记录槽组中的第三记录槽、第三记录槽用于记录发送该流中的第二报文的大小为例,第三记录槽的初始流值为0,目的主机接收到该流中的第一个第二报文(大小为A1bit),可以将该第三记录槽的流值更新为A1,接收到该流中的第二个第二报文(大小为A2bit),可以将该第三记录槽的流值更新为A1+A2,依次类推,目的主机每接收到该流中的一个第二报文,就会将该第三记录槽的流 值加发送新的第二报文的大小。In another possible example, take a stream, and the stream corresponds to the third recording slot in the third recording slot group, and the third recording slot is used to record the size of the second packet sent in the stream as an example. The initial stream value of the third recording slot is 0, and the destination host receives the first second packet (size A1bit) in the stream, and can update the stream value of the third recording slot to A1, and receive the stream The second second packet (size A2bit) of the third record slot can be updated to A1+A2, and so on, every time the destination host receives a second packet in the stream, it will Add the flow value of the third recording slot to the size of the new second message sent.
需要说明的是,当记录的流值为大小时,源主机也可以记录第一报文的大小,此处,交换机和目的主机接收到第二报文后,可记录第二报文的大小分别减去主机索引的大小、交换机索引的大小和第一时间窗口的大小后的大小。It should be noted that when the recorded flow value is the size, the source host can also record the size of the first packet. Here, the switch and the destination host can record the size of the second packet after receiving the second packet. The size after subtracting the size of the host index, the size of the switch index, and the size of the first time window.
从上述步骤401至步骤408可以看出,源主机可以获取发起的每个流的流值和流键,并在第一报文中增加第一时间窗口,可以保证同一报文在全网(从源主机到交换机再到目的主机)的转发过程中都位于同一个时间窗口,不管交换机或目的主机本地维护的时间窗口是否与该第一时间窗口一致,一个流全部第一报文的在全网的传递过程中,都使用第二报文中的第一时间窗口字段确定需要更新的流值。如此,可以实现流的完全准确性,而且可以充分利用主机和交换机的各自的资源优势。进一步,第二报文中携带有主机索引,主机索引比较小,且交换机接收到的第二报文占用的内存也比较小;而且,交换机中不需要记录流键,只需要更新流值,从而有助于实现低资源开销。From the above steps 401 to 408, it can be seen that the source host can obtain the flow value and flow key of each flow initiated, and add the first time window to the first message, which can ensure that the same message is in the entire network (from The forwarding process from the source host to the switch to the destination host) are all in the same time window, regardless of whether the time window maintained locally by the switch or the destination host is consistent with the first time window, all the first packets of a flow are in the entire network During the transmission process, the first time window field in the second message is used to determine the stream value that needs to be updated. In this way, the complete accuracy of the flow can be achieved, and the respective resource advantages of the host and the switch can be fully utilized. Furthermore, the second message carries a host index, the host index is relatively small, and the memory occupied by the second message received by the switch is also relatively small; moreover, the switch does not need to record the flow key, only the flow value needs to be updated, thus Helps achieve low resource overhead.
如下,示例性地的示出了四种情形下确定第一时间窗口方式。以下以源主机和目的主机为例进行说明。As follows, the manner of determining the first time window in four situations is exemplarily shown. The following takes the source host and the destination host as an example for description.
情形一,主机确定进入新的时间窗口。Case 1: The host determines to enter a new time window.
参阅图6,为本申请提供的一种时间窗口的同步方法。该方法包括以下步骤:Refer to Fig. 6 for a time window synchronization method provided by this application. The method includes the following steps:
步骤601,源主机可根据本地时钟,确定进入新的时间窗口,将该新的时间窗口确定为源主机的本地时间窗口(local epoch)。In step 601, the source host may determine to enter a new time window according to the local clock, and determine the new time window as the local time window (local epoch) of the source host.
步骤602,源主机向控制器发送该新的时间窗口。相应地,控制器接收来自源主机的新的时间窗口。Step 602: The source host sends the new time window to the controller. Accordingly, the controller receives the new time window from the source host.
步骤603,控制器确定接收到新的时间窗口是否大于控制器的本地时间窗口;若大于,执行步骤604;若不大于,执行步骤607。In step 603, the controller determines whether the received new time window is larger than the local time window of the controller; if it is larger, execute step 604; if it is not larger, execute step 607.
步骤604,控制器将控制器的本地时间窗口更新为该新的时间窗口,并向全网中的主机(源主机和目的主机)广播第四报文。Step 604: The controller updates the local time window of the controller to the new time window, and broadcasts the fourth message to the hosts (source host and destination host) in the entire network.
此处,第四报文可包括该新的时间窗口。应理解,第四报文为时间窗口的同步报文。Here, the fourth message may include the new time window. It should be understood that the fourth message is a synchronization message of the time window.
步骤605,目的主机获取第四报文中的该新的时间窗口,并确定该新的时间窗口是否大于目的主机的本地时间窗口;若是,执行步骤606;若否,执行步骤609。Step 605: The destination host obtains the new time window in the fourth message, and determines whether the new time window is greater than the local time window of the destination host; if yes, execute step 606; if not, execute step 609.
需要说明的是,源主机接收到第四报文后,可确定第四报文中的新的时间窗口与本地的时间窗口是同步的,不需要更新源主机的本地时间窗口。It should be noted that after receiving the fourth message, the source host can determine that the new time window in the fourth message is synchronized with the local time window, and there is no need to update the local time window of the source host.
步骤606,目的主机将目的主机的本地时间窗口更新为该新的时间窗口。Step 606: The destination host updates the local time window of the destination host to the new time window.
通过控制器广播第三报文,可以实现全网时间窗口同步。即由控制器配合主机协调全网时间窗口同步的算法,实现了近乎强一致性模型。By broadcasting the third message through the controller, the time window synchronization of the entire network can be realized. That is, the controller cooperates with the host to coordinate the algorithm of the time window synchronization of the whole network, and realizes a nearly strong consistency model.
步骤607,控制器向源主机发送第一消息。Step 607: The controller sends the first message to the source host.
该第一消息包括控制器的本地时间窗口,用于通知/指示源主机将源主机的本地时间窗口更新为控制的第一消息携带的控制器的本地时间窗口。The first message includes the local time window of the controller, and is used to notify/instruct the source host to update the local time window of the source host to the local time window of the controller carried in the first message of control.
步骤608,源主机将源主机的本地时间窗口更新为控制器的本地时间窗口。Step 608: The source host updates the local time window of the source host to the local time window of the controller.
步骤609,目的主机向控制器发送目的主机的本地时间窗口。相应地,控制器接收来自目的主机的本地时间窗口。Step 609: The destination host sends the local time window of the destination host to the controller. Correspondingly, the controller receives the local time window from the destination host.
步骤610,控制器确定接收到的目的主机的本地时间窗口是否大于控制器的本地时间 窗口;若大于,执行步骤611;若不大于,执行步骤612。In step 610, the controller determines whether the received local time window of the destination host is greater than the local time window of the controller; if it is greater, step 611 is executed; if it is not greater, step 612 is executed.
步骤611,控制器向将控制器的本地时间窗口更新为目的主机的本地时间窗口,并向全网中的主机(源主机和目的主机)广播第五报文。Step 611: The controller updates the local time window of the controller to the local time window of the destination host, and broadcasts the fifth message to hosts (source host and destination host) in the entire network.
此处,第五报文可包括目的主机的本地时间窗口。应理解,第五报文也为时间窗口的同步报文。全网中的主机可根据第五报文中包括的目的主机的本地时间窗口与主机自身的本地时间窗口的关系,确定是否更新主机自身的维护的本地时间窗口。Here, the fifth message may include the local time window of the destination host. It should be understood that the fifth message is also a synchronization message of the time window. The hosts in the entire network can determine whether to update the local time window maintained by the host itself according to the relationship between the local time window of the destination host included in the fifth message and the local time window of the host itself.
步骤612,控制器向目的主机发送第二消息。Step 612: The controller sends a second message to the destination host.
该第二消息包括控制器的本地时间窗口,用于通知/指示目的主机将目的主机的本地时间窗口更新为控制的第二消息携带的控制器的本地时间窗口。The second message includes the local time window of the controller, and is used to notify/instruct the destination host to update the local time window of the destination host to the local time window of the controller carried in the second message of control.
从上述步骤601至步骤612可以看出,通过源主机、目的主机和控制器交互各自本地的时间窗口,有助于实现全网中的实体的时间窗口同步。It can be seen from the above steps 601 to 612 that the source host, the destination host, and the controller interact with their respective local time windows, which helps to realize the synchronization of the time windows of the entities in the entire network.
情形二,目的主机接收到第二报文。Case 2: The destination host receives the second message.
在一种可能的实现方式中,目的主机获取第二报文中的第一时间窗口,若确定第一时间窗口大于目的主机的本地时间窗口,则将目的主机的本地时间窗口更新为第一时间窗口。In a possible implementation manner, the destination host obtains the first time window in the second message, and if it is determined that the first time window is greater than the local time window of the destination host, then the local time window of the destination host is updated to the first time window.
情形三,控制器确定进入新的时间窗口。In case three, the controller determines to enter a new time window.
参阅图7,为本申请提供的另一种时间窗口的同步方法。该方法包括以下步骤:Refer to Fig. 7 for another time window synchronization method provided by this application. The method includes the following steps:
步骤701,控制器根据本地的时钟,确定进入新的时间窗口(可称为第二时间窗口)后,将控制器的本地时间窗口更新为第二时间窗口。In step 701, the controller determines to enter a new time window (which may be referred to as a second time window) according to the local clock, and then updates the local time window of the controller to the second time window.
步骤702,控制器向全网中的主机广播第三报文。Step 702: The controller broadcasts the third message to hosts in the entire network.
此处,第三报文中包括第二时间窗口。应理解,全网中的主机包括源主机和目的主机。Here, the third message includes the second time window. It should be understood that the hosts in the entire network include source hosts and destination hosts.
步骤703,主机确定接收到第三报文中的第二时间窗口是否大于主机的本地时间窗口;若大于,执行步骤704;若不大于,执行步骤705。In step 703, the host determines whether the second time window in the received third message is greater than the local time window of the host; if it is greater than, step 704 is executed; if it is not greater than, step 705 is executed.
步骤704,主机将主机的本地时间窗口更新为第二时间窗口。Step 704: The host updates the local time window of the host to the second time window.
步骤705,主机向控制器发送主机的本地时间窗口。相应地,控制器接收主机的本地时间窗口。Step 705: The host sends the local time window of the host to the controller. Correspondingly, the controller receives the host's local time window.
步骤706,控制器将控制器的本地时间窗口更新为主机的本地时间窗口,并向全网中的主机广播第六报文。Step 706: The controller updates the local time window of the controller to the local time window of the host, and broadcasts the sixth message to the hosts in the entire network.
此处,第六报文中包括控制器更新后的控制器的本地时间窗口,即接收到的主机的本地时间窗口。Here, the sixth message includes the local time window of the controller updated by the controller, that is, the received local time window of the host.
情形四,主机同时接收到第二报文和第三报文,或者同时收到第二报文和第四报文。Case 4: The host receives the second message and the third message at the same time, or receives the second message and the fourth message at the same time.
在一种可能的实现方式中,主机可对比第二报文中的第一时间窗口、第三报文中的第二时间窗口和主机的本地时间窗口,若主机的本地时间窗口最大,则不进行更新;否则,将主机的本地时间窗口更新为其中最大的时间窗口。In a possible implementation, the host can compare the first time window in the second message, the second time window in the third message, and the host’s local time window. If the host’s local time window is the largest, it does not Update; otherwise, update the local time window of the host to the largest time window.
在一种可能的实现方式中,主机可对比第二报文中的第一时间窗口、第四报文中的新的时间窗口和主机的本地时间窗口,若主机的本地时间窗口最大,则不进行更新;否则,将主机的本地时间窗口更新为其中最大的时间窗口。In a possible implementation, the host can compare the first time window in the second message, the new time window in the fourth message, and the host’s local time window. If the host’s local time window is the largest, it will not Update; otherwise, update the local time window of the host to the largest time window.
需要说明的是,上述各图中步骤之间的先后顺序仅是一个示例,并不对本申请构成限定。It should be noted that the sequence of steps in the above figures is only an example, and does not limit the application.
本申请中,每个时间窗口结束后,控制器可获取该时间窗口内源主机、目的主机和交 换机上记录的流的流值,并根据每个流的流值,确定该流是否发生丢包。进一步,可选地,源主机、目的主机和交换机均可以将为该时间窗口分配的记录槽组回收。如下,以第一时间窗口为例,详细介绍控制器确定是否发生丢包的方法,以及若发生丢包控制器如何确定丢包的过程。In this application, after the end of each time window, the controller can obtain the flow value of the flow recorded on the source host, destination host, and switch in the time window, and determine whether the flow has lost packets according to the flow value of each flow . Further, optionally, the source host, the destination host, and the switch may all reclaim the recording slot group allocated for the time window. As follows, taking the first time window as an example, the method for the controller to determine whether packet loss occurs, and how the controller determines the process of packet loss if a packet loss occurs.
在第一时间窗口结束后,控制器可从源主机获取与主机索引和所述第一时间窗口对应记录的第一流值,以及从目的主机获取与所述主机索引和所述第一时间窗口对应记录的第二流值;可从源主机获取与所述第一时间窗口对应的第一记录槽组对应的记录槽与流值的对应关系;控制器确定所述第一流值和所述第二流值不一致时,确定所述流发生丢包。After the first time window ends, the controller may obtain the first stream value recorded corresponding to the host index and the first time window from the source host, and obtain the first stream value corresponding to the host index and the first time window from the destination host The recorded second stream value; the corresponding relationship between the recording slot and the stream value corresponding to the first recording slot group corresponding to the first time window can be obtained from the source host; the controller determines the first stream value and the second When the flow values are inconsistent, it is determined that packet loss occurs in the flow.
在一种可能的实现方式中,所述控制器确定所述源主机中与所述第一时间窗口对应的第一记录槽组,在所述第一记录槽组中确定与所述主机索引对应的第一记录槽,并确定所述第一记录槽中记录的所述第一流值;所述控制器可确定所述目的主机中与所述第一时间窗口对应的第三记录槽组;在所述第三记录槽组中确定与所述主机索引对应的第三记录槽,并确定所述第三记录槽中记录的所述第二流值。In a possible implementation manner, the controller determines a first recording slot group in the source host corresponding to the first time window, and determines in the first recording slot group to correspond to the host index And determine the first stream value recorded in the first recording slot; the controller may determine the third recording slot group in the destination host corresponding to the first time window; The third recording slot corresponding to the host index is determined in the third recording slot group, and the second stream value recorded in the third recording slot is determined.
在一种可能的实现方式中,所述控制器确定交换机中与所述第一时间窗口对应的第二记录槽组,在所述第二记录槽组中确定与所述交换机的交换机索引对应的N个第二记录槽,并确定所述N个第二记录槽中分别记录的第三流值,根据所述第一流值、所述第二流值和所述N个第三流值,确定所述流在所述交换机的丢包数量,所述N为大于1的整数。In a possible implementation manner, the controller determines a second record slot group in the switch corresponding to the first time window, and determines in the second record slot group the switch index corresponding to the switch N second recording grooves, and determining the third stream value respectively recorded in the N second recording grooves, and determining according to the first stream value, the second stream value, and the N third stream values The number of lost packets of the flow at the switch, where N is an integer greater than 1.
进一步,可选地,控制器可分别获取源主机在第一时间窗口内的哈希表中存储的流键、源主机在第一时间窗口内的第一记录槽组中记录的流值、交换机在第一时间窗口内的第二记录槽组中记录的流值、以及目的主机在第一时间窗口内的第三记录槽组中记录的流值,可确定第一记录槽组中第一记录槽记录的流值、第二记录槽组中第二记录槽记录的流值以及第三记录槽组中的第三记录槽记录的流值属于同一条流的流值;也可以理解为,控制器可确定同一条流在源主机的流值、在交换机的流值和在目的主机的流值,若确定同一条流在第一记录槽的流值和第三记录槽中的流值不一致,则确定该流发生了丢包。通过控制器在每个时间窗口结束后,获取一次网络所有主机和交换机上记录的流值,有助于缓减控制器的带宽压力。Further, optionally, the controller may respectively obtain the stream key stored in the hash table of the source host in the first time window, the stream value recorded in the first recording slot group of the source host in the first time window, and the switch The stream value recorded in the second slot group in the first time window and the stream value recorded in the third slot group in the first time window by the destination host can determine the first record in the first slot group The stream value recorded by the slot, the stream value recorded by the second slot in the second slot group, and the stream value recorded by the third slot in the third slot group belong to the stream value of the same stream; it can also be understood as control The device can determine the flow value of the same flow in the source host, the flow value in the switch, and the flow value in the destination host. If it is determined that the flow value of the same flow in the first recording slot is inconsistent with the flow value in the third recording slot, It is determined that packet loss has occurred in the stream. After each time window is over, the controller obtains the flow values recorded on all hosts and switches on the network once, which helps to reduce the bandwidth pressure of the controller.
在一种可能的实现方式中,可以是控制器在第一时间窗口结束后,分别向全网中的主机和交换机发送请求消息,以请求获取第一时间窗口内各个网络实体记录的流键、流值等信息;或者也可以是,全网中的主机和交换机在第一时间窗口结束后,向控制器上报第一时间窗口内记录的流键、流值等流信息。In a possible implementation manner, after the first time window ends, the controller sends request messages to hosts and switches in the entire network to request to obtain stream keys, Information such as the flow value; or, after the first time window ends, the hosts and switches in the entire network report the flow information such as the flow key and the flow value recorded in the first time window to the controller.
进一步,可选地,在第一时间窗口结束,源主机可向控制器上报与第一时间窗口对应的第一记录槽组对应的每个记录槽(包括第一记录槽)与流值的对应关系。进一步,还可上报在第一时间窗口内,哈希表中记录的流键的哈希值;目的主机可向控制器上报与第一时间窗口对应的第三记录槽组对应的每个记录槽(包括第三记录槽)与流值的对应关系;交换机也可向控制器上报与第一时间窗口对应的第二记录槽组对应的每个记录槽(包括第二记录槽)与流值的对应关系。Further, optionally, at the end of the first time window, the source host may report to the controller the correspondence between each recording slot (including the first recording slot) and the stream value corresponding to the first recording slot group corresponding to the first time window relation. Furthermore, it can also report the hash value of the stream key recorded in the hash table in the first time window; the destination host can report to the controller each record slot corresponding to the third record slot group corresponding to the first time window (Including the third recording slot) and the corresponding relationship between the stream value; the switch can also report to the controller the relationship between each recording slot (including the second recording slot) and the stream value corresponding to the second recording slot group corresponding to the first time window Correspondence.
相应地,控制器可对流键的哈希值进行运算,得到流键(如五元组),并根据流键确定出源主机和目的主机。Correspondingly, the controller can perform operations on the hash value of the stream key to obtain the stream key (such as a five-tuple), and determine the source host and the destination host according to the stream key.
需要说明的是,若控制器从源主机控制的是流键的哈希值,则控制器可根据哈希运算的,得到源主机中的流键。当然,控制器也可从源主机直接获取流键。本申请对此不做限 定。It should be noted that if the controller controls the hash value of the stream key from the source host, the controller can obtain the stream key in the source host according to the hash calculation. Of course, the controller can also obtain the stream key directly from the source host. This application is not limited.
当控制器确定某一条流发生了丢包,控制器可根据该流在第一记录槽组上第一流值、在第二记录槽组上的第三流值和第三记录槽组上的第二流值,推断在交换机上的丢包情况。When the controller determines that a certain stream has lost packets, the controller can use the first stream value on the first recording slot group, the third stream value on the second recording slot group, and the third stream value on the third recording slot group according to the stream. The second-rate value, infers the packet loss on the switch.
在一种可能的实现方式中,控制器可以构建一个线性方程组,通过线性方程组的求解,确定各个交换机上的丢包情况。In a possible implementation, the controller can construct a linear equation set, and determine the packet loss on each switch by solving the linear equation set.
示例性地,以流值为流所包括的报文的数量为例,源主机和目的主机之间经过两个交换机(交换机1和交换机2),线性方程组的变量可用于表示在交换机1上的丢包数量x和在交换机2上的丢包数量y,源主机上该流的流值为a,目的主机上该流的流值为b,该流在交换机1上的流值为c,该流在交换机2上的流值为d,则a=c+x+d+y+b。Exemplarily, taking the flow value as the number of packets included in the flow as an example, the source host and the destination host pass through two switches (switch 1 and switch 2), and the variables of the linear equation group can be used to express on the switch 1. The number of lost packets x and the number of lost packets y on switch 2, the flow value of the flow on the source host is a, the flow value of the flow on the destination host is b, and the flow value of the flow on switch 1 is c, The flow value of the flow on the switch 2 is d, then a=c+x+d+y+b.
需要说明的是,流对应的交换机索引可能是N个,则可确定出N个a=c+x+d+y+b,即增加了该线性方程组的变量的约束,可使得该线性方程组在绝大多数情况下都有唯一解,从而可正确推断出发生丢包的流在交换机上的丢包情况。经验证,当N=2时,99.7%的情况下都可以准确的推断出丢包情况。It should be noted that there may be N switch indexes corresponding to the flow, and N a=c+x+d+y+b can be determined, that is, the constraint of the variables of the linear equation group is increased, and the linear equation can be made The group has a unique solution in most cases, so that it can correctly infer the packet loss on the switch of the flow that has lost packets. It has been verified that when N=2, the packet loss situation can be accurately inferred in 99.7% of the cases.
在一种可能的实现方式中,控制器还可根据每个流的总流量大小,确定网络当前的总承载量。In a possible implementation manner, the controller may also determine the current total load capacity of the network according to the total flow of each flow.
可以理解的是,为了实现上述实施例中功能,源主机、交换机、目的主机和控制器包括了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本申请中所公开的实施例描述的各示例的模块及方法步骤,本申请能够以硬件或硬件和计算机软件相结合的形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用场景和设计约束条件。It can be understood that, in order to implement the functions in the foregoing embodiments, the source host, the switch, the destination host, and the controller include hardware structures and/or software modules corresponding to each function. Those skilled in the art should easily realize that, in combination with the modules and method steps of the examples described in the embodiments disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application scenarios and design constraints of the technical solution.
基于上述内容和相同构思,图8和图9为本申请的提供的可能的网络测量装置的结构示意图。这些网络测量装置可以用于实现上述方法实施例中源主机或交换机或目的主机或控制器的功能,因此也能实现上述方法实施例所具备的有益效果。在本申请中,该网络测量装置可以是如图2所示的交换机101,也可以是如图2所示的主机102。Based on the foregoing content and the same concept, FIGS. 8 and 9 are schematic structural diagrams of possible network measurement devices provided by this application. These network measurement devices can be used to implement the functions of the source host or switch or the destination host or controller in the foregoing method embodiment, and therefore can also achieve the beneficial effects of the foregoing method embodiment. In this application, the network measurement device may be the switch 101 as shown in FIG. 2 or the host 102 as shown in FIG. 2.
如图8所示,该网络测量装置800包括处理模块801和收发模块802。网络测量装置800用于实现上述图4、图6或图7中所示的方法实施例中源主机或交换机或目的主机或控制器的功能。As shown in FIG. 8, the network measurement device 800 includes a processing module 801 and a transceiver module 802. The network measurement device 800 is used to implement the functions of the source host or switch or the destination host or controller in the method embodiment shown in FIG. 4, FIG. 6 or FIG. 7 above.
当网络测量装置800用于实现图4所示的方法实施例的源主机的功能时:处理模块801用于获取待发送流对应的主机索引、第一时间窗口和交换机索引,并在第一报文中增加主机索引、交换机索引和第一时间窗口,得到第二报文,第一报文为流包括的任意报文;收发模块802用于通过交换机索引对应的交换机向目的主机发送第二报文;处理模块801还用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。When the network measurement device 800 is used to implement the function of the source host in the method embodiment shown in FIG. 4: the processing module 801 is used to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and report it in the first report. The host index, switch index, and first time window are added to the text to obtain the second message, the first message is any message included in the flow; the transceiver module 802 is used to send the second message to the destination host through the switch corresponding to the switch index The processing module 801 is also used to update the stream value recorded corresponding to the host index and the first time window according to the second message.
当网络测量装置800用于实现图4所示的方法实施例的交换机的功能时:收发模块802用于接收来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引,并向目的主机转发第二报文,交换机与交换机索引对应;处理模块801用于根据第二报文,更新与交换机索引和第一时间窗口对应记录的流值。When the network measurement device 800 is used to implement the function of the switch in the method embodiment shown in FIG. 4: the transceiver module 802 is used to receive a second message from the source host, and the second message includes the host index, the first time window, and Switch index, and forward the second message to the destination host, the switch corresponds to the switch index; the processing module 801 is configured to update the flow value corresponding to the switch index and the first time window according to the second message.
当网络测量装置800用于实现图4所示的方法实施例的目的主机的功能时:收发模块802用于接收交换机转发的来自源主机的第二报文,第二报文包括主机索引、第一时间窗口和交换机索引;交换机与交换机索引对应;处理模块801用于根据第二报文,更新与主机索引和第一时间窗口对应记录的流值。When the network measurement device 800 is used to implement the function of the destination host in the method embodiment shown in FIG. 4: the transceiver module 802 is used to receive the second packet from the source host forwarded by the switch, and the second packet includes the host index and the first packet. A time window and switch index; the switch corresponds to the switch index; the processing module 801 is configured to update the flow value recorded corresponding to the host index and the first time window according to the second message.
当网络测量装置800用于实现图4所示的方法实施例的控制器的功能时:处理模块801与收发模块802协作,用于在第一时间窗口结束,从源主机获取与主机索引和第一时间窗口对应记录的第一流值,以及从目的主机获取与主机索引和第一时间窗口对应记录的第二流值;其中,流由源主机发送到目的主机,主机索引根据流确定;处理模块801还用于确定第一流值和第二流值不一致时,确定流发生丢包。When the network measurement device 800 is used to implement the function of the controller in the method embodiment shown in FIG. 4: the processing module 801 cooperates with the transceiver module 802, and is used to obtain the host index and the first time window at the end of the first time window from the source host. One time window corresponds to the recorded first flow value, and obtains from the destination host the second flow value recorded corresponding to the host index and the first time window; wherein, the flow is sent from the source host to the destination host, and the host index is determined according to the flow; processing module 801 is also used to determine that when the first flow value and the second flow value are inconsistent, determine that packet loss occurs in the flow.
有关上述处理模块801和收发模块802更详细的描述可以参考图4所示的方法实施例中相关描述直接得到,此处不再一一赘述。A more detailed description of the processing module 801 and the transceiver module 802 can be directly obtained by referring to the relevant description in the method embodiment shown in FIG. 4, and will not be repeated here.
应理解,本申请实施例中的处理模块801可以由处理器或处理器相关电路组件实现,收发模块802可以由通信接口或通信接口相关电路组件实现。It should be understood that the processing module 801 in the embodiment of the present application may be implemented by a processor or processor-related circuit components, and the transceiver module 802 may be implemented by a communication interface or a communication interface-related circuit component.
基于上述内容和相同构思,如图9所示,本申请还提供一种网络测量装置900。该网络测量装置900可包括处理器901和通信接口902。处理器901和通信接口902之间相互耦合。可以理解的是,通信接口902可以为接口电路或输入输出接口。可选地,网络测量装置900还可包括存储器903,用于存储处理器901执行的指令或存储处理器901运行指令所需要的输入数据或存储处理器901运行指令后产生的数据。Based on the foregoing content and the same concept, as shown in FIG. 9, the present application also provides a network measurement device 900. The network measurement device 900 may include a processor 901 and a communication interface 902. The processor 901 and the communication interface 902 are coupled with each other. It can be understood that the communication interface 902 may be an interface circuit or an input/output interface. Optionally, the network measurement device 900 may further include a memory 903 for storing instructions executed by the processor 901 or storing input data required by the processor 901 to run the instructions or storing data generated after the processor 901 runs the instructions.
当网络测量装置900用于实现图4所示的方法时,处理器901用于执行上述处理模块801的功能,通信接口902用于执行上述收发模块802的功能。When the network measurement device 900 is used to implement the method shown in FIG. 4, the processor 901 is used to execute the function of the above-mentioned processing module 801, and the communication interface 902 is used to execute the function of the above-mentioned transceiving module 802.
可以理解的是,本申请的实施例中的处理器可以是中央处理单元(central processing unit,CPU),还可以是其它通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件、晶体管逻辑器件,硬件部件或者其任意组合。通用处理器可以是微处理器,也可以是任何常规的处理器。It is understandable that the processor in the embodiment of the present application may be a central processing unit (central processing unit, CPU), or other general-purpose processors, digital signal processors (digital signal processors, DSP), and application-specific integrated circuits. (application specific integrated circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
本申请的实施例中的方法步骤可以通过硬件的方式来实现,也可以由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(random access memory,RAM)、闪存、只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于网络设备或终端设备中。当然,处理器和存储介质也可以作为分立组件存在于网络设备或终端设备中。The method steps in the embodiments of the present application can be implemented by hardware, and can also be implemented by a processor executing software instructions. Software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (programmable ROM) , PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or well-known in the art Any other form of storage medium. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in the ASIC. In addition, the ASIC can be located in a network device or a terminal device. Of course, the processor and the storage medium may also exist as discrete components in the network device or the terminal device.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机程序或指令。在计算机上加载和执行计算机程序或指令时,全部或部分地执行本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、网络设备、用户设备或者其它可编程装置。计算机程序或指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机程序或指令可以从一个网站站点、计算机、服务器或数据中心通过有线或无线方式 向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是集成一个或多个可用介质的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,例如,软盘、硬盘、磁带;也可以是光介质,例如,数字视频光盘(digital video disc,DVD);还可以是半导体介质,例如,固态硬盘(solid state drive,SSD)。In the foregoing embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer programs or instructions. When the computer programs or instructions are loaded and executed on the computer, the procedures or functions of the embodiments of the present application are executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, user equipment, or other programmable devices. Computer programs or instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, a computer program or instruction can be downloaded from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired or wireless means. 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 that integrates one or more available media. The usable medium can be a magnetic medium, such as a floppy disk, a hard disk, and a magnetic tape; it can also be an optical medium, such as a digital video disc (digital video disc, DVD); and it can also be a semiconductor medium, such as a solid state drive (SSD). ).
在本申请的各个实施例中,如果没有特殊说明以及逻辑冲突,不同的实施例之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例中的技术特征根据其内在的逻辑关系可以组合形成新的实施例。In the various embodiments of this application, if there are no special instructions and logical conflicts, the terms and/or descriptions between different embodiments are consistent and can be mutually cited. The technical features in different embodiments are based on their inherent Logical relationships can be combined to form new embodiments.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。在本申请的文字描述中,字符“/”,一般表示前后关联对象是一种“或”的关系;在本申请的公式中,字符“/”,表示前后关联对象是一种“相除”的关系。另外,在本申请中,“示例的”一词用于表示作例子、例证或说明。本申请中被描述为“示例”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。或者可理解为,使用示例的一词旨在以具体方式呈现概念,并不对本申请构成限定。In this application, "at least one" refers to one or more, and "multiple" refers to two or more. "The following at least one item (a)" or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a). For example, at least one of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ", where a, b, and c can be single or multiple. "And/or" describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. In the text description of this application, the character "/" generally indicates that the associated objects before and after are an "or" relationship; in the formula of this application, the character "/" indicates that the associated objects before and after are a kind of "division" Relationship. In addition, in this application, the term "exemplary" is used to mean serving as an example, illustration, or illustration. Any embodiment or design solution described as an "example" in this application should not be construed as being more preferable or advantageous than other embodiments or design solutions. Or it can be understood that the term using examples is intended to present the concept in a specific manner, and does not limit the application.
可以理解的是,在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定。术语“第一”、“第二”等类似表述,是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块。方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块。It is understandable that the various numerical numbers involved in the embodiments of the present application are only for easy distinction for description, and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic. The terms "first", "second" and other similar expressions are used to distinguish similar objects, but not necessarily used to describe a specific order or sequence. In addition, the terms "including" and "having" and any variations of them are intended to cover non-exclusive inclusions, for example, including a series of steps or modules. The method, system, product, or device is not necessarily limited to those clearly listed steps or modules, but may include other steps or modules that are not clearly listed or are inherent to these processes, methods, products, or devices.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的保护范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to this application without departing from the scope of protection of this application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application also intends to include these modifications and variations.

Claims (46)

  1. 一种网络测量方法,其特征在于,包括:A network measurement method, characterized in that it comprises:
    源主机获取待发送流对应的主机索引、第一时间窗口和交换机索引;The source host obtains the host index, the first time window, and the switch index corresponding to the stream to be sent;
    所述源主机在第一报文中增加所述主机索引、所述交换机索引和所述第一时间窗口,得到第二报文,所述第一报文为所述流包括的任意报文;The source host adds the host index, the switch index, and the first time window to the first message to obtain a second message, where the first message is any message included in the flow;
    所述源主机通过所述交换机索引对应的交换机向目的主机发送所述第二报文,并根据所述第二报文,更新与所述主机索引和所述第一时间窗口对应记录的流值。The source host sends the second message to the destination host through the switch corresponding to the switch index, and according to the second message, updates the flow value recorded corresponding to the host index and the first time window .
  2. 如权利要求1所述的方法,其特征在于,所述源主机在第一报文中增加所述主机索引、所述交换机索引和所述第一时间窗口,得到第二报文,包括:The method of claim 1, wherein the source host adds the host index, the switch index, and the first time window to the first message to obtain the second message, comprising:
    所述源主机将所述主机索引、和/或、所述交换机索引、和/或、所述第一时间窗口增加于所述第一报文的以太网包头与网络协议IP包头之间,得到所述第二报文。The source host adds the host index, and/or, the switch index, and/or, the first time window between the Ethernet header of the first packet and the network protocol IP header to obtain The second message.
  3. 如权利要求1或2所述的方法,其特征在于,所述源主机更新与所述主机索引和所述第一时间窗口对应记录的流值,包括:The method according to claim 1 or 2, wherein the source host updating the stream value recorded corresponding to the host index and the first time window comprises:
    所述源主机将所述主机索引和所述第一时间窗口对应记录的流值加1;或者,The source host adds 1 to the host index and the stream value recorded corresponding to the first time window; or,
    所述源主机将所述主机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The source host adds the host index and the flow value recorded corresponding to the first time window to the size of the second packet.
  4. 如权利要求1至3任一项所述的方法,其特征在于,所述源主机更新与所述主机索引和所述第一时间窗口对应记录的流值,包括:The method according to any one of claims 1 to 3, wherein the source host updating the stream value recorded corresponding to the host index and the first time window comprises:
    所述源主机根据所述第一时间窗口,确定与所述第一时间窗口对应的第一记录槽组,所述第一记录槽组包括多个记录槽;Determining, by the source host, a first recording slot group corresponding to the first time window according to the first time window, the first recording slot group including a plurality of recording slots;
    所述源主机根据所述主机索引,在所述第一记录槽组中确定与所述主机索引对应的第一记录槽;Determining, by the source host, a first recording slot corresponding to the host index in the first recording slot group according to the host index;
    所述源主机将所述第一记录槽记录的流值加1,或者,将所述第一记录槽记录的流值加所述第二报文的大小。The source host adds 1 to the stream value recorded in the first recording slot, or adds the stream value recorded in the first recording slot to the size of the second packet.
  5. 如权利要求1至4任一项所述的方法,其特征在于,所述源主机获取待发送流的主机索引,包括:The method according to any one of claims 1 to 4, wherein the source host acquiring the host index of the stream to be sent comprises:
    所述源主机对所述流的流键进行哈希运算,根据运算结果确定所述流键在哈希表中的位置,将所述位置确定为所述主机索引。The source host performs a hash operation on the stream key of the stream, determines the position of the stream key in the hash table according to the result of the operation, and determines the position as the host index.
  6. 如权利要求1至5任一项所述的方法,其特征在于,所述源主机获取待发送流对应的第一时间窗口,包括:The method according to any one of claims 1 to 5, wherein the source host acquiring the first time window corresponding to the stream to be sent comprises:
    所述源主机将本地时间窗口确定为所述第一时间窗口。The source host determines the local time window as the first time window.
  7. 如权利要求6所述的方法,其特征在于,所述方法还包括:The method of claim 6, wherein the method further comprises:
    所述源主机接收来自控制器的第三报文,所述第三报文包括第二时间窗口;The source host receives a third message from the controller, where the third message includes a second time window;
    若所述源主机确定所述第二时间窗口大于所述本地时间窗口,将所述本地时间窗口更新为所述第二时间窗口。If the source host determines that the second time window is greater than the local time window, update the local time window to the second time window.
  8. 如权利要求6或7所述的方法,其特征在于,所述方法还包括:The method according to claim 6 or 7, wherein the method further comprises:
    若所述源主机确定所述本地时间窗口进入新的时间窗口,将所述本地时间窗口更新为所述新的时间窗口,并向控制器发送所述新的时间窗口。If the source host determines that the local time window enters a new time window, update the local time window to the new time window, and send the new time window to the controller.
  9. 如权利要求1至8任一项所述的方法,其特征在于,所述源主机获取待发送流对应 的交换机索引,包括:The method according to any one of claims 1 to 8, wherein the source host acquiring the switch index corresponding to the stream to be sent comprises:
    所述源主机确定控制器预先为所述源主机划分的M个交换机索引,所述M个交换机索引互不相同,所述M为大于1的整数;The source host determines the M switch indexes that the controller divides for the source host in advance, the M switch indexes are different from each other, and the M is an integer greater than 1;
    所述源主机从所述M个交换机索引中,选择N个交换机索引,将所述N个交换机索引确定为所述待发送流对应的交换机索引,所述N为大于1且小于或等于所述M的整数。The source host selects N switch indexes from the M switch indexes, and determines the N switch indexes as the switch indexes corresponding to the to-be-sent flow, where N is greater than 1 and less than or equal to the The integer of M.
  10. 一种网络测量方法,其特征在于,包括:A network measurement method, characterized in that it comprises:
    交换机接收来自源主机的第二报文,所述第二报文包括主机索引、第一时间窗口和交换机索引,所述交换机与所述交换机索引对应;The switch receives a second message from the source host, where the second message includes a host index, a first time window, and a switch index, and the switch corresponds to the switch index;
    所述交换机向目的主机转发所述第二报文;The switch forwards the second message to the destination host;
    所述交换机根据所述第二报文,更新与所述交换机索引和所述第一时间窗口对应记录的流值。The switch updates the flow value recorded corresponding to the switch index and the first time window according to the second message.
  11. 如权利要求10所述的方法,其特征在于,所述交换机更新与所述交换机索引和所述第一时间窗口对应记录的流值,包括:The method according to claim 10, wherein the update of the flow value recorded by the switch corresponding to the switch index and the first time window comprises:
    所述交换机将所述交换机索引和所述第一时间窗口对应记录的流值加1;或者,The switch adds 1 to the switch index and the flow value recorded corresponding to the first time window; or,
    所述交换机将所述交换机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The switch adds the size of the second packet to the switch index and the flow value recorded corresponding to the first time window.
  12. 如权利要求10或11所述的方法,其特征在于,所述交换机更新与所述交换机索引和所述第一时间窗口对应记录的流值,包括:The method according to claim 10 or 11, wherein the update of the flow value recorded by the switch corresponding to the switch index and the first time window comprises:
    所述交换机根据所述第一时间窗口,确定与所述第一时间窗口对应的第二记录槽组,所述第二记录槽组包括多个记录槽;Determining, by the switch, a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group including a plurality of recording slots;
    所述交换机根据所述交换机索引,在所述第二记录槽组中确定与所述交换机索引对应的第二记录槽;Determining, by the switch, a second recording slot corresponding to the switch index in the second recording slot group according to the switch index;
    所述交换机将所述第二记录槽记录的流值加1,或者,将所述第二记录槽记录的流值加所述第二报文的大小。The switch adds 1 to the flow value recorded in the second recording slot, or adds the flow value recorded in the second recording slot to the size of the second packet.
  13. 一种网络测量方法,其特征在于,包括:A network measurement method, characterized in that it comprises:
    目的主机接收交换机转发的来自源主机的第二报文,所述第二报文包括主机索引、第一时间窗口和交换机索引,所述交换机与所述交换机索引对应;The destination host receives a second message from the source host forwarded by the switch, where the second message includes a host index, a first time window, and a switch index, and the switch corresponds to the switch index;
    所述目的主机根据所述第二报文,更新与所述主机索引和所述第一时间窗口对应记录的流值。The destination host updates the flow value recorded corresponding to the host index and the first time window according to the second message.
  14. 如权利要求13所述的方法,其特征在于,所述目的主机更新与所述主机索引和所述第一时间窗口对应记录的流值,包括:The method according to claim 13, wherein the update of the flow value recorded by the destination host corresponding to the host index and the first time window comprises:
    所述目的主机将所述主机索引和所述第一时间窗口对应记录的流值加1;或者,The destination host adds 1 to the host index and the stream value recorded corresponding to the first time window; or,
    所述目的主机将所述主机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The destination host adds the host index and the flow value recorded corresponding to the first time window to the size of the second packet.
  15. 如权利要求13或14所述的方法,其特征在于,所述目的主机更新与所述主机索引和所述第一时间窗口对应记录的流值,包括:The method according to claim 13 or 14, wherein the update of the flow value recorded by the destination host corresponding to the host index and the first time window comprises:
    所述目的主机根据所述第一时间窗口,确定与所述第一时间窗口对应的第三记录槽组,所述第三记录槽组包括多个记录槽;Determining, by the destination host, a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including a plurality of recording slots;
    所述目的主机根据所述主机索引,在所述第三记录槽组中确定与所述主机索引对应的第三记录槽;Determining, by the destination host, a third recording slot corresponding to the host index in the third recording slot group according to the host index;
    所述目的主机将所述第三记录槽记录的流值加1,或者,将所述第三记录槽记录的流值加所述第二报文的大小。The destination host adds 1 to the stream value recorded in the third recording slot, or adds the stream value recorded in the third recording slot to the size of the second packet.
  16. 如权利要求13至15任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 13 to 15, wherein the method further comprises:
    若所述目的主机确定所述第一时间窗口大于本地时间窗口,将所述本地时间窗口更新为所述第一时间窗口。If the destination host determines that the first time window is greater than the local time window, update the local time window to the first time window.
  17. 如权利要求16所述的方法,其特征在于,所述方法还包括:The method of claim 16, wherein the method further comprises:
    所述目的主机接收来自控制器的第三报文,所述第三报文包括第二时间窗口;The destination host receives a third message from the controller, where the third message includes a second time window;
    若所述目的主机确定所述第二时间窗口大于所述本地时间窗口,将所述本地时间窗口更新为所述第二时间窗口。If the destination host determines that the second time window is greater than the local time window, update the local time window to the second time window.
  18. 如权利要求16或17所述的方法,其特征在于,所述方法还包括:The method according to claim 16 or 17, wherein the method further comprises:
    若所述目的主机确定所述本地时间窗口进入新的时间窗口,将所述本地时间窗口更新为所述新的时间窗口,并向控制器发送所述新的时间窗口。If the destination host determines that the local time window enters a new time window, update the local time window to the new time window, and send the new time window to the controller.
  19. 一种网络测量方法,其特征在于,包括:A network measurement method, characterized in that it comprises:
    在第一时间窗口结束,控制器针对要测量的流从源主机获取与主机索引和所述第一时间窗口对应记录的第一流值,以及从目的主机获取与所述主机索引和所述第一时间窗口对应记录的第二流值;所述流由所述源主机发送到所述目的主机,所述主机索引是根据所述流确定的;At the end of the first time window, for the flow to be measured, the controller obtains the first flow value recorded corresponding to the host index and the first time window from the source host, and obtains the first flow value corresponding to the host index and the first time window from the destination host. The time window corresponds to the recorded second flow value; the flow is sent from the source host to the destination host, and the host index is determined according to the flow;
    所述控制器确定所述第一流值和所述第二流值不一致时,确定所述流发生丢包。When the controller determines that the first flow value is inconsistent with the second flow value, it determines that packet loss occurs in the flow.
  20. 如权利要求19所述的方法,其特征在于,所述控制器针对要测量的从源主机获取与主机索引和所述第一时间窗口对应记录的第一流值,包括:21. The method according to claim 19, wherein the controller acquiring the first stream value recorded corresponding to the host index and the first time window from the source host for the measurement to be measured comprises:
    所述控制器确定所述源主机中与所述第一时间窗口对应的第一记录槽组;Determining, by the controller, a first record slot group corresponding to the first time window in the source host;
    所述控制器在所述第一记录槽组中确定与所述主机索引对应的第一记录槽,并确定所述第一记录槽中记录的所述第一流值;The controller determines the first recording slot corresponding to the host index in the first recording slot group, and determines the first stream value recorded in the first recording slot;
    所述控制器从目的主机获取与主机索引和所述第一时间窗口对应记录的第二流值,包括:The controller acquiring the second stream value recorded corresponding to the host index and the first time window from the destination host includes:
    所述控制器确定所述目的主机中与所述第一时间窗口对应的第三记录槽组;Determining, by the controller, a third record slot group corresponding to the first time window in the destination host;
    所述控制器在所述第三记录槽组中确定与所述主机索引对应的第三记录槽,并确定所述第三记录槽中记录的所述第二流值。The controller determines a third recording slot corresponding to the host index in the third recording slot group, and determines the second stream value recorded in the third recording slot.
  21. 如权利要求19或20所述的方法,其特征在于,所述方法还包括:The method according to claim 19 or 20, wherein the method further comprises:
    所述控制器确定交换机中与所述第一时间窗口对应的第二记录槽组;所述交换机用于将来自所述源主机的所述流转发至所述目的主机;The controller determines a second record slot group in the switch corresponding to the first time window; the switch is used to forward the flow from the source host to the destination host;
    所述控制器在所述第二记录槽组中确定与所述交换机的交换机索引对应的N个第二记录槽,并确定所述N个第二记录槽中分别记录的第三流值,所述N为大于1的整数;The controller determines the N second recording slots corresponding to the switch index of the switch in the second recording slot group, and determines the third stream values respectively recorded in the N second recording slots, so Said N is an integer greater than 1;
    所述控制器根据所述第一流值、所述第二流值和所述N个第三流值,确定所述流在所述交换机的丢包数量。The controller determines the number of lost packets of the flow at the switch according to the first flow value, the second flow value, and the N third flow values.
  22. 一种网络测量装置,其特征在于,包括处理模块和收发模块:A network measurement device is characterized in that it comprises a processing module and a transceiver module:
    所述处理模块,用于获取待发送流对应的主机索引、第一时间窗口和交换机索引,并在第一报文中增加所述主机索引、所述交换机索引和所述第一时间窗口,得到第二报文,所述第一报文为所述流包括的任意报文;The processing module is configured to obtain the host index, the first time window, and the switch index corresponding to the stream to be sent, and add the host index, the switch index, and the first time window to the first message to obtain A second message, where the first message is any message included in the flow;
    所述收发模块,用于通过所述交换机索引对应的交换机向目的主机发送所述第二报文;The transceiver module is configured to send the second message to the destination host through the switch corresponding to the switch index;
    所述处理模块,还用于根据所述第二报文,更新与所述主机索引和所述第一时间窗口对应记录的流值。The processing module is further configured to update the flow value recorded corresponding to the host index and the first time window according to the second message.
  23. 如权利要求22所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 22, wherein the processing module is specifically configured to:
    将所述主机索引、和/或、所述交换机索引、和/或、所述第一时间窗口增加于所述第一报文的以太网包头与网络协议IP包头之间,得到所述第二报文。The host index, and/or, the switch index, and/or, the first time window is added between the Ethernet header of the first packet and the network protocol IP header to obtain the second Message.
  24. 如权利要求22或23所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 22 or 23, wherein the processing module is specifically configured to:
    将所述主机索引和所述第一时间窗口对应记录的流值加1;或者,Add 1 to the host index and the stream value recorded corresponding to the first time window; or,
    将所述主机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The size of the second packet is added to the host index and the flow value recorded corresponding to the first time window.
  25. 如权利要求22至24任一项所述的装置,其特征在于,所述处理模块,具体用于:The device according to any one of claims 22 to 24, wherein the processing module is specifically configured to:
    根据所述第一时间窗口,确定与所述第一时间窗口对应的第一记录槽组,所述第一记录槽组包括多个记录槽;Determining a first recording slot group corresponding to the first time window according to the first time window, the first recording slot group including a plurality of recording slots;
    根据所述主机索引,在所述第一记录槽组中确定与所述主机索引对应的第一记录槽;Determining, in the first recording slot group, a first recording slot corresponding to the host index according to the host index;
    将所述第一记录槽记录的流值加1,或者,将所述第一记录槽记录的流值加所述第二报文的大小。The stream value recorded in the first recording slot is added by 1, or the stream value recorded in the first recording slot is added to the size of the second packet.
  26. 如权利要求22至25任一项所述的装置,其特征在于,所述处理模块,具体用于:The device according to any one of claims 22 to 25, wherein the processing module is specifically configured to:
    对所述流的流键进行哈希运算,根据运算结果确定所述流键在哈希表中的位置,将所述位置确定为所述主机索引。Perform a hash operation on the stream key of the stream, determine the position of the stream key in the hash table according to the result of the operation, and determine the position as the host index.
  27. 如权利要求22至26任一项所述的装置,其特征在于,所述处理模块,具体用于:The device according to any one of claims 22 to 26, wherein the processing module is specifically configured to:
    将本地时间窗口确定为所述第一时间窗口。Determine the local time window as the first time window.
  28. 如权利要求27所述的装置,其特征在于,所述收发模块,还用于:The device according to claim 27, wherein the transceiver module is further configured to:
    接收来自控制器的第三报文,所述第三报文包括第二时间窗口;Receiving a third message from the controller, where the third message includes a second time window;
    所述处理模块,还用于:The processing module is also used for:
    若确定所述第二时间窗口大于所述本地时间窗口,将所述本地时间窗口更新为所述第二时间窗口。If it is determined that the second time window is greater than the local time window, update the local time window to the second time window.
  29. 如权利要求27或28所述的装置,其特征在于,所述处理模块,还用于:The device according to claim 27 or 28, wherein the processing module is further configured to:
    若确定所述本地时间窗口进入新的时间窗口,将所述本地时间窗口更新为所述新的时间窗口,并向控制器发送所述新的时间窗口。If it is determined that the local time window enters a new time window, update the local time window to the new time window, and send the new time window to the controller.
  30. 如权利要求22至29任一项所述的装置,其特征在于,所述处理模块,具体用于:The device according to any one of claims 22 to 29, wherein the processing module is specifically configured to:
    确定控制器预先为所述源主机划分的M个交换机索引,所述M个交换机索引互不相同,所述M为大于1的整数;Determine the M switch indexes pre-divided by the controller for the source host, the M switch indexes are different from each other, and the M is an integer greater than 1;
    从所述M个交换机索引中,选择N个交换机索引,将所述N个交换机索引确定为所述待发送流对应的交换机索引,所述N为大于1且小于或等于所述M的整数。From the M switch indexes, N switch indexes are selected, and the N switch indexes are determined as the switch indexes corresponding to the flow to be sent. The N is an integer greater than 1 and less than or equal to the M.
  31. 一种网络测量装置,其特征在于,包括处理模块和收发模块:A network measurement device is characterized in that it comprises a processing module and a transceiver module:
    所述收发模块,用于接收来自源主机的第二报文,所述第二报文包括主机索引、第一时间窗口和交换机索引,并向目的主机转发所述第二报文,所述交换机与所述交换机索引对应;The transceiver module is configured to receive a second message from a source host, the second message including a host index, a first time window, and a switch index, and to forward the second message to the destination host, the switch Corresponding to the switch index;
    所述处理模块,用于根据所述第二报文,更新与所述交换机索引和所述第一时间窗口对应记录的流值。The processing module is configured to update the flow value recorded corresponding to the switch index and the first time window according to the second message.
  32. 如权利要求31所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 31, wherein the processing module is specifically configured to:
    将所述交换机索引和所述第一时间窗口对应记录的流值加1;或者,Add 1 to the switch index and the flow value recorded corresponding to the first time window; or,
    将所述交换机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The size of the second packet is added to the switch index and the flow value recorded corresponding to the first time window.
  33. 如权利要求31或32所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 31 or 32, wherein the processing module is specifically configured to:
    根据所述第一时间窗口,确定与所述第一时间窗口对应的第二记录槽组,所述第二记录槽组包括多个记录槽;Determining a second recording slot group corresponding to the first time window according to the first time window, the second recording slot group including a plurality of recording slots;
    根据所述交换机索引,在所述第二记录槽组中确定与所述交换机索引对应的第二记录槽;Determine, in the second record slot group, a second record slot corresponding to the switch index according to the switch index;
    将所述第二记录槽记录的流值加1,或者,将所述第二记录槽记录的流值加所述第二报文的大小。The stream value recorded in the second recording slot is added by 1, or the stream value recorded in the second recording slot is added to the size of the second packet.
  34. 一种网络测量装置,其特征在于,包括处理模块和收发模块:A network measurement device is characterized in that it comprises a processing module and a transceiver module:
    所述收发模块,用于接收交换机转发的来自源主机的第二报文,所述第二报文包括主机索引、第一时间窗口和交换机索引;所述交换机与所述交换机索引对应;The transceiver module is configured to receive a second message from a source host forwarded by a switch, the second message including a host index, a first time window, and a switch index; the switch corresponds to the switch index;
    所述处理模块,用于根据所述第二报文,更新与所述主机索引和所述第一时间窗口对应记录的流值。The processing module is configured to update the flow value recorded corresponding to the host index and the first time window according to the second message.
  35. 如权利要求34所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 34, wherein the processing module is specifically configured to:
    将所述主机索引和所述第一时间窗口对应记录的流值加1;或者,Add 1 to the host index and the stream value recorded corresponding to the first time window; or,
    将所述主机索引和所述第一时间窗口对应记录的流值加所述第二报文的大小。The size of the second packet is added to the host index and the flow value recorded corresponding to the first time window.
  36. 如权利要求34或35所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 34 or 35, wherein the processing module is specifically configured to:
    根据所述第一时间窗口,确定与所述第一时间窗口对应的第三记录槽组,所述第三记录槽组包括多个记录槽;Determining a third recording slot group corresponding to the first time window according to the first time window, the third recording slot group including a plurality of recording slots;
    根据所述主机索引,在所述第三记录槽组中确定与所述主机索引对应的第三记录槽;Determine, in the third recording slot group, a third recording slot corresponding to the host index according to the host index;
    将所述第三记录槽记录的流值加1,或者,将所述第三记录槽记录的流值加所述第二报文的大小。The stream value recorded in the third recording slot is added by 1, or the stream value recorded in the third recording slot is added to the size of the second packet.
  37. 如权利要求34至36任一项所述的装置,其特征在于,所述处理模块,还用于:The device according to any one of claims 34 to 36, wherein the processing module is further configured to:
    若确定所述第一时间窗口大于本地时间窗口,将所述本地时间窗口更新为所述第一时间窗口。If it is determined that the first time window is greater than the local time window, update the local time window to the first time window.
  38. 如权利要求37所述的装置,其特征在于,所述收发模块,还用于:The device according to claim 37, wherein the transceiver module is further configured to:
    接收来自控制器的第三报文,所述第三报文包括第二时间窗口;Receiving a third message from the controller, where the third message includes a second time window;
    所述处理模块,还用于:The processing module is also used for:
    若确定所述第二时间窗口大于所述本地时间窗口,将所述本地时间窗口更新为所述第二时间窗口。If it is determined that the second time window is greater than the local time window, update the local time window to the second time window.
  39. 如权利要求37或38所述的装置,其特征在于,所述处理模块,还用于:The device according to claim 37 or 38, wherein the processing module is further configured to:
    若确定所述本地时间窗口进入新的时间窗口,将所述本地时间窗口更新为所述新的时间窗口,并向控制器发送所述新的时间窗口。If it is determined that the local time window enters a new time window, update the local time window to the new time window, and send the new time window to the controller.
  40. 一种网络测量装置,其特征在于,包括处理模块和收发模块:A network measurement device is characterized in that it comprises a processing module and a transceiver module:
    所述处理模块与所述收发模块协作,用于在第一时间窗口结束,针对要测量的流从源主机获取与主机索引和所述第一时间窗口对应记录的第一流值,以及从目的主机获取与所述主机索引和所述第一时间窗口对应记录的第二流值;其中,所述流由所述源主机发送到所述目的主机,所述主机索引根据所述流确定;The processing module cooperates with the transceiver module and is configured to end the first time window, obtain the first stream value recorded corresponding to the host index and the first time window from the source host for the stream to be measured, and obtain the first stream value from the destination host Acquiring a second stream value recorded corresponding to the host index and the first time window; wherein the stream is sent from the source host to the destination host, and the host index is determined according to the stream;
    所述处理模块,还用于确定所述第一流值和所述第二流值不一致时,确定所述流发生丢包。The processing module is further configured to determine that packet loss occurs in the flow when it is determined that the first flow value and the second flow value are inconsistent.
  41. 如权利要求40所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 40, wherein the processing module is specifically configured to:
    确定所述源主机中与所述第一时间窗口对应的第一记录槽组;Determine the first record slot group corresponding to the first time window in the source host;
    在所述第一记录槽组中确定与所述主机索引对应的第一记录槽,并确定所述第一记录槽中记录的所述第一流值;Determine the first recording slot corresponding to the host index in the first recording slot group, and determine the first stream value recorded in the first recording slot;
    确定所述目的主机中与所述第一时间窗口对应的第三记录槽组;Determining a third record slot group corresponding to the first time window in the destination host;
    在所述第三记录槽组中确定与所述主机索引对应的第三记录槽,并确定所述第三记录槽中记录的所述第二流值。A third recording slot corresponding to the host index is determined in the third recording slot group, and the second stream value recorded in the third recording slot is determined.
  42. 如权利要求40或41所述的装置,其特征在于,所述处理模块,还用于:The device according to claim 40 or 41, wherein the processing module is further configured to:
    确定交换机中与所述第一时间窗口对应的第二记录槽组,所述交换机用于将来自所述源主机的流转发至所述目的主机;Determining a second record slot group corresponding to the first time window in the switch, where the switch is used to forward the flow from the source host to the destination host;
    在所述第二记录槽组中确定与所述交换机索引对应的N个第二记录槽,并确定所述N个第二记录槽分别记录的第三流值,并根据所述第一流值、所述第二流值和所述N个第三流值,确定所述流在所述交换机的丢包数量,所述N为大于1的整数。Determine N second recording slots corresponding to the switch index in the second recording slot group, and determine the third stream values respectively recorded by the N second recording slots, and according to the first stream value, The second flow value and the N third flow values determine the number of lost packets of the flow at the switch, and the N is an integer greater than 1.
  43. 一种网络测量装置,其特征在于,包括处理器和通信接口,所述通信接口用于接收来自所述装置之外的其它装置的信号并传输至所述处理器或将来自所述处理器的信号发送给所述网络测量装置之外的其它装置,所述处理器通过逻辑电路或执行代码指令用于实现如权利要求1至21中任一项所述的方法。A network measurement device, which is characterized by comprising a processor and a communication interface, the communication interface being used to receive signals from other devices other than the device and transmit them to the processor or to transfer signals from the processor The signal is sent to a device other than the network measurement device, and the processor is used to implement the method according to any one of claims 1 to 21 through a logic circuit or executing code instructions.
  44. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被网络测量装置执行时,实现如权利要求1至21中任一项所述的方法。A computer-readable storage medium, characterized in that a computer program or instruction is stored in the computer-readable storage medium, and when the computer program or instruction is executed by a network measurement device, it implements any of claims 1 to 21. The method described in one item.
  45. 一种计算机程序产品,其特征在于,包括计算机程序或指令,当所述计算机程序或指令在计算机上执行时,使得如权利要求1至21中任一项所述的方法被执行。A computer program product, characterized by comprising a computer program or instruction, when the computer program or instruction is executed on a computer, the method according to any one of claims 1 to 21 is executed.
  46. 一种通信系统,其特征在于,包括如权利要求22至30任一项所述的网络测量装置,权利要求31至33任一项所述的网络测量装置,权利要求34至39任一项所述的网络测量装置以及权利要求40至42任一项所述的网络测量装置。A communication system, characterized by comprising the network measurement device according to any one of claims 22 to 30, the network measurement device according to any one of claims 31 to 33, and the network measurement device according to any one of claims 34 to 39. The network measurement device described above and the network measurement device described in any one of claims 40 to 42.
PCT/CN2021/100828 2020-06-19 2021-06-18 Network measurement method and apparatus WO2021254474A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010565111.2 2020-06-19
CN202010565111.2A CN113824606B (en) 2020-06-19 2020-06-19 Network measurement method and device

Publications (1)

Publication Number Publication Date
WO2021254474A1 true WO2021254474A1 (en) 2021-12-23

Family

ID=79268494

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/100828 WO2021254474A1 (en) 2020-06-19 2021-06-18 Network measurement method and apparatus

Country Status (2)

Country Link
CN (1) CN113824606B (en)
WO (1) WO2021254474A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754662B1 (en) * 2000-08-01 2004-06-22 Nortel Networks Limited Method and apparatus for fast and consistent packet classification via efficient hash-caching
US20040221132A1 (en) * 2000-12-20 2004-11-04 Kjell Torkelsson Efficient mapping of signal elements to a limited range of identifiers
CN102946330A (en) * 2012-09-29 2013-02-27 华为技术有限公司 Method, device and system for network packet loss measurement
US20160149788A1 (en) * 2014-11-20 2016-05-26 Telefonaktiebolaget L M Ericsson (pubI) Passive Performance Measurement for Inline Service Chaining
CN107005439A (en) * 2014-11-20 2017-08-01 瑞典爱立信有限公司 The passive performance measurement linked for online service

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105281969B (en) * 2014-07-04 2019-11-29 华为技术有限公司 A kind of statistical information acquisition methods and device
CN105429822B (en) * 2015-11-30 2018-07-20 东南大学 Hop-by-hop packet loss of link measurement method on end-to-end path based on software defined network
CN107769988B (en) * 2016-08-19 2021-05-04 华为技术有限公司 Method, device and network equipment for sending information and detecting message loss
CN106506399B (en) * 2016-11-03 2019-10-25 盛科网络(苏州)有限公司 Realize the method, apparatus and data exchange chip of MFP
CN109660414B (en) * 2017-10-11 2021-01-08 上海层峰网络科技有限公司 End-to-end service monitoring method and device based on SDN network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754662B1 (en) * 2000-08-01 2004-06-22 Nortel Networks Limited Method and apparatus for fast and consistent packet classification via efficient hash-caching
US20040221132A1 (en) * 2000-12-20 2004-11-04 Kjell Torkelsson Efficient mapping of signal elements to a limited range of identifiers
CN102946330A (en) * 2012-09-29 2013-02-27 华为技术有限公司 Method, device and system for network packet loss measurement
US20160149788A1 (en) * 2014-11-20 2016-05-26 Telefonaktiebolaget L M Ericsson (pubI) Passive Performance Measurement for Inline Service Chaining
CN107005439A (en) * 2014-11-20 2017-08-01 瑞典爱立信有限公司 The passive performance measurement linked for online service

Also Published As

Publication number Publication date
CN113824606A (en) 2021-12-21
CN113824606B (en) 2023-10-24

Similar Documents

Publication Publication Date Title
US20230011387A1 (en) Data processing method and nvme storage device
JP7039685B2 (en) Traffic measurement methods, devices, and systems
EP3758412A1 (en) Multichannel data transmission method and apparatus
CN107508719B (en) Method and device for measuring network time delay and network node
US11836385B2 (en) High speed data packet flow processing
WO2021052374A1 (en) Network congestion control method, node, system and storage medium
US11637787B2 (en) Preventing duplication of packets in a network
US20180285294A1 (en) Quality of service based handling of input/output requests method and apparatus
US20220191140A1 (en) Data transmission control method, apparatus, and storage medium
WO2017112260A1 (en) Technologies for sideband performance tracing of network traffic
US20230042747A1 (en) Message Processing Method and Device, Storage Medium, and Electronic Device
CN111817977A (en) Network congestion control method and device
CN111026324B (en) Updating method and device of forwarding table entry
KR20220045982A (en) A method for transmitting a data packet, and an apparatus for implementing the method
WO2016202158A1 (en) Message transmission method and device, and computer-readable storage medium
US10284672B2 (en) Network interface
US8289963B2 (en) Process and system for calculating distances between wireless nodes
WO2021254474A1 (en) Network measurement method and apparatus
WO2023078232A1 (en) Transmission method and apparatus
JP7003467B2 (en) Packet classification program, packet classification method and packet classification device
CN113810284A (en) Method and device for determining message sending path
JP7284266B2 (en) Audio stream switching method and apparatus
US20120317316A1 (en) System to manage input/output performance and/or deadlock in network attached storage gateway connected to a storage area network environment
WO2024055584A1 (en) Delay measurement method, electronic device, and computer-readable medium
WO2022247307A1 (en) Message transmission method and apparatus

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: 21826484

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: 21826484

Country of ref document: EP

Kind code of ref document: A1