WO2020177383A1 - Data stream processing method and related device - Google Patents

Data stream processing method and related device Download PDF

Info

Publication number
WO2020177383A1
WO2020177383A1 PCT/CN2019/117783 CN2019117783W WO2020177383A1 WO 2020177383 A1 WO2020177383 A1 WO 2020177383A1 CN 2019117783 W CN2019117783 W CN 2019117783W WO 2020177383 A1 WO2020177383 A1 WO 2020177383A1
Authority
WO
WIPO (PCT)
Prior art keywords
data stream
network attribute
hash value
transmission queue
attribute information
Prior art date
Application number
PCT/CN2019/117783
Other languages
French (fr)
Chinese (zh)
Inventor
匡光彩
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020177383A1 publication Critical patent/WO2020177383A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Definitions

  • This application relates to the field of electronic technology, and in particular to a data stream processing method and related equipment.
  • the virtio network card is a virtual network card mounted on the Peripheral Component Interconnect (PCI) bus simulated by virtio. It can greatly improve the network performance of the virtual machine, but the virtio network card does not support the classification of data streams.
  • PCI Peripheral Component Interconnect
  • the embodiments of the present application provide a data stream processing method and related equipment, which are used to implement support for stream classification by an electronic device including a virtio network card.
  • an embodiment of the present application provides a data stream processing method applied to a first electronic device including a virtio network card, and the method includes:
  • one hash value corresponds to at least one first transmission queue
  • the first transmission queue is used to transmit the first data stream To the first module or the second electronic device in the first electronic device corresponding to the first transmission queue
  • one transmission queue corresponds to at least one first module or at least one second electronic device.
  • an embodiment of the present application provides a data stream processing device, which is applied to a first electronic device including a virtio network card, and the device includes:
  • a parsing unit configured to parse the first data stream to obtain network attribute information carried by the first data stream
  • the calculation unit is configured to call a hash function to calculate the hash value of the network attribute information
  • the diversion unit is configured to import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer all
  • the first data stream is transmitted to the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device.
  • an embodiment of the present application provides an electronic device, including a virtio network card, a processor, a memory, a communication interface, and one or more programs.
  • the one or more programs are stored in the memory and are The configuration is executed by the processor, and the program includes instructions for executing part or all of the steps described in the method described in the first aspect of the embodiments of the present application.
  • embodiments of the present application provide a computer non-volatile readable storage medium, wherein the aforementioned computer non-volatile readable storage medium is used to store a computer program, wherein the aforementioned computer program is executed by a processor, In order to realize part or all of the steps described in the method described in the first aspect of the embodiments of the present application.
  • the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hence, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
  • Figure 1 is a schematic structural diagram of a data stream processing system provided by an embodiment of the present application.
  • Fig. 2 is a schematic flowchart of a data stream processing method provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of another data stream processing method provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a data stream processing apparatus provided by an embodiment of the present application.
  • virtio is an abstraction layer above the device in a paravirtualized hypervisor.
  • the virtio network card is a virtual network card mounted on the PCI bus emulated by virtio. Because virtio network card is the fastest and most comprehensive virtual network card in virtualization, it is generally widely used in virtual machine development.
  • FIG. 1 is a schematic structural diagram of a data stream processing system provided in an embodiment of the present application.
  • the data stream processing system includes a first electronic device and multiple first modules, or,
  • the data stream processing system includes a first electronic device and a plurality of second electronic devices.
  • the first electronic device includes a virtio network card for receiving the first data stream and importing the first data stream to the first transmission queue, and each transmission queue corresponds to at least one first module or at least one second electronic device.
  • Each of the first electronic device and the plurality of second electronic devices may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal device (terminal device), etc.
  • the plurality of first modules may be applications in the first electronic device.
  • the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hence, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
  • FIG. 2 is a schematic flowchart of a data stream processing method provided by an embodiment of the present application, which is applied to a first electronic device including a virtio network card, and the method includes:
  • Step 201 Receive the first data stream.
  • the first data stream is a sequence of data that can only be read once in a pre-defined order, and the data can be pictures, videos, audios, or documents, which are not limited here.
  • the first data stream is sent by a third electronic device, which may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem, and Various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), and so on.
  • UE User Equipment
  • MS Mobile Station
  • terminal device terminal equipment
  • Step 202 Parse the first data stream to obtain network attribute information carried by the first data stream.
  • the network attribute information includes at least one of the following: network protocol, source transmission control protocol port number, destination transmission control protocol port number, source user datagram protocol port number, destination user datagram port number, source Internet protocol address, The priority bit in the destination Internet Protocol address, service type field.
  • the network protocol refers to a set of rules, standards, or agreements established for data exchange in a computer network.
  • the network protocol type includes at least one of the following: Transmission Control Protocol (TCP), User Datagram Protocol (UDP), File Transfer Protocol (FTP), Real-time Transmission Protocol (Real -time Transport Protocol, RTP), the interconnection protocol between networks (Internet Protocol, IP).
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • FTP File Transfer Protocol
  • RTP Real-time Transmission Protocol
  • IP Internet Protocol
  • the TCP protocol is a connection-oriented, reliable, slow transmission speed, byte stream-based transport layer communication protocol, which is mainly used to establish a virtual connection between hosts to achieve highly reliable data packet exchange;
  • UDP The protocol is one of the Open System Interconnect (OSI) models;
  • the FTP protocol is mainly used to upload and download files between two computers, one of which acts as an FTP client and the other as an FTP client.
  • RTP is a network transmission protocol that specifies the standard data packet format for transmitting audio and video on the Internet.
  • IP is a protocol designed for computer networks to communicate with each other. It is a set of rules that enables all computer networks connected to the Internet to communicate with each other, and stipulates that computers are on the Internet Rules that should be followed when communicating.
  • the source TCP port number and the destination TCP port number are included in the TCP message of the data stream.
  • the source TCP port number indicates the port used by the native program to send data
  • the destination TCP port number indicates the interface through which the other host receives the data.
  • the valid range of TCP port number and destination TCP port number is from 0 to 65535.
  • the source UDP port number and the destination UDP port number are included in the UDP message of the data stream.
  • the source UDP port number indicates the port used by the native program to send data
  • the destination UDP port number indicates the interface through which the other host receives the data.
  • the valid range of UDP port number and destination UDP port number is from 0 to 65535.
  • the source IP address and the destination IP address are included in the IP packet of the data stream, the source IP address represents the IP address of the data sender, and the destination IP address represents the IP address of the data receiver.
  • the source IP address represents the IP address of the data sender
  • the destination IP address represents the IP address of the data receiver.
  • 192.168.4.23 is a source IP address or destination IP address.
  • the Type of Service (ToS) field is used by the router to select actual transmission parameters for a specific network, a next-hop network, and the next router for routing data between networks.
  • the valid range of ToS is 0 to 7.
  • the priority bits in the ToS field can be determined according to its effective range, and the priority bits are 0 to 7.
  • Step 203 Call a hash function to calculate the hash value of the network attribute information.
  • the network attribute information includes a plurality of network attribute parameters
  • the hash function is a remainder function
  • the invoking the hash function to calculate the hash value of the network attribute information includes:
  • different network protocols can correspond to different attribute values, and can also correspond to the same attribute value.
  • the attribute value of the destination TCP port number, the attribute value of the source UDP port number, or the attribute value of the destination UDP port number can set its corresponding port number to its corresponding attribute value; the source IP address or the destination IP address can have its address last One bit is set to its corresponding attribute value.
  • the attribute value of the priority bit in ToS may be its priority bit.
  • Table 1 is the mapping table of the correspondence between the network protocol and the attribute value
  • Table 2 is the mapping table of the correspondence between the source TCP port number and the attribute value
  • Table 3 is the mapping table of the correspondence between the destination TCP port number and the attribute value
  • Table 4 is the source UDP port number and attribute value mapping table
  • Table 5 is the mapping table of the destination UDP port number and attribute value
  • Table 6 is the source IP address and attribute value mapping table
  • Table 7 is the destination IP address and The mapping table of the corresponding relationship of the attribute value
  • Table 8 is the mapping table of the corresponding relationship between the priority bit in the ToS and the attribute value.
  • the attribute values of the multiple network attribute parameters Sum 38 Assuming that the number of transmission queues created by the first electronic device is 7, the hash value of the network attribute information is calculated based on the first formula.
  • the network attribute information includes multiple network attribute parameters
  • the hash function is a summation function
  • the invoking the hash function to calculate the hash value of the network attribute information includes:
  • the attribute values of the multiple network attribute parameters If the sum is 38, the hash value of the network attribute information is calculated as 38 based on the second formula.
  • the network attribute information includes multiple network attribute parameters
  • the invoking a hash function to calculate the hash value of the network attribute information includes:
  • the first hash value of the network attribute information is calculated based on the third formula
  • the second hash value of the network attribute information is calculated based on the fourth formula.
  • the H1 is the first hash value
  • the H2 is the second hash value
  • the A is the sum of the attribute values of all network attribute parameters included in the network attribute information
  • the B is the number of transmission queues created by the first electronic device
  • the% is a remainder symbol
  • the attribute values of the multiple network attribute parameters The sum of 26, assuming that the number of transmission queues created by the first electronic device is 7, then the first hash value of the network attribute information is calculated based on the third formula, and the network attribute is calculated based on the fourth formula.
  • the second hash value of the information is 26, and the hash value calculated based on the fifth formula is 6.
  • the network attribute information includes a source transmission control protocol port number
  • the hash function is a remainder function
  • the calling the hash function to calculate the hash value of the network attribute information includes :
  • the hash value of the network attribute information is calculated as 2 based on the third formula.
  • the call hash The specific implementation manner of the function calculating the hash value of the network attribute information is the same as the specific implementation manner of the network attribute information including the source transmission control protocol port number, and will not be described again.
  • Step 204 Import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer the first transmission queue The data stream is transmitted to the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device.
  • the importing the first data stream into the first transmission queue corresponding to the hash value includes:
  • the transmission queue corresponding to the calculated hash value is determined from the multiple transmission queues that have been created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least one hash value, so Each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device;
  • the first module or the second electronic device corresponding to each transmission queue may be the same or different, which is not limited here.
  • the second electronic device corresponding to transmission queue A is a, b, and c
  • the second electronic device corresponding to transmission queue B can be d, e, f, or a, b, d, or a , B, c.
  • Table 9 is a mapping relationship table between hash values and transmission queues. If the hash value is 1, 4, or 7, then transmission queue A is the first transmission queue, and the first data stream is imported to transmission queue A; if the hash value is 2, 5 or 8, then transmission queue B is the first In the transmission queue, the first data stream is imported to the transmission queue B; if the hash value is 3, 6 or 9, then the transmission queue C is the first transmission queue, and the first data stream is imported to the transmission queue C.
  • the importing the first data stream into the first transmission queue corresponding to the hash value includes:
  • the first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: data currently queued in the first transmission queue The number of streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue The required transmission time is less than or equal to the preset duration.
  • the preset number may be 3, 5, 7 or other values, which is not limited here.
  • the size of the data stream currently allowed to enter the first transmission queue may be 10G, 15G, 30G or other values, which is not limited here.
  • the preset duration may be 3h, 5h, 7h or other values, which is not limited here.
  • the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hence, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
  • the method further includes:
  • the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream;
  • the second data stream is imported into the first transmission queue
  • the third data stream is imported into the second transmission queue.
  • the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the first transmission queue.
  • the size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
  • the first data stream is split into 8G and 2G, or the first data stream can be split into 5G and 5G are not limited here.
  • the method before the importing the third data stream to the second transmission queue, the method further includes:
  • the second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
  • the preset threshold may be 2, 4, 6, or other values, which are not limited here.
  • the hash value corresponding to the second transmission queue includes at least one hash value from 6 to 10.
  • the method before the importing the third data stream to the second transmission queue, the method further includes:
  • the second transmission queue is determined from the multiple transmission queues created by the first electronic device, and the total required transmission time of the data stream currently queued in the second transmission queue is the multiple transmission queues created The data stream currently queued in each transmission queue has the least total required transmission time.
  • FIG. 3 is another data stream processing method provided by an embodiment of the present application, which is characterized in that it is applied to a first electronic device including a virtio network card, The method includes:
  • Step 301 Receive the first data stream.
  • Step 302 Parse the first data stream to obtain network attribute information carried by the first data stream.
  • Step 303 The network attribute information includes multiple network attribute parameters, the hash function is a remainder function, the attribute value corresponding to each network attribute parameter is determined, and the attribute value corresponding to each network attribute parameter is determined based on the determination The sum of attribute values of the multiple network attribute parameters;
  • Step 305 The network attribute information includes a plurality of network attribute parameters, the hash function is a summation function, the attribute value corresponding to each network attribute parameter is determined, and the attribute value corresponding to each network attribute parameter is determined based on the determination The sum of attribute values of the multiple network attribute parameters;
  • Step 307 The network attribute information includes the source transmission control protocol port number, the hash function is a remainder function, and the hash value of the network attribute information is calculated based on a third formula.
  • Step 308 Under a first condition, import the first data stream to a first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: the first transmission queue is currently queuing The number of data streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the data stream currently queued by the first transmission queue The total required transmission time is less than or equal to the preset duration.
  • Step 309 If the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream.
  • Step 310 Determine a second transmission queue from the multiple transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information.
  • the difference in the Greek value is less than or equal to the preset threshold.
  • Step 311 Import the second data stream into the first transmission queue, and import the third data stream into the second transmission queue, the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to The size of the second data stream, and the size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
  • step 303-step 304, step 305-step 306, and step 307 are three parallel implementations. In the specific implementation process, you can choose one of them. For the specific implementation process of this embodiment, please refer to the above method implementation The specific implementation process described in the example will not be described here.
  • Figure 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application, including a processor, a memory, a communication interface, and one or more A program, wherein, one or more of the above-mentioned programs are stored in the above-mentioned memory and configured to be executed by the above-mentioned processor, and the above-mentioned program includes instructions for executing the following steps:
  • one hash value corresponds to at least one first transmission queue
  • the first transmission queue is used to transmit the first data stream To the first module or the second electronic device in the first electronic device corresponding to the first transmission queue
  • one transmission queue corresponds to at least one first module or at least one second electronic device.
  • the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hence, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
  • the network attribute information includes a plurality of network attribute parameters
  • the hash function is a remainder function.
  • the network attribute information includes a plurality of network attribute parameters
  • the hash function is a summation function.
  • the network attribute information includes multiple network attribute parameters, and in terms of calling a hash function to calculate the hash value of the network attribute information, the above program includes instructions specifically for executing the following steps:
  • the first hash value of the network attribute information is calculated based on the third formula
  • the second hash value of the network attribute information is calculated based on the fourth formula.
  • the H1 is the first hash value
  • the H2 is the second hash value
  • the A is the sum of the attribute values of all network attribute parameters included in the network attribute information
  • the B is the number of transmission queues created by the first electronic device
  • the% is a remainder symbol
  • the hash value of the network attribute information is calculated based on the fifth formula.
  • the network attribute information includes the source transmission control protocol port number
  • the hash function is a remainder function
  • the program includes instructions specifically for performing the following steps:
  • the above-mentioned program includes instructions further used to perform the following steps:
  • the transmission queue corresponding to the calculated hash value is determined from the multiple transmission queues that have been created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least one hash value, so Each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device;
  • the transmission queue corresponding to the calculated hash value is determined as the first transmission queue.
  • the above-mentioned program includes instructions specifically for executing the following steps:
  • a first condition import the first data stream to the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: a data stream currently queued by the first transmission queue The number of data streams currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue is less than or equal to the preset number; The time to be transmitted is less than or equal to the preset duration.
  • the above-mentioned program includes instructions further used to execute the following steps:
  • the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream;
  • the second data stream is imported into the first transmission queue
  • the third data stream is imported into the second transmission queue.
  • the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the first transmission queue.
  • the size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
  • the above-mentioned program includes instructions further used to perform the following steps:
  • the second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
  • the electronic device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the method example.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of this application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • a data stream processing apparatus provided by an embodiment of the present application is applied to a first electronic device including a virtio network card, and the apparatus includes:
  • the receiving unit 501 is configured to receive the first data stream
  • the parsing unit 502 is configured to analyze the first data stream to obtain network attribute information carried by the first data stream;
  • the calculation unit 503 is configured to call a hash function to calculate the hash value of the network attribute information
  • the diversion unit 504 is configured to import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer The first data stream is transmitted to a first module or a second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device .
  • the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hence, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
  • the network attribute information includes multiple network attribute parameters
  • the hash function is a remainder function.
  • the The calculation unit 503 includes:
  • the first determining module 5031 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
  • the network attribute information includes multiple network attribute parameters
  • the hash function is a summation function.
  • the The calculation unit 503 includes:
  • the second determining module 5033 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
  • the network attribute information includes multiple network attribute parameters.
  • the calculation unit 503 includes:
  • the third determining module 5035 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
  • the network attribute information includes a source transmission control protocol port number
  • the hash function is a remainder function
  • the hash function is called to calculate the hash value of the network attribute information.
  • the calculation unit 503 includes:
  • the apparatus before importing the first data stream into the first transmission queue corresponding to the hash value, the apparatus further includes:
  • the determining unit 505 is configured to determine the transmission queue corresponding to the calculated hash value from the multiple transmission queues created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least A hash value, each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device; the transmission queue corresponding to the calculated hash value is determined as the first transmission queue.
  • the diversion unit 504 is specifically used to transfer all data under the first condition.
  • the first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: the number of data streams currently queued in the first transmission queue is less than or equal to a preset number
  • the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total required transmission time of the data stream currently queued in the first transmission queue is less than or equal to the pre- Set the duration.
  • the device further includes a splitting unit 506, configured to: if the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, the first data stream A data stream is split into a second data stream and a third data stream; the diversion unit 504 is also used to import the second data stream to the first transmission queue, and to transfer the third data stream Imported to the second transmission queue, the size of the data flow currently allowed to enter the first transmission queue is greater than or equal to the size of the second data flow, and the size of the data flow currently allowed to enter the second transmission queue is greater than or equal to the The size of the third data stream.
  • a splitting unit 506 configured to: if the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, the first data stream A data stream is split into a second data stream and a third data stream; the diversion unit 504 is also used to import the second data stream to the first transmission queue, and to transfer the third data stream Imported to the second transmission queue, the size
  • the determining unit 505 is further configured to determine from the multiple transmission queues that the first electronic device has created In the second transmission queue, the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information. The difference between the hash value and the hash value of the network attribute information is less than or equal to a preset threshold.
  • the analysis unit 502, the calculation unit 503, the diversion unit 504, the determination unit 505, and the splitting unit 506 can be implemented by a processor, and the receiving unit 501 can be implemented by a communication interface.
  • An embodiment of the present application also provides a computer storage medium, where the computer storage medium stores a computer program for storing a computer program, and the computer program is executed by a processor as part or all of the steps of any method described in the above method embodiment.
  • the embodiments of the present application also provide a computer program product.
  • the above-mentioned computer program product includes a non-transitory computer non-volatile readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute the above-mentioned method embodiment. Part or all of the steps of any method described.
  • the computer program product may be a software installation package.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application.
  • the aforementioned memory includes: U disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.

