CN114584493A - Method and device for measuring data flow - Google Patents

Method and device for measuring data flow Download PDF

Info

Publication number
CN114584493A
CN114584493A CN202011383567.3A CN202011383567A CN114584493A CN 114584493 A CN114584493 A CN 114584493A CN 202011383567 A CN202011383567 A CN 202011383567A CN 114584493 A CN114584493 A CN 114584493A
Authority
CN
China
Prior art keywords
data
stream
flow
storage space
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011383567.3A
Other languages
Chinese (zh)
Inventor
许延伟
黄群
章瑞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202011383567.3A priority Critical patent/CN114584493A/en
Priority to PCT/CN2021/133234 priority patent/WO2022111596A1/en
Publication of CN114584493A publication Critical patent/CN114584493A/en
Pending legal-status Critical Current

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/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/06Generation of reports
    • H04L43/062Generation of reports related to network traffic

Landscapes

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

Abstract

The embodiment of the application discloses a method and a device for measuring data flow, belonging to the technical field of communication. The method is applied to network equipment and comprises the following steps: receiving a target data packet, and determining a data storage space corresponding to a target data stream to which the target data packet belongs in each data row of a target data table based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet. And if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value of the target data stream in the data storage space. And if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in the target data table based on the measured value of the target data packet. By adopting the method and the device, the error of the measured value of the data stream can be relatively small.

Description

