Disclosure of Invention
In view of this, the present application provides a communication method and apparatus, which are used to solve the problem that in the existing manner of configuring a smaller token bucket at the user side, the user needs to manually configure the size of the token bucket, and the user experience is poor.
In a first aspect, the present application provides a communication method applied to a source network device, where the source network device includes a first exit configured with an exit speed limit value, and a token bucket is configured in the source network device, the method includes:
converting the first capacity value into a first rate value for sending service traffic according to the outlet speed limit value and the first capacity value of the token bucket, wherein the service traffic is traffic which can be sent in the burst network accommodating time;
according to the first rate value, a first detection flow which can be sent in the network burst accommodating time is sent to the destination network equipment;
if the current lost packet is determined according to the first detection flow, calculating a second rate value according to the first rate value;
repeatedly executing the process of sending the detection flow which can be sent in the network burst accommodation time to the destination network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the current non-lost packet is determined according to the detection flow;
acquiring a third speed value, wherein the third speed value is a current speed value of sending the detected flow when determining that the packet is not lost currently according to the detected flow;
and converting the third speed value into a second capacity value of the token bucket, and taking the second capacity value as the current capacity of the token bucket.
In a second aspect, the present application provides a communications apparatus for application to a source network device, the source network device including a first outlet configured with an outlet limit value, a token bucket configured within the source network device, the apparatus comprising:
the conversion unit is used for converting the first capacity value into a first rate value for sending service traffic according to the outlet speed limit value and the first capacity value of the token bucket, wherein the service traffic is traffic which can be sent in the network burst accommodation time;
a sending unit, configured to send, to a destination network device, a first probe traffic that may be sent within a network burst accommodating time according to the first rate value;
the calculating unit is used for calculating a second rate value according to the first rate value if the current lost packet is determined according to the first detection flow;
the sending unit and the calculating unit are further configured to repeatedly perform a process of sending a probe flow that can be sent in the network burst accommodating time to the destination network device according to the rate value, and calculating a next rate value according to a last rate value if the current packet loss is determined according to the probe flow, until the current packet loss is determined according to the probe flow;
the acquisition unit is used for acquiring a third speed value, wherein the third speed value is a current speed value for transmitting the detection flow when the current non-packet loss is determined according to the detection flow;
the scaling unit is further configured to scale the third rate value to a second capacity value of the token bucket, and take the second capacity value as a current capacity of the token bucket.
In a third aspect, the present application provides a network device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor to cause the processor to perform the method provided in the first aspect of the present application.
Therefore, by applying the communication method and device provided by the application, according to the outlet speed limit value and the first capacity value of the token bucket, the source end network equipment converts the first capacity value into a first rate value for sending service traffic, wherein the service traffic is traffic which can be sent in the network burst accommodation time; according to the first rate value, the source end network equipment transmits a first detection flow which can be transmitted in the network burst accommodating time to the destination end network equipment; if the current lost packet is determined according to the first detection flow, the source end network equipment calculates a second rate value according to the first rate value; repeatedly executing the process of sending the detection flow which can be sent in the network burst accommodation time to the destination network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the current non-lost packet is determined according to the detection flow; the source end network equipment acquires a third speed value, wherein the third speed value is a current speed value for transmitting the detection flow when determining that the packet is not lost currently according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and takes the second capacity value as the current capacity of the token bucket.
And judging whether the packet is lost or not by sending the detection flow, and converting the current capacity of the token bucket according to the current speed value of the detection flow when the packet is not lost currently. The capacity of the local token bucket is automatically updated according to the traffic size of the allowable burst of the detection operator side. The method solves the problem that in the existing mode of configuring the smaller token bucket at the user side, the user needs to manually configure the size of the token bucket, and the user experience is poor.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the corresponding listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
The communication method provided in the embodiment of the present application is described in detail below. Referring to fig. 1, fig. 1 is a flowchart of a communication method provided in an embodiment of the present application. The method is applied to source network equipment, the source network equipment is positioned at a user side, the source network equipment comprises a first outlet with a configured outlet speed limit value, and a token bucket is configured inside the first outlet. The communication method provided by the embodiment of the application can comprise the following steps.
And 110, converting the first capacity value into a first rate value for sending service traffic according to the outlet speed limit value and the first capacity value of the token bucket, wherein the service traffic is traffic which can be sent in the network burst accommodation time.
Specifically, as shown in fig. 2, fig. 2 is a networking schematic diagram of an application communication method according to an embodiment of the present application. The source network device is on the user side and has a token bucket configured inside. The destination network device is located at the operator side, and a token bucket is configured inside the destination network device.
The user side rents 10M lines on the operator side, and the burst traffic allowed by the operator side is 21M.
The source network equipment configures a traffic supervision service at a first outlet, and opens a network quality analysis (English: network Quality Analyzer, abbreviated as NQA) service through the configured traffic supervision service association.
NQA services refer to analyzing a link state, network performance, services provided by a network, and quality of service by sending a probe packet, and providing parameters for a user, such as a delay, a jitter time, a TCP connection setup time, an FTP connection setup time, and a file transfer rate, to identify the current network performance and quality of service. By utilizing the analysis result of the NQA service, a user can timely know the performance condition of the network, correspondingly process different network performances and diagnose and position network faults.
It is to be understood that NQA service is a well-known technology, and only a simple description is omitted herein.
After the source network device starts the NQA service, a first capacity value (for example, 625000 Byte) of a current token bucket configured by the traffic supervision service and an outlet speed limit value (for example, 10M) configured by the first outlet are acquired through the NQA service.
The source network device converts the first capacity value into a first rate value for sending traffic by using the outlet speed limit value and the first capacity value. The service may be specifically NQA service, and the service traffic is probe traffic that may be sent during the network burst accommodation time.
Further, according to the outlet speed limit value and the first capacity value of the token bucket, the specific process of converting the first capacity value into the first rate value for sending the service flow by the source network device is as follows:
the source end network equipment performs addition processing on the first value and the second value to obtain a third value; the first value is the product of the first capacity value and the fixed conversion ratio, and the second value is the product of the quotient of the outlet speed limit value and the preset seventh value and the network burst accommodation time.
The source end network equipment multiplies the third value with the fourth value to obtain a fifth value; the fourth value is a quotient of a preset seventh value and the network burst accommodation time.
The source network device takes the quotient of the fifth value and the preset sixth value as a first rate value.
In the embodiment of the present application, the fixed conversion ratio is specifically 8; the sixth value is preset to be 1000000 specifically, and the value is used for converting the fifth value into M units; the preset seventh value is specifically 1000, and the value is used for converting 1s into 1000ms; the network burst hold time is specifically 50ms.
In one example, the first capacity value of the token bucket is 625000Byte, and the first rate value of the source network device to convert the first capacity value to probe traffic transmittable within 50ms is:
(((625000*8)+(10000000/1000)*50)*(1000/50))/1000000=110M
and step 120, according to the first rate value, sending a first probing flow which can be sent in the network burst accommodation time to the destination network equipment.
Specifically, after the source network device calculates the first rate value according to the description of step 110, the source network device sends, to the destination network device, a first probe traffic that can be (or is allowed to be) sent within the network burst hold time according to the first rate value.
According to the foregoing example, after the source network device calculates the first rate value to be 110M, since the source network device has previously associated to start the NQA service, the source network device initiates NQA service detection, and counts the detection result. The source network device constructs a first probe traffic that can be sent within 50ms and sends it to the destination network device at a 110M rate.
And 130, if the current lost packet is determined according to the first detection flow, calculating a second rate value according to the first rate value.
Specifically, according to the description of step 120, after the source network device initiates NQA service detection, the packet loss rate, round trip time, etc. are calculated according to whether the response packet sent by the destination network device is received or not, and the time of receiving the response packet.
If the source end network device does not receive the response message sent by the destination end network device after sending the first detection flow, the source end network device determines that the packet is lost currently. At this time, the source network device calculates a second rate value from the first rate value.
Further, the source network device takes half of the first rate value as the second rate value.
As can be seen from the foregoing examples, the first rate value is 110M, and the second rate value in this step is 55M.
And 140, repeatedly executing the process of sending the detection flow which can be sent in the network burst accommodating time to the destination network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the current non-lost packet is determined according to the detection flow.
Specifically, according to the description of step 130, after the source network device calculates that the second rate value is 55M, NQA service detection is initiated again, and the detection result is counted. The source network device constructs a first probe traffic that can be sent within 50ms and sends it to the destination network device at a 55M rate.
In order to ensure that the token bucket configured on the operator side is effectively supplemented, the time interval for the source network device to initiate NQA service detection is set to 1000ms.
The source end network equipment repeatedly executes the process of sending the detection flow to the destination end network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the source end network equipment determines that the current lost packet is not lost according to the detection flow.
Further, in the embodiment of the present application, the specific process of determining, by the source network device, that the packet is not lost currently according to the detected traffic is:
if the lost packet is determined according to the last transmitted detection flow and the next transmitted detection flow, and the current non-lost packet is determined according to the current transmitted detection flow, the source network device judges whether the difference value between the current speed value and the next speed value is smaller than a preset difference value threshold.
If the current rate value is smaller than the preset difference threshold, the source network equipment determines that no packet is lost currently, and takes the current rate value as a third rate value.
Wherein the preset difference threshold is specifically 0.5M. The smaller the preset difference threshold is set, the closer the speed value is to the burst flow value allowed by the operator side entry.
In one example, after the source network device sends the second probe traffic, the source network device determines, according to the second probe traffic, that there is a packet loss in the second probe traffic. And after the source end network equipment sends the third detection flow again, the source end network equipment determines that no packet is lost in the third detection flow according to the third detection flow. After the source end network device sends the fourth detection flow again, the source end network device determines that packet loss exists in the fourth detection flow according to the fourth detection flow.
At this time, the source network device determines whether a difference between a third rate value of the third probe traffic and a fourth rate value of the fourth probe traffic is less than a preset difference threshold.
For example, if the third rate value is 20.625 and the fourth rate value is 20.224, and the difference between the two rate values is less than 0.5M, the source network device determines that no packet is lost when transmitting the third probe traffic according to the third rate value.
It can be understood that, in the process of initiating NQA service detection, the source network device determines a rate value of just not losing packets of the sending detection flow according to a dichotomy.
Assuming that the burst flow allowed by the side entrance of the operator is 21M, according to the dichotomy, the source end network equipment finally determines that the value of the speed of transmitting the detection flow without losing the packet is 20.625M.
Step 150, obtaining a third rate value, where the third rate value is a current rate value of sending the detected traffic when determining that the packet is not lost currently according to the detected traffic.
Specifically, according to the description of step 140, after determining the rate value of sending probe traffic just without packet loss, the source network device obtains the rate value, for example, the third rate value.
Step 160, converting the third speed value into a second capacity value of the token bucket, and taking the second capacity value as the current capacity of the token bucket.
Specifically, after the source network device obtains the third rate value, the third rate value is converted into the second capacity value of the token bucket according to the description of step 150. The second capacity value is the current capacity of the token bucket.
Further, the specific process of the source network device converting the third rate value into the second capacity value of the token bucket is as follows:
and the source end network equipment multiplies the third speed value with a preset sixth value to obtain a first product value. And the source network multiplies the quotient of the first product value and a preset seventh value by the network burst accommodation time to obtain a second product value. The source network takes the quotient of the second product value and the fixed conversion ratio as the second capacity.
In one example, the third rate value is 20.625M and the source network device scales the third rate value to a second capacity value as:
(((20.625*10000001)/1000)*50)/8=128906Byte
therefore, by applying the communication method provided by the application, according to the outlet speed limit value and the first capacity value of the token bucket, the source end network equipment converts the first capacity value into a first rate value for sending service traffic, wherein the service traffic is traffic which can be sent in the network burst accommodation time; according to the first rate value, the source end network equipment transmits a first detection flow which can be transmitted in the network burst accommodating time to the destination end network equipment; if the current lost packet is determined according to the first detection flow, the source end network equipment calculates a second rate value according to the first rate value; repeatedly executing the process of sending the detection flow which can be sent in the network burst accommodation time to the destination network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the current non-lost packet is determined according to the detection flow; the source end network equipment acquires a third speed value, wherein the third speed value is a current speed value for transmitting the detection flow when determining that the packet is not lost currently according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and takes the second capacity value as the current capacity of the token bucket.
And judging whether the packet is lost or not by sending the detection flow, and converting the current capacity of the token bucket according to the current speed value of the detection flow when the packet is not lost currently. The capacity of the local token bucket is automatically updated according to the traffic size of the allowable burst of the detection operator side. The method solves the problem that in the existing mode of configuring the smaller token bucket at the user side, the user needs to manually configure the size of the token bucket, and the user experience is poor.
Based on the same inventive concept, the embodiment of the application also provides a communication device corresponding to the communication method. Referring to fig. 3, fig. 3 is a structural diagram of a communication device according to an embodiment of the present application. The apparatus is applied to a source network device, the source network device includes a first outlet configured with an outlet speed limit value, a token bucket is configured in the source network device, and the apparatus includes:
a conversion unit 310, configured to convert, according to the exit speed limit value and a first capacity value of the token bucket, the first capacity value into a first rate value for sending traffic, where the traffic is a traffic that can be sent in a network burst accommodation time;
a sending unit 320, configured to send, to a destination network device, a first probe traffic that may be sent during a network burst accommodating time according to the first rate value;
a calculating unit 330, configured to calculate a second rate value according to the first rate value if it is determined that the packet is currently lost according to the first probe flow;
the sending unit 320 and the calculating unit 330 are further configured to repeatedly perform a process of sending, according to the rate value, a probe flow that can be sent within the network burst accommodation time to the destination network device, and if the current packet loss is determined according to the probe flow, calculating a next rate value according to a last rate value until the current packet loss is determined according to the probe flow;
an obtaining unit 340, configured to obtain a third rate value, where the third rate value is a current rate value of sending the detected traffic when determining that the detected traffic is not lost currently;
the scaling unit 310 is further configured to scale the third rate value to a second capacity value of the token bucket, and take the second capacity value as the current capacity of the token bucket.
Optionally, the scaling unit 310 is specifically configured to add the first value to the second value to obtain a third value;
multiplying the third value with the fourth value to obtain a fifth value;
taking the quotient of the fifth value and a preset sixth value as the first rate value;
wherein the first value is the product of the first capacity value and a fixed scaling factor; the second value is the product of the quotient of the outlet speed limit value and a preset seventh value and the network burst accommodation time; the fourth value is a quotient of the preset seventh value and the network burst accommodation time.
Optionally, the calculating unit 330 is specifically configured to take half of the first rate value as the second rate value.
Optionally, the calculating unit 330 is specifically configured to determine whether the difference between the current rate value and the next rate value is smaller than a preset difference threshold if it is determined that the packet is lost according to both the last transmitted probe flow and the next transmitted probe flow and it is determined that the packet is not lost currently according to the currently transmitted probe flow;
if the current rate value is smaller than the third rate value, determining that the packet is not lost currently, and taking the current rate value as the third rate value.
Optionally, the scaling unit 310 is further specifically configured to specifically include: multiplying the third speed value with the preset sixth value to obtain a first product value;
multiplying the quotient of the first product value and the preset seventh value by the network burst accommodation time to obtain a second product value;
and taking the quotient of the second product value and the fixed conversion ratio as the second capacity.
Therefore, by applying the communication device provided by the application, according to the outlet speed limit value and the first capacity value of the token bucket, the source network equipment converts the first capacity value into a first rate value for sending service traffic, wherein the service traffic is traffic which can be sent in the network burst accommodation time; according to the first rate value, the source end network equipment transmits a first detection flow which can be transmitted in the network burst accommodating time to the destination end network equipment; if the current lost packet is determined according to the first detection flow, the source end network equipment calculates a second rate value according to the first rate value; repeatedly executing the process of sending the detection flow which can be sent in the network burst accommodation time to the destination network equipment according to the speed value, and calculating the next speed value according to the last speed value if the current lost packet is determined according to the detection flow until the current non-lost packet is determined according to the detection flow; the source end network equipment acquires a third speed value, wherein the third speed value is a current speed value for transmitting the detection flow when determining that the packet is not lost currently according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and takes the second capacity value as the current capacity of the token bucket.
And judging whether the packet is lost or not by sending the detection flow, and converting the current capacity of the token bucket according to the current speed value of the detection flow when the packet is not lost currently. The capacity of the local token bucket is automatically updated according to the traffic size of the allowable burst of the detection operator side. The method solves the problem that in the existing mode of configuring the smaller token bucket at the user side, the user needs to manually configure the size of the token bucket, and the user experience is poor.
Based on the same inventive concept, the present embodiment also provides a network device, as shown in fig. 4, including a processor 410, a transceiver 420, and a machine-readable storage medium 430, where the machine-readable storage medium 430 stores machine-executable instructions capable of being executed by the processor 410, and the processor 410 is caused to perform the communication method provided by the present embodiment by the machine-executable instructions. The communication device shown in fig. 3 may be implemented by using a hardware structure of a network device as shown in fig. 4.
The computer readable storage medium 430 may include a random access Memory (in english: random Access Memory, abbreviated as RAM) or a nonvolatile Memory (in english: non-volatile Memory, abbreviated as NVM), such as at least one magnetic disk Memory. Optionally, the computer readable storage medium 430 may also be at least one storage device located remotely from the aforementioned processor 410.
The processor 410 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (English: digital Signal Processor; DSP; for short), an application specific integrated circuit (English: application Specific Integrated Circuit; ASIC; for short), a Field programmable gate array (English: field-Programmable Gate Array; FPGA; for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In this embodiment, processor 410 is enabled by reading machine-executable instructions stored in machine-readable storage medium 430, which cause processor 410 itself to be implemented and transceiver 420 to perform the communication methods described in the embodiments of the present application.
Additionally, embodiments of the present application provide a machine-readable storage medium 430, the machine-readable storage medium 430 storing machine-executable instructions that, when invoked and executed by the processor 410, cause the processor 410 itself and the invoking transceiver 420 to perform the communication methods described in the embodiments of the present application previously.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
For the communication device and the machine-readable storage medium embodiments, since the method content involved is substantially similar to the method embodiments described above, the description is relatively simple, and reference will only be made to part of the description of the method embodiments.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.