Abstract

The present application relates to cloud computing in the technical field of electronics, and particularly relates to a data stream processing method and related device, applicable to a first electronic device comprising a VirtIO network card, said method comprising: receiving a first data stream; analyzing the first data stream to obtain network attribute information carried by the first data stream; invoking a hash function to calculate the hash value of the network attribute information; importing the first data stream into a first transmission queue corresponding to the hash value, the first transmission queue being used for transmitting the first data stream to a first module or a second electronic device in a first electronic device corresponding to the first transmission queue. The embodiments of the present application can be achieve support, for flow classification, by an electronic device comprising a VirtIO network card.

Description

数据流处理方法及相关设备Data stream processing method and related equipment
本申请要求于2019年03月04日提交中国专利局、申请号为201910160002.X、申请名称为“数据流处理方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201910160002.X, and the application name is "Data Stream Processing Method and Related Equipment" on March 4, 2019. The entire content is incorporated herein by reference. Applying.
技术领域Technical field
本申请涉及电子技术领域,尤其涉及一种数据流处理方法及相关设备。This application relates to the field of electronic technology, and in particular to a data stream processing method and related equipment.
背景技术Background technique
随着互联网技术的日益普遍,特别是移动终端的普及,通信网络涌现出越来越多类型的数据流。不同类型的数据流对网络服务的要求不尽相同,因此,通常针对不同类型的数据流需要提供不同的服务质量。virtio网卡是挂载在virtio模拟的外设部件互连标准(Peripheral Component Interconnect,PCI)总线上的一个虚拟网卡,它可以大大提高虚拟机网络性能,但是virtio网卡不支持对数据流进行分类。With the increasing popularity of Internet technology, especially the popularization of mobile terminals, more and more types of data streams have emerged in communication networks. Different types of data streams have different requirements for network services. Therefore, different types of data streams generally need to provide different service qualities. The virtio network card is a virtual network card mounted on the Peripheral Component Interconnect (PCI) bus simulated by virtio. It can greatly improve the network performance of the virtual machine, but the virtio network card does not support the classification of data streams.
发明内容Summary of the invention
本申请实施例提供一种数据流处理方法及相关设备,用于实现包括virtio网卡的电子设备对流分类的支持。The embodiments of the present application provide a data stream processing method and related equipment, which are used to implement support for stream classification by an electronic device including a virtio network card.
第一方面,本申请实施例提供一种数据流处理方法,应用于包括virtio网卡的第一电子设备,所述方法包括:In the first aspect, an embodiment of the present application provides a data stream processing method applied to a first electronic device including a virtio network card, and the method includes:
接收第一数据流;Receive the first data stream;
解析所述第一数据流,得到所述第一数据流携带的的网络属性信息;Parse the first data stream to obtain network attribute information carried by the first data stream;
调用哈希函数计算所述网络属性信息的哈希值;Calling a hash function to calculate the hash value of the network attribute information;
将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。Import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transmit the first data stream To the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, one transmission queue corresponds to at least one first module or at least one second electronic device.
第二方面,本申请实施例提供一种数据流处理装置,应用于包括virtio网卡的第一电子设备,所述装置包括:In a second aspect, an embodiment of the present application provides a data stream processing device, which is applied to a first electronic device including a virtio network card, and the device includes:
接收单元,用于接收第一数据流;A receiving unit for receiving the first data stream;
解析单元,用于解析所述第一数据流,得到所述第一数据流携带的网络属性信息;A parsing unit, configured to parse the first data stream to obtain network attribute information carried by the first data stream;
计算单元,用于调用哈希函数计算所述网络属性信息的哈希值;The calculation unit is configured to call a hash function to calculate the hash value of the network attribute information;
导流单元,用于将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。The diversion unit is configured to import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer all The first data stream is transmitted to the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device.
第三方面,本申请实施例提供一种电子设备,包括virtio网卡、处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如本申请实施例第一方面所述的方法中所描述的部分或全部步骤的指令。In a third aspect, an embodiment of the present application provides an electronic device, including a virtio network card, a processor, a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and are The configuration is executed by the processor, and the program includes instructions for executing part or all of the steps described in the method described in the first aspect of the embodiments of the present application.
第四方面,本申请实施例提供了一种计算机非易失性可读存储介质,其中,上述计算机非易失性可读存储介质用于存储计算机程序,其中,上述计算机程序被处理器执行,以实现如本申请实施例第一方面所述的方法中所描述的部分或全部步骤。In a fourth aspect, embodiments of the present application provide a computer non-volatile readable storage medium, wherein the aforementioned computer non-volatile readable storage medium is used to store a computer program, wherein the aforementioned computer program is executed by a processor, In order to realize part or all of the steps described in the method described in the first aspect of the embodiments of the present application.
可以看出,在本申请实施例中,包括virtio网卡的第一电子设备解析接收到的第一数据流,得到第一数据流携带的网络属性信息;然后调用哈希函数计算网络属性信息的哈希值, 将第一数据流导入至哈希值对应第一传输队列中。由于不同的传输队列对应不同的哈希值,这样可以基于哈希值将不同网络属性信息的数据流导入到不同的传输队列,从而传输至相应的第一模块或第二电子设备,实现了包括virtio网卡的电子设备对流分类的支持。It can be seen that, in this embodiment of the application, the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hopefully, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative work, other drawings can be obtained based on these drawings.
图1是本申请实施例提供的一种数据流处理系统的结构示意图;Figure 1 is a schematic structural diagram of a data stream processing system provided by an embodiment of the present application;
图2是本申请实施例提供的一种数据流处理方法的流程示意图;Fig. 2 is a schematic flowchart of a data stream processing method provided by an embodiment of the present application;
图3是本申请实施例提供的另一种数据流处理方法的流程示意图;3 is a schematic flowchart of another data stream processing method provided by an embodiment of the present application;
图4是本申请实施例提供的一种电子设备的结构示意图;4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图5是本申请实施例提供的一种数据流处理装置的结构示意图。Fig. 5 is a schematic structural diagram of a data stream processing apparatus provided by an embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to enable those skilled in the art to better understand the solution of the application, the technical solutions in the embodiments of the application will be clearly and completely described below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only It is a part of the embodiments of this application, not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the protection scope of this application.
以下分别进行详细说明。Detailed descriptions are given below.
本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third" and "fourth" in the description and claims of the application and the drawings are used to distinguish different objects, rather than describing a specific order . In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes unlisted steps or units, or optionally also includes Other steps or units inherent to these processes, methods, products or equipment.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference to "embodiments" herein means that a specific feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art clearly and implicitly understand that the embodiments described herein can be combined with other embodiments.
下面结合附图对本申请的实施例进行描述。The embodiments of the present application will be described below in conjunction with the drawings.
virtio是半虚拟化hypervisor中位于设备之上的抽象层。virtio网卡是挂载在virtio模拟的PCI总线上的一个虚拟网卡。由于virtio网卡是在虚拟化中速度最快、功能最全面的虚拟网卡,它一般在虚拟机开发中广泛应用。virtio is an abstraction layer above the device in a paravirtualized hypervisor. The virtio network card is a virtual network card mounted on the PCI bus emulated by virtio. Because virtio network card is the fastest and most comprehensive virtual network card in virtualization, it is generally widely used in virtual machine development.
请参阅图1,图1是本申请实施例提供了一种数据流处理系统的结构示意图,在本申请实施例中,该数据流处理系统包括第一电子设备和多个第一模块,或者,该数据流处理系统包括第一电子设备和多个第二电子设备。第一电子设备包括virtio网卡,用于接收第一数据流,以及将第一数据流导入至第一传输队列,每个传输队列对应至少一个第一模块或至少一个第二电子设备。Please refer to FIG. 1. FIG. 1 is a schematic structural diagram of a data stream processing system provided in an embodiment of the present application. In the embodiment of the present application, the data stream processing system includes a first electronic device and multiple first modules, or, The data stream processing system includes a first electronic device and a plurality of second electronic devices. The first electronic device includes a virtio network card for receiving the first data stream and importing the first data stream to the first transmission queue, and each transmission queue corresponds to at least one first module or at least one second electronic device.
第一电子设备和多个第二电子设备均可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。多个第一模块可以是所述第一电子设备中的应用。Each of the first electronic device and the plurality of second electronic devices may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal device (terminal device), etc. The plurality of first modules may be applications in the first electronic device.
可以看出,在本申请实施例中,包括virtio网卡的第一电子设备解析接收到的第一数据流,得到第一数据流携带的网络属性信息;然后调用哈希函数计算网络属性信息的哈希值, 将第一数据流导入至哈希值对应第一传输队列中。由于不同的传输队列对应不同的哈希值,这样可以基于哈希值将不同网络属性信息的数据流导入到不同的传输队列,从而传输至相应的第一模块或第二电子设备,实现了包括virtio网卡的电子设备对流分类的支持。It can be seen that, in this embodiment of the application, the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hopefully, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
请参见图2,图2是本申请实施例提供的一种数据流处理方法的流程示意图,应用于包括virtio网卡的第一电子设备,所述方法包括:Please refer to FIG. 2. FIG. 2 is a schematic flowchart of a data stream processing method provided by an embodiment of the present application, which is applied to a first electronic device including a virtio network card, and the method includes:
步骤201:接收第一数据流。Step 201: Receive the first data stream.
其中,第一数据流是只能以事先规定好的顺序被读取一次的数据的一个序列,该数据可以是图片、视频、音频或者文档,在此不作限定。Among them, the first data stream is a sequence of data that can only be read once in a pre-defined order, and the data can be pictures, videos, audios, or documents, which are not limited here.
其中,第一数据流是第三电子设备发送的,第三电子设备可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。Among them, the first data stream is sent by a third electronic device, which may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem, and Various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), and so on.
步骤202:解析所述第一数据流,得到所述第一数据流携带的网络属性信息。Step 202: Parse the first data stream to obtain network attribute information carried by the first data stream.
其中,所述网络属性信息包括以下至少一种:网络协议、源传输控制协议端口号、目的传输控制协议端口号、源用户数据报协议端口号、目的用户数据报端口号、源互联网协议地址、目的互联网协议地址、服务类型域中的优先级位。Wherein, the network attribute information includes at least one of the following: network protocol, source transmission control protocol port number, destination transmission control protocol port number, source user datagram protocol port number, destination user datagram port number, source Internet protocol address, The priority bit in the destination Internet Protocol address, service type field.
其中,网络协议指的是为计算机网络中进行数据交换而建立的规则、标准或约定的集合。所述网络协议类型包括以下至少一种:传输控制协议(Transmission Control Protocol,TCP)、用户数据报协议(User Datagram Protocol,UDP)、文件传输协议(File Transfer Protocol,FTP)、实时传输协议(Real-time Transport Protocol,RTP)、网络之间互连的协议(Internet Protocol,IP)。Among them, the network protocol refers to a set of rules, standards, or agreements established for data exchange in a computer network. The network protocol type includes at least one of the following: Transmission Control Protocol (TCP), User Datagram Protocol (UDP), File Transfer Protocol (FTP), Real-time Transmission Protocol (Real -time Transport Protocol, RTP), the interconnection protocol between networks (Internet Protocol, IP).
其中,TCP协议是一种面向连接的、可靠的、传输速度慢、基于字节流的传输层通信协议,主要用于在主机间建立一个虚拟连接,以实现高可靠性的数据包交换;UDP协议是开放式系统互联(Open System Interconnect,OSI)模型中的一种;FTP协议主要作用于在两台计算机之间实现文件的上传与下载,其中一台作为FTP的客户端,另一台作为FTP的服务端;RTP是一个网络传输协议,详细说明了在互联网上传递音频和视频的标准数据包格式,广泛应用于流媒体相关的通讯和娱乐,包括电话、视频会议、电视和基于网络的一键通业务(类似对讲机的通话);IP是为计算机网络相互连接进行通信而设计的协议,它是能使连接到网上的所有计算机网络实现相互通信的一套规则,规定了计算机在因特网上进行通信时应当遵守的规则。Among them, the TCP protocol is a connection-oriented, reliable, slow transmission speed, byte stream-based transport layer communication protocol, which is mainly used to establish a virtual connection between hosts to achieve highly reliable data packet exchange; UDP The protocol is one of the Open System Interconnect (OSI) models; the FTP protocol is mainly used to upload and download files between two computers, one of which acts as an FTP client and the other as an FTP client. FTP server; RTP is a network transmission protocol that specifies the standard data packet format for transmitting audio and video on the Internet. It is widely used in streaming media-related communications and entertainment, including telephone, video conferencing, TV and network-based Push-to-talk service (similar to a walkie-talkie call); IP is a protocol designed for computer networks to communicate with each other. It is a set of rules that enables all computer networks connected to the Internet to communicate with each other, and stipulates that computers are on the Internet Rules that should be followed when communicating.
其中,源TCP端口号和目的TCP端口号包含在数据流的TCP报文中,源TCP端口号表示本机程序用来发送数据的端口,目的TCP端口号表示对方主机接收该数据的接口,源TCP端口号和目的TCP端口号的有效范围是从0到65535。Among them, the source TCP port number and the destination TCP port number are included in the TCP message of the data stream. The source TCP port number indicates the port used by the native program to send data, and the destination TCP port number indicates the interface through which the other host receives the data. The valid range of TCP port number and destination TCP port number is from 0 to 65535.
其中,源UDP端口号和目的UDP端口号包含在数据流的UDP报文中,源UDP端口号表示本机程序用来发送数据的端口,目的UDP端口号表示对方主机接收该数据的接口,源UDP端口号和目的UDP端口号的有效范围是从0到65535。Among them, the source UDP port number and the destination UDP port number are included in the UDP message of the data stream. The source UDP port number indicates the port used by the native program to send data, and the destination UDP port number indicates the interface through which the other host receives the data. The valid range of UDP port number and destination UDP port number is from 0 to 65535.
其中,源IP地址和目的IP地址包含在数据流的IP报文中,源IP地址表示数据发送方的IP地址,目的IP地址表示数据接收方的IP地址。例如192.168.4.23为一个源IP地址或目的IP地址。Among them, the source IP address and the destination IP address are included in the IP packet of the data stream, the source IP address represents the IP address of the data sender, and the destination IP address represents the IP address of the data receiver. For example, 192.168.4.23 is a source IP address or destination IP address.
其中,服务类型域(Type of Service,ToS)是路由器用来为特定网络、下一跳的网络和为网间数据选择路由的下一个路由器选择实际的传输参数。ToS的有效范围为0到7。ToS域中的优先级位可以依据其有效范围确定,优先级位为0到7。Among them, the Type of Service (ToS) field is used by the router to select actual transmission parameters for a specific network, a next-hop network, and the next router for routing data between networks. The valid range of ToS is 0 to 7. The priority bits in the ToS field can be determined according to its effective range, and the priority bits are 0 to 7.
步骤203:调用哈希函数计算所述网络属性信息的哈希值。Step 203: Call a hash function to calculate the hash value of the network attribute information.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:In an implementation manner of the present application, the network attribute information includes a plurality of network attribute parameters, the hash function is a remainder function, and the invoking the hash function to calculate the hash value of the network attribute information includes:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。The hash value of the network attribute information is calculated based on the first formula, the first formula is: Z=X%Y, the Z is the hash value, and the X is all network attributes included in the network attribute information The sum of the attribute values of the parameters, the Y is the number of transmission queues created by the first electronic device, and the% is the remainder symbol.
其中,不同的网络协议可以对应的不同的属性值,也可以对应相同的属性值。目的TCP端口号的属性值、源UDP端口号的属性值或目的UDP端口号的属性值可以将其对应的端口号设置为其对应的属性值;源IP地址或目的IP地址可以将其地址最后一位设置为其对应的属性值。ToS中的优先级位的属性值可以为其优先级位。Among them, different network protocols can correspond to different attribute values, and can also correspond to the same attribute value. The attribute value of the destination TCP port number, the attribute value of the source UDP port number, or the attribute value of the destination UDP port number can set its corresponding port number to its corresponding attribute value; the source IP address or the destination IP address can have its address last One bit is set to its corresponding attribute value. The attribute value of the priority bit in ToS may be its priority bit.
表1Table 1
网络协议Network protocol 属性值 Attribute value
TCPTCP 11
UDPUDP 22
FTPFTP 33
RTPRTP 44
IPIP 55
 To ······