Method and device for measuring data flow
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for measuring data flow.
Background
In the field of communications, data flow measurements are crucial for analyzing communication link quality and for developing various communication strategies. The data flow measurement may include a data packet quantity measurement of the data flow, a byte number measurement of the data flow, and the like.
Currently, the sketch algorithm is widely applied to flow measurement. Specifically, a sketch data table with m rows and n columns is set, each grid in the sketch data table corresponds to one bucket, each data row of the sketch data table corresponds to one hash function, and the hash functions corresponding to the data rows are different. When a data packet is received, for each data row of the sketch data table, performing hash calculation by using a hash function corresponding to the data row and a stream identifier corresponding to the data packet to obtain a hash result, and accumulating the measurement value of the target data packet to a bucket corresponding to the data row of the hash result. Thus, the measured value of the data flow recorded in each bucket of the sketch data table is the sum of the measured values corresponding to flow identifications having the same hash result. When the measurement value corresponding to the specified flow identifier is queried, hash calculation is performed on the specified flow identifier by using the hash function corresponding to each data row, so that m buckets in which the measurement value corresponding to the specified flow identifier is recorded can be determined. Then, the minimum measurement value recorded in the m buckets is taken as the measurement value corresponding to the specified flow identifier.
However, the error of the measured value of any data stream obtained by the sketch data table is related to the sum of the measured values of all data streams recorded by the sketch data table, and the larger the sum of the measured values of all data streams recorded is, the larger the error of the measured value of each data stream is.
Disclosure of Invention
The embodiment of the application provides a method and a device for measuring data flow, which can solve the problem of large error of the measured value of the data flow in the related technology, and the technical scheme is as follows:
in a first aspect, a method for data flow measurement is provided, where the method is applied to a network device, and the method includes:
receiving a target data packet, and determining a data storage space corresponding to a target data stream to which the target data packet belongs in each data row of a target data table based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet. And if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space. And if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in the target data table based on the measured value of the target data packet.
In the solution shown in the embodiment of the present application, the flow identifier may be set according to an actual requirement, and is used to uniquely identify one data flow, for example, the flow identifier may be a source address and a destination address carried in a packet of the data flow, and for example, the flow identifier may also be quintuple information carried in the packet of the data flow. A data stream comprises a plurality of data packets, and the measurement value of the data stream is the sum of the measurement values of all the data packets included in the data stream. Specifically, the measured value may be the number of packets included in the data stream, or may also be the total number of bytes of the packets included in the data stream, and so on. The first data stream may also be referred to as a big stream, which is referred to as one data storage space.
The target data table is used for recording data such as stream identification of the data stream, and measurement value of the data stream. For example, the target data table may be a sketch data table. Each data row of the target data table may correspond to a first eigenvalue calculation function, and different data rows may correspond to different first eigenvalue functions. The first feature value calculation function may be a hash function. For each data row, the first eigenvalue calculation function corresponding to the data row may have m calculation results, where m is the number of columns of the target data table, that is, the number of data storage spaces corresponding to each data row. Each of the m calculation results corresponds to one data storage space of the data line, that is, the m calculation results correspond to the m data storage spaces one to one. The data storage space may also be referred to as a bucket, and in a case that the target data table is a sketch data table, the data storage space corresponding to the target data table may be referred to as a sketch bucket.
According to the scheme shown in the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a big stream is judged, and if the data stream is the big stream, the stream identifier and the measured value of the data packet are recorded separately, so that the measured value of the big stream is relatively accurate. And because the measured values of the large flow are recorded separately, only the measured values of the data flows except the large flow can be recorded in the target data table, so that the accuracy of the obtained measured values is relatively high when the measured values of the data flows are recovered due to the reduction of the number of the recorded data flows.
In a second aspect, a method for data flow measurement is provided, where the method is used for a network device, and the method includes:
receiving a target data packet, and for each data row of a target data table, determining a data storage space corresponding to the data row of a target data stream to which the target data packet belongs on the basis of a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet. And recording the measured value of the target data stream in the data storage space based on the measured value corresponding to the target data packet. And if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space.
With reference to the first aspect or the second aspect, in a possible implementation manner, if the target data stream is a first data stream corresponding to the data storage space, determining a measured value of the target data stream based on a measured value of the target data packet, and recording the measured value in the data storage space, includes:
if the stream identifier and the measured value of the first data stream are not recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, taking the measured value of the target data packet as the measured value of the target data stream, taking the stream identifier of the target data stream as the stream identifier of the first data stream corresponding to the data storage space, and correspondingly recording the stream identifier and the measured value of the target data in the data storage space.
And if the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is the same as the flow identification of the first data flow recorded in the data storage space, accumulating the measured value of the target data packet to the measured value of the first data flow recorded in the data storage space.
If the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is different from the flow identification of the first data flow recorded in the data storage space, determining whether a comparative measured value is recorded in the data storage space, if no comparative measured value is recorded, recording the measured value of the target data packet in the data storage space as the comparative measured value corresponding to the data storage space, and if a comparative measured value is recorded, accumulating the measured value of the target data packet on the comparative measured value recorded in the data storage space.
If the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the first data stream recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, updating the stream identifier of the first data stream recorded in the data storage space to the stream identifier of the target data stream, updating the measurement value of the first data stream recorded in the data storage space to the measurement value of the target data packet, and updating the comparison measurement value recorded in the data storage space to 0.
In the solution shown in the embodiment of the present application, for a data storage space of a target data table, a first data stream a entering the data storage space for recording may be regarded as a large stream of the data storage space.
And after a third data stream C enters the data storage space, comparing the measured values of the data stream C and the data stream B to determine whether to replace the large stream.
If the measured value of the data stream B is not larger than the measured value of the data stream A, the data stream A is considered to be still a big stream of the data storage space, next, after a third data stream C enters the data storage space, the measured value of the data stream A and the sum of the measured values of the data stream B and the data stream C are compared, if the sum of the measured values is larger than the measured value of the data stream A, the big stream of the data storage space is replaced by the data stream C, and if the sum of the measured values is not larger than the measured value of the data stream A, the data stream A is considered to be still the big stream of the data storage space.
That is, for a data storage space, its large stream is instead updatable.
With reference to the first aspect, in a possible implementation manner, if a stream identifier and a measured value of a first data stream are recorded in the data storage space, and a stream identifier of a target data stream is different from the stream identifier of the first data stream recorded in the data storage space, the method further includes:
and if the accumulated comparison measured value recorded in the data storage space is smaller than the measured value of the first data stream recorded in the data storage space, determining that the target data stream is not the first data stream corresponding to the data storage space, and recording the measured value of the target data stream in a target data table based on the measured value of the target data packet.
In the solution shown in the embodiment of the present application, for a large flow, a measured value and a flow identifier are recorded correspondingly, and if it is determined that a target data flow is not a large flow, the target data flow is recorded in another manner in a target data table. Therefore, the measured value of the non-big flow can be recovered subsequently without being influenced by the measured value of the big flow, so that the finally obtained statistical measured value of the non-big flow is more accurate.
With reference to the first aspect or the second aspect, in a possible implementation manner, if the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the first data stream recorded in the data storage space, the storage space identifier of the data storage space, the stream identifier of the first data stream recorded in the data storage space, and the measurement value of the first data stream are sent to a controller.
And if the accumulated comparison measurement value recorded in the data storage space is smaller than the measurement value of the first data stream recorded in the data storage space, sending the stream identifier corresponding to the target data packet to the controller as the stream identifier of the second data stream. The second data stream may also be referred to as a non-big stream.
In addition, each time the preset duration elapses, the locally stored target data table is sent to the controller, and the locally stored target data table is initialized.
In the scheme shown in the embodiment of the present application, for one data storage space, after a large stream is replaced, the stream identifier and the measured value of the replaced large stream are uploaded to the controller, so that the subsequent controller calculates the measured value summed by the large stream. In addition, when the target data stream is judged to be a non-major stream, the stream identifier of the target data stream is uploaded to the controller, so that the subsequent controller can know which data stream needs to be calculated in the target data table through an optimization algorithm.
After the data are reported to the controller, the controller can recover the measured value of the data stream, and the processing resource of the network equipment can be effectively saved. After the report, the local related data of the network equipment can be deleted, so that the storage resource is saved.
With reference to the first aspect or the second aspect, in a possible implementation manner, before sending the flow identifier corresponding to the target packet to the controller as the flow identifier of the second data flow, the method further includes: and determining the stream identifier corresponding to the target data packet which is not sent to the controller, and recording the stream identifier corresponding to the target data packet.
In the solution shown in the embodiment of the present application, in order to avoid repeatedly recording or repeatedly sending the stream identifier of the non-big stream, when it is determined that the target data stream is not the big stream, it may be determined first whether the stream identifier of the target data stream is already uploaded to the controller. If the upload is already done, the upload is not repeated.
With reference to the first aspect or the second aspect, in a possible implementation manner, determining that a flow identifier corresponding to the target packet is not sent to a controller, and recording the flow identifier corresponding to the target packet includes:
and determining that the flow identification corresponding to the target data packet is not recorded in a locally stored bloom filter, and recording the flow identification corresponding to the target data packet in the bloom filter.
In the solution shown in the embodiment of the present application, in order to record the flow identifier of the non-mainstream and save the storage resource as much as possible, the flow identifier of the non-mainstream may not be directly recorded, but a Bloom Filter (Bloom Filter) is used to record the measurement value of the non-mainstream. Specifically, the Bloom Filter may be set, and before recording or sending the flow identifier of the non-big flow, it may be determined whether the flow identifier is recorded in the Bloom Filter, and if the flow identifier is not recorded, the flow identifier may be recorded or sent. After recording or transmitting the flow identification of the non-large flow, the flow identification may be recorded in the Bloom Filter.
In addition, one Bloom Filter may be set for each data storage space in the target data table, and one Bloom Filter may also be set for one target data table. In the case that one Bloom Filter is set in each data storage space, the Bloom Filter may be stored in the corresponding data storage space, before recording or transmitting the stream identifier of the non-streamlet, it may be determined whether the stream identifier is recorded in the Bloom Filter stored in the data storage space corresponding to the stream identifier of the non-streamlet, and after recording or transmitting the stream identifier of the non-streamlet, the stream identifier may be recorded in the Bloom Filter stored in the corresponding data storage space
With reference to the first aspect, in a possible implementation manner, recording, in a target data table, a measured value of the target data stream based on the measured value of the target data packet includes:
and calculating a function based on the second characteristic value corresponding to the data row and the stream identification of the target data packet, determining an accumulation coefficient corresponding to the target data stream, multiplying the measured value of the target data packet by the accumulation coefficient to obtain an adjusted measured value of the target data packet, and accumulating the adjusted measured value of the target data packet to the measured value of the second data stream recorded in the data storage space.
In the scheme shown in the embodiment of the present application, the second data stream may be referred to as a non-big stream. For each data line of the target data table, besides a first characteristic value calculation function, a second characteristic value calculation function can also be corresponding to the data line. The second eigenvalue calculation function may also be a hash function, and the second eigenvalue calculation function corresponding to each data line is different.
For each data storage space corresponding to the determined target data stream, when recording the measured value of the target data stream based on the measured value of the target data packet, the to-be-calculated value corresponding to the target data packet may be input into the second eigenvalue calculation function corresponding to the data row where the data storage space is located, so as to obtain the accumulation coefficient corresponding to the stream identifier. Wherein the accumulation coefficient may be a fractional number. Then, the measured value of the target data packet is multiplied by the accumulation coefficient to obtain the adjusted measured value of the target data packet. Finally, the adjusted measurement value of the target data packet is added to the measurement value of the non-mainstream recorded in the data storage space.
Therefore, when the measured values of the non-mainstream are recorded in the target data table, the measured values are multiplied by the corresponding accumulation coefficients and then recorded, so that when the measured values of the data stream are restored by adopting the solution optimization problem subsequently, the constructed equation set can be constrained by the accumulation coefficients, the number of the equation set solutions is relatively small, and correspondingly, the errors of the finally obtained solutions (the statistical measured values of the non-mainstream) are relatively small.
With reference to the second aspect, in a possible implementation manner, recording, in the data storage space, a measured value of the target data stream based on a measured value corresponding to the target data packet includes:
and determining an accumulation coefficient corresponding to the target data stream based on a second eigenvalue calculation function corresponding to the data row and the stream identification of the target data packet, multiplying the measurement value of the target data packet by the accumulation coefficient to obtain an adjusted measurement value of the target data packet, and accumulating the adjusted measurement value of the target data packet to the measurement value of the data stream recorded in the data storage space.
In a third aspect, a method for data flow measurement is provided, which is applied to a network device, and the method includes:
and receiving a target data packet, and determining a first data storage space corresponding to the target data stream to which the target data packet belongs in a corresponding first data table based on a third eigenvalue calculation function and the stream identification corresponding to the target data packet. And if the target data stream is a big stream corresponding to the first data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the first data storage space. And if the target data stream is not the first data stream corresponding to the first data storage space, recording the measured value of the target data stream in a target data table based on the measured value of the target data packet.
In a possible implementation manner, if the target data stream is a first data stream corresponding to the first data storage space, determining a measured value of the target data stream based on a measured value of the target data packet, and recording the measured value of the target data stream in the first data storage space, includes:
and if the first data storage space is empty, determining that the target data stream is the first data stream corresponding to the first data storage space, taking the measured value of the target data packet as the measured value of the target data stream, taking the stream identifier of the target data stream as the stream identifier of the first data stream corresponding to the first data storage space, and correspondingly recording the stream identifier and the measured value of the target data in the first data storage space.
And if the first data storage space is not empty and the stream identifier of the target data stream is the same as the stream identifier of the first data stream recorded in the first data storage space, accumulating the measured value of the target data packet to the measured value of the first data stream recorded in the first data storage space.
If the first data storage space is not empty and the flow identifier of the target data flow is different from the flow identifier of the first data flow recorded in the first data storage space, determining whether a comparative measured value is recorded in the first data storage space, if no comparative measured value is recorded, recording the measured value of the target data packet in the first data storage space as the comparative measured value corresponding to the first data storage space, and if a comparative measured value is recorded, accumulating the measured value of the target data packet on the comparative measured value recorded in the first data storage space.
If the accumulated comparison measurement value recorded in the first data storage space is greater than the measurement value of the first data stream recorded in the first data storage space, determining that the target data stream is the first data stream corresponding to the first data storage space, updating the stream identifier of the first data stream recorded in the first data storage space to the stream identifier of the target data stream, updating the measurement value of the first data stream recorded in the first data storage space to the measurement value of the target data packet, and updating the comparison measurement value recorded in the first data storage space to 0.
In one possible implementation, if the first data storage space is not empty and the stream identifier of the target data stream is different from the stream identifier of the first data stream recorded in the first data storage space, the method further includes:
and if the accumulated comparison measurement value recorded in the first data storage space is smaller than the measurement value of the first data stream recorded in the first data storage space, determining that the target data stream is not the first data stream corresponding to the first data storage space, and recording the measurement value of the target data stream in a target data table based on the measurement value of the target data packet.
In one possible implementation, recording the measurement value of the target data stream in a target data table based on the measurement value of the target data packet includes:
for each data row of a target data table, determining a second data storage space corresponding to a target data stream to which the target data packet belongs in the data row based on a first eigenvalue calculation function corresponding to the data row and a stream identifier corresponding to the target data packet, determining an accumulation coefficient corresponding to the target data stream based on a second eigenvalue calculation function corresponding to the data row and the stream identifier of the target data packet, multiplying a measured value of the target data packet by the accumulation coefficient to obtain an adjusted measured value of the target data packet, and accumulating the adjusted measured value of the target data packet to the measured value of the second data stream recorded in the second data storage space.
In one possible implementation, if the accumulated comparison measurement value recorded in the first data storage space is greater than the measurement value of the first data stream recorded in the first data storage space, the method further includes:
sending, to a controller, a stream identifier of a first data stream and a measured value of the first data stream, which are recorded in the first data storage space correspondingly;
if the accumulated comparison measure recorded in the first data storage space is less than the measure of the first data stream recorded in the first data storage space, the method further comprises:
sending the stream identifier corresponding to the target data packet to the controller as a stream identifier of a second data stream;
the method further comprises the following steps:
and sending the first data table and the target data table which are locally stored to the controller every time a preset time length passes, and initializing the first data table and the target data table which are locally stored.
In a possible implementation manner, before sending the flow identifier corresponding to the target packet to the controller as the flow identifier of the second data flow, the method further includes:
and determining that the flow identification corresponding to the target data packet is not sent to the controller, and recording the flow identification corresponding to the target data packet.
In a possible implementation manner, determining that the flow identifier corresponding to the target packet is not sent to the controller, and recording the flow identifier corresponding to the target packet includes:
and determining that the flow identification corresponding to the target data packet is not recorded in a locally stored bloom filter, and recording the flow identification corresponding to the target data packet in the bloom filter.
In a fourth aspect, a method for data flow measurement is provided, where the method is applied to a controller, and the method includes:
and receiving the stream identification of the first data stream, the corresponding measured value, the corresponding storage space identification of the data storage space, the stream identification of the second data stream and the target data table which are sent by the network equipment. And screening the measured values of the first data streams corresponding to the same stream identifier from the measured values of the first data streams recorded by the target data table to obtain a first measured value of each first data stream recorded by the target data table. And accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream. And screening the second measured values of the first data flows corresponding to the same flow identifier from the received second measured values corresponding to the flow identifier of each first data flow to obtain a third measured value corresponding to the flow identifier of each first data flow. And accumulating the first measured value and the third measured value corresponding to the same flow identification in the first measured value of each first data flow recorded by the target data table and the received third measured value corresponding to the flow identification of each first data flow to obtain a statistical measured value corresponding to the flow identification of each first data flow. And determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow and the target data table.
In a possible implementation manner, the screening, among the measured values of the first data streams recorded in the target data table, the measured values of the first data streams corresponding to the same stream identifier to obtain a first measured value of each first data stream recorded in the target data table includes:
and taking the maximum measured value of the first data stream corresponding to the same stream identifier as the first measured value of the first data stream corresponding to the same stream identifier in the measured values of the first data stream recorded by the target data table.
The screening, in the received second measurement value corresponding to the flow identifier of each first data flow, the second measurement values of the first data flows corresponding to the same flow identifier to obtain a third measurement value corresponding to the flow identifier of each first data flow, includes:
and in the received second measurement value corresponding to the flow identifier of each first data flow, taking the maximum second measurement value of the first data flows corresponding to the same flow identifier as the third measurement value of the first data flows corresponding to the same flow identifier.
In a possible implementation manner, the determining, based on the received flow identifier of the second data flow and the target data table, a statistical measurement value corresponding to the flow identifier of each second data flow includes:
for each data storage space in the target data table, determining a stream identifier of a second data stream corresponding to the data storage space in the stream identifiers of the received second data streams based on a first characteristic value calculation function corresponding to the data row in which the data storage space is located, and determining an accumulation coefficient corresponding to the stream identifier of each second data stream corresponding to the data storage space based on a second characteristic value calculation function corresponding to the data row in which the data storage space is located. And taking the statistical measurement value corresponding to the stream identification of each second data stream corresponding to the data storage space as an unknown number to be multiplied by the corresponding accumulation coefficient, accumulating, and taking the measurement value of the data stream recorded by the data storage space as an accumulation result to obtain a target equation corresponding to the data storage space. And forming a target equation set based on the target equations corresponding to the data storage spaces in the target data table. And based on a linear optimization algorithm, solving the target equation set by taking the minimum sum of the statistical measurement values corresponding to the stream identifications of the received second data streams as an optimization target to obtain the statistical measurement value corresponding to the stream identification of each second data stream.
In the application, the measured values of the non-mainstream are recorded in the target data table after being multiplied by the corresponding accumulation coefficients, correspondingly, when the target equation is constructed, the unknowns are also multiplied by the corresponding accumulation coefficients, and through the processing, the number of solutions of the equation set can be relatively small, so that the error of the finally obtained solution (the statistical measured value of each non-mainstream) is relatively small.
In one possible implementation, the method further includes: and accumulating the measurement values corresponding to the same flow identification in the obtained statistical measurement value corresponding to the flow identification of the first data flow and the statistical measurement value corresponding to the flow identification of the second data flow to obtain a total measurement value corresponding to each flow identification.
In a fifth aspect, a method for data flow measurement is provided, where the method is applied to a controller, and the method includes:
and receiving the stream identification of the first data stream, the corresponding measured value, the corresponding storage space identification of the data storage space, the stream identification of the second data stream and the target data table which are sent by the network equipment. And screening the measured values of the first data streams corresponding to the same stream identifier from the measured values of the first data streams recorded by the target data table to obtain a first measured value of each first data stream recorded by the target data table. And accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream. And screening the second measurement values corresponding to the flow identifications of the first data flows corresponding to the same flow identification in the received second measurement values corresponding to the flow identifications of each first data flow to obtain a third measurement value corresponding to the flow identification of each first data flow. And accumulating the first measurement value and the second measurement value corresponding to the same flow identification in the first measurement value of each first data flow recorded by the target data table and the received third measurement value corresponding to the flow identification of each first data flow to obtain the statistical measurement value corresponding to the flow identification of each first data flow. And determining the statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow, the measurement value of the data flow recorded in each data storage space in the target data table and the obtained statistical measurement value corresponding to the flow identification of each first data flow.
In a possible implementation manner, determining, based on the received flow identifier of the second data flow, the measured value of the data flow recorded in each data storage space in the target data table, and the obtained statistical measured value corresponding to the flow identifier of each first data flow, a statistical measured value corresponding to the flow identifier of each second data flow includes:
and for each data storage space of the target data table, determining an accumulation coefficient corresponding to the stream identification of each first data stream corresponding to the data storage space based on a second eigenvalue calculation function corresponding to the data line where the data storage space is located. And multiplying the statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space by the corresponding accumulation coefficient to obtain the adjusted statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space. And determining the stream identification of the second data stream corresponding to the data storage space in the stream identification of the received second data stream based on the first characteristic value calculation function corresponding to the data line where the data storage space is located, and determining the accumulation coefficient corresponding to the stream identification of each second data stream corresponding to the data storage space based on the second characteristic value calculation function corresponding to the data line where the data storage space is located. And taking the statistical measurement value corresponding to the flow identification of each second data flow corresponding to the data storage space as an unknown number to be multiplied by the corresponding accumulation coefficient, adding the statistical measurement value to the adjusted statistical measurement value corresponding to the flow identification of each first data flow corresponding to the data storage space, taking the measurement value of the data flow recorded by the data storage space as an accumulation result, and obtaining a target equation corresponding to the data storage space. And forming a target equation set based on the target equations corresponding to the data storage spaces in the target data table. And based on a linear optimization algorithm, solving the target equation set by taking the minimum sum of the statistical measurement values corresponding to the stream identifications of the received second data streams as an optimization target to obtain the statistical measurement value corresponding to the stream identification of each second data stream.
In a sixth aspect, a method for data flow measurement is provided, the method being applied to a controller, the method comprising:
and receiving the flow identification and the measured value of the first data flow, the flow identification of the second data flow, the target data table and the first data table which are sent by the network equipment. And accumulating the measured values corresponding to the same flow identification in the received measured values of the first data flows and the measured values recorded by the first data table to obtain the statistical measured value corresponding to the flow identification of each first data flow. And determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow and the target data table.
In one possible implementation manner, determining, based on the received flow identifier of the second data flow and the target data table, a statistical measurement value corresponding to the flow identifier of each second data flow includes:
for each data storage space in the target data table, determining a stream identifier of at least one target second data stream corresponding to the data storage space in the stream identifiers of the received second data streams based on a first characteristic value calculation function corresponding to the data line where the data storage space is located, and determining an accumulation coefficient corresponding to the stream identifier of each target second data stream based on a second characteristic value calculation function corresponding to the data line where the data storage space is located. Taking a statistical measurement value corresponding to the stream identifier of each target second data stream in the stream identifiers of the at least one target second data stream as an unknown number to be multiplied by a corresponding accumulation coefficient, and accumulating the statistical measurement values, and taking the measurement values of the data streams recorded in the data storage space as accumulation results to obtain a target equation;
and forming a target equation set based on the target equations corresponding to the data storage spaces in the target data table. And based on a linear optimization algorithm, solving the target equation set by taking the minimum sum of the statistical measurement values corresponding to the stream identifications of the received second data streams as an optimization target to obtain the statistical measurement value corresponding to the stream identification of each second data stream.
In one possible implementation, the method further includes:
and accumulating the measured values corresponding to the same flow identifier in the obtained statistical measured value corresponding to the flow identifier of the first data flow and the statistical measured value corresponding to the flow identifier of the second data flow to obtain a total measured value corresponding to each flow identifier.
In a seventh aspect, an apparatus for data flow measurement is provided, which is configured to perform the first aspect or any one of the possible implementation manners of the first aspect. In particular, the apparatus comprises means for performing the first aspect or any one of its possible implementations of the first aspect.
In an eighth aspect, an apparatus for data flow measurement is provided, which is configured to perform the second aspect or any one of the possible implementations of the second aspect. In particular, the apparatus comprises means for performing the second aspect or any one of its possible implementations of the second aspect.
In a ninth aspect, an apparatus for data flow measurement is provided, which is configured to perform any one of the possible implementation manners of the third aspect or the third aspect. In particular, the apparatus comprises means for performing the third aspect or any one of its possible implementations of the third aspect.
In a tenth aspect, an apparatus for data flow measurement is provided, which is configured to perform any one of the possible implementations of the fourth aspect or the fourth aspect. In particular, the apparatus comprises means for performing any one of the possible implementations of the fourth aspect or the fourth aspect.
In an eleventh aspect, an apparatus for data flow measurement is provided, which is configured to perform any one of the possible implementations of the fifth aspect or the fifth aspect. In particular, the apparatus comprises means for performing the fifth aspect or any one of its possible implementations of the fifth aspect.
In a twelfth aspect, an apparatus for data flow measurement is provided, which is configured to perform any one of the possible implementation manners of the sixth aspect or the sixth aspect. In particular, the apparatus comprises means for performing any one of the possible implementations of the sixth aspect or the sixth aspect.
In a thirteenth aspect, a network device is provided, the network device comprising a processor and a memory, wherein:
the memory stores instructions that are executed by the processor to implement the method as described in any of the first, second and third aspects above.
In a fourteenth aspect, there is provided a controller comprising a processor and a memory, wherein:
the memory stores instructions that are executed by the processor to implement the method of any of the fourth, fifth and sixth aspects above.
In a fifteenth aspect, there is provided a computer readable storage medium having instructions stored therein, the instructions being loaded and executed by a processor to implement the method of any of the first to sixth aspects described above.
In a sixteenth aspect, there is provided a computer program product comprising instructions that are loaded and executed by a processor to implement the method according to any one of the first to sixth aspects.
In a seventeenth aspect, a system for data flow measurement is provided, the system comprising a network device and a controller, wherein:
the network device is configured to perform the method according to the first aspect;
the controller is configured to perform the method according to the fourth aspect.
In an eighteenth aspect, a system for data flow measurement is provided, where the system includes a network device and a controller, where:
the network device is configured to perform the method according to the second aspect;
the controller is adapted to perform the method of the fifth aspect as described above.
In a nineteenth aspect, a system for data flow measurement is provided, where the system includes a network device and a controller, where:
the network device is configured to perform the method according to the third aspect;
the controller is adapted to perform the method according to the sixth aspect.
In a twentieth aspect, there is provided a processor for performing the method of the first to sixth aspects. In the course of performing these methods, the processes of transmitting data and receiving data in the above-described methods may be understood as a process of outputting the above-described data by a processor, and a process of receiving the above-described data by a processor. When outputting the data, the processor outputs the data to the transceiver for transmission by the transceiver. The data may also need to be processed after being output by the processor before reaching the transceiver. Similarly, when the processor receives the input data, the transceiver receives the data and inputs the data into the processor. Further, after the transceiver receives the data, the data may need to be processed before being input to the processor.
Based on the above principle, for example, the aforementioned method may be understood as that the processor outputs the stream identifier and the measured value of the first data stream, the identifier of the second data stream, and the target data table. As another example, receiving the flow identification and measurement for the first data flow, the identification of the second data flow, the target data table may be understood as the processor receiving the flow identification and measurement for the first data flow, the identification of the second data flow, the target data table.
The operations relating to the processor, such as transmitting, sending and receiving, may be understood more generally as operations relating to the processor, such as outputting and receiving, inputting, etc., than those performed directly by the rf circuitry and antenna, unless specifically stated otherwise, or if not contradicted by their actual role or inherent logic in the associated description.
In implementation, the processor may be a processor dedicated to performing the methods, or may be a processor executing computer instructions in a memory to perform the methods, such as a general-purpose processor. The Memory may be a non-transitory (non-transitory) Memory, such as a Read Only Memory (ROM), which may be integrated on the same chip as the processor or may be separately disposed on different chips.
In a twenty-first aspect, embodiments of the present application provide a chip system, where the chip system includes a processor and an interface, where the interface is configured to obtain a program or an instruction, and the processor is configured to call the program or the instruction to implement a function related to any one of the first to sixth aspects, for example, to determine or process data related to the method, where the data may be a measurement value, a flow identifier, or the like.
In one possible design, the system-on-chip further includes a memory for storing program instructions and data necessary for the network device. The chip system may be formed by a chip, or may include a chip and other discrete devices.
Drawings
Fig. 1 is a flowchart of a method for measuring data flow according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a target data table provided in an embodiment of the present application;
fig. 3 is a flowchart of a method for determining a big flow according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a target data table provided by an embodiment of the present application;
fig. 5 is a flowchart of a method for measuring data flow according to an embodiment of the present application;
fig. 6 is a flowchart of a method for determining a measurement value corresponding to a flow identifier of a non-macro flow according to an embodiment of the present disclosure;
fig. 7 is a flowchart of a method for measuring data flow according to an embodiment of the present application;
fig. 8 is a flowchart of a method for measuring data flow according to an embodiment of the present application;
fig. 9 is a flowchart of a method for determining a measurement value corresponding to a flow identifier of a non-macro flow according to an embodiment of the present disclosure;
fig. 10 is a flowchart of a method for measuring data flow according to an embodiment of the present application;
fig. 11 is a flowchart of a method for measuring data flow according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of an apparatus for data flow measurement according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of an apparatus for data flow measurement according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a network device according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of a controller according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a method for measuring data flow, which can be realized by network equipment. The network device may be a device for receiving and forwarding a data packet, for example: routers, switches, etc. The network device may calculate and record the measurements of the received data packets. In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are separately recorded, so that the measured value of the major stream is relatively accurate. And because the measured values of the large flow are recorded separately, only the measured values of the data flows except the large flow can be recorded in the target data table, so that the accuracy of the obtained measured values is relatively high when the measured values of the data flows are recovered due to the reduction of the number of the recorded data flows.
The data flow measuring method provided by the embodiment of the application can be applied to the scenes of network security, forwarding strategy planning and the like. For example, in a network security scenario, a Denial of Service (DOS) attack may be detected through data flow measurement, specifically, a network device may obtain the number of data packets of a data flow by executing the data flow measurement method provided in this embodiment of the present application, and count the number of data packets of a data flow with the same destination address, if a large number of data packets sent to a certain destination address exist within a period of time, it may be preliminarily determined that a host corresponding to the destination address may be attacked by DOS, and further perform corresponding defense processing.
Referring to fig. 1, an embodiment of the present application provides a method for measuring a data flow, where a processing flow of the method may include the following steps:
step 101, receiving a target data packet, and for each data row of a target data table, determining a data storage space corresponding to a target data stream to which the target data packet belongs in the data row based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet.
The flow identifier may be set according to actual requirements, and is used to uniquely identify one data flow, for example, the flow identifier may be a source address and a destination carried in a data packet of the data flow, and for example, the flow identifier may also be quintuple information carried in the data packet of the data flow. A data stream comprises a plurality of data packets, and the measurement value of the data stream is the sum of the measurement values of all the data packets included in the data stream.
The target data table is used for recording data such as stream identification of the data stream, and measurement value of the data stream. For example, the target data table may be a sketch data table. Each data row of the target data table may correspond to a first eigenvalue calculation function, and different data rows may correspond to different first eigenvalue functions. The first feature value calculation function may be a hash function.
For each data row, the first eigenvalue calculation function corresponding to the data row may have m calculation results, where m is the number of columns of the target data table, that is, the number of data storage spaces corresponding to each data row. Each of the m calculation results corresponds to one data storage space of the data line, that is, the m calculation results correspond to the m data storage spaces one to one. The data storage space may also be referred to as a bucket, and in a case that the target data table is a sketch data table, the data storage space corresponding to the target data table may be referred to as a sketch bucket.
In implementation, when a network device receives a data packet, it determines the data storage space corresponding to the data stream to which the data packet belongs in the target data table. That is, it is determined in which data storage space corresponding to the target data table the measured value of the data packet needs to be recorded. For convenience of description, a currently received packet is referred to herein as a destination packet, and a data stream to which the packet belongs is referred to as a destination data stream.
For each data row of the target data table, the data storage space corresponding to the data stream to which the target data packet belongs in the data row may be determined, and the determining method may be as follows:
firstly, preprocessing the flow identification corresponding to the target data packet to obtain a numerical value to be calculated. The preprocessing may be to convert the stream identifier into a binary number, and correspondingly, the to-be-calculated value is the binary number corresponding to the stream identifier. Then, the numerical value to be calculated is input into the first characteristic value calculation function, and the output result corresponding to the flow identifier is obtained. And finally, determining the data storage space corresponding to the output result corresponding to the flow identification in the corresponding relation between the output result and the data storage space. The output result of the first characteristic value calculation function is the storage space identification of the data storage space, and the storage space identification of each data storage space of the target data table is different. The storage space identification may be a number, e.g., 1, 2, 3, etc.
As shown in FIG. 2, the flow ID corresponding to the target packet is K1Measured value is V1The first characteristic value calculation function corresponding to the first data row of the target data table is h1The first eigenvalue calculation function corresponding to the second data row is h1By analogy, the first characteristic value calculation function corresponding to the mth data line is hm. To K1Preprocessing to obtain the numerical values to be calculated, and respectively substituting the numerical values to be calculated into h1、h1……hmAnd m output results are obtained, and each data result corresponds to one data storage space corresponding to the target data table.
And 102, if the target data stream is the first data stream corresponding to the data storage space, determining a measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space.
The first data stream may also be referred to as a big stream, and for ease of understanding, the first data stream is hereinafter referred to as a big stream. The measured value can be set according to actual needs, for example, the measured value can be the number of packets included in the data flow, and for example, the measured value can also be the total number of bytes of the packets included in the data flow, and so on.
In an implementation, upon receiving a target packet, the network device may calculate a measurement value for the packet. After the data storage space corresponding to the target data stream is determined, the measured value of the target data packet can be recorded in different modes according to whether the target data stream is a big stream or not. For each data storage space corresponding to the determined target data stream, a method for determining whether the target data stream is a big stream and recording a measured value of the target data packet may specifically include the following steps, as shown in fig. 3:
and S1021, determining whether the stream identification and the measured value of the large stream are recorded in the data storage space.
The step is to judge whether the target data packet is the first data packet entering the data storage space for recording after the data storage space is initialized. It should be noted here that the initialization of the data storage space is performed at the end of each measurement period, and specifically, the data recorded in the data storage space may be deleted. Then, the above-mentioned "determining whether the target data packet is the first data packet entering the data storage space for recording after the data storage space is initialized" means that it is determined whether the target data packet is the first data packet entering the data storage space for recording in the current measurement period.
And S1022, if the stream identifier and the measured value of the large stream are not recorded in the data storage space, determining that the target data stream is the large stream corresponding to the data storage space, taking the measured value of the target data packet as the measured value of the target data stream, taking the stream identifier of the target data stream as the stream identifier of the first data stream corresponding to the data storage space, and correspondingly recording the stream identifier and the measured value of the target data in the data storage space.
If the stream identifier and the measured value of the streamlet are not recorded in the data storage space, it is indicated that the target data packet is the first data packet entering the data storage space for recording after the data storage space is initialized, that is, the target data packet is the first data packet entering the data storage space for recording in the current measurement period. In this case, the target data stream may be treated as a large stream, and the measured value of the target data stream may be recorded in the data storage space.
For example, the flow ID corresponding to the target packet is K1Measured value is V1If the stream id and the measured value of the streamlet are not recorded in the data storage space, the stream id of the streamlet is recorded as K1Recording the measured value of the mass flow as V1. In the case of a measured value of the number of packets of the data stream, V1=1。
And S1023, if the flow identification and the measured value of the big flow are recorded in the data storage space, determining whether the flow identification of the target data flow is the same as the flow identification of the big flow recorded in the data storage space.
If the stream identification and the measured value of the big stream are recorded in the data storage space, it indicates that other data packets are recorded in the data storage space before the target data packet. In this case, it may be continuously determined whether the target data stream to which the target packet belongs is a recorded large stream.
And S1024, if the stream identification of the target data stream is the same as the stream identification of the large stream recorded in the data storage space, accumulating the measured value of the target data packet to the measured value of the first data stream recorded in the data storage space.
If the stream identifier of the target data stream is the same as the stream identifier of the large stream recorded in the data storage space, it indicates that other data packets belonging to the target data stream are still in the data storage space before the target data packet for recording, and the target data stream is the large stream corresponding to the data storage space. In this case, the recorded measurement values of the large stream may be updated.
For example, the flow ID corresponding to the target packet is K1Measured value is V1A stream identification K of the large stream recorded in the data storage space1The measured value is V, and after the flow identification corresponding to the target data packet is determined to be the same as the flow identification of the recorded large flow, the measured value V of the target data packet is determined1Adding up to the recorded high flow measurement value V, i.e. updating the high flow measurement value V to (V + V)1)。
S1025, if the stream identification of the target data stream is different from the stream identification of the first data stream recorded in the data storage space, determining whether a comparative measurement value is recorded in the data storage space.
In order to determine whether a data stream is a big stream, the sum of the measured value of the data stream and the measured values of other data streams following the data stream needs to be known, so the sum of the measured values of other data streams besides the big stream can be recorded in the data storage space, which is referred to as a comparison measured value herein.
And S1026, if the comparison measurement value is not recorded, recording the measurement value of the target data packet in the data storage space as the comparison measurement value corresponding to the data storage space.
If the comparison measurement value is not recorded, it indicates that the target data packet is the first data packet entering the data storage space for recording after the data storage space is initialized, that is, the target data packet is the first data packet entering the data storage space for recording in the current measurement period, except the recorded data packet of the big stream. In this case, the measured value of the target data packet may be used as the comparative measured value corresponding to the data storage space.
For example, the flow ID corresponding to the packet is K1Measured value is V1If no comparison measurement value is recorded in the data storage space, the comparison measurement value is recorded as V1
S1027, if the comparison measurement value is recorded, the measurement value of the target data packet is added to the comparison measurement value recorded in the data storage space.
If the comparison measurement value is recorded, it indicates that other data packets besides the recorded data packet of the big stream are recorded in the data storage space before the target data packet. In this case, the recorded comparative measurements may be updated.
For example, the flow ID corresponding to the target packet is K1Measured value is V1In this data storage space, a comparison measurement value C is recorded. Measuring value V of target data packet1Added to the recorded comparison measurement value C, i.e. the comparison measurement value C is updated to (C + V)1)。
S1028, determining whether the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the big stream recorded in the data storage space.
After the comparison measurement value recorded in the data storage space is updated, the measurement value of the recorded big stream and the updated comparison measurement value need to be compared to judge whether the recorded big stream is still a big stream.
S1029, if the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the mainstream recorded in the data storage space, determining that the target data stream is the mainstream corresponding to the data storage space, updating the stream identifier of the mainstream recorded in the data storage space to the stream identifier of the target data stream, updating the measurement value of the mainstream recorded in the data storage space to the measurement value of the target data packet, and updating the comparison measurement value recorded in the data storage space to 0.
If the accumulated comparison measure recorded in the data storage space is greater than the measure of the big stream recorded in the data storage space, it is indicated that the currently recorded big stream is no longer a big stream. In this case, it is necessary to update the flow identification of the large flow, the measured value of the large flow, and the comparison measured value, which are recorded in the data storage space, with the data flow to which the target packet belongs as a new large flow.
For example, the flow ID corresponding to the target packet is K1Measured value is V1Measuring the target data packetValue V1After adding to the recorded high flow measurement value C, the comparison measurement value is updated from C to (C + V)1). And, the updated comparison measurement value (C + V)1) If the measured value is larger than the measured value V of the recorded big stream, the target data stream to which the target data packet belongs is taken as a new big stream, and the stream identification of the big stream is updated to K1Updating the measured value of the mass flow to V1. Since no other data packet has been received after the target data packet at this time, all the comparison measurement values are updated to 0.
And 103, if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in the target data table based on the measured value of the target data packet.
In practice, if the accumulated comparison measurement value recorded in the data storage space is not greater than the measurement value of the recorded big stream, it is determined that the target data stream to which the target data packet belongs is not the big stream corresponding to the data storage space.
For example, the flow ID corresponding to the target packet is K1Measured value is V1The measured value V of the target data packet1After the addition of the comparison measurement value C to the recorded high-flow measurement value C, the comparison measurement value is updated from C to (C + V)1). Updated comparative measurement (C + V)1) Not greater than the measured value V of the recorded big stream, it may be determined that the target data stream to which the target packet belongs is not the big stream corresponding to the data storage space.
In this case, there are several methods for recording the measured value of the target data stream in the data storage space, and the following two methods are listed for explanation.
The method I comprises the steps of calculating a function based on a second characteristic value corresponding to a data line where the data storage space is located and a stream identification of a target data packet, determining an accumulation coefficient corresponding to the target data stream, multiplying a measured value of the target data packet by the accumulation coefficient to obtain an adjusted measured value of the target data packet, and accumulating the adjusted measured value of the target data packet to a measured value of a non-big stream recorded in the data storage space.
In addition to the stream identification, the measured value of the major stream and the comparison measured value of the major stream, the measured value of the non-major stream can be recorded in each data storage space corresponding to the target data table.
For each data row of the target data table, besides a first characteristic value calculation function, a second characteristic value calculation function can be corresponding. The second eigenvalue calculation function may also be a hash function, and the second eigenvalue calculation function corresponding to each data line is different.
For each data storage space corresponding to the determined target data stream, when recording the measured value of the target data stream based on the measured value of the target data packet, the to-be-calculated value corresponding to the target data packet may be input into the second eigenvalue calculation function corresponding to the data row where the data storage space is located, so as to obtain the accumulation coefficient corresponding to the stream identifier. Wherein the accumulation coefficient may be a fractional number. It should be noted here that the value to be calculated corresponding to the target data packet may be obtained by preprocessing when determining the data storage space corresponding to the data stream to which the target data packet belongs.
Then, the measured value of the target data packet is multiplied by the accumulation coefficient to obtain the adjusted measured value of the target data packet. Finally, the adjusted measurement value of the target data packet is added to the measurement value of the non-mainstream recorded in the data storage space.
As shown in fig. 4, on the basis of fig. 2, the first data row of the target data table also corresponds to a second eigenvalue calculation function g1The second data row also corresponds to a second eigenvalue function of g2, and so on, and the mth data row also corresponds to a second eigenvalue calculation function of gm. To K1Preprocessing to obtain the numerical values to be calculated, and respectively substituting the numerical values to be calculated into h1、h2……hmAnd m output results are obtained, and each data result corresponds to one data storage space corresponding to the target data table. Then, the values to be calculated are respectively substituted into g1 and g2 … … gm to obtain m accumulation coefficients. Finally, g is mixediResulting cumulative coefficient XiAnd the measured value V1Multiply by hiResulting output junctionOn the non-mainstream measurement value recorded in the data storage space corresponding to the result, i.e. h in the ith rowiThe output result of (2) is corresponding to the measured value D of the non-mainstream recorded in the data storage spaceiIs updated to (D)i+Xi*V1) Wherein i represents the number of rows, i is greater than or equal to 1 and less than or equal to m.
And the second method is to directly add the measured value of the target data packet to the measured value of the non-big stream recorded in the data storage space.
For example, the flow ID corresponding to the target packet is K1Measured value is V1The measured value V of the target data packet1Added to the recorded measured values of the non-macrostream, i.e. the recorded measured values of the non-macrostream are updated to (D + V)1)。
After each measurement period is finished, the measurement value of the data stream in the measurement period may be recovered, that is, the measurement value of the data stream in the processing period is determined. The recovery of the measured value of the data stream in the measurement period can be realized by the device or the controller. The controller can be a network device such as a router and a switch, a terminal device such as a mobile phone, a desktop computer, a notebook computer and a tablet computer, and a cloud device such as a single server and a server cluster.
If the method is implemented by the present apparatus, in step S1029, when it is determined that the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the streamlet recorded in the data storage space, the stream identifier of the streamlet currently recorded in the data storage space and the measurement value of the streamlet are taken out and stored. After determining that the target data stream is not the big stream corresponding to the data storage space in step 103, the stream identifier corresponding to the target data packet may be recorded as the stream identifier of the non-big stream. At the end of each measurement period, the locally stored target data table may be taken out to be stored in another storage space, and the currently stored target data table is initialized.
If implemented by the controller, in step S1029, after determining that the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the big stream recorded in the data storage space, the storage space identifier of the data storage space, the stream identifier of the big stream currently recorded in the data storage space, and the measurement value of the big stream may be correspondingly transmitted to the controller. After determining that the target data flow is not a big flow corresponding to the data storage space in step 103, the flow identifier corresponding to the target data packet may be sent to the controller as a flow identifier of a non-big flow. At the end of each measurement cycle, the locally stored target data table may be sent to the controller and initialized.
In addition, in order to avoid repeated recording or repeated transmission of the flow id of the non-large flow, a Bloom Filter (Bloom Filter) may be provided, and before recording or transmitting the flow id of the non-large flow, it may be determined whether the flow id is recorded in the Bloom Filter, and if the flow id is not recorded, the flow id is recorded or transmitted. After recording or transmitting the flow identification of the non-large flow, the flow identification may be recorded in the Bloom Filter. The use of Bloom Filter is explained below:
the Bloom Filter is essentially a data structure consisting of a long array and a plurality of hash functions. When a flow identifier needs to be recorded in the Bloom Filter, each hash function in the Bloom Filter may be used to calculate the hash value of the flow identifier. Then, the position corresponding to the hash value in the Bloom Filter array is treated as 1. When it is required to query whether a flow identifier is recorded in the Bloom Filter, each hash function in the Bloom Filter is also used to calculate a hash value of the flow identifier, and then, it is queried whether the position in the array of the Bloom Filter corresponding to the calculated hash value is 1, if all the positions are 1, it indicates that the Bloom Filter records the element, and if not all the positions are 1, it indicates that the Bloom Filter does not record the element.
It should be noted here that one Bloom Filter may be set for each data storage space in the target data table, and one Bloom Filter may also be set for one target data table. In the case that one Bloom Filter is set in each data storage space, the Bloom Filter may be stored in the corresponding data storage space, before recording or transmitting the stream identifier of the non-streamlet, it may be determined whether the stream identifier is recorded in the Bloom Filter stored in the data storage space corresponding to the stream identifier of the non-streamlet, and after recording or transmitting the stream identifier of the non-streamlet, the stream identifier may be recorded in the Bloom Filter stored in the corresponding data storage space.
In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are recorded separately, so that the measured value of the major stream is relatively accurate. And because the measured values of the large flow are recorded separately, only the measured values of the data flows except the large flow can be recorded in the target data table, so that the accuracy of the obtained measured values is relatively high when the measured values of the data flows are recovered due to the reduction of the number of the recorded data flows.
The controller will be described below as implementing the measured value recovery of the data stream. The method for implementing the measured value recovery of the data stream by the device is similar to the method for implementing the measured value recovery of the data stream by the controller, and is not described again here. It should be noted here that the recovery of the measurement value of the data stream is a part of the measurement of the data stream.
Referring to fig. 5, for the method for measuring data flow shown in fig. 3, the method for the controller to recover the measurement of data flow may include the following steps:
step 201, receiving a stream identifier of a large stream, a corresponding measured value, a corresponding storage space identifier of a data storage space, a stream identifier of the large stream, and a target data table, which are sent by a network device.
Step 202, in the measured values of the large flows recorded in the target data table, the measured values of the large flows corresponding to the same flow identifier are screened, and a first measured value of each large flow recorded in the target data table is obtained.
In practice, since the measured value of any data packet is recorded in the target data table in the corresponding data storage space of each data row, the measured value of the same big stream may be recorded in a plurality of data storage spaces in the target data table. In this case, the measured values of the large flows recorded in the target data table may be filtered. The screening method can be various, and the following methods are listed for illustration:
the method I is to take the maximum measured value of the large flow corresponding to the same flow identification as the first measured value of the large flow in the measured values of the large flow recorded by the target data table.
For example, for large flows K1In the three data storage spaces of the target data table, the measured values are recorded as V1、V2、V3. Comparison V1、V2、V3Of which the largest measured value is taken as the big flow K1The first measurement value of (a).
And secondly, taking the average value of the measured values of the large flows corresponding to the same flow identification as the first measured value of the large flow in the measured values of the large flows recorded by the target data table.
For example, for large flows K1In the three data storage spaces of the target data table, the measured values are recorded as V1、V2、V3. Calculating V1、V2、V3Average value of (2)
Figure BDA0002809106670000171
Will be provided with
Figure BDA0002809106670000172
As a large flow K1The first measurement value of (a).
And thirdly, taking any one measured value of the large flows corresponding to the same flow identification as a first measured value of the large flow in the measured values of the large flows recorded by the target data table.
For example, for large flows K1In the three data storage spaces of the target data table, the measured values are respectively recorded as V1、V2、V3. Randomly choosing V1、V2、V3Is taken as the big flow K1First measurement ofMagnitude.
And step 203, accumulating the measured values of the large flows corresponding to the same storage space identifier and the same flow identifier in the received measured values of the large flows to obtain a second measured value corresponding to the flow identifier of each received large flow.
In practice, when the network device records the measured values of the large flows in the target data table, it may happen that a large flow is replaced in the same data storage space for many times, and after each replacement, the measured values of the large flow are sent to the controller. In this way, the controller receives a plurality of measured values of the big stream corresponding to the data storage space (i.e. a plurality of measured values corresponding to the same storage space identifier and the same stream identifier), which are actually measured values of the big stream at different times in the measurement period, and in order to count the measured values of the big stream in the measurement period, the measured values may be accumulated to obtain a second measured value of the big stream. Furthermore, if there is only one measurement value for a large flow corresponding to the same memory space identity, the same flow identity, then this measurement value can be considered as the second measurement value for this large flow.
Step 204, in the received second measurement value corresponding to the flow identifier of each first data flow, the second measurement values of the first data flows corresponding to the same flow identifier are screened, and a third measurement value corresponding to the flow identifier of each received first data flow is obtained.
In practice, since the measured value of any data packet is recorded in the target data table in the corresponding data storage space of each data row, it may happen that a large stream is replaced in multiple data storage spaces, and the measured value of the large stream is sent to the controller after the large stream is replaced in each data storage space. Thus, the controller receives the measured values of the large flows corresponding to the data storage spaces (i.e. receives the measured values of the large flows corresponding to different storage space identifiers and the same flow identifier). In this case, the measured values of the large flows received corresponding to different storage space identifiers and the same flow identifier may be filtered. Since the measured values of the big flows corresponding to the same flow id and the same storage space id are already accumulated in step 203, the second measured values of the big flows corresponding to different storage space ids and the same flow id are filtered here. Specifically, the screening method may be the same as the screening method for the measured value of the mainstream recorded in the target data table in step 202, and several methods are described below.
In the first method, in the received second measurement values corresponding to the flow identifiers of the large flows, the largest second measurement value of the large flow corresponding to the same flow identifier is used as the third measurement value of the large flow.
For example, for large flows K2The second measurement value with three different storage space identifiers is V4、V5、V6. Comparison V4、V5、V6Of which the largest second measurement value is taken as the big flow K2Of the third measurement value.
And in the received second measurement values corresponding to the flow identifications of the large flows, taking the average value of the second measurement values of the large flows corresponding to the same flow identification as a third measurement value of the large flow.
For example, for large flows K2In the three data storage spaces of the target data table, the measured values are recorded as V4、V5、V6. Calculating V4、V5、V6Average value of (2)
Figure BDA0002809106670000173
Will be provided with
Figure BDA0002809106670000174
As a large flow K2The first measurement value of (a).
And in the received second measurement values corresponding to the flow identifications of the large flows, taking any one second measurement value of the large flow corresponding to the same flow identification as a third measurement value of the large flow.
For example, for large flows K2In the three data storage spaces of the target data table, the measured values are recorded as V4、V5、V6. Randomly choosing V4、V5、V6Is taken as the big flow K2Of the third measurement value.
Step 205, in the first measurement value of each major flow recorded in the target data table and the received third measurement value corresponding to the flow identifier of each major flow, the first measurement value and the second measurement value corresponding to the same flow identifier are accumulated to obtain a statistical measurement value corresponding to the flow identifier of each major flow.
In an implementation, a network device may receive packets belonging to the same data flow intermittently, and the following situations may occur: the data stream is judged as a big stream, then replaced by other data streams, and finally judged as a big stream and continued until the end of a measuring period. In this case, the flow identification of the data flow may be caused to be sent to the controller as a measure of the big flow, and the data flow may also be recorded as a big flow in the target data table sent to the controller. Then, in order to count the measurement values of the data streams in one measurement period, the first measurement value and the third measurement value of the streamlet corresponding to the same stream identifier may be accumulated in the first measurement value of each streamlet recorded in the target data table and the third measurement value corresponding to the received stream identifier of each streamlet, and the accumulated measurement values may be used as the statistical measurement value corresponding to the stream identifier of the streamlet.
In addition, if a certain large flow only has the first measurement value or the third measurement value, the first measurement value or the second measurement value of the large flow is used as the statistical measurement value of the large flow.
Step 206, based on the received flow id of the non-major flow and the target data table, determining a statistical measurement value corresponding to the flow id of each non-major flow.
In the implementation, regarding a first method for recording the measured value of the target data stream in the data storage space in step 103, here, a method for determining the statistical measured value corresponding to the stream identifier of each non-big stream may refer to fig. 6, and specifically may include the following steps:
s2061, for each data storage space in the target data table, based on the first characteristic value calculation function corresponding to the data row where the data storage space is located, and in the stream identification of the received non-big stream, the stream identification of the non-big stream corresponding to the data storage space is determined.
And for each received flow identifier of each non-big flow, preprocessing the flow identifier of the non-big flow to obtain a numerical value to be calculated. And then inputting the numerical value to be calculated into the first characteristic value calculation function corresponding to each data row to obtain a plurality of output results corresponding to the flow identification. Then, the data storage space corresponding to each output result is determined. In this way, the stream identifier of the non-major stream corresponding to each data storage space can be determined.
S2062, based on the second eigenvalue calculation function corresponding to the data row where the data storage space is located, the accumulation coefficient corresponding to the stream identifier of each non-mainstream corresponding to the data storage space is determined. And taking the statistical measurement value corresponding to the stream identification of each non-major stream corresponding to the data storage space as an unknown number to be multiplied by the corresponding accumulation coefficient, accumulating, and taking the measurement value of the data stream recorded by the data storage space as an accumulation result to obtain a target equation.
For example, one data storage space of the target data table records a non-big stream measurement value of Y, and the corresponding three non-big streams of the data storage space are K7、K8And K9. K is obtained through a second characteristic value calculation function corresponding to the data line where the data storage space is located7、K8And K9Respectively of X7、X8And X9. Assuming that the statistical measurement values of three non-big flows are respectively unknown numbers V7、V8And V9The following equation can be established:
X7*V7+X8*V8+X9*V9=Y。
it should be noted that this equation is merely an example, and there may be other transformations based on this equation, which are not listed here.
S2063, forming an object equation set by the object equations corresponding to the data storage spaces in the object data table.
And S2064, based on a linear optimization algorithm, solving the objective equation set by taking the minimum sum of the statistical measurement values corresponding to the received flow identifiers of the non-major flows as an optimization objective to obtain the statistical measurement value corresponding to the flow identifier of each non-major flow.
The linear optimization algorithm can be a branch-and-bound method, a cut plane method, a Monte Carlo method and the like.
In the application, the measured values of the non-mainstream are recorded in the target data table after being multiplied by the corresponding accumulation coefficient, and correspondingly, when the target equation is constructed, the unknowns are also multiplied by the corresponding accumulation coefficient.
For the second method of recording the measured value of the target data stream in the data storage space in step 103, here, the method of determining the statistical measured value corresponding to the stream identifier of each non-big stream may be as follows:
and for the stream identifier of each non-big stream, determining the data storage space corresponding to the stream identifier of the non-big stream in each data row through a first characteristic value calculation function corresponding to each data row of the target data table. Then, the minimum value of the determined measurement values of the non-mainstream recorded in each storage space is determined as the statistical measurement value corresponding to the stream identifier of the non-mainstream, that is, the statistical measurement value of the non-mainstream.
In a possible implementation manner, in the obtained statistical measurement value corresponding to the flow identifier of the large flow and the statistical measurement value corresponding to the flow identifier of the non-large flow, the measurement values corresponding to the same flow identifier are accumulated to obtain a total measurement value corresponding to each flow identifier.
In the embodiment of the present application, since the macro flow is the flow identification and the measurement value recorded correspondingly, the finally obtained measurement value of the macro flow is relatively accurate. And because the measured values of the non-big flows are recorded in the target data table, the measured values of the non-big flows do not contain the measured values of the big flows, and thus, the measured value of each non-big flow calculated finally is also more accurate.
Referring to fig. 7, an embodiment of the present application further provides a method for measuring a data flow, where a processing flow of the method may include the following steps:
step 301, receiving a target data packet, and for each data row of a target data table, determining a data storage space corresponding to the data row of a target data stream to which the target data packet belongs based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet.
The specific implementation of step 301 is the same as or similar to the specific implementation of step 101, and is not described herein again.
Step 302, recording the measured value of the target data stream in the data storage space based on the measured value corresponding to the target data packet.
In practice, there are several methods for recording the measured value of the target data stream in the data storage space, and two methods are listed below for explanation.
The method I includes the steps of calculating a function based on a second characteristic value corresponding to a data line where the data storage space is located and a stream identification of a target data packet, determining an accumulation coefficient corresponding to the target data stream, multiplying a measured value of the target data packet by the accumulation coefficient to obtain an adjusted measured value of the target data packet, and accumulating the adjusted measured value of the target data packet to the measured value of the data stream recorded in the data storage space.
For each data row of the target data table, besides a first characteristic value calculation function, a second characteristic value calculation function can be corresponding. The second eigenvalue calculation function may also be a hash function, and the second eigenvalue calculation function corresponding to each data line is different.
For each data storage space corresponding to the determined target data stream, when recording the measured value of the target data stream based on the measured value of the target data packet, the to-be-calculated value corresponding to the target data packet may be input into the second eigenvalue calculation function corresponding to the data row where the data storage space is located, so as to obtain the accumulation coefficient corresponding to the stream identifier. Wherein the accumulation coefficient may be a fractional number.
Then, the measured value of the target data packet is multiplied by the accumulation coefficient to obtain the adjusted measured value of the target data packet. Finally, the adjusted measurement value of the target data packet is added to the measurement value of the data stream recorded in the data storage space.
For example, the flow id corresponding to the target packet is K1Measured value is V1First, a second eigenvalue calculation function pair K is adopted1Calculating to obtain an accumulation coefficient X1. Then, an adjustment measurement value X of the target data packet is calculated1*V1. Finally, adjusting the measured value X of the target data packet1*V1Adding to the measured value of the recorded data stream, i.e. updating the measured value E of the recorded data stream to (E + X)1*V1)。
And the second method is that the measured value of the target data packet is directly added to the measured value of the data stream recorded in the data storage space.
For example, the flow ID corresponding to the target packet is K1Measured value is V1The measured value V of the target data packet1Adding to the measured value of the recorded data stream, i.e. updating the measured value E of the recorded data stream to (E + V)1)。
Step 303, if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space.
The specific implementation of step 303 is the same as or similar to the specific implementation of step 102, and is not described herein again.
In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are recorded separately, so that the measured value of the major stream is relatively accurate. In addition, although in the embodiment of the present application, the measured values of the data streams (including the massive stream and the non-massive stream) are recorded in the target data table, not only the measured values of the non-massive stream. However, since the separately recorded measured value of the large stream can be obtained according to the recorded measured value of the data stream and the separately recorded measured value of the large stream when the measured value of the non-large stream is subsequently recovered, the technical effect that can be achieved by the embodiment shown in fig. 1 can also be achieved.
Referring to fig. 8 for the method of data flow measurement shown in fig. 7, the method for the controller to recover the measured value of the data flow may include the following steps:
step 401, receiving a stream identifier of a large stream, a corresponding measured value, a corresponding storage space identifier of a data storage space, a stream identifier of the large stream, and a target data table, which are sent by a network device.
Step 402, screening the measured values of the large flows corresponding to the same flow identifier in the measured values of the large flows recorded in the target data table to obtain a first measured value of each large flow recorded in the target data table.
The specific implementation of step 402 is the same as or similar to the specific implementation of step 202, and is not described herein again.
Step 403, accumulating the measured values of the large flows corresponding to the same storage space identifier and the same flow identifier in the received measured values of the large flows to obtain a second measured value corresponding to the flow identifier of each received large flow.
The specific implementation of step 403 is the same as or similar to the specific implementation of step 403, and is not described herein again.
Step 404, in the second measurement value corresponding to the flow identifier of each received large flow, the second measurement value of the first data flow corresponding to the same flow identifier is screened, and a third measurement value corresponding to the flow identifier of each received large flow is obtained.
The specific implementation of step 404 is the same as or similar to the specific implementation of step 204, and is not described herein again.
Step 405, in the first measurement value of each major flow recorded in the target data table and the received third measurement value corresponding to the flow identifier of each major flow, the first measurement value and the second measurement value corresponding to the same flow identifier are accumulated to obtain a statistical measurement value corresponding to the flow identifier of each major flow.
The specific implementation of step 405 is the same as or similar to the specific implementation of step 205, and is not described herein again.
Step 406, determining a statistical measurement value corresponding to the flow identifier of each non-major flow based on the received flow identifier of the non-major flow, the measurement value of the data flow recorded in each data storage space in the target data table, and the obtained statistical measurement value corresponding to the flow identifier of each major flow.
In implementation, regarding to the first method for recording the measured value of the target data stream in the data storage space in step 302, here, the method for determining the measured value corresponding to the stream identifier of each non-big stream may refer to fig. 9, and specifically may include the following steps:
s4061, for each data storage space of the target data table, determining an accumulation coefficient corresponding to the stream identifier of each major stream corresponding to the data storage space based on a second eigenvalue calculation function corresponding to the data row where the data storage space is located. And multiplying the statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space by the corresponding accumulation coefficient to obtain the adjusted statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space.
The large stream corresponding to each data storage space in the target data table includes a large stream corresponding to the stream identifier of the large stream recorded in the data storage space and a large stream corresponding to the stream identifier of the large stream corresponding to the storage space identifier of the data storage space and sent by the network device.
For example, the data storage space of the target data table1Stream id K in which a large stream is recorded1Wherein the data storage space1Indicates that the storage space is marked as1The data storage space of (2). And received the corresponding storage space identification1Flow identification K of the big flow2. Thus, the data storage space1The two corresponding major flows are respectively K1、K2. Through the data line corresponding to the data storage spaceK is obtained by a two-eigenvalue calculation function1、K2The accumulation coefficients are respectively X1、X1
S4062, based on the first eigenvalue calculation function corresponding to the data row where the data storage space is located, in the stream identifiers of the received non-major streams, the stream identifier of the non-major stream corresponding to the data storage space is determined, and based on the second eigenvalue calculation function corresponding to the data row where the data storage space is located, the accumulation coefficient corresponding to the stream identifier of each non-stream corresponding to the data storage space is determined.
For example, the three non-major flows corresponding to the data storage space 1 of the target data table are determined to be K3、K4And K5. K is obtained through a second characteristic value calculation function corresponding to the data line where the data storage space is located3、K4And K5Respectively of X3、X4And X5
S4063, taking the statistical measurement value corresponding to the stream identifier of each non-major stream corresponding to the data storage space as an unknown number to multiply the corresponding accumulation coefficient, adding the statistical measurement value to the adjusted statistical measurement value corresponding to the stream identifier of each major stream corresponding to the data storage space, taking the measurement value of the data stream recorded by the data storage space as an accumulation result, and obtaining a target equation corresponding to the data storage space.
For example, the data storage space of the target data table1The measured value of the recorded data stream is E1The corresponding large flow is K1And K2The corresponding non-major flow is K3、K4And K5,K1、K2、K3、K4And K5The corresponding accumulation coefficients are respectively X1、X2、X3、X4And X5. Suppose three non-large flows K3、K4And K5Are respectively an unknown number V3、V4And V5The following equation can be established:
X1*V1+X2*V2+X3*V3+X4*V4+X5*V5+X6*V6=E1
it should be noted that this equation is merely an example, and other transformations may be provided on the basis of this equation, which is not further described here.
S4064, forming an object equation set based on the object equations corresponding to the data storage spaces in the object data table.
S4065, based on a linear optimization algorithm, solving an objective equation set by taking the minimum sum of the statistical measurement values corresponding to the received flow identifiers of the non-major flows as an optimization objective to obtain the statistical measurement value corresponding to the flow identifier of each second data flow.
The linear optimization algorithm can be a branch-and-bound method, a secant plane method, a Monte Carlo method and the like.
In the embodiment of the present application, since the macro flow is the flow identification and the measurement value recorded correspondingly, the finally obtained measurement value of the macro flow is relatively accurate. And even if not only the measured values of the non-mainstream are recorded in the target data table, the measured values of the non-mainstream can be obtained from the recorded measured values of the data stream and the measured values of the mainstream. Therefore, the technical effects achieved by the embodiment shown in fig. 5 described above can be achieved as well.
Referring to fig. 10, an embodiment of the present application further provides a method for measuring data flow, where a processing flow of the method may include the following steps:
step 501, receiving the target data packet, calculating a function based on the third eigenvalue and a stream identifier corresponding to the target data packet, and determining a data storage space corresponding to the target data stream to which the target data packet belongs in the corresponding first data table.
The first data table may be a hash table, the third feature value calculation function may be a hash function, and the first data table is a function for calculating one third feature value. The third eigenvalue calculation function may have n calculation results, where n is the number of columns of the first data table, that is, the number of data storage spaces corresponding to the first data table. Each of the m calculation results corresponds to one data storage space, that is, the m calculation results correspond to the m data storage spaces one to one. The data storage space may also be referred to as a bucket, and in a case that the target data table is a hash table, the data storage space corresponding to the first data table may be referred to as a hash bucket.
In implementation, when a data packet is received by the network device, the data storage space corresponding to the data stream to which the data packet belongs in the first data table is determined. That is, it is determined in which data storage space corresponding to the first data table the measured value of the data packet needs to be recorded. For convenience of description, a currently received packet is referred to herein as a destination packet, and a data stream to which the packet belongs is referred to as a destination data stream.
Determining the data storage space corresponding to the target data stream in the first data table, the following method may be used:
and preprocessing the flow identifier corresponding to the target data packet to obtain a numerical value to be calculated. The preprocessing may be to convert the stream identifier into a binary number, and correspondingly, the to-be-calculated value is the binary number corresponding to the stream identifier. And then, inputting the numerical value to be calculated into a third characteristic value calculation function to obtain an output result corresponding to the flow identifier. And finally, determining the data storage space corresponding to the output result corresponding to the flow identification in the corresponding relation between the output result and the data storage space.
Step 502, if the target data stream is a big stream corresponding to the data storage space, determining a measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space.
The specific implementation of step 502 is the same as or similar to the specific implementation of step 102, and is not described herein again.
It should be noted that the stream id, the measured value and the comparative measured value of the streamlet recorded in the data storage space corresponding to the target data table in step 102 are recorded in the data storage space corresponding to the first data table in step 502.
And step 503, if the target data stream is not the big stream corresponding to the data storage space, recording the measured value of the target data stream in the target data table based on the measured value of the target data packet.
The specific implementation of step 503 is the same as or similar to the specific implementation of step 103, and is not described herein again. Note that, the difference between this step 503 and the above-described embodiment of step 103 is: in this step 503, a function needs to be calculated according to the first characteristic value corresponding to each data row of the target data table, so as to determine the data storage space corresponding to each data row of the target data stream. Then, based on the measured value of the target data packet, the measured value of the target data stream is determined and recorded in the data storage space. In addition, only one Bloom Filter is needed to record the flow identification of the non-streamlet in this step 503.
In addition, after each measurement cycle is finished, unlike the method of data flow measurement shown in fig. 1, the method of data flow measurement shown in fig. 5 needs to take out the first data table stored locally to another storage space for storage, or send the first data table to the controller. The first data table currently stored needs to be initialized. Initializing the currently stored first data table may be deleting data recorded in the first data table.
In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are recorded separately, so that the measured value of the major stream is relatively accurate. And because the measured values of the large flow are recorded separately, only the measured values of the data flows except the large flow can be recorded in the target data table, so that the accuracy of the obtained measured values is relatively high when the measured values of the data flows are recovered due to the reduction of the number of the recorded data flows.
Referring to fig. 11, for the method for measuring data flow shown in fig. 10, the method for the controller to recover the measured value of the data flow may include the following steps:
step 601, receiving a flow identifier and a measurement value of a large flow, a flow identifier of a non-large flow, a target data table and a first data table sent by a network device.
Step 602, accumulating the measurement values corresponding to the same flow identifier in the received measurement values of the large flows and the measurement values recorded in the first data table, so as to obtain a statistical measurement value corresponding to the flow identifier of each large flow.
In an implementation, a network device may receive packets belonging to the same data flow intermittently, and the following situations may occur: the data stream is judged as a big stream, then replaced by other data streams, and finally judged as a big stream and continued until the end of a measuring period. In this case, the flow identification of the data flow is sent to the controller as a measured value of the big flow, and the data flow is also recorded as the big flow in the first data table sent to the controller. In order to count the measured values of the data streams in one measured value period, the measured values of the big streams corresponding to the same stream identifier and the intermediate measured values may be accumulated in the received measured values of the big streams and the measured values of the big streams recorded in the first data table, and the accumulated measured values may be used as the statistical measured values corresponding to the stream identifiers of the big streams.
Step 603, determining a statistical measurement value corresponding to the flow identifier of each non-major flow based on the received flow identifier of the non-major flow and the target data table.
The specific implementation of step 603 is the same as or similar to the specific implementation of step 204, and is not described herein again.
In the embodiment of the present application, since the macro flow is the flow identification and the measurement value recorded correspondingly, the finally obtained measurement value of the macro flow is relatively accurate. And because the measured values of the non-big flows are recorded in the target data table, the measured values of the non-big flows do not contain the measured values of the big flows, so that the measured value of each non-big flow calculated finally is more accurate.
Based on the same technical concept, the embodiment of the present application further provides an apparatus for measuring a data stream, as shown in fig. 12, the apparatus includes a receiving module 710 and a recording module 720. The data measuring apparatus may perform a plurality of different data measuring methods, and accordingly, the functions performed by the receiving module 710 and the recording module 720 may be different when performing different data measuring methods. The following describes functions performed by the receiving module 710 and the recording module 720 when the data flow measurement device performs different methods of data measurement.
First, the data flow measurement apparatus performs the data measurement method shown in fig. 1.
The transceiver module 710 is configured to receive a target data packet, and for each data row of a target data table, determine, based on a first eigenvalue calculation function corresponding to the data row and a stream identifier corresponding to the target data packet, a data storage space corresponding to a target data stream to which the target data packet belongs in the data row. Illustratively, the transceiver module 710 is configured to perform step 101.
A processing module 720, configured to determine, if the target data stream is a first data stream corresponding to the data storage space, a measured value of the target data stream based on the measured value of the target data packet, and record the measured value in the data storage space; and if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in a target data table based on the measured value of the target data packet. Illustratively, the processing module 720 is configured to perform steps 102 and 103.
In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are recorded separately, so that the measured value of the major stream is relatively accurate. And because the measured values of the large flow are recorded separately, only the measured values of the data flows except the large flow can be recorded in the target data table, so that the accuracy of the obtained measured values is relatively high when the measured values of the data flows are recovered due to the reduction of the number of the recorded data flows.
Second, the data flow measuring apparatus executes the data measuring method shown in fig. 7.
The transceiver module 710 is configured to receive a target data packet, and for each data row of a target data table, determine, based on a first eigenvalue calculation function corresponding to the data row and a stream identifier corresponding to the target data packet, a data storage space corresponding to the data row of a target data stream to which the target data packet belongs. Illustratively, the transceiver module 710 is configured to perform step 301.
A processing module 720, configured to record, in the data storage space, a measured value of the target data stream based on a measured value corresponding to the target data packet; and if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value of the target data stream in the data storage space. Illustratively, the processing module 720 is configured to perform steps 302 and 303.
In the embodiment of the application, after the data packet is received, whether the data stream to which the data packet belongs is a major stream is judged, and if the data stream is the major stream, the stream identifier and the measured value are recorded separately, so that the measured value of the major stream is relatively accurate. In addition, although in the embodiment of the present application, the measured values of the data streams (including the massive stream and the non-massive stream) are recorded in the target data table, not only the measured values of the non-massive stream. However, since the separately recorded measured value of the large stream can be obtained according to the recorded measured value of the data stream and the separately recorded measured value of the large stream when the measured value of the non-large stream is subsequently recovered, the technical effect that can be achieved by the embodiment shown in fig. 1 can also be achieved.
It should be noted that: in the data flow measurement apparatus provided in the foregoing embodiment, only the division of the functional modules is illustrated in the foregoing, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the network device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for measuring data flow provided by the foregoing embodiment and the method embodiment for measuring data flow belong to the same concept, and details of a specific implementation process thereof are referred to in the method embodiment and are not described herein again.
Based on the same technical concept, the embodiment of the present application further provides an apparatus for measuring data flow, as shown in fig. 13, the apparatus includes a receiving module 810 and a calculating module 820. The data measuring apparatus may perform a plurality of different data measuring methods, and accordingly, the functions performed by the receiving module 810 and the calculating module 820 may be different when performing different data measuring methods. The following describes functions performed by the receiving module 810 and the calculating module 820 when the data flow measuring device performs different methods of data measurement.
First, the data flow measurement apparatus performs the data measurement method shown in fig. 5.
The receiving module 810 is configured to receive the stream identifier and the corresponding measured value of the first data stream, the stream identifier of the second data stream, and the target data table, which are sent by the network device. Illustratively, the receiving module 810 may be configured to perform step 201.
A processing module 820, configured to filter, from among the measured values of the first data streams recorded in the target data table, the measured values of the first data streams corresponding to the same stream identifier to obtain a first measured value of each first data stream recorded in the target data table; accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream; screening the second measured values of the first data flows corresponding to the same flow identifier from the received second measured values corresponding to the flow identifier of each first data flow to obtain a third measured value corresponding to the flow identifier of each first data flow; accumulating the first measured value and the third measured value corresponding to the same flow identification in the first measured value of each first data flow recorded by the target data table and the received third measured value corresponding to the flow identification of each first data flow to obtain a statistical measured value corresponding to the flow identification of each first data flow; and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow and the target data table. Illustratively, the processing module 820 may be configured to perform any of the steps 201 and 206.
In the embodiment of the present application, since the macro flow is the flow identification and the measurement value recorded correspondingly, the finally obtained measurement value of the macro flow is relatively accurate. And because the measured values of the non-big flows are recorded in the target data table, the measured values of the non-big flows do not contain the measured values of the big flows, so that the measured value of each non-big flow calculated finally is more accurate.
Second, the data flow measuring apparatus executes the data measuring method shown in fig. 8.
The receiving module 810 is configured to receive a stream identifier of a first data stream, a corresponding measured value, a corresponding storage space identifier of a data storage space, a stream identifier of a second data stream, and a target data table, where the stream identifier, the corresponding measured value, the storage space identifier of the data storage space, and the target data table are sent by a network device. Illustratively, the receiving module 810 is configured to perform step 401.
A calculating module 820, configured to filter, from the measurement values of the first data streams recorded in the target data table, measurement values of the first data streams corresponding to the same stream identifier to obtain a first measurement value of each first data stream recorded in the target data table; accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream; screening second measurement values corresponding to the flow identifications of the first data flows corresponding to the same flow identification from the received second measurement values corresponding to the flow identifications of each first data flow to obtain a third measurement value corresponding to the flow identification of each first data flow; accumulating the first measurement value and the second measurement value corresponding to the same flow identification in the first measurement value of each first data flow recorded by the target data table and the received third measurement value corresponding to the flow identification of each first data flow to obtain a statistical measurement value corresponding to the flow identification of each first data flow; and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow, the measurement value of the data flow recorded in each data storage space in the target data table and the obtained statistical measurement value corresponding to the flow identification of each first data flow. Illustratively, the processing module 820 may be configured to perform any of the steps 401 and 406.
In the embodiment of the present application, since the macro flow is the flow identification and the measurement value recorded correspondingly, the finally obtained measurement value of the macro flow is relatively accurate. And even if not only the measured values of the non-mainstream are recorded in the target data table, the measured values of the non-mainstream can be obtained from the recorded measured values of the data stream and the measured values of the mainstream. Therefore, the technical effects achieved by the embodiment shown in fig. 5 described above can be achieved as well.
It should be noted that: in the data flow measurement apparatus provided in the foregoing embodiment, only the division of the functional modules is illustrated in the foregoing, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the network device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for measuring data flow provided by the foregoing embodiment and the method embodiment for measuring data flow belong to the same concept, and details of a specific implementation process thereof are referred to in the method embodiment and are not described herein again.
Referring to fig. 14, an embodiment of the present application provides a schematic diagram of a network device 900. The network device 900 may be a network device that performs any of the methods of fig. 1, 7, and 10 described above. The network device 900 comprises at least one processor 901, an internal connection 902, a memory 903 and at least one transceiver 904.
The network device 900 is a hardware structure apparatus, and can be used to implement the functional modules in the apparatus shown in fig. 12. For example, those skilled in the art will appreciate that the recording module 720 in the apparatus shown in fig. 12 may be implemented by the at least one processor 901 calling code in the memory 903, and the receiving module 710 in the apparatus shown in fig. 12 may be implemented by the transceiver 904.
Alternatively, the processor 901 may be a general processing unit (CPU), a Network Processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program according to the present disclosure.
The internal connections 902 may include a path for passing information between the components. Optionally, the internal connection 902 is a single board or a bus.
The transceiver 904 is used to communicate with other devices or communication networks.
The memory 903 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these. The memory may be self-contained and coupled to the processor via a bus. The memory may also be integrated with the processor.
The memory 903 is used for storing application program codes for executing the scheme of the application, and the processor 901 controls the execution. The processor 901 is configured to execute application program code stored in the memory 903 and cooperate with the at least one transceiver 904 to enable the network device 900 to implement the functions of the present application.
In particular implementations, processor 901 may include one or more CPUs such as CPU0 and CPU1 in fig. 14 as one embodiment.
In particular implementations, network device 900 may include multiple processors, such as processor 901 and processor 907 of fig. 14, for example, as an example. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
Referring to fig. 15, an embodiment of the present application provides a schematic diagram of a controller 1000. The controller 1000 may be a controller that performs any of the methods of fig. 5, 8, and 11 described above. The controller 1000 includes at least one processor 1001, internal connections 1002, memory 1003, and at least one transceiver 1004.
The controller 1000 is a hardware-structured device, and can be used to implement the functional blocks in the device shown in fig. 13. For example, one skilled in the art can appreciate that the computing module 720 in the apparatus shown in fig. 13 can be implemented by the at least one processor 1001 calling code in the memory 1003, and the receiving module 810 in the apparatus shown in fig. 13 can be implemented by the transceiver 1004.
Alternatively, the processor 1001 may be a general processing unit (CPU), a Network Processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program according to the present disclosure.
The internal connections 1002 may include a path for passing information between the components. Optionally, the internal connection 1002 is a single board or a bus.
The transceiver 1004 is used for communicating with other devices or communication networks.
The memory 1003 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these. The memory may be self-contained and coupled to the processor via a bus. The memory may also be integral to the processor.
The memory 1003 is used for storing application program codes for executing the present application, and the processor 1001 controls the execution. The processor 1001 is configured to execute application code stored in the memory 1003 and cooperate with the at least one transceiver 1004 to enable the controller 1000 to implement the functions of the present application.
In particular implementations, processor 1001 may include one or more CPUs such as CPU0 and CPU1 in fig. 15, for example, as one embodiment.
In particular implementations, the controller 1000 may include a plurality of processors, such as the processor 1001 and the processor 1007 in fig. 15, as an example. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
The embodiment of the present application further provides a computer-readable storage medium, where instructions or a program are stored in the computer-readable storage medium, and the instructions or the program are loaded and executed by a processor to implement the method for measuring data flow provided by the embodiment of the present application.
The embodiment of the present application further provides a computer program product, where the computer program product includes instructions, and the instructions are loaded and executed by a processor, so as to implement the method for measuring data flow provided in the embodiment of the present application.
The embodiment of the present application further provides a chip system, where the chip system includes a processor and an interface, where the interface is used to obtain a program or an instruction, and the processor is used to call the program or the instruction to implement or support a terminal device to implement the functions related to any of the above method embodiments, for example, determine or process data related to the above method, where the data may be a measurement value, a stream identifier, and the like.
In one possible design, the system-on-chip further includes a memory for storing program instructions and data necessary for the terminal device. The chip system may be formed by a chip, or may include a chip and other discrete devices.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any combination thereof, and when the implementation is realized by software, all or part of the implementation may be realized in the form of a computer program product. The computer program product comprises one or more computer program instructions which, when loaded and executed on a device, cause a process or function according to an embodiment of the application to be performed in whole or in part. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optics, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by the device or a data storage device, such as a server, a data center, etc., that is integrated into one or more available media. The usable medium may be a magnetic medium (such as a floppy Disk, a hard Disk, a magnetic tape, etc.), an optical medium (such as a Digital Video Disk (DVD), etc.), or a semiconductor medium (such as a solid state Disk, etc.).
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the principles of the present application should be included in the scope of the present application.

