CN111949403B - Data packet distribution method and device and electronic equipment - Google Patents

Data packet distribution method and device and electronic equipment Download PDF

Info

Publication number
CN111949403B
CN111949403B CN202010801205.5A CN202010801205A CN111949403B CN 111949403 B CN111949403 B CN 111949403B CN 202010801205 A CN202010801205 A CN 202010801205A CN 111949403 B CN111949403 B CN 111949403B
Authority
CN
China
Prior art keywords
allocation
value
distribution
information corresponding
values
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010801205.5A
Other languages
Chinese (zh)
Other versions
CN111949403A (en
Inventor
段亚伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202010801205.5A priority Critical patent/CN111949403B/en
Publication of CN111949403A publication Critical patent/CN111949403A/en
Application granted granted Critical
Publication of CN111949403B publication Critical patent/CN111949403B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Abstract

The disclosure provides a data packet distribution method, a data packet distribution device and electronic equipment, wherein the distribution method comprises the following steps: acquiring allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm; determining a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value; and updating the first allocation value by using the second allocation value so as to allocate all data packets received in a preset time period after the current moment to at least one processor based on the second allocation value by using a preset algorithm. The distribution method of the data packet can avoid the problems of packet loss and resource waste caused by idle of other processors of the processor caused by distributing the received data packet to the same processor, and improves the processing efficiency of the data packet and the resource utilization rate of the processor.

Description

Data packet distribution method and device and electronic equipment
Technical Field
The disclosure relates to the technical field of flow distribution, and in particular relates to a data packet distribution method, a data packet distribution device and electronic equipment.
Background
As networks are applied to various corners in work and life, the number of users of the networks is increasing, and the performance requirements of network devices are increasing. In order to improve the performance of network equipment, a multi-core architecture is generally adopted to process data; the process of processing data by using the multi-core network device is as follows: when it receives a network packet, the relevant network card needs to decide which processor to process the network packet through a mechanism, and RSS (receive side scaling, receiver side adjustment) is a network packet distribution mechanism, and the distribution of the network packet to the processors is performed through RSS by using parameters given by a developer.
Specifically, the Hash function is utilized to exclusive-or and shift the received tuple and a 40-byte allocation value such as a Key value to obtain a 32-bit Hash result, and the network card allocates the network data packet to the processor through the lower 7 bits of the Hash result. However, for each network card, the Key value is predetermined and fixed, so that the lower 7 bits of the Hash result determined by the Key value are the same for each tuple, i.e. the received network data packet is distributed to the same processor, and the processor is caused to lose packets; and simultaneously, other processors are idle to cause the condition of resource waste.
Disclosure of Invention
Accordingly, an object of an embodiment of the present disclosure is to provide a method, an apparatus and an electronic device for distributing a data packet, which are used for solving the problem in the prior art that a received network data packet is distributed to the same processor, so that the processor loses the packet and other processors are idle, resulting in resource waste.
In a first aspect, an embodiment of the present disclosure provides a method for distributing a data packet, where the method includes:
acquiring allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
determining a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value;
and updating the first allocation value by using the second allocation value so as to allocate all data packets received in a preset time period after the current moment to at least one processor based on the second allocation value by using a preset algorithm.
In one possible implementation manner, the determining, based on the allocation information corresponding to the first allocation value and the first allocation value, a second allocation value includes:
Acquiring a current network address;
determining a plurality of third allocation values based on the network address and the first allocation values;
the second assigned value is selected from the first assigned value and the plurality of third assigned values.
In a possible implementation manner, the determining a plurality of third allocation values based on the network address and the first allocation value includes:
determining a value range of the third assigned value based on the network address;
and selecting a plurality of third distribution values based on a selection rule between the first distribution value and the maximum value of the value range.
In one possible embodiment, the selecting the second allocation value from the first allocation value and the plurality of third allocation values includes:
distributing all data packets in a preset time period before the current moment based on each third distribution value to obtain distribution information corresponding to each third distribution value;
and screening the second distribution value from the first distribution value and a plurality of third distribution values based on the distribution information corresponding to the first distribution value and the distribution information corresponding to each third distribution value.
In a possible implementation manner, the allocation information includes the number of processors and the number of data packets allocated to each processor.
In one possible implementation manner, the selecting the second allocation value from the first allocation value and the plurality of third allocation values based on allocation information corresponding to the first allocation value and allocation information corresponding to each of the third allocation values includes:
respectively distributing a first average absolute error corresponding to the distribution information corresponding to the first distribution value and a second average absolute error corresponding to the distribution information corresponding to each third distribution value;
and taking the third distribution value corresponding to the smallest second average absolute error as the second distribution value under the condition that the smallest second average absolute error is smaller than the first average absolute error.
In one possible embodiment, in the case where the third allocation value corresponding to the smallest second average absolute error is plural, the smallest of the plural third allocation values corresponding to the second average absolute error is taken as the second allocation value.
In a possible implementation manner, the updating the first allocation value with the second allocation value includes:
Modifying the plurality of byte sections of the first distribution value respectively to obtain a plurality of modified distribution values;
respectively utilizing a preset algorithm to distribute a preset number of data packets based on the first distribution value and each modification distribution value to obtain first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value;
determining a valid bit based on first comparative allocation information corresponding to the first allocation value and second comparative allocation information corresponding to each of the modified allocation values;
and updating the valid byte segment corresponding to the valid bit in the first distribution value by using the valid byte segment corresponding to the valid bit in the second distribution value.
In a second aspect, an embodiment of the present disclosure further provides a device for distributing a data packet, including:
the acquisition module is configured to acquire allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
a determination module configured to determine a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value;
An updating module configured to update the first allocation value with the second allocation value to allocate all data packets received within a preset time period after a current time to at least one processor based on the second allocation value with a preset algorithm.
In a third aspect, the present disclosure further provides an electronic device, including: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating via the bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of the method of distributing data packets as described.
The data packet distribution method provided by the embodiment of the disclosure can update the first distribution value in real time so as to distribute all data packets received in a preset time period after the current moment to at least one processor based on the second distribution value (namely the updated first distribution value) by using a preset algorithm, so that the problem that the received data packets are distributed to the same processor, and the packet loss and the resource waste caused by the idle of other processors are caused in the processor is avoided, and the processing efficiency of the data packets and the resource utilization rate of the processor are improved.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure or the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present disclosure, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 illustrates a flow chart of a method of distributing data packets provided by the present disclosure;
fig. 2 is a flowchart illustrating a method for determining a second allocation value according to allocation information corresponding to the first allocation value and the first allocation value in the method for allocating a data packet provided in the present disclosure;
FIG. 3 is a flow chart illustrating a method for determining a plurality of third allocation values based on a network address and a first allocation value in a method for allocating a data packet provided by the present disclosure;
FIG. 4 is a flow chart illustrating a method for sorting out a second allocation value from a first allocation value and a plurality of third allocation values in a method for allocating a data packet according to the present disclosure;
Fig. 5 is a flowchart illustrating a method for selecting a second allocation value from a first allocation value and a plurality of third allocation values based on allocation information corresponding to the first allocation value and allocation information corresponding to each third allocation value in the method for allocating a data packet provided in the present disclosure;
FIG. 6 illustrates a flow chart for updating a first allocation value with a second allocation value in a method of allocating a data packet provided by the present disclosure;
fig. 7 is a schematic structural diagram of a packet distribution device provided by the present disclosure;
fig. 8 shows a schematic structural diagram of an electronic device provided by the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more apparent, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the present disclosure. It will be apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be made by one of ordinary skill in the art without the need for inventive faculty, are within the scope of the present disclosure, based on the described embodiments of the present disclosure.
Unless defined otherwise, technical or scientific terms used in this disclosure should be given the ordinary meaning as understood by one of ordinary skill in the art to which this disclosure belongs. The terms "first," "second," and the like, as used in this disclosure, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", etc. are used merely to indicate relative positional relationships, which may also be changed when the absolute position of the object to be described is changed.
In order to keep the following description of the present disclosure clear and concise, detailed descriptions of known functions and known components are omitted from the present disclosure.
The embodiment of the disclosure provides a data packet distribution method, which can update a first distribution value in real time, so that all data packets received in a preset time period after a current moment are distributed to a plurality of processors based on a second distribution value (namely the updated first distribution value) by using a preset algorithm, the problem that the received data packets are distributed to the same processor, so that the processor loses the packets and the other processors are idle to cause resource waste is avoided, and the processing efficiency of the data packets and the resource utilization rate of the processors are improved.
It should be noted that, the allocation method of the embodiment of the present disclosure is applicable not only to a scenario in which a packet is allocated to a plurality of processing devices, but also to a scenario in which a packet is allocated to a plurality of cores of a processing device in a case where the processing device is multi-core, and a processor in the embodiment of the present disclosure may be understood as a processing device in a practical sense, and may also be understood as a core of a processing device or the like.
In order to facilitate understanding of the present disclosure, a detailed description is first provided of a method for distributing a data packet according to the present disclosure. As shown in fig. 1, a flowchart of a method for distributing data packets according to an embodiment of the disclosure specifically includes the following steps:
S101, acquiring allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm.
In a specific implementation, considering that the amount of network users is larger and larger, the amount of data packets to be processed is also increased, therefore, a time period, that is, a preset time period, may be predetermined, so as to adjust and update some parameters based on information in the preset time period to improve the processing efficiency of the data packets, for example, allocation information. The preset time period may be 1 second, 2 seconds, etc., and specifically may be determined and adjusted in real time based on the number of data packets in the current network environment.
Here, the allocation information is information obtained by allocating all received data packets to at least one processor based on the first allocation value using a preset algorithm. The preset algorithm is RSS, namely, the Hash function is utilized to carry out exclusive OR, shift and other operation calculations on the tuple of the received data packet and the first distribution value, and all the data packets to be processed in the received network are distributed to at least one processor through the calculation result; i.e. the allocation information comprises the number of processors and the number of data packets allocated per processor. The allocation method provided by the embodiment of the disclosure is applicable to five-tuple, four-tuple, two-tuple and the like. The first assignment value may include a Key value in the background section, or may correspond to a Key value in the background section, or the like.
For example, after 100 packets are received in total in a preset period of time before the current time, and allocated to 5 processors using RSS, allocation information includes 10 processors 1, 30 processors 2, 20 processors 3, 20 processors 4, and 20 processors 5.
S102, determining a second distribution value based on the distribution information corresponding to the first distribution value and the first distribution value.
After the allocation information in the preset time period before the current moment is acquired, a second allocation value can be determined in real time based on the allocation information corresponding to the first allocation value and the first allocation value, wherein the second allocation value has the same function as the first allocation value and is used for allocating all data packets to be processed in the received network to at least one processor, and the values of the second allocation value and the first allocation value can be the same or different.
Specifically, the method shown in fig. 2 is referred to for determining the second allocation value based on the allocation information corresponding to the first allocation value and the first allocation value, wherein the specific steps are as follows:
s201, acquiring the current network address.
S202, a plurality of third allocation values are determined based on the network address and the first allocation values.
In implementations, a network address of a network where the current location is located is obtained, the network address being an internet protocol address (Internet Protocol Address, IP) address.
After the network address of the current network is acquired, a plurality of third allocation values are determined based on the network address and the first allocation values, wherein the third allocation values have the same function as the first allocation values and the first allocation values are different from each third allocation value.
Further, a plurality of third allocation values are determined based on the network address and the first allocation values with reference to the method shown in fig. 3, wherein the specific steps are as follows:
s301, determining a value range of the third allocation value based on the network address.
S302, selecting a plurality of third distribution values based on a selection rule between the first distribution value and the maximum value of the value range.
Here, in determining the value range of the third allocation value based on the network address, specifically, the value range of the third allocation value is determined based on the range determined by one byte of the IP address, for example, the value of the byte is 166, and the determined value range is 166 to 255, and since the value of each byte in the IP address is any one of 0 to 255, the maximum value of the value range is 255.
And selecting a plurality of third distribution values between the first distribution values and the maximum value of the value range based on a selection rule, wherein the selection rule is an integer sequentially taken, an integer sequentially taken as an even number, and the like.
S203, screening the second distribution value from the first distribution value and a plurality of third distribution values.
After the plurality of third allocation values are selected, the second allocation values are selected from the first allocation values and the plurality of third allocation values, specifically, the second allocation values may be selected from the first allocation values and the plurality of third allocation values by referring to the method shown in fig. 4, where the specific steps are as follows:
s401, all data packets in a preset time period before the current moment are distributed based on each third distribution value respectively to obtain distribution information corresponding to each third distribution value.
S402, based on the allocation information corresponding to the first allocation value and the allocation information corresponding to each third allocation value, second allocation values are screened out from the first allocation value and the third allocation values.
After a plurality of third distribution values are taken out, all data packets to be processed in the network are distributed to at least one processor by utilizing a preset algorithm based on each third distribution value, and distribution information corresponding to each third distribution value is obtained.
After the allocation information corresponding to each third allocation value is calculated, the second allocation value is selected from the first allocation value and the plurality of third allocation values based on the allocation information corresponding to the first allocation value and the allocation information corresponding to each third allocation value.
Specifically, the method shown in fig. 5 may be referred to for screening the second allocation value from the first allocation value and the plurality of third allocation values based on the allocation information corresponding to the first allocation value and the allocation information corresponding to each third allocation value, where the specific steps are as follows:
s501, respectively calculating a first average absolute error corresponding to the allocation information corresponding to the first allocation value and a second average absolute error corresponding to the allocation information corresponding to each third allocation value.
S502, when the minimum second average absolute error is smaller than the first average absolute error, taking a third distribution value corresponding to the minimum second average absolute error as a second distribution value.
S503, when the third distribution value corresponding to the smallest second average absolute error is plural, the smallest third distribution value among the plural third distribution values corresponding to the second average absolute error is taken as the second distribution value.
The allocation information includes the number of processors and the number of data packets allocated to each processor, and further calculates the average absolute error based on the number of processors in the allocation information and the number of data packets allocated to each processor.
For example, the allocation information includes that 10 processors 1 are allocated, 30 processors 2 are allocated, 20 processors 3 are allocated, 20 processors 4 are allocated, and 20 processors 5 are allocated; and calculating to obtain the average absolute error corresponding to the distribution information as 4 by using a formula of the average absolute error.
Wherein, the formula of the average absolute error is as follows:
wherein MAE represents the mean absolute error; y is i Indicating the number of data packets allocated to the processor i; y is i p Representing the average number of data packets allocated to each processor; n represents the number of processors.
Respectively calculating a first average absolute error corresponding to the allocation information corresponding to the first allocation value and a second average absolute error corresponding to the allocation information corresponding to each third allocation value by utilizing the formula of the average absolute error; screening out the smallest second average absolute error from all the second average absolute errors, comparing the smallest second average absolute error with the first average absolute error, and taking a third distribution value corresponding to the smallest second average absolute error as a second distribution value under the condition that the smallest second average absolute error is smaller than the first average absolute error; of course, if the smallest second average absolute error is greater than or equal to the first average absolute error, the first allocation value corresponding to the first average absolute error is taken as the second allocation value.
In specific implementation, there are a plurality of second average absolute errors corresponding to the allocation information corresponding to the third allocation values which are the same and are the smallest; at this time, the smallest of the plurality of third allocation values corresponding to the second average absolute error is set as the second allocation value.
The method comprises the steps of storing a first preset number of data packets and a second preset number of processors in advance, and distributing the first preset number of data packets to the second preset number of processors by utilizing a preset algorithm based on a first distribution value and each third distribution value respectively, so as to obtain test distribution information corresponding to the first distribution value and test distribution information corresponding to each third distribution value; and screening the second distribution value from the first distribution value and the third distribution values based on the test distribution information corresponding to the first distribution value and the test distribution information corresponding to each third distribution value.
And S103, updating the first distribution value by using the second distribution value so as to distribute all data packets received in a preset time period after the current moment to at least one processor by using a preset algorithm based on the second distribution value.
After determining the second allocation value, updating the first allocation value with the second allocation value; and when the data packet to be processed in the network is received within a preset time period after the current moment, the data packet is distributed by utilizing a preset algorithm based on the updated first distribution value, namely the second distribution value.
Specifically, the above process is performed every preset time period, so as to ensure that the first allocation value can be updated in real time, further avoid that the received data packet is always allocated to the same processor based on the fixed first allocation value in the prior art, and solve the problems of packet loss and resource waste caused by idle of other processors in the processor, thereby achieving the purposes of improving the processing efficiency of the data packet and the resource utilization rate of the processor.
Further, the method shown in fig. 6 is referred to for updating the first allocation value with the second allocation value, wherein the specific steps are as follows:
s601, respectively modifying the plurality of byte sections of the first distribution value to obtain a plurality of modification distribution values.
S602, respectively distributing a preset number of data packets based on the first distribution value and each modification distribution value by using a preset algorithm to obtain first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value.
S603, a valid bit is determined based on the first contrast allocation information corresponding to the first allocation value and the second contrast allocation information corresponding to each of the modified allocation values.
S604, updating the valid byte segment corresponding to the valid bit in the first allocation value by using the valid byte segment corresponding to the valid bit in the second allocation value.
The valid bits in the first allocation value are predetermined considering that the first allocation value includes more bytes, e.g., 40 bytes, i.e., 320 bits, but it affects not all bytes allocated. Specifically, the plurality of byte segments of the first allocation value are respectively modified to obtain a plurality of modification allocation values, for example, modification allocation value 1 is obtained by modifying a first byte segment of the first allocation value, modification allocation value 2 is obtained by modifying a second byte segment of the first allocation value, and so on.
After a plurality of modification distribution values are obtained, a preset algorithm is utilized to distribute a preset number of data packets based on the first distribution value and each modification distribution value, and first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value are obtained. Of course, each time a preset number of data packets are allocated, the number of corresponding processors is the same.
And determining a valid bit based on the first contrast distribution information corresponding to the first distribution value and the second contrast distribution information corresponding to each modification distribution value, wherein a byte section corresponding to the valid bit is a byte section affecting data packet distribution. And then, updating the valid byte section corresponding to the valid bit in the first distribution value by using the valid byte section corresponding to the valid bit in the second distribution value, and updating all byte sections of the whole first distribution value is not needed, so that the updating efficiency is improved, and the resource consumption is reduced.
Based on the same inventive concept, the second aspect of the present disclosure further provides a data packet distribution device corresponding to the data packet distribution method, and since the principle of solving the problem of the device in the present disclosure is similar to that of the above-mentioned data packet distribution method in the present disclosure, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 7, the information display apparatus includes:
an obtaining module 701, configured to obtain allocation information in a preset time period before the current time; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
a determining module 702 configured to determine a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value;
an updating module 703 configured to update the first allocation value with the second allocation value to allocate all data packets received within a preset time period after the current time to at least one processor based on the second allocation value using a preset algorithm.
In another embodiment, the determining module 702 includes:
an acquisition unit 7021 configured to acquire a current network address;
a first determining unit 7022 configured to determine a plurality of third allocation values based on the network address and the first allocation values;
a screening unit 7023 configured to screen the second allocation value from the first allocation value and the plurality of third allocation values.
In another embodiment, the first determining unit 7022 is specifically configured to:
Determining a value range of the third assigned value based on the network address;
and selecting a plurality of third distribution values based on a selection rule between the first distribution value and the maximum value of the value range.
In another embodiment, the screening unit 7023 is specifically configured to:
distributing all data packets in a preset time period before the current moment based on each third distribution value to obtain distribution information corresponding to each third distribution value;
and screening the second distribution value from the first distribution value and a plurality of third distribution values based on the distribution information corresponding to the first distribution value and the distribution information corresponding to each third distribution value.
In another embodiment, the filtering unit 7023, when filtering the second allocation value from the first allocation value and the plurality of third allocation values based on the allocation information corresponding to the first allocation value and the allocation information corresponding to each of the third allocation values, includes:
respectively calculating a first average absolute error corresponding to the allocation information corresponding to the first allocation value and a second average absolute error corresponding to the allocation information corresponding to each third allocation value;
And taking the third distribution value corresponding to the smallest second average absolute error as the second distribution value under the condition that the smallest second average absolute error is smaller than the first average absolute error.
In another embodiment, the filtering unit 7023 determines, as the second distribution value, a smallest one of the plurality of third distribution values corresponding to the second average absolute error, in a case where the third distribution value corresponding to the smallest second average absolute error is determined to be a plurality of.
In another embodiment, the updating module 703 includes:
a modifying unit 7031 configured to modify the plurality of byte segments of the first allocation value, respectively, to obtain a plurality of modified allocation values;
an allocation unit 7032 configured to allocate a preset number of data packets based on the first allocation value and each of the modified allocation values by using a preset algorithm, so as to obtain first comparison allocation information corresponding to the first allocation value and second comparison allocation information corresponding to each of the modified allocation values;
a second determining unit 7033 configured to determine a valid bit based on first comparative allocation information corresponding to the first allocation value and second comparative allocation information corresponding to each of the modified allocation values;
An updating unit 7034 configured to update a valid byte segment corresponding to the valid bit in the first allocation value with a valid byte segment corresponding to the valid bit in the second allocation value.
The distribution device provided by the embodiment of the disclosure updates the first distribution value in real time, so that the problem that the received data packet is distributed to the same processor and the packet loss occurs in the processor and the other processors are idle to cause resource waste is avoided, and the purposes of improving the processing efficiency of the data packet and the resource utilization rate of the processor are achieved.
The third aspect of the present disclosure further provides an electronic device, as shown in fig. 8, at least including a memory 801 and a processor 802, where the memory 801 stores a computer program, and the processor 802 implements the method provided by any embodiment of the present disclosure when executing the computer program on the memory 801. The method performed by the electronic device computer program is exemplified as follows:
s11, acquiring allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
S12, determining a second distribution value based on the distribution information corresponding to the first distribution value and the first distribution value;
and S13, updating the first distribution value by using the second distribution value so as to distribute all data packets received in a preset time period after the current moment to at least one processor by using a preset algorithm based on the second distribution value.
The processor, when executing the allocation information stored on the memory and corresponding to the first allocation value and the first allocation value, further executes the following computer program: acquiring a current network address; determining a plurality of third allocation values based on the network address and the first allocation values; the second assigned value is selected from the first assigned value and the plurality of third assigned values.
The processor, when executing the plurality of third allocation values stored on the memory based on the network address and the first allocation values, further executes a computer program that: determining a value range of the third assigned value based on the network address; and selecting a plurality of third distribution values based on a selection rule between the first distribution value and the maximum value of the value range.
The processor, when executing the screening of the second allocation value from the first allocation value and the plurality of third allocation values stored on the memory, further executes the computer program of: distributing all data packets in a preset time period before the current moment based on each third distribution value to obtain distribution information corresponding to each third distribution value; and screening the second distribution value from the first distribution value and a plurality of third distribution values based on the distribution information corresponding to the first distribution value and the distribution information corresponding to each third distribution value.
The processor further executes the following computer program when executing the allocation information stored on the memory and corresponding to the first allocation value and the allocation information corresponding to each third allocation value, and selecting the second allocation value from the first allocation value and the plurality of third allocation values: respectively calculating a first average absolute error corresponding to the allocation information corresponding to the first allocation value and a second average absolute error corresponding to the allocation information corresponding to each third allocation value; and taking the third distribution value corresponding to the smallest second average absolute error as the second distribution value under the condition that the smallest second average absolute error is smaller than the first average absolute error.
The processor, when executing the method of allocating data packets stored on the memory, also executes the following computer program: in the case that the third distribution value corresponding to the smallest second average absolute error is a plurality of third distribution values, the smallest third distribution value among the plurality of third distribution values corresponding to the second average absolute error is taken as the second distribution value
The processor, when executing the updating of the first allocation value with the second allocation value stored on the memory, further executes the computer program of: modifying the plurality of byte sections of the first distribution value respectively to obtain a plurality of modified distribution values; respectively utilizing a preset algorithm to distribute a preset number of data packets based on the first distribution value and each modification distribution value to obtain first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value; determining a valid bit based on first comparative allocation information corresponding to the first allocation value and second comparative allocation information corresponding to each of the modified allocation values; and updating the valid byte segment corresponding to the valid bit in the first distribution value by using the valid byte segment corresponding to the valid bit in the second distribution value.
According to the embodiment of the disclosure, the first distribution value can be ensured to be updated in real time, so that the problem that the received data packet is distributed to the same processor and the packet loss occurs in the processor and the other processors are idle to cause resource waste is avoided, and the purposes of improving the processing efficiency of the data packet and the resource utilization rate of the processor are achieved.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The storage medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The storage medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects an internet protocol address from the at least two internet protocol addresses and returns the internet protocol address; receiving an Internet protocol address returned by node evaluation equipment; wherein the acquired internet protocol address indicates an edge node in the content distribution network.
Alternatively, the storage medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It should be noted that the storage medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any storage medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a storage medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units referred to in this disclosure may be implemented in software or in hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.
While various embodiments of the present disclosure have been described in detail, the present disclosure is not limited to these specific embodiments, and various modifications and embodiments can be made by those skilled in the art on the basis of the concepts of the present disclosure, and these modifications and modifications should be within the scope of the present disclosure as claimed.

Claims (6)

1. A method of distributing data packets, comprising:
acquiring allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
determining a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value;
updating the first allocation value by using the second allocation value to allocate all data packets received in a preset time period after the current moment to at least one processor based on the second allocation value by using a preset algorithm;
The determining a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value includes:
acquiring a current network address;
determining a value range of a third allocation value based on the network address;
selecting a plurality of third allocation values based on a selection rule between the first allocation value and the maximum value of the value range;
distributing all data packets in a preset time period before the current moment based on each third distribution value to obtain distribution information corresponding to each third distribution value;
screening the second distribution value from the first distribution value and a plurality of third distribution values based on the distribution information corresponding to the first distribution value and the distribution information corresponding to each third distribution value;
the updating the first allocation value with the second allocation value includes:
modifying the plurality of byte sections of the first distribution value respectively to obtain a plurality of modified distribution values;
respectively utilizing a preset algorithm to distribute a preset number of data packets based on the first distribution value and each modification distribution value to obtain first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value;
Determining a valid bit based on first comparative allocation information corresponding to the first allocation value and second comparative allocation information corresponding to each of the modified allocation values;
and updating the valid byte segment corresponding to the valid bit in the first distribution value by using the valid byte segment corresponding to the valid bit in the second distribution value.
2. The allocation method according to claim 1, wherein the allocation information includes the number of processors and the number of data packets allocated to each processor.
3. The allocation method according to claim 2, wherein the selecting the second allocation value from the first allocation value and the plurality of third allocation values based on the allocation information corresponding to the first allocation value and the allocation information corresponding to each of the third allocation values includes:
respectively calculating a first average absolute error corresponding to the allocation information corresponding to the first allocation value and a second average absolute error corresponding to the allocation information corresponding to each third allocation value;
and taking the third distribution value corresponding to the smallest second average absolute error as the second distribution value under the condition that the smallest second average absolute error is smaller than the first average absolute error.
4. The allocation method according to claim 3, wherein, when the third allocation value corresponding to the smallest second average absolute error is plural, the smallest of the plural third allocation values corresponding to the second average absolute error is taken as the second allocation value.
5. A packet distribution device, comprising:
the acquisition module is configured to acquire allocation information in a preset time period before the current moment; the allocation information is obtained by allocating all received data packets to at least one processor based on a first allocation value by using a preset algorithm;
a determination module configured to determine a second allocation value based on allocation information corresponding to the first allocation value and the first allocation value;
an updating module configured to update the first allocation value with the second allocation value to allocate all data packets received within a preset time period after a current time to at least one processor based on the second allocation value with a preset algorithm;
the determining module includes:
an acquisition unit configured to acquire a current network address;
a first determination unit configured to determine a plurality of third allocation values based on the network address and the first allocation values;
A screening unit configured to screen the second allocation value from the first allocation value and a plurality of the third allocation values;
the first determination unit is specifically configured to:
determining a value range of the third assigned value based on the network address;
selecting a plurality of third allocation values based on a selection rule between the first allocation value and the maximum value of the value range;
the screening unit is specifically configured to:
distributing all data packets in a preset time period before the current moment based on each third distribution value to obtain distribution information corresponding to each third distribution value;
screening the second distribution value from the first distribution value and a plurality of third distribution values based on the distribution information corresponding to the first distribution value and the distribution information corresponding to each third distribution value;
the updating module comprises:
a modifying unit configured to modify the plurality of byte segments of the first allocation value respectively to obtain a plurality of modified allocation values;
the distribution unit is configured to distribute a preset number of data packets based on the first distribution value and each modification distribution value by using a preset algorithm respectively to obtain first comparison distribution information corresponding to the first distribution value and second comparison distribution information corresponding to each modification distribution value;
A second determination unit configured to determine a valid bit based on first comparative allocation information corresponding to the first allocation value and second comparative allocation information corresponding to each of the modified allocation values;
and the updating unit is configured to update the valid byte section corresponding to the valid bit in the first allocation value by using the valid byte section corresponding to the valid bit in the second allocation value.
6. An electronic device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating via the bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of the method of distributing data packets according to any of claims 1 to 4.
CN202010801205.5A 2020-08-11 2020-08-11 Data packet distribution method and device and electronic equipment Active CN111949403B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010801205.5A CN111949403B (en) 2020-08-11 2020-08-11 Data packet distribution method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010801205.5A CN111949403B (en) 2020-08-11 2020-08-11 Data packet distribution method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111949403A CN111949403A (en) 2020-11-17
CN111949403B true CN111949403B (en) 2024-01-26

Family

ID=73332707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010801205.5A Active CN111949403B (en) 2020-08-11 2020-08-11 Data packet distribution method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111949403B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580017A (en) * 2014-12-30 2015-04-29 东软集团股份有限公司 Network conversation issuing method and system based on RSS
CN105119960A (en) * 2015-07-13 2015-12-02 东软集团股份有限公司 Network data distribution method and network device
CN107196870A (en) * 2017-07-20 2017-09-22 哈尔滨工业大学 A kind of flow dynamics load-balancing method based on DPDK
CN111193668A (en) * 2019-12-10 2020-05-22 中移(杭州)信息技术有限公司 Flow distribution method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580017A (en) * 2014-12-30 2015-04-29 东软集团股份有限公司 Network conversation issuing method and system based on RSS
CN105119960A (en) * 2015-07-13 2015-12-02 东软集团股份有限公司 Network data distribution method and network device
CN107196870A (en) * 2017-07-20 2017-09-22 哈尔滨工业大学 A kind of flow dynamics load-balancing method based on DPDK
CN111193668A (en) * 2019-12-10 2020-05-22 中移(杭州)信息技术有限公司 Flow distribution method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111949403A (en) 2020-11-17

Similar Documents

Publication Publication Date Title
CN111787069A (en) Method, device and equipment for processing service access request and computer storage medium
CN107135268B (en) Distributed task computing method based on information center network
US9311148B2 (en) Pseudo-random hardware resource allocation through the plurality of resource controller based on non-repeating sequence of index list entries
CN108809848A (en) Load-balancing method, device, electronic equipment and storage medium
CN112148492A (en) Service deployment and resource allocation method considering multi-user mobility
CN111722933A (en) Deadlock resolution between distributed processes
CN111949403B (en) Data packet distribution method and device and electronic equipment
CN114338133B (en) Application access system, method, communication device and storage medium
CN111756833B (en) Node processing method, node processing device, electronic equipment and computer readable medium
CN111694670B (en) Resource allocation method, apparatus, device and computer readable medium
CN114253730A (en) Method, device and equipment for managing database memory and storage medium
CN113391882A (en) Virtual machine memory management method and device, storage medium and electronic equipment
US20190158585A1 (en) Systems and Methods for Server Failover and Load Balancing
CN112929416A (en) Load balancing method, device, equipment and storage medium of domain name system
CN108520025B (en) Service node determination method, device, equipment and medium
CN112181605A (en) Load balancing method and device, electronic equipment and computer readable medium
CN112148448B (en) Resource allocation method, apparatus, device and computer readable medium
CN115993942B (en) Data caching method, device, electronic equipment and computer readable medium
US11528322B1 (en) Consistent distribution using jump table assisted hybrid hash
US20170331716A1 (en) Active probing for troubleshooting links and devices
CN111835848B (en) Data fragmentation method and device, electronic equipment and computer readable medium
US20200293358A1 (en) Computing node identifier-based request allocation
CN112291340B (en) Service distribution method, controller and virtual network element
CN115220903A (en) Resource management method, device, system, equipment and medium
CN116528004A (en) Video pushing method, device, equipment and storage medium

Legal Events

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