表2Table 2
源TCP端口号Source TCP port number 属性值Attribute value
11 11
22 22
33 33
44 44
55 55
······ ······
表3table 3
目的TCP端口号Destination TCP port number 属性值Attribute value
11 11
22 22
33 33
44 44
55 55
······ ······
表4Table 4
源UDP端口号Source UDP port number 属性值Attribute value
11 11
22 22
33 33
44 44
55 55
······ ······
表5table 5
目的UDP端口号Destination UDP port number 属性值Attribute value
11 11
22 22
33 33
44 44
55 55
······ ······
表6Table 6
源IP地址Source IP address 属性值Attribute value
192.168.4.21192.168.4.21 11
192.168.4.22192.168.4.22 22
192.168.4.23192.168.4.23 33
192.168.4.24192.168.4.24 44
192.168.4.25192.168.4.25 55
······ ······
表7Table 7
目的IP地址Destination IP address 属性值Attribute value
192.165.4.21192.165.4.21 11
192.165.4.22192.165.4.22 22
192.165.4.23192.165.4.23 33
192.165.4.24192.165.4.24 44
192.165.4.25192.165.4.25 55
······ ······
表8Table 8
ToS中的优先级位Priority bits in ToS 属性值Attribute value
11 11
22 22
33 33
44 44
55 55
66 66
77 77
表1是网络协议与属性值的对应关系映射表,表2是源TCP端口号与属性值的对应关系映射表,表3是目的TCP端口号与属性值的对应关系映射表,表4是源UDP端口号与属性值的对应关系映射表,表5是目的UDP端口号与属性值的对应关系映射表,表6是源IP地址与属性值的对应关系映射表,表7是目的IP地址与属性值的对应关系映射表,表8是ToS中的优先级位与属性值的对应关系映射表。Table 1 is the mapping table of the correspondence between the network protocol and the attribute value, Table 2 is the mapping table of the correspondence between the source TCP port number and the attribute value, Table 3 is the mapping table of the correspondence between the destination TCP port number and the attribute value, and Table 4 is the source UDP port number and attribute value mapping table, Table 5 is the mapping table of the destination UDP port number and attribute value, Table 6 is the source IP address and attribute value mapping table, Table 7 is the destination IP address and The mapping table of the corresponding relationship of the attribute value, Table 8 is the mapping table of the corresponding relationship between the priority bit in the ToS and the attribute value.
举例说明,假定所述网络属性信息包括的网络协议为TCP,源TCP端口号为23,目的TCP端口号为11,ToS中的优先级位为3,则所述多个网络属性参数的属性值之和38,假 定所述第一电子设备已创建的传输队列的数目为7,则基于第一公式计算所述网络属性信息的哈希值为3。For example, assuming that the network protocol included in the network attribute information is TCP, the source TCP port number is 23, the destination TCP port number is 11, and the priority bit in ToS is 3, then the attribute values of the multiple network attribute parameters Sum 38. Assuming that the number of transmission queues created by the first electronic device is 7, the hash value of the network attribute information is calculated based on the first formula.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters, the hash function is a summation function, and the invoking the hash function to calculate the hash value of the network attribute information includes:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之和。The hash value of the network attribute information is calculated based on a second formula, the second formula is: K=J, the K is the hash value, and J is the value of all network attribute parameters included in the network attribute information The sum of attribute values.
举例说明,假定所述网络属性信息包括的网络协议为TCP,源TCP端口号为23,目的TCP端口号为11,ToS中的优先级位为3,则所述多个网络属性参数的属性值之和38,则基于第二公式计算所述网络属性信息的哈希值为38。For example, assuming that the network protocol included in the network attribute information is TCP, the source TCP port number is 23, the destination TCP port number is 11, and the priority bit in ToS is 3, then the attribute values of the multiple network attribute parameters If the sum is 38, the hash value of the network attribute information is calculated as 38 based on the second formula.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters, and the invoking a hash function to calculate the hash value of the network attribute information includes:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第三公式计算所述网络属性信息的第一哈希值,以及基于第四公式计算所述网络属性信息的第二哈希值,所述第三公式为:H1=A%B,所述第四公式为:H2=A,所述H1为第一哈希值,所述H2为第二哈希值,所述A为所述网络属性信息包括的所有网络属性参数的属性值之和,所述B为所述第一电子设备已创建的传输队列的数目,所述%为求余符号;The first hash value of the network attribute information is calculated based on the third formula, and the second hash value of the network attribute information is calculated based on the fourth formula. The third formula is: H1=A%B, the The fourth formula is: H2=A, the H1 is the first hash value, the H2 is the second hash value, and the A is the sum of the attribute values of all network attribute parameters included in the network attribute information, The B is the number of transmission queues created by the first electronic device, and the% is a remainder symbol;
基于第五公式计算所述网络属性信息的哈希值,所述第五公式为H=H1·H 2/(H1+H2),所述H为哈希值。The hash value of the network attribute information is calculated based on the fifth formula, the fifth formula is H=H1·H2/(H1+H2), and the H is the hash value.
举例说明,假定所述网络属性信息包括的网络协议为TCP,源TCP端口号为13,目的TCP端口号为10,ToS中的优先级位为3,则所述多个网络属性参数的属性值之和26,假定所述第一电子设备已创建的传输队列的数目为7,则基于第三公式计算所述网络属性信息的第一哈希值为5,基于第四公式计算所述网络属性信息的第二哈希值为26,基于第五公式计算的哈希值为6。For example, assuming that the network protocol included in the network attribute information is TCP, the source TCP port number is 13, the destination TCP port number is 10, and the priority bit in ToS is 3, then the attribute values of the multiple network attribute parameters The sum of 26, assuming that the number of transmission queues created by the first electronic device is 7, then the first hash value of the network attribute information is calculated based on the third formula, and the network attribute is calculated based on the fourth formula The second hash value of the information is 26, and the hash value calculated based on the fifth formula is 6.
在本申请的一实现方式中,所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:In an implementation manner of the present application, the network attribute information includes a source transmission control protocol port number, the hash function is a remainder function, and the calling the hash function to calculate the hash value of the network attribute information includes :
基于第六公式计算所述网络属性信息的哈希值,所述第六公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。The hash value of the network attribute information is calculated based on the sixth formula, the sixth formula is: L=M%N, the L is the hash value, the M is the source transmission control protocol port number, and the N The number of transmission queues that have been created for the first electronic device.
举例说明,假定所述网络属性信息包括的网络协议为TCP,源TCP端口号为23,则基于第三公式计算所述网络属性信息的哈希值为2。For example, assuming that the network protocol included in the network attribute information is TCP and the source TCP port number is 23, the hash value of the network attribute information is calculated as 2 based on the third formula.
需要说明的是,所述网络属性信息包括网络协议、目的TCP端口号、源UDP端口号、目的UDP端口号、源IP地址、目的IP地址或ToS中的优先级位时,所述调用哈希函数计算所述网络属性信息的哈希值的具体实现方式与所述网络属性信息包括源传输控制协议端口号的具体实现方式相同,再次不再详述。It should be noted that when the network attribute information includes network protocol, destination TCP port number, source UDP port number, destination UDP port number, source IP address, destination IP address, or priority bits in ToS, the call hash The specific implementation manner of the function calculating the hash value of the network attribute information is the same as the specific implementation manner of the network attribute information including the source transmission control protocol port number, and will not be described again.
步骤204:将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。Step 204: Import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer the first transmission queue The data stream is transmitted to the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device.
具体地,所述将所述第一数据流导入至所述哈希值对应第一传输队列中,包括:Specifically, the importing the first data stream into the first transmission queue corresponding to the hash value includes:
从所述第一电子设备已创建的多个传输队列中确定计算得到的所述哈希值对应的传输 队列,所述多个传输队列中的每一个传输队列均对应至少一个哈希值,所述多个传输队列中的每一个传输队列均对应至少一个第一模块或至少一个第二电子设备;The transmission queue corresponding to the calculated hash value is determined from the multiple transmission queues that have been created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least one hash value, so Each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device;
将计算得到的所述哈希值对应的传输队列确定为第一传输队列;Determining the transmission queue corresponding to the calculated hash value as the first transmission queue;
将所述第一数据流导入至所述第一传输队列中。Import the first data stream into the first transmission queue.
其中,每一个传输队列对应的第一模块或第二电子设备可以是相同的,也可以是不同的,在此不作限定。举例说明,传输队列A对应的第二电子设备为a、b、c,则传输队列B对应的第二电子设备可以为d、e、f,也可以为a、b、d,还可以为a、b、c。Wherein, the first module or the second electronic device corresponding to each transmission queue may be the same or different, which is not limited here. For example, if the second electronic device corresponding to transmission queue A is a, b, and c, the second electronic device corresponding to transmission queue B can be d, e, f, or a, b, d, or a , B, c.
表9Table 9
传输队列Transmission queue 哈希值Hash value
传输队列A Transmission queue A 1、4、71, 4, 7
传输队列BTransmission queue B 2、5、82, 5, 8
传输队列CTransmission queue C 3、6、93, 6, 9
······ ······
又举例说明,表9是哈希值和传输队列的映射关系表。若哈希值为1、4或7,则传输队列A为第一传输队列,将第一数据流导入至传输队列A;若哈希值为2、5或8,则传输队列B为第一传输队列,将第一数据流导入至传输队列B;若哈希值为3、6或9,则传输队列C为第一传输队列,将第一数据流导入至传输队列C。As another example, Table 9 is a mapping relationship table between hash values and transmission queues. If the hash value is 1, 4, or 7, then transmission queue A is the first transmission queue, and the first data stream is imported to transmission queue A; if the hash value is 2, 5 or 8, then transmission queue B is the first In the transmission queue, the first data stream is imported to the transmission queue B; if the hash value is 3, 6 or 9, then the transmission queue C is the first transmission queue, and the first data stream is imported to the transmission queue C.
在本申请的一实现方式中,所述将所述第一数据流导入至所述哈希值对应的第一传输队列中,包括:In an implementation manner of the present application, the importing the first data stream into the first transmission queue corresponding to the hash value includes:
在第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列中,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。Under a first condition, the first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: data currently queued in the first transmission queue The number of streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue The required transmission time is less than or equal to the preset duration.
其中,所述预设数量可以为3、5、7或者是其他值,在此不作限定。Wherein, the preset number may be 3, 5, 7 or other values, which is not limited here.
其中,所述第一传输队列当前允许进入的数据流的大小可以为10G、15G、30G或者是其他值,在此不作限定。Wherein, the size of the data stream currently allowed to enter the first transmission queue may be 10G, 15G, 30G or other values, which is not limited here.
其中,所述预设时长可以为3h、5h、7h或者是其他值,在此不作限定。Wherein, the preset duration may be 3h, 5h, 7h or other values, which is not limited here.
可以看出,在本申请实施例中,包括virtio网卡的第一电子设备解析接收到的第一数据流,得到第一数据流携带的网络属性信息;然后调用哈希函数计算网络属性信息的哈希值,将第一数据流导入至哈希值对应第一传输队列中。由于不同的传输队列对应不同的哈希值,这样可以基于哈希值将不同网络属性信息的数据流导入到不同的传输队列,从而传输至相应的第一模块或第二电子设备,实现了包括virtio网卡的电子设备对流分类的支持。It can be seen that, in this embodiment of the application, the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hopefully, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
在本申请的一实现方式中,所述方法还包括:In an implementation manner of the present application, the method further includes:
若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流;If the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream;
将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。The second data stream is imported into the first transmission queue, and the third data stream is imported into the second transmission queue. The size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the first transmission queue. Second, the size of the data stream. The size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
举例说明,若第一数据流的大小为10G,第一传输队列当前允许进入的数据流的大小8G,则将第一数据流拆分成8G和2G,也可以将第一数据流拆分成5G和5G,在此不作限定。For example, if the size of the first data stream is 10G and the size of the data stream currently allowed in the first transmission queue is 8G, the first data stream is split into 8G and 2G, or the first data stream can be split into 5G and 5G are not limited here.
在本申请的一实现方式中,所述将所述第三数据流导入至第二传输队列之前,所述方法还包括:In an implementation manner of the present application, before the importing the third data stream to the second transmission queue, the method further includes:
从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列 对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。The second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
其中,预设阈值可以为2、4、6或者是其他值,在此不做限定。The preset threshold may be 2, 4, 6, or other values, which are not limited here.
举例说明,所述网络属性信息的哈希值为8,预设阈值为2,则第二传输队列对应的哈希值中至少包括一个哈希值为6~10中的一个数。For example, if the hash value of the network attribute information is 8, and the preset threshold value is 2, then the hash value corresponding to the second transmission queue includes at least one hash value from 6 to 10.
在本申请的另一实现方式中,所述将所述第三数据流导入至第二传输队列之前,所述方法还包括:In another implementation manner of the present application, before the importing the third data stream to the second transmission queue, the method further includes:
从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列当前正在排队的数据流总的所需传输的时间为所述已创建的多个传输队列中每个传输队列当前正在排队的数据流总的所需传输的时间最少的。The second transmission queue is determined from the multiple transmission queues created by the first electronic device, and the total required transmission time of the data stream currently queued in the second transmission queue is the multiple transmission queues created The data stream currently queued in each transmission queue has the least total required transmission time.
与所述图2所示的实施例一致的,请参阅图3,图3是本申请实施例提供的另一种数据流处理方法,其特征在于,应用于包括virtio网卡的第一电子设备,所述方法包括:Consistent with the embodiment shown in FIG. 2, please refer to FIG. 3. FIG. 3 is another data stream processing method provided by an embodiment of the present application, which is characterized in that it is applied to a first electronic device including a virtio network card, The method includes:
步骤301:接收第一数据流。Step 301: Receive the first data stream.
步骤302:解析所述第一数据流,得到所述第一数据流携带的网络属性信息。Step 302: Parse the first data stream to obtain network attribute information carried by the first data stream.
步骤303:所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Step 303: The network attribute information includes multiple network attribute parameters, the hash function is a remainder function, the attribute value corresponding to each network attribute parameter is determined, and the attribute value corresponding to each network attribute parameter is determined based on the determination The sum of attribute values of the multiple network attribute parameters;
步骤304:基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。Step 304: Calculate the hash value of the network attribute information based on a first formula, the first formula being: Z=X%Y, the Z is the hash value, and the X is the value included in the network attribute information The sum of the attribute values of all network attribute parameters, the Y is the number of transmission queues that the first electronic device has created, and the% is the remainder symbol.
步骤305:所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Step 305: The network attribute information includes a plurality of network attribute parameters, the hash function is a summation function, the attribute value corresponding to each network attribute parameter is determined, and the attribute value corresponding to each network attribute parameter is determined based on the determination The sum of attribute values of the multiple network attribute parameters;
步骤306:基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之和。Step 306: Calculate the hash value of the network attribute information based on a second formula, the second formula is: K=J, the K is the hash value, and the J is all networks included in the network attribute information The sum of attribute values of attribute parameters.
步骤307:所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,基于第三公式计算所述网络属性信息的哈希值,所述第三公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。Step 307: The network attribute information includes the source transmission control protocol port number, the hash function is a remainder function, and the hash value of the network attribute information is calculated based on a third formula. The third formula is: L= M%N, the L is a hash value, the M is the source transmission control protocol port number, and the N is the number of transmission queues created by the first electronic device.
步骤308:在第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。Step 308: Under a first condition, import the first data stream to a first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: the first transmission queue is currently queuing The number of data streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the data stream currently queued by the first transmission queue The total required transmission time is less than or equal to the preset duration.
步骤309:若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流。Step 309: If the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream.
步骤310:从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。Step 310: Determine a second transmission queue from the multiple transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information. The difference in the Greek value is less than or equal to the preset threshold.
步骤311:将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。Step 311: Import the second data stream into the first transmission queue, and import the third data stream into the second transmission queue, the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to The size of the second data stream, and the size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
需要说明的是,步骤303-步骤304、步骤305-步骤306和步骤307为三种并列的实现 方式,具体实施过程中,任选其中一种,本实施例的具体实现过程可参见上述方法实施例所述的具体实现过程,在此不再叙述。It should be noted that step 303-step 304, step 305-step 306, and step 307 are three parallel implementations. In the specific implementation process, you can choose one of them. For the specific implementation process of this embodiment, please refer to the above method implementation The specific implementation process described in the example will not be described here.
与上述图2和图3所示的实施例一致的,请参阅图4,图4是本申请实施例提供的一种电子设备的结构示意图,包括处理器、存储器、通信接口以及一个或多个程序,其中,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行以下步骤的指令:Consistent with the embodiments shown in Figures 2 and 3 above, please refer to Figure 4. Figure 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application, including a processor, a memory, a communication interface, and one or more A program, wherein, one or more of the above-mentioned programs are stored in the above-mentioned memory and configured to be executed by the above-mentioned processor, and the above-mentioned program includes instructions for executing the following steps:
接收第一数据流;Receive the first data stream;
解析所述第一数据流,得到所述第一数据流携带的网络属性信息;Parse the first data stream to obtain network attribute information carried by the first data stream;
调用哈希函数计算所述网络属性信息的哈希值;Calling a hash function to calculate the hash value of the network attribute information;
将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。Import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transmit the first data stream To the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, one transmission queue corresponds to at least one first module or at least one second electronic device.
可以看出,在本申请实施例中,包括virtio网卡的第一电子设备解析接收到的第一数据流,得到第一数据流携带的网络属性信息;然后调用哈希函数计算网络属性信息的哈希值,将第一数据流导入至哈希值对应第一传输队列中。由于不同的传输队列对应不同的哈希值,这样可以基于哈希值将不同网络属性信息的数据流导入到不同的传输队列,从而传输至相应的第一模块或第二电子设备,实现了包括virtio网卡的电子设备对流分类的支持。It can be seen that, in this embodiment of the application, the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hopefully, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,在调用哈希函数计算所述网络属性信息的哈希值方面,上述程序包括具体用于执行以下步骤的指令:In an implementation manner of the present application, the network attribute information includes a plurality of network attribute parameters, and the hash function is a remainder function. In terms of calling the hash function to calculate the hash value of the network attribute information, the above program Include instructions specifically for performing the following steps:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。The hash value of the network attribute information is calculated based on the first formula, the first formula is: Z=X%Y, the Z is the hash value, and the X is all network attributes included in the network attribute information The sum of the attribute values of the parameters, the Y is the number of transmission queues created by the first electronic device, and the% is the remainder symbol.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,在调用哈希函数计算所述网络属性信息的哈希值方面,上述程序包括具体用于执行以下步骤的指令:In an implementation manner of the present application, the network attribute information includes a plurality of network attribute parameters, and the hash function is a summation function. In terms of calling the hash function to calculate the hash value of the network attribute information, the aforementioned program Include instructions specifically for performing the following steps:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之和。The hash value of the network attribute information is calculated based on a second formula, the second formula is: K=J, the K is the hash value, and J is the value of all network attribute parameters included in the network attribute information The sum of attribute values.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,在调用哈希函数计算所述网络属性信息的哈希值方面,上述程序包括具体用于执行以下步骤的指令:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters, and in terms of calling a hash function to calculate the hash value of the network attribute information, the above program includes instructions specifically for executing the following steps:
确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
基于第三公式计算所述网络属性信息的第一哈希值,以及基于第四公式计算所述网络属性信息的第二哈希值,所述第三公式为:H1=A%B,所述第四公式为:H2=A,所述H1为第一哈希值,所述H2为第二哈希值,所述A为所述网络属性信息包括的所有网络属性参数的属性值之和,所述B为所述第一电子设备已创建的传输队列的数目,所述%为求余符号;The first hash value of the network attribute information is calculated based on the third formula, and the second hash value of the network attribute information is calculated based on the fourth formula. The third formula is: H1=A%B, the The fourth formula is: H2=A, the H1 is the first hash value, the H2 is the second hash value, and the A is the sum of the attribute values of all network attribute parameters included in the network attribute information, The B is the number of transmission queues created by the first electronic device, and the% is a remainder symbol;
基于第五公式计算所述网络属性信息的哈希值,所述第五公式为H=H1·H 2%(H1+H2), 所述H为哈希值。The hash value of the network attribute information is calculated based on the fifth formula. The fifth formula is H=H1·H 2% (H1+H2), and the H is the hash value.
在本申请的一实现方式中,所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,在调用哈希函数计算所述网络属性信息的哈希值方面,上述程序包括具体用于执行以下步骤的指令:In an implementation manner of the present application, the network attribute information includes the source transmission control protocol port number, the hash function is a remainder function, and in terms of calling the hash function to calculate the hash value of the network attribute information, the above The program includes instructions specifically for performing the following steps:
基于第六公式计算所述网络属性信息的哈希值,所述第六公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。The hash value of the network attribute information is calculated based on the sixth formula, the sixth formula is: L=M%N, the L is the hash value, the M is the source transmission control protocol port number, and the N The number of transmission queues that have been created for the first electronic device.
在本申请的一实现方式中,在将所述第一数据流导入至所述哈希值对应第一传输队列中之前,上述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, before the first data stream is imported into the first transmission queue corresponding to the hash value, the above-mentioned program includes instructions further used to perform the following steps:
从所述第一电子设备已创建的多个传输队列中确定计算得到的所述哈希值对应的传输队列,所述多个传输队列中的每一个传输队列均对应至少一个哈希值,所述多个传输队列中的每一个传输队列均对应至少一个第一模块或至少一个第二电子设备;The transmission queue corresponding to the calculated hash value is determined from the multiple transmission queues that have been created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least one hash value, so Each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device;
将计算得到的所述哈希值对应的传输队列确定为第一传输队列。The transmission queue corresponding to the calculated hash value is determined as the first transmission queue.
在本申请的一实现方式中,在将所述第一数据流导入至所述哈希值对应的第一传输队列中方面,上述程序包括具体用于执行以下步骤的指令:In an implementation manner of the present application, in terms of importing the first data stream into the first transmission queue corresponding to the hash value, the above-mentioned program includes instructions specifically for executing the following steps:
在第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。Under a first condition, import the first data stream to the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: a data stream currently queued by the first transmission queue The number of data streams currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue is less than or equal to the preset number; The time to be transmitted is less than or equal to the preset duration.
在本申请的一实现方式中,上述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, the above-mentioned program includes instructions further used to execute the following steps:
若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流;If the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream;
将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。The second data stream is imported into the first transmission queue, and the third data stream is imported into the second transmission queue. The size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the first transmission queue. Second, the size of the data stream. The size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
在本申请的一实现方式中,在将所述第三数据流导入至第二传输队列之前,上述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, before the third data stream is imported into the second transmission queue, the above-mentioned program includes instructions further used to perform the following steps:
从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。The second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
需要说明的是,本实施例的具体实现过程可参见上述方法实施例所述的具体实现过程,在此不再叙述。It should be noted that the specific implementation process of this embodiment can refer to the specific implementation process described in the foregoing method embodiment, which will not be described here.
上述实施例主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing embodiment mainly introduces the solution of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that, in order to implement the above-mentioned functions, the electronic device includes hardware structures and/or software modules corresponding to each function. Those skilled in the art should easily realize that in combination with the units and algorithm steps of the examples described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
本申请实施例可以根据所述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。所述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实 现时可以有另外的划分方式。The embodiment of the present application may divide the electronic device into functional units according to the method example. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of this application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
下面为本申请装置实施例,本申请装置实施例用于执行本申请方法实施例所实现的方法。请参阅图5,本申请实施例提供的一种数据流处理装置,应用于包括virtio网卡的第一电子设备,所述装置包括:The following are device embodiments of this application, and the device embodiments of this application are used to execute the methods implemented in the method embodiments of this application. Referring to FIG. 5, a data stream processing apparatus provided by an embodiment of the present application is applied to a first electronic device including a virtio network card, and the apparatus includes:
接收单元501,用于接收第一数据流;The receiving unit 501 is configured to receive the first data stream;
解析单元502,用于解析所述第一数据流,得到所述第一数据流携带的网络属性信息;The parsing unit 502 is configured to analyze the first data stream to obtain network attribute information carried by the first data stream;
计算单元503,用于调用哈希函数计算所述网络属性信息的哈希值;The calculation unit 503 is configured to call a hash function to calculate the hash value of the network attribute information;
导流单元504,用于将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。The diversion unit 504 is configured to import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer The first data stream is transmitted to a first module or a second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device .
可以看出,在本申请实施例中,包括virtio网卡的第一电子设备解析接收到的第一数据流,得到第一数据流携带的网络属性信息;然后调用哈希函数计算网络属性信息的哈希值,将第一数据流导入至哈希值对应第一传输队列中。由于不同的传输队列对应不同的哈希值,这样可以基于哈希值将不同网络属性信息的数据流导入到不同的传输队列,从而传输至相应的第一模块或第二电子设备,实现了包括virtio网卡的电子设备对流分类的支持。It can be seen that, in this embodiment of the application, the first electronic device including the virtio network card parses the received first data stream to obtain the network attribute information carried by the first data stream; and then calls the hash function to calculate the hash function of the network attribute information. Hopefully, the first data stream is imported into the first transmission queue corresponding to the hash value. Since different transmission queues correspond to different hash values, data streams of different network attribute information can be imported into different transmission queues based on the hash values, and then transmitted to the corresponding first module or second electronic device, which realizes The electronic equipment of virtio network card supports flow classification.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,在调用哈希函数计算所述网络属性信息的哈希值方面,所述计算单元503,包括:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters, and the hash function is a remainder function. In terms of calling the hash function to calculate the hash value of the network attribute information, the The calculation unit 503 includes:
第一确定模块5031,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The first determining module 5031 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
第一计算模块5032,用于基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。The first calculation module 5032 is configured to calculate the hash value of the network attribute information based on a first formula, the first formula being: Z=X%Y, the Z is the hash value, and the X is the The sum of the attribute values of all network attribute parameters included in the network attribute information, the Y is the number of transmission queues created by the first electronic device, and the% is the remainder symbol.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,在调用哈希函数计算所述网络属性信息的哈希值方面,所述计算单元503,包括:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters, and the hash function is a summation function. In terms of calling the hash function to calculate the hash value of the network attribute information, the The calculation unit 503 includes:
第二确定模块5033,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The second determining module 5033 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
第二计算模块5034,用于基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之和。The second calculation module 5034 is configured to calculate the hash value of the network attribute information based on a second formula, where the second formula is: K=J, the K is the hash value, and the J is the network attribute The sum of the attribute values of all network attribute parameters included in the information.
在本申请的一实现方式中,所述网络属性信息包括多个网络属性参数,在调用哈希函数计算所述网络属性信息的哈希值方面,所述计算单元503包括:In an implementation manner of the present application, the network attribute information includes multiple network attribute parameters. In terms of calling a hash function to calculate the hash value of the network attribute information, the calculation unit 503 includes:
第三确定模块5035,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The third determining module 5035 is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
第三计算模块5036,用于基于第三公式计算所述网络属性信息的第一哈希值,以及基于第四公式计算所述网络属性信息的第二哈希值,所述第三公式为:H1=A%B,所述第四公式为:H2=A,所述H1为第一哈希值,所述H2为第二哈希值,所述A为所述网络属性信息包括的所有网络属性参数的属性值之和,所述B为所述第一电子设备已创建的传输队列的数目,所述%为求余符号;基于第五公式计算所述网络属性信息的哈希值,所述第五公式为H=H1·H 2%(H1+H2),所述H为哈希值。The third calculation module 5036 is configured to calculate the first hash value of the network attribute information based on a third formula, and calculate the second hash value of the network attribute information based on a fourth formula, and the third formula is: H1=A%B, the fourth formula is: H2=A, the H1 is the first hash value, the H2 is the second hash value, and the A is all networks included in the network attribute information The sum of the attribute values of the attribute parameters, the B is the number of transmission queues created by the first electronic device, and the% is the remainder symbol; the hash value of the network attribute information is calculated based on the fifth formula, so The fifth formula is H=H1·H 2%(H1+H2), and the H is a hash value.
在本申请的一实现方式中,所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,在调用哈希函数计算所述网络属性信息的哈希值方面,所述计算单元503, 包括:In an implementation manner of the present application, the network attribute information includes a source transmission control protocol port number, the hash function is a remainder function, and the hash function is called to calculate the hash value of the network attribute information. The calculation unit 503 includes:
第四计算模块5034,用于基于第三公式计算所述网络属性信息的哈希值,所述第三公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。The fourth calculation module 5034 is configured to calculate the hash value of the network attribute information based on a third formula, where the third formula is: L=M%N, the L is the hash value, and the M is the source transmission Control protocol port number, where N is the number of transmission queues created by the first electronic device.
在本申请的一实现方式中,在将所述第一数据流导入至所述哈希值对应第一传输队列中之前,所述装置还包括:In an implementation manner of the present application, before importing the first data stream into the first transmission queue corresponding to the hash value, the apparatus further includes:
确定单元505,用于从所述第一电子设备已创建的多个传输队列中确定计算得到的所述哈希值对应的传输队列,所述多个传输队列中的每一个传输队列均对应至少一个哈希值,所述多个传输队列中的每一个传输队列均对应至少一个第一模块或至少一个第二电子设备;将计算得到的所述哈希值对应的传输队列确定为第一传输队列。The determining unit 505 is configured to determine the transmission queue corresponding to the calculated hash value from the multiple transmission queues created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least A hash value, each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device; the transmission queue corresponding to the calculated hash value is determined as the first transmission queue.
在本申请的一实现方式中,在将所述第一数据流导入至所述哈希值对应的第一传输队列中方面,所述导流单元504,具体用于第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。In an implementation manner of the present application, in terms of importing the first data stream into the first transmission queue corresponding to the hash value, the diversion unit 504 is specifically used to transfer all data under the first condition. The first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: the number of data streams currently queued in the first transmission queue is less than or equal to a preset number The size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total required transmission time of the data stream currently queued in the first transmission queue is less than or equal to the pre- Set the duration.
在本申请的一实现方式中,所述装置还包括拆分单元506,用于若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流;所述导流单元504,还用于将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。In an implementation manner of the present application, the device further includes a splitting unit 506, configured to: if the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, the first data stream A data stream is split into a second data stream and a third data stream; the diversion unit 504 is also used to import the second data stream to the first transmission queue, and to transfer the third data stream Imported to the second transmission queue, the size of the data flow currently allowed to enter the first transmission queue is greater than or equal to the size of the second data flow, and the size of the data flow currently allowed to enter the second transmission queue is greater than or equal to the The size of the third data stream.
在本申请的一实现方式中,在将所述第三数据流导入至第二传输队列之前,所述确定单元505,还用于从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。In an implementation manner of the present application, before the third data stream is imported to the second transmission queue, the determining unit 505 is further configured to determine from the multiple transmission queues that the first electronic device has created In the second transmission queue, the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information. The difference between the hash value and the hash value of the network attribute information is less than or equal to a preset threshold.
需要说明的是,解析单元502、计算单元503、导流单元504、确定单元505和拆分单元506可通过处理器实现,接收单元501可通过通信接口。It should be noted that the analysis unit 502, the calculation unit 503, the diversion unit 504, the determination unit 505, and the splitting unit 506 can be implemented by a processor, and the receiving unit 501 can be implemented by a communication interface.
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于存储计算机程序,该计算机程序被处理器执行如上述方法实施例中记载的任一方法的部分或全部步骤。An embodiment of the present application also provides a computer storage medium, where the computer storage medium stores a computer program for storing a computer program, and the computer program is executed by a processor as part or all of the steps of any method described in the above method embodiment.
本申请实施例还提供一种计算机程序产品,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机非易失性可读存储介质,上述计算机程序可操作来使计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包。The embodiments of the present application also provide a computer program product. The above-mentioned computer program product includes a non-transitory computer non-volatile readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute the above-mentioned method embodiment. Part or all of the steps of any method described. The computer program product may be a software installation package.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described sequence of actions. Because according to this application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种 逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application. The aforementioned memory includes: U disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable memory, and the memory can include: flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above examples are only used to help understand the methods and core ideas of the application; A person of ordinary skill in the art, based on the idea of the present application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation of the present application.

Claims (20)

  1. 一种数据流处理方法,其特征在于,应用于包括virtio网卡的第一电子设备,所述方法包括:A data stream processing method, characterized in that it is applied to a first electronic device including a virtio network card, and the method includes:
    接收第一数据流;Receive the first data stream;
    解析所述第一数据流,得到所述第一数据流携带的网络属性信息;Parse the first data stream to obtain network attribute information carried by the first data stream;
    调用哈希函数计算所述网络属性信息的哈希值;Calling a hash function to calculate the hash value of the network attribute information;
    将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。Import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transmit the first data stream To the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, one transmission queue corresponds to at least one first module or at least one second electronic device.
  2. 根据权利要求1所述的方法,其特征在于,所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:The method according to claim 1, wherein the network attribute information includes a plurality of network attribute parameters, the hash function is a remainder function, and the hash function is called to calculate the hash of the network attribute information Values include:
    确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。The hash value of the network attribute information is calculated based on the first formula, the first formula is: Z=X%Y, the Z is the hash value, and the X is all network attributes included in the network attribute information The sum of the attribute values of the parameters, the Y is the number of transmission queues created by the first electronic device, and the% is the remainder symbol.
  3. 根据权利要求1所述的方法,其特征在于,所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:The method according to claim 1, wherein the network attribute information includes multiple network attribute parameters, the hash function is a summation function, and the hash function is called to calculate the hash of the network attribute information Values include:
    确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之和。The hash value of the network attribute information is calculated based on a second formula, the second formula is: K=J, the K is the hash value, and J is the value of all network attribute parameters included in the network attribute information The sum of attribute values.
  4. 根据权利要求1所述的方法,其特征在于,所述网络属性信息包括多个网络属性参数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:The method according to claim 1, wherein the network attribute information includes multiple network attribute parameters, and the invoking a hash function to calculate the hash value of the network attribute information comprises:
    确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;Determining the attribute value corresponding to each network attribute parameter, and determining the sum of attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    基于第三公式计算所述网络属性信息的第一哈希值,以及基于第四公式计算所述网络属性信息的第二哈希值,所述第三公式为:H1=A%B,所述第四公式为:H2=A,所述H1为第一哈希值,所述H2为第二哈希值,所述A为所述网络属性信息包括的所有网络属性参数的属性值之和,所述B为所述第一电子设备已创建的传输队列的数目,所述%为求余符号;The first hash value of the network attribute information is calculated based on the third formula, and the second hash value of the network attribute information is calculated based on the fourth formula. The third formula is: H1=A%B, the The fourth formula is: H2=A, the H1 is the first hash value, the H2 is the second hash value, and the A is the sum of the attribute values of all network attribute parameters included in the network attribute information, The B is the number of transmission queues created by the first electronic device, and the% is a remainder symbol;
    基于第五公式计算所述网络属性信息的哈希值,所述第五公式为H=H1·H2%(H1+H2),所述H为哈希值。The hash value of the network attribute information is calculated based on the fifth formula. The fifth formula is H=H1·H2% (H1+H2), and the H is the hash value.
  5. 根据权利要求1所述的方法,其特征在于,所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,包括:The method according to claim 1, wherein the network attribute information includes a source transmission control protocol port number, the hash function is a remainder function, and the hash function is called to calculate the hash function of the network attribute information. Hope values include:
    基于第六公式计算所述网络属性信息的哈希值,所述第六公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。The hash value of the network attribute information is calculated based on the sixth formula, the sixth formula is: L=M%N, the L is the hash value, the M is the source transmission control protocol port number, and the N The number of transmission queues that have been created for the first electronic device.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述将所述第一数据流导入至所述哈希值对应第一传输队列中之前,所述方法还包括:The method according to any one of claims 1-5, wherein before the importing the first data stream into the first transmission queue corresponding to the hash value, the method further comprises:
    从所述第一电子设备已创建的多个传输队列中确定计算得到的所述哈希值对应的传输 队列,所述多个传输队列中的每一个传输队列均对应至少一个哈希值,所述多个传输队列中的每一个传输队列均对应至少一个第一模块或至少一个第二电子设备;The transmission queue corresponding to the calculated hash value is determined from the multiple transmission queues that have been created by the first electronic device, and each transmission queue in the multiple transmission queues corresponds to at least one hash value, so Each of the multiple transmission queues corresponds to at least one first module or at least one second electronic device;
    将计算得到的所述哈希值对应的传输队列确定为第一传输队列。The transmission queue corresponding to the calculated hash value is determined as the first transmission queue.
  7. 根据权利要求6所述的方法,其特征在于,所述将所述第一数据流导入至所述哈希值对应的第一传输队列中,包括:The method according to claim 6, wherein the importing the first data stream into the first transmission queue corresponding to the hash value comprises:
    在第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列中,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。Under a first condition, the first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: data currently queued in the first transmission queue The number of streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue The required transmission time is less than or equal to the preset duration.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流;If the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream, split the first data stream into a second data stream and a third data stream;
    将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。The second data stream is imported into the first transmission queue, and the third data stream is imported into the second transmission queue. The size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the first transmission queue. Second, the size of the data stream. The size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
  9. 根据权利要求8所述的方法,其特征在于,所述将所述第三数据流导入至第二传输队列之前,所述方法还包括:The method according to claim 8, wherein before the importing the third data stream to the second transmission queue, the method further comprises:
    从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。The second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
  10. 一种数据流处理装置,其特征在于,应用于包括virtio网卡的第一电子设备,所述装置包括:A data stream processing device, characterized in that it is applied to a first electronic device including a virtio network card, and the device includes:
    接收单元,用于接收第一数据流;A receiving unit for receiving the first data stream;
    解析单元,用于解析所述第一数据流,得到所述第一数据流携带的网络属性信息;A parsing unit, configured to parse the first data stream to obtain network attribute information carried by the first data stream;
    计算单元,用于调用哈希函数计算所述网络属性信息的哈希值;The calculation unit is configured to call a hash function to calculate the hash value of the network attribute information;
    导流单元,用于将所述第一数据流导入至所述哈希值对应的第一传输队列中,一个哈希值对应至少一个第一传输队列,所述第一传输队列用于将所述第一数据流传输至与所述第一传输队列对应的所述第一电子设备中的第一模块或第二电子设备,一个传输队列对应至少一个第一模块或至少一个第二电子设备。The diversion unit is configured to import the first data stream into a first transmission queue corresponding to the hash value, one hash value corresponds to at least one first transmission queue, and the first transmission queue is used to transfer all The first data stream is transmitted to the first module or the second electronic device in the first electronic device corresponding to the first transmission queue, and one transmission queue corresponds to at least one first module or at least one second electronic device.
  11. 根据权利要求10所述的装置,其特征在于,所述网络属性信息包括多个网络属性参数,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,所述计算单元包括:The device according to claim 10, wherein the network attribute information includes a plurality of network attribute parameters, the hash function is a remainder function, and the hash function is called to calculate the hash of the network attribute information Value, the calculation unit includes:
    第一确定模块,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The first determining module is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    第一计算模块,用于基于第一公式计算所述网络属性信息的哈希值,所述第一公式为:Z=X%Y,所述Z为哈希值,所述X为所述网络属性信息包括的所有网络属性参数的属性值之和,所述Y为所述第一电子设备已创建的传输队列的数目,所述%为求余符号。The first calculation module is configured to calculate the hash value of the network attribute information based on a first formula, the first formula being: Z=X%Y, the Z is the hash value, and the X is the network The attribute information includes the sum of attribute values of all network attribute parameters, the Y is the number of transmission queues created by the first electronic device, and the% is the remainder symbol.
  12. 根据权利要求10所述的装置,其特征在于,所述网络属性信息包括多个网络属性参数,所述哈希函数为求和函数,所述调用哈希函数计算所述网络属性信息的哈希值,所述计算单元包括:The device according to claim 10, wherein the network attribute information includes a plurality of network attribute parameters, the hash function is a sum function, and the hash function is called to calculate the hash of the network attribute information Value, the calculation unit includes:
    第二确定模块,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The second determining module is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    第二计算模块,用于基于第二公式计算所述网络属性信息的哈希值,所述第二公式为:K=J,所述K为哈希值,所述J为所述网络属性信息包括的所有网络属性参数的属性值之 和。The second calculation module is configured to calculate the hash value of the network attribute information based on a second formula, where the second formula is: K=J, the K is the hash value, and the J is the network attribute information The sum of attribute values of all network attribute parameters included.
  13. 根据权利要求10所述的装置,其特征在于,所述网络属性信息包括多个网络属性参数,所述调用哈希函数计算所述网络属性信息的哈希值,所述计算单元包括:The apparatus according to claim 10, wherein the network attribute information includes a plurality of network attribute parameters, the calling a hash function to calculate the hash value of the network attribute information, and the calculation unit comprises:
    第三确定模块,用于确定每个网络属性参数对应的属性值,以及基于确定的每个网络属性参数对应的属性值确定所述多个网络属性参数的属性值之和;The third determining module is configured to determine the attribute value corresponding to each network attribute parameter, and determine the sum of the attribute values of the multiple network attribute parameters based on the determined attribute value corresponding to each network attribute parameter;
    第三计算模块,用于基于第三公式计算所述网络属性信息的第一哈希值,以及基于第四公式计算所述网络属性信息的第二哈希值,所述第三公式为:H1=A%B,所述第四公式为:H2=A,所述H1为第一哈希值,所述H2为第二哈希值,所述A为所述网络属性信息包括的所有网络属性参数的属性值之和,所述B为所述第一电子设备已创建的传输队列的数目,所述%为求余符号;基于第五公式计算所述网络属性信息的哈希值,所述第五公式为H=H1·H2%(H1+H2),所述H为哈希值。The third calculation module is configured to calculate the first hash value of the network attribute information based on the third formula, and calculate the second hash value of the network attribute information based on the fourth formula, the third formula is: H1 =A%B, the fourth formula is: H2=A, the H1 is the first hash value, the H2 is the second hash value, and the A is all network attributes included in the network attribute information The sum of the attribute values of the parameters, the B is the number of transmission queues created by the first electronic device, and the% is the remainder symbol; the hash value of the network attribute information is calculated based on the fifth formula, the The fifth formula is H=H1·H2%(H1+H2), and the H is a hash value.
  14. 根据权利要求10所述的装置,其特征在于,所述网络属性信息包括源传输控制协议端口号,所述哈希函数为求余函数,所述调用哈希函数计算所述网络属性信息的哈希值,所述计算单元包括:The device according to claim 10, wherein the network attribute information includes a source transmission control protocol port number, the hash function is a remainder function, and the hash function is called to calculate the hash function of the network attribute information. Hopefully, the calculation unit includes:
    第四计算单元,用于基于第六公式计算所述网络属性信息的哈希值,所述第六公式为:L=M%N,所述L为哈希值,所述M为源传输控制协议端口号,所述N为所述第一电子设备已创建的传输队列的数目。The fourth calculation unit is configured to calculate the hash value of the network attribute information based on the sixth formula, where the sixth formula is: L=M%N, the L is the hash value, and the M is the source transmission control Protocol port number, where N is the number of transmission queues created by the first electronic device.
  15. 根据权利要求10-14任一项所述的装置,其特征在于,所述将所述第一数据流导入至所述哈希值对应第一传输队列中之前,所述装置还包括:The device according to any one of claims 10-14, wherein before the importing the first data stream into the first transmission queue corresponding to the hash value, the device further comprises:
    确定单元,用于从所述第一电子设备已创建的多个传输队列中确定计算得到的所述哈希值对应的传输队列,所述多个传输队列中的每一个传输队列均对应至少一个哈希值,所述多个传输队列中的每一个传输队列均对应至少一个第一模块或至少一个第二电子设备;将计算得到的所述哈希值对应的传输队列确定为第一传输队列。The determining unit is configured to determine the transmission queue corresponding to the calculated hash value from the multiple transmission queues that the first electronic device has created, and each transmission queue of the multiple transmission queues corresponds to at least one A hash value, each transmission queue of the plurality of transmission queues corresponds to at least one first module or at least one second electronic device; the transmission queue corresponding to the calculated hash value is determined as the first transmission queue .
  16. 根据权利要求15所述的装置,其特征在于,所述将所述第一数据流导入至所述哈希值对应的第一传输队列中,所述导流单元,具体用于:15. The device according to claim 15, wherein the importing the first data stream into the first transmission queue corresponding to the hash value, and the diversion unit is specifically configured to:
    在第一条件下,将所述第一数据流导入至所述哈希值对应的第一传输队列中,所述第一条件包括以下至少一种:所述第一传输队列当前正在排队的数据流的数量小于或等于预设数量;所述第一传输队列当前允许进入的数据流的大小大于或等于所述第一数据流的大小;所述第一传输队列当前正在排队的数据流总的所需传输的时间小于或等于预设时长。Under a first condition, the first data stream is imported into the first transmission queue corresponding to the hash value, and the first condition includes at least one of the following: data currently queued in the first transmission queue The number of streams is less than or equal to the preset number; the size of the data stream currently allowed to enter the first transmission queue is greater than or equal to the size of the first data stream; the total number of data streams currently queued in the first transmission queue The required transmission time is less than or equal to the preset duration.
  17. 根据权利要求16所述的装置,其特征在于,所述装置还包括:The device according to claim 16, wherein the device further comprises:
    拆分单元,用于若所述第一传输队列当前允许进入的数据流的大小小于所述第一数据流的大小,将所述第一数据流拆分成第二数据流和第三数据流;A splitting unit, configured to split the first data stream into a second data stream and a third data stream if the size of the data stream currently allowed to enter the first transmission queue is smaller than the size of the first data stream ;
    所述导流单元,还用于将所述第二数据流导入至所述第一传输队列,以及将所述第三数据流导入至第二传输队列,所述第一传输队列当前允许进入的数据流大小大于或等于所述第二数据流的大小,所述第二传输队列当前允许进入的数据流大小大于或等于所述第三数据流的大小。The diversion unit is further configured to import the second data stream into the first transmission queue, and import the third data stream into the second transmission queue, which is currently allowed to enter the first transmission queue The size of the data stream is greater than or equal to the size of the second data stream, and the size of the data stream currently allowed to enter the second transmission queue is greater than or equal to the size of the third data stream.
  18. 根据权利要求17所述的方法,其特征在于,所述将所述第三数据流导入至第二传输队列之前,所述确定单元,还用于:The method according to claim 17, wherein, before the importing the third data stream to the second transmission queue, the determining unit is further configured to:
    从所述第一电子设备已创建的多个传输队列中确定第二传输队列,所述第二传输队列对应的哈希值中至少包括一个哈希值与所述网络属性信息的哈希值的差小于或等于预设阈值。The second transmission queue is determined from the plurality of transmission queues created by the first electronic device, and the hash value corresponding to the second transmission queue includes at least one hash value and the hash value of the network attribute information The difference is less than or equal to the preset threshold.
  19. 一种电子设备,其特征在于,包括virtio网卡、处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-9任一项所述的方法中的步骤的指令。An electronic device, characterized by comprising a virtio network card, a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be processed by the The program includes instructions for executing the steps in the method according to any one of claims 1-9.
  20. 一种计算机非易失性可读存储介质,其特征在于,所述计算机非易失性可读存储介质用于存储计算机程序,所述计算机程序被处理器执行,以实现如权利要求1-9任一项所述的方法。A computer non-volatile readable storage medium, characterized in that the computer non-volatile readable storage medium is used to store a computer program, and the computer program is executed by a processor to implement claims 1-9 Any one of the methods.
PCT/CN2019/117783 2019-03-04 2019-11-13 Data stream processing method and related device WO2020177383A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910160002.XA CN110011935B (en) 2019-03-04 2019-03-04 Data stream processing method and related equipment
CN201910160002X 2019-03-04

Publications (1)

Publication Number Publication Date
WO2020177383A1 true WO2020177383A1 (en) 2020-09-10

Family

ID=67166318

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117783 WO2020177383A1 (en) 2019-03-04 2019-11-13 Data stream processing method and related device

Country Status (2)

Country Link
CN (1) CN110011935B (en)
WO (1) WO2020177383A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110011935B (en) * 2019-03-04 2022-05-24 平安科技(深圳)有限公司 Data stream processing method and related equipment
CN111882179A (en) * 2020-07-09 2020-11-03 福建奇点时空数字科技有限公司 Network security situation awareness system platform based on data stream processing
CN112087402A (en) * 2020-09-16 2020-12-15 盛科网络(苏州)有限公司 Queue distribution method and system based on HASH algorithm
CN113067989B (en) * 2021-06-01 2021-09-24 神威超算(北京)科技有限公司 Data processing method and chip
CN114710811A (en) * 2022-04-07 2022-07-05 中国联合网络通信集团有限公司 Data stream forwarding method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7483430B1 (en) * 2003-02-28 2009-01-27 Cisco Technology, Inc. Hierarchical hash method for performing forward route lookup
CN106302236A (en) * 2015-05-27 2017-01-04 国家计算机网络与信息安全管理中心 A kind of method of data distribution and access device
CN108282412A (en) * 2018-01-19 2018-07-13 世纪龙信息网络有限责任公司 Network shunt method, apparatus, system and computer equipment
CN110011935A (en) * 2019-03-04 2019-07-12 平安科技(深圳)有限公司 Data flow processing method and relevant device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7830905B2 (en) * 2007-04-20 2010-11-09 Cray Inc. Speculative forwarding in a high-radix router
CN101616083B (en) * 2009-08-06 2012-01-04 杭州华三通信技术有限公司 Message forwarding method and device
CN106209672B (en) * 2016-07-21 2019-04-09 湖南智卓创新金融电子有限公司 A kind of method and system of Network Load Balance
CN107222408B (en) * 2017-06-01 2020-08-04 杭州迪普科技股份有限公司 Shunting method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7483430B1 (en) * 2003-02-28 2009-01-27 Cisco Technology, Inc. Hierarchical hash method for performing forward route lookup
CN106302236A (en) * 2015-05-27 2017-01-04 国家计算机网络与信息安全管理中心 A kind of method of data distribution and access device
CN108282412A (en) * 2018-01-19 2018-07-13 世纪龙信息网络有限责任公司 Network shunt method, apparatus, system and computer equipment
CN110011935A (en) * 2019-03-04 2019-07-12 平安科技(深圳)有限公司 Data flow processing method and relevant device

Also Published As

Publication number Publication date
CN110011935B (en) 2022-05-24
CN110011935A (en) 2019-07-12

Similar Documents

Publication Publication Date Title
WO2020177383A1 (en) Data stream processing method and related device
US20200358886A1 (en) Data Transmission Method, Apparatus, And System
EP3720052B1 (en) Service identification method and device, and network device
CN104580192B (en) The treating method and apparatus of the network access request of application program
WO2017185719A1 (en) Udp protocol acceleration method and system
Kundel et al. OpenBNG: Central office network functions on programmable data plane hardware
WO2019105317A1 (en) Method for sending service packet, network device, and system
WO2015106453A1 (en) Service processing method and network device
WO2017162117A1 (en) Accurate speed limiting method and apparatus for cluster
WO2022100199A1 (en) Data transmission method and apparatus, and medium, electronic device and network access device
US10382339B2 (en) Large scale bandwidth management of IP flows using a hierarchy of traffic shaping devices
CN110545230A (en) method and device for forwarding VXLAN message
CN108809549B (en) Data transmission method and equipment
WO2016202224A1 (en) Method and device for adjusting transport layer parameter
CN110391919A (en) Flux of multicast retransmission method, device, electronic equipment
WO2012122832A1 (en) Hot backup method and apparatus for network address translation entry
US10097375B2 (en) Electronic device and transmission method thereof
CN110224932B (en) Method and system for rapidly forwarding data
WO2017185632A1 (en) Data transmission method and electronic device
CN112383801B (en) Media stream distribution method, device, distribution server and storage medium
CN109379342B (en) UDP network protocol-based upper computer and DSP data transmission method
CN109818882B (en) Method and device for executing QoS strategy
WO2015192572A1 (en) Method, apparatus and system for configuring quality of service (qos) parameters
WO2014107905A1 (en) Cluster and forwarding method
CN110995680A (en) Virtual machine message receiving method, system, device and computer readable storage medium

Legal Events

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

Ref document number: 19917763

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19917763

Country of ref document: EP

Kind code of ref document: A1