Claims (29)

1. A method for data flow measurement, wherein the method is applied to a network device, and the method comprises:
receiving a target data packet, and determining a data storage space corresponding to a target data stream to which the target data packet belongs in each data row of a target data table based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet;
if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value of the target data stream in the data storage space;
and if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in a target data table based on the measured value of the target data packet.
2. The method of claim 1, wherein if the target data stream is a first data stream corresponding to the data storage space, determining a measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space comprises:
if the stream identifier and the measured value of the first data stream are not recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, taking the measured value of the target data packet as the measured value of the target data stream, taking the stream identifier of the target data stream as the stream identifier of the first data stream corresponding to the data storage space, and correspondingly recording the stream identifier and the measured value of the target data in the data storage space;
if the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is the same as the flow identification of the first data flow recorded in the data storage space, the measured value of the target data packet is added to the measured value of the first data flow recorded in the data storage space;
if the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is different from the flow identification of the first data flow recorded in the data storage space, determining whether a comparative measured value is recorded in the data storage space, if no comparative measured value is recorded, recording the measured value of the target data packet in the data storage space as the comparative measured value corresponding to the data storage space, and if a comparative measured value is recorded, accumulating the measured value of the target data packet on the comparative measured value recorded in the data storage space;
if the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the first data stream recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, updating the stream identifier of the first data stream recorded in the data storage space to the stream identifier of the target data stream, updating the measurement value of the first data stream recorded in the data storage space to the measurement value of the target data packet, and updating the comparison measurement value recorded in the data storage space to 0.
3. The method of claim 2, wherein if a flow identification and a measurement value for a first data flow are recorded in the data storage space, and the flow identification for the target data flow is different from the flow identification for the first data flow recorded in the data storage space, the method further comprises:
and if the accumulated comparison measurement value recorded in the data storage space is smaller than the measurement value of the first data stream recorded in the data storage space, determining that the target data stream is not the first data stream corresponding to the data storage space, and recording the measurement value of the target data stream in a target data table based on the measurement value of the target data packet.
4. The method of claim 3, wherein if the accumulated comparison measure recorded in the data storage space is greater than the measure of the first data stream recorded in the data storage space, the method further comprises:
sending a storage space identification of the data storage space, a stream identification of the first data stream recorded in the data storage space and a measured value of the first data stream to a controller;
if the accumulated comparison measure recorded in the data storage space is less than the measure of the first data stream recorded in the data storage space, the method further comprises:
sending the flow identifier corresponding to the target data packet to the controller as the flow identifier of the second data flow;
the method further comprises the following steps:
and sending the locally stored target data table to the controller every time a preset time length passes, and initializing the locally stored target data table.
5. The method of claim 4, wherein before sending the flow identifier corresponding to the target packet to the controller as the flow identifier of the second data flow, the method further comprises:
and determining that the flow identification corresponding to the target data packet is not sent to the controller, and recording the flow identification corresponding to the target data packet.
6. The method of claim 5, wherein the determining that the flow id corresponding to the target packet is not sent to the controller and recording the flow id corresponding to the target packet comprises:
and determining that the flow identification corresponding to the target data packet is not recorded in a locally stored bloom filter, and recording the flow identification corresponding to the target data packet in the bloom filter.
7. The method according to any of claims 1-6, wherein said recording the measurement value of the target data stream in a target data table based on the measurement value of the target data packet comprises:
and determining an accumulation coefficient corresponding to the target data stream based on a second characteristic value calculation function corresponding to the data row and the stream identification of the target data packet, multiplying the measured value of the target data packet by the accumulation coefficient to obtain an adjusted measured value of the target data packet, and accumulating the adjusted measured value of the target data packet to the measured value of the second data stream recorded in the data storage space.
8. A method of data flow measurement, the method being for a network device, the method comprising:
receiving a target data packet, and determining a data storage space corresponding to a target data stream to which the target data packet belongs in each data row of a target data table based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet;
recording the measured value of the target data stream in the data storage space based on the measured value corresponding to the target data packet;
and if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value of the target data stream in the data storage space.
9. The method of claim 8, wherein if the target data stream is a first data stream corresponding to the data storage space, determining a measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space comprises:
if the stream identifier and the measured value of the first data stream are not recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, taking the measured value of the target data packet as the measured value of the target data stream, taking the stream identifier of the target data stream as the stream identifier of the first data stream corresponding to the data storage space, and correspondingly recording the stream identifier and the measured value of the target data in the data storage space;
if the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is the same as the flow identification of the first data flow recorded in the data storage space, the measured value of the target data packet is added to the measured value of the first data flow recorded in the data storage space;
if the flow identification and the measured value of the first data flow are recorded in the data storage space, and the flow identification of the target data flow is different from the flow identification of the first data flow recorded in the data storage space, determining whether a comparative measured value is recorded in the data storage space, if no comparative measured value is recorded, recording the measured value of the target data packet in the data storage space as the comparative measured value corresponding to the data storage space, and if a comparative measured value is recorded, accumulating the measured value of the target data packet on the comparative measured value recorded in the data storage space;
and if the accumulated comparison measurement value recorded in the data storage space is greater than the measurement value of the first data stream recorded in the data storage space, determining that the target data stream is the first data stream corresponding to the data storage space, updating the stream identifier of the first data stream recorded in the data storage space to the stream identifier of the target data stream, updating the measurement value of the first data stream recorded in the data storage space to the measurement value of the target data packet, and updating the comparison measurement value recorded in the data storage space to 0.
10. The method of claim 9, wherein if the accumulated comparison measure recorded in the data storage space is greater than the measure of the first data stream recorded in the data storage space, the method further comprises:
sending a storage space identifier of the data storage space, a stream identifier of a first data stream correspondingly recorded in the data storage space and a measured value of the first data stream to a controller;
the method further comprises the following steps:
if the accumulated comparison measurement value recorded in the data storage space is smaller than the measurement value of the first data stream recorded in the data storage space, sending the stream identifier corresponding to the target data packet to the controller as the stream identifier of the second data stream;
and sending the locally stored target data table to the controller every time a preset time length passes, and initializing the locally stored target data table.
11. The method of claim 10, wherein before sending the flow id corresponding to the target packet to the controller as the flow id of the second data flow, the method further comprises:
and determining that the flow identification corresponding to the target data packet is not sent to the controller, and recording the flow identification corresponding to the target data packet.
12. The method of claim 11, wherein the determining that the flow id corresponding to the target packet is not sent to the controller and recording the flow id corresponding to the target packet comprises:
and determining that the flow identification corresponding to the target data packet is not recorded in a locally stored bloom filter, and recording the flow identification corresponding to the target data packet in the bloom filter.
13. The method according to any one of claims 8-12, wherein the recording the measurement value of the target data stream in the data storage space based on the measurement value corresponding to the target data packet comprises:
and determining an accumulation coefficient corresponding to the target data stream based on a second eigenvalue calculation function corresponding to the data row and the stream identification of the target data packet, multiplying the measurement value of the target data packet by the accumulation coefficient to obtain an adjusted measurement value of the target data packet, and accumulating the adjusted measurement value of the target data packet to the measurement value of the data stream recorded in the data storage space.
14. A method for data flow measurement, the method being applied to a controller, the method comprising:
receiving a stream identifier of a first data stream, a corresponding measured value, a corresponding storage space identifier of a data storage space, a stream identifier of a second data stream and a target data table which are sent by network equipment;
screening the measured values of the first data streams corresponding to the same stream identifier in the measured values of the first data streams recorded by the target data table to obtain a first measured value of each first data stream recorded by the target data table;
accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream;
screening the second measured values of the first data flows corresponding to the same flow identifier from the received second measured values corresponding to the flow identifier of each first data flow to obtain a third measured value corresponding to the flow identifier of each first data flow;
accumulating the first measured value and the third measured value corresponding to the same flow identification in the first measured value of each first data flow recorded by the target data table and the received third measured value corresponding to the flow identification of each first data flow to obtain a statistical measured value corresponding to the flow identification of each first data flow;
and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow and the target data table.
15. The method according to claim 14, wherein the filtering, among the measured values of the first data flows recorded in the target data table, the measured values of the first data flows corresponding to the same flow identifier to obtain the first measured value of each first data flow recorded in the target data table, includes:
taking the maximum measured value of the first data stream corresponding to the same stream identifier as the first measured value of the first data stream corresponding to the same stream identifier, in the measured values of the first data stream recorded by the target data table;
the screening, in the received second measurement value corresponding to the flow identifier of each first data flow, the second measurement values of the first data flows corresponding to the same flow identifier to obtain a third measurement value corresponding to the flow identifier of each first data flow, includes:
and in the received second measurement value corresponding to the flow identifier of each first data flow, taking the maximum second measurement value of the first data flow corresponding to the same flow identifier as the third measurement value of the first data flow corresponding to the same flow identifier.
16. The method as claimed in claim 14 or 15, wherein the determining the statistical measure corresponding to the flow identifier of each second data flow based on the received flow identifier of the second data flow and the target data table comprises:
for each data storage space in the target data table, determining a stream identifier of a second data stream corresponding to the data storage space in the stream identifiers of the received second data streams based on a first characteristic value calculation function corresponding to a data line where the data storage space is located, and determining an accumulation coefficient corresponding to the stream identifier of each second data stream corresponding to the data storage space based on a second characteristic value calculation function corresponding to the data line where the data storage space is located;
taking the statistical measurement value corresponding to the stream identifier of each second data stream corresponding to the data storage space as an unknown number to be multiplied by the corresponding accumulation coefficient, accumulating, taking the measurement value of the data stream recorded by the data storage space as an accumulation result, and obtaining a target equation corresponding to the data storage space;
forming a target equation set based on the target equations corresponding to the data storage spaces in the target data table;
and based on a linear optimization algorithm, solving the target equation set by taking the minimum sum of the statistical measurement values corresponding to the stream identifications of the received second data streams as an optimization target to obtain the statistical measurement value corresponding to the stream identification of each second data stream.
17. The method of claim 15, further comprising:
and accumulating the measured values corresponding to the same flow identifier in the obtained statistical measured value corresponding to the flow identifier of the first data flow and the statistical measured value corresponding to the flow identifier of the second data flow to obtain a total measured value corresponding to each flow identifier.
18. A method of data flow measurement, the method being applied to a controller, the method comprising:
receiving a stream identifier of a first data stream, a corresponding measured value, a corresponding storage space identifier of a data storage space, a stream identifier of a second data stream and a target data table which are sent by network equipment;
screening the measured values of the first data streams corresponding to the same stream identifier from the measured values of the first data streams recorded by the target data table to obtain a first measured value of each first data stream recorded by the target data table;
accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream;
screening second measurement values corresponding to the flow identifications of the first data flows corresponding to the same flow identification in the received second measurement values corresponding to the flow identifications of each first data flow to obtain a third measurement value corresponding to the flow identification of each first data flow;
accumulating the first measurement value and the second measurement value corresponding to the same flow identification in the first measurement value of each first data flow recorded by the target data table and the received third measurement value corresponding to the flow identification of each first data flow to obtain a statistical measurement value corresponding to the flow identification of each first data flow;
and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow, the measurement value of the data flow recorded in each data storage space in the target data table and the obtained statistical measurement value corresponding to the flow identification of each first data flow.
19. The method of claim 18, wherein determining the statistical measure corresponding to the flow identifier of each second data flow based on the received flow identifier of the second data flow, the measured values of the data flows recorded in each data storage space of the target data table, and the obtained statistical measure corresponding to the flow identifier of each first data flow comprises:
for each data storage space of the target data table, determining an accumulation coefficient corresponding to the stream identification of each first data stream corresponding to the data storage space based on a second eigenvalue calculation function corresponding to the data line where the data storage space is located;
multiplying the statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space by the corresponding accumulation coefficient to obtain an adjusted statistical measurement value corresponding to the stream identifier of each first data stream corresponding to the data storage space;
determining a stream identifier of a second data stream corresponding to the data storage space in the stream identifiers of the received second data streams based on a first characteristic value calculation function corresponding to the data line where the data storage space is located, and determining an accumulation coefficient corresponding to the stream identifier of each second data stream corresponding to the data storage space based on a second characteristic value calculation function corresponding to the data line where the data storage space is located;
taking the statistical measurement value corresponding to the flow identifier of each second data flow corresponding to the data storage space as an unknown number to be multiplied by a corresponding accumulation coefficient, adding the statistical measurement value to the adjusted statistical measurement value corresponding to the flow identifier of each first data flow corresponding to the data storage space, taking the measurement value of the data flow recorded by the data storage space as an accumulation result, and obtaining a target equation corresponding to the data storage space;
forming a target equation set based on the target equations corresponding to the data storage spaces in the target data table;
and based on a linear optimization algorithm, solving the target equation set by taking the minimum sum of the statistical measurement values corresponding to the stream identifications of the received second data streams as an optimization target to obtain the statistical measurement value corresponding to the stream identification of each second data stream.
20. An apparatus for data flow measurement, the apparatus comprising:
the receiving and sending module is used for receiving a target data packet, and for each data row of a target data table, determining a data storage space corresponding to a target data stream to which the target data packet belongs in the data row based on a first characteristic value calculation function corresponding to the data row and a stream identification corresponding to the target data packet;
the processing module is used for determining the measured value of the target data stream based on the measured value of the target data packet and recording the measured value in the data storage space if the target data stream is the first data stream corresponding to the data storage space; and if the target data stream is not the first data stream corresponding to the data storage space, recording the measured value of the target data stream in a target data table based on the measured value of the target data packet.
21. An apparatus for data flow measurement, the apparatus comprising:
the receiving and sending module is used for receiving a target data packet, and for each data row of a target data table, determining a data storage space corresponding to the data row of a target data stream to which the target data packet belongs based on a first characteristic value calculation function corresponding to the data row and a stream identifier corresponding to the target data packet;
the processing module is used for recording the measured value of the target data stream in the data storage space based on the measured value corresponding to the target data packet; and if the target data stream is the first data stream corresponding to the data storage space, determining the measured value of the target data stream based on the measured value of the target data packet, and recording the measured value in the data storage space.
22. An apparatus for data flow measurement, the apparatus comprising:
the receiving module is used for receiving the stream identifier and the corresponding measured value of the first data stream, the stream identifier of the second data stream and the target data table which are sent by the network equipment;
the processing module is configured to filter, among the measurement values of the first data streams recorded in the target data table, measurement values of the first data streams corresponding to the same stream identifier to obtain a first measurement value of each first data stream recorded in the target data table; accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream; screening the second measurement values of the first data streams corresponding to the same stream identifier in the received second measurement values corresponding to the stream identifier of each first data stream to obtain a third measurement value corresponding to the stream identifier of each first data stream; accumulating the first measured value and the third measured value corresponding to the same flow identification in the first measured value of each first data flow recorded by the target data table and the received third measured value corresponding to the flow identification of each first data flow to obtain a statistical measured value corresponding to the flow identification of each first data flow; and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow and the target data table.
23. An apparatus for data flow measurement, the apparatus comprising:
the receiving module is used for receiving the stream identifier of the first data stream, the corresponding measured value, the storage space identifier of the corresponding data storage space, the stream identifier of the second data stream and the target data table which are sent by the network equipment;
the processing module is configured to filter, among the measurement values of the first data streams recorded in the target data table, measurement values of the first data streams corresponding to the same stream identifier to obtain a first measurement value of each first data stream recorded in the target data table; accumulating the measured values of the first data streams corresponding to the same storage space identifier and the same stream identifier in the received measured values of the first data streams to obtain a second measured value corresponding to the stream identifier of each received first data stream; screening second measurement values corresponding to the flow identifications of the first data flows corresponding to the same flow identification from the received second measurement values corresponding to the flow identifications of each first data flow to obtain a third measurement value corresponding to the flow identification of each first data flow; accumulating the first measurement value and the second measurement value corresponding to the same flow identification in the first measurement value of each first data flow recorded by the target data table and the received third measurement value corresponding to the flow identification of each first data flow to obtain a statistical measurement value corresponding to the flow identification of each first data flow; and determining a statistical measurement value corresponding to the flow identification of each second data flow based on the received flow identification of the second data flow, the measurement value of the data flow recorded in each data storage space in the target data table and the obtained statistical measurement value corresponding to the flow identification of each first data flow.
24. A network device, comprising a processor and a memory, wherein:
the memory stores instructions that are executed by the processor to implement the method of data flow measurement as claimed in any one of claims 1 to 13.
25. A computer-readable storage medium having instructions stored thereon, the instructions being loaded and executed by a processor to implement the method of data flow measurement as claimed in any one of claims 1 to 13.
26. A controller, comprising a processor and a memory, wherein:
the memory stores instructions that are executed by the processor to implement the method of data flow measurement as claimed in any one of claims 14 to 19.
27. A computer-readable storage medium having stored thereon instructions which are loaded and executed by a processor to implement the method of data flow measurement according to any one of claims 14 to 19.
28. A system for data flow measurement, the system comprising a network device and a controller, wherein:
the network device is configured to perform a method of data flow measurement according to any one of claims 1 to 7;
the controller is configured to perform a method of data flow measurement as claimed in any one of claims 14 to 17.
29. A system for data flow measurement, the system comprising a network device and a controller, wherein:
the network device is configured to perform a method of data flow measurement according to any one of claims 8 to 13;
the controller is adapted to perform a method of data flow measurement according to claim 18 or 19.
CN202011383567.3A 2020-11-30 2020-11-30 Method and device for measuring data flow Pending CN114584493A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011383567.3A CN114584493A (en) 2020-11-30 2020-11-30 Method and device for measuring data flow
PCT/CN2021/133234 WO2022111596A1 (en) 2020-11-30 2021-11-25 Data stream measurement method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011383567.3A CN114584493A (en) 2020-11-30 2020-11-30 Method and device for measuring data flow

Publications (1)

Publication Number Publication Date
CN114584493A true CN114584493A (en) 2022-06-03

Family

ID=81753764

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011383567.3A Pending CN114584493A (en) 2020-11-30 2020-11-30 Method and device for measuring data flow

Country Status (2)

Country Link
CN (1) CN114584493A (en)
WO (1) WO2022111596A1 (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3831034B1 (en) * 2018-07-27 2024-05-01 Nokia Solutions and Networks Oy Method, device, and system for network traffic analysis
CN109861881B (en) * 2019-01-24 2021-11-19 大连理工大学 Elephant flow detection method based on three-layer Sketch framework
CN110019250A (en) * 2019-03-06 2019-07-16 清华大学 Network measure method and computer readable storage medium based on hash function
CN110830322B (en) * 2019-09-16 2021-07-06 北京大学 Network flow measuring method and system based on probability measurement data structure Sketch

Also Published As

Publication number Publication date
WO2022111596A1 (en) 2022-06-02

Similar Documents

Publication Publication Date Title
JP2020529171A (en) Traffic measurement methods, devices, and systems
CN109039819B (en) Time delay statistical method, device, system and storage medium
JP5534481B2 (en) Communication quality monitoring system, communication quality monitoring method, and storage medium
CN110083475B (en) Abnormal data detection method and device
CN111597054B (en) Information processing method, system, electronic equipment and storage medium
CN110784336A (en) Multi-device intelligent timing delay scene setting method and system based on Internet of things
CN115396345A (en) Flow measuring method, device and related equipment
CN113746763B (en) Data processing method, device and equipment
CN114584493A (en) Method and device for measuring data flow
CN113127693B (en) Traffic data packet statistics method, device, equipment and storage medium
WO2023109794A1 (en) Methods and systems for adaptive stochastic-based load balancing
CN111884932B (en) Link determining method, device, equipment and computer readable storage medium
CN109104453B (en) Sensor evaluation server and sensor evaluation method
CN115955323A (en) Network security situation sensing method and device and electronic equipment
CN113472591A (en) Method and device for determining service performance
JP7359299B2 (en) Packet identification device, packet identification method, and packet identification program
CN111008476A (en) Method and device for calculating bulb tube cooling rate, electronic equipment and storage medium
CN112671616A (en) Flow monitoring method and device, programmable chip, storage medium and electronic device
CN108173689B (en) Output system of load balancing data
CN112511449A (en) Message flow out-of-order detection method, message processing method and device
CN112148765B (en) Service data processing method, device and storage medium
CN107592269B (en) Method and network node for transmitting load information of path
CN115937253B (en) Lu Bangbo Songduobernoulli filtering method under thick tail measurement noise and related equipment
CN113452614B (en) Message processing method and device
CN114143083B (en) Blacklist policy matching method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination