Disclosure of Invention
In view of this, the present application provides a communication method and apparatus, so as to solve the problem that the user needs to manually configure the size of a token bucket in the conventional manner of configuring a smaller token bucket on the user side, and the user experience is poor.
In a first aspect, the present application provides a communication method, where the method is applied to a source network device, where the source network device includes a first egress with an egress speed limit configured, and a token bucket is configured in the source network device, and the method includes:
converting the first capacity value into a first speed value for sending service traffic according to the exit speed limit value and the first capacity value of the token bucket, wherein the service traffic is the traffic which can be sent within the network burst accommodation time;
according to the first rate value, first detection flow which can be sent in the network burst accommodating time is sent to the destination network equipment;
if the current packet loss is determined according to the first detection flow, calculating a second speed value according to the first speed value;
repeatedly executing the process of sending the detection flow which can be sent within the network burst accommodation time to the destination network equipment according to the rate value, and if the current packet loss is determined according to the detection flow, calculating the next rate value according to the last rate value until the current packet loss is determined according to the detection flow;
acquiring a third rate value, wherein the third rate value is a current rate value of sending detection flow when the packet loss is not determined at present according to the detection flow;
and converting the third rate 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 communication apparatus, where the apparatus is applied to a source network device, where the source network device includes a first egress with an egress speed limit configured, and a token bucket is configured in the source network device, and the apparatus includes:
the conversion unit is used for converting the first capacity value into a first speed value for sending service traffic according to the exit speed limit value and the first capacity value of the token bucket, wherein the service traffic is the traffic which can be sent within the network burst holding time;
a sending unit, configured to send, to the destination network device, a first probe traffic that can be sent within a network burst accommodating time according to the first rate value;
a calculating unit, configured to calculate a second rate value according to the first rate value if it is determined that the packet has been lost currently according to the first probe traffic;
the sending unit and the calculating unit are further configured to repeatedly execute a process of sending, according to the rate value, the detection traffic that can be sent within the network burst accommodating time to the destination network device, and if the current packet loss is determined according to the detection traffic, calculating a next rate value according to a previous rate value until the current packet loss is determined according to the detection traffic;
the acquisition unit is used for acquiring a third rate value, wherein the third rate value is a current rate value for sending detection traffic when packet loss does not exist currently according to the detection traffic;
the conversion unit is further configured to convert the third rate value into a second capacity value of the token bucket, and use the second capacity value as the 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, the processor being caused by the machine-executable instructions to perform the method provided by the first aspect of the present application.
Therefore, by applying the communication method and the communication device provided by the application, according to the exit speed limit value and the first capacity value of the token bucket, the source end network device converts the first capacity value into a first rate value for sending the service traffic, wherein the service traffic is the traffic which can be sent within the network burst accommodation time; according to the first rate value, the source end network equipment sends a first detection flow which can be sent in the network burst accommodation time to the destination end network equipment; if the current packet loss is determined according to the first detection flow, the source end network device calculates a second speed value according to the first speed value; repeatedly executing the process of sending the detection flow which can be sent within the network burst accommodation time to the destination network equipment according to the rate value, and if the current packet loss is determined according to the detection flow, calculating the next rate value according to the last rate value until the current packet loss is determined according to the detection flow; the source end network equipment acquires a third rate value, wherein the third rate value is a current rate value for sending detection flow when packet loss is not currently determined according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and uses the second capacity value as the current capacity of the token bucket.
Therefore, whether packet loss exists or not is judged by sending the detection flow, and the current capacity of the token bucket is converted according to the current speed value of the sending detection flow when packet loss does not exist. The capacity of the local token bucket is automatically updated according to the size of the burst flow allowed by the detection operator side. The method and the device solve the problem that in the existing mode of configuring a smaller token bucket on a 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 the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent 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 certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the 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 should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the corresponding listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The following describes the communication method provided in the embodiments of the present application in detail. Referring to fig. 1, fig. 1 is a flowchart of a communication method according to an embodiment of the present disclosure. The method is applied to source end network equipment, the source end network equipment is positioned at a user side, the source end network equipment comprises a first outlet configured with an outlet speed limit value, and a token bucket is configured inside the source end network equipment. The communication method provided by the embodiment of the application can comprise the following steps.
Andstep 110, converting the first capacity value into a first speed value for sending service traffic according to the exit speed limit value and the first capacity value of the token bucket, wherein the service traffic is the traffic which can be sent in the network burst holding time.
Specifically, as shown in fig. 2, fig. 2 is a schematic networking diagram of an application communication method provided in the embodiment of the present application. The source network device is at the user side and has a token bucket configured inside. The destination network equipment is arranged at the operator side, and the token bucket is configured in the destination network equipment.
The user side leases a 10M line on the operator side, and the burst flow allowed by the operator side is 21M.
The source end Network device configures a traffic monitoring service at the first outlet, and starts a Network Quality Analysis (NQA) service through the configured traffic monitoring service association.
The NQA service refers to analyzing a link state, a network performance, a service provided by a network, and a quality of service by transmitting a probe packet, and providing a user with parameters for identifying the current network performance and the quality of service, such as a delay, a jitter time, a TCP connection setup time, an FTP connection setup time, a file transfer rate, and the like. By utilizing the analysis result of the NQA service, a user can know the performance condition of the network in time, correspondingly process different network performances and diagnose and position network faults.
It is understood that the NQA service is well known in the art, and will not be described herein again for simplicity.
After the source network device opens the NQA service, a first capacity value (e.g., 625000Byte) of a current token bucket configured by the traffic policing service and an outlet speed limit value (e.g., 10M) configured by a first outlet are obtained through the NQA service.
The source end network device converts the first capacity value into a first speed value for sending the service flow by using the exit speed limit value and the first capacity value. The service may specifically be an NQA service, and the service traffic is probe traffic that can be sent within a network burst accommodating time.
Further, according to the exit speed limit value and the first capacity value of the token bucket, the specific process of the source end network device converting the first capacity value into the first rate value for sending the traffic flow is as follows:
the source end network device adds 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 export speed limit value and the preset seventh value and the network burst accommodating time.
The source end network device multiplies the third value by the fourth value to obtain a fifth value; and the fourth value is the quotient of the preset seventh value and the network burst accommodation time.
The source network device uses the quotient of the fifth value and a preset sixth value as the first rate value.
In the embodiment of the present application, the fixed conversion ratio is specifically 8; a preset sixth value is 1000000 in particular, which is used to convert the fifth value into M units; the preset seventh value is specifically 1000, and the value is used for converting 1s into 1000 ms; the network burst accommodating time is specifically 50 ms.
In one example, the first capacity value of the token bucket is 625000 bytes, and the source network device scales the first capacity value to a first rate value of probe traffic that can be sent within 50 ms:
(((625000*8)+(10000000/1000)*50)*(1000/50))/1000000=110M
and step 120, sending a first probe flow which can be sent within the network burst accommodating time to the destination network equipment according to the first rate value.
Specifically, according to the description ofstep 110, after calculating the first rate value, the source network device sends, to the destination network device, the first probe traffic that can be (or is allowed to be) sent within the network burst accommodating time according to the first rate value.
According to the foregoing example, after the first rate value calculated by the source end network device is 110M, since the source end network device has associated and started the NQA service in advance, the source end network device initiates NQA service detection, and counts a detection result. The source network device constructs a first probe flow which can be sent within 50ms, and sends the first probe flow to the destination network device according to the rate of 110M.
Step 130, if it is determined that the packet has been lost currently according to the first detection traffic, calculating a second rate value according to the first rate value.
Specifically, according to the description instep 120, after the source network device initiates the NQA service detection, the message loss rate, the round trip time, and the like are calculated according to whether the response packet sent by the destination network device is received or not and the time for 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 according to 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 above example, if the first speed value is 110M, the second speed value in this step is 55M.
Step 140, repeatedly executing the process of sending the detection traffic which can be sent within the network burst accommodation time to the destination network device according to the rate value, and if the packet is determined to be lost currently according to the detection traffic, calculating the next rate value according to the last rate value until the packet is determined to be not lost currently according to the detection traffic.
Specifically, according to the description instep 130, after the source network device calculates that the second rate value is 55M, it initiates the NQA service detection again, and counts the detection result. The source network device constructs a first probe flow which can be sent within 50ms, and sends the first probe flow to the destination network device according to the rate of 55M.
In order to ensure that the token bucket configured on the operator side is effectively supplemented, the time interval for the source end network device to initiate the NQA service detection is set to 1000 ms.
The source end network device repeatedly executes the process of sending the detection flow to the destination end network device according to the rate value, and if the current packet loss is determined according to the detection flow, calculating the next rate value according to the last rate value until the source end network device determines that the packet loss is not performed currently according to the detection flow.
Further, in this embodiment of the present application, a specific process of determining, by a source network device, that a packet is not lost currently according to a probe traffic is as follows:
if packet loss is determined according to the detection traffic sent last time and the detection traffic sent next time, and it is determined that no packet is lost currently according to the detection traffic sent currently, the source end network device determines whether the difference between the current rate value and the next rate value is smaller than a preset difference threshold.
And if the current speed value is smaller than the preset difference threshold value, the source end network device determines that no packet is lost currently, and takes the current speed value as a third speed value.
Wherein the preset difference threshold is specifically 0.5M. The smaller the preset difference threshold is set, the closer the rate value is to the value of the burst flow allowed by the operator-side inlet.
In an example, after the source network device sends the second probe traffic, according to the second probe traffic, the source network device determines that there is a packet loss in the second probe traffic. After the source end network device sends the third detection traffic again, according to the third detection traffic, the source end network device determines that no packet is lost in the third detection traffic. After the source end network device sends the fourth detection traffic again, the source end network device determines that packet loss exists in the fourth detection traffic according to the fourth detection traffic.
At this time, the source end network device determines whether a difference between a third rate value for sending the third probing traffic and a fourth rate value for sending the fourth probing traffic is smaller than a preset difference threshold.
For example, the third rate value is 20.625, the fourth rate value is 20.224, and the difference between the two rate values is less than 0.5M, the source end network device determines that no packet is lost when the third probe traffic is sent according to the third rate value.
It can be understood that, in the process of initiating the NQA service detection by the source network device, a rate value at which the transmission detection traffic just does not lose packets is determined according to the bisection method.
Assuming that the burst traffic allowed by the operator-side entry is 21M, according to the bisection method, the rate value for determining that the packet loss of the transmission probe traffic is just not lost is finally determined to be 20.625M by the source-side network device.
Step 150, obtaining a third rate value, where the third rate value is a current rate value of the sending detection traffic when the packet loss is not currently determined according to the detection traffic.
Specifically, according to the description instep 140, after determining the rate value at which the probe traffic is sent without packet loss, the source network device obtains the rate value, for example, the third rate value.
And 160, converting the third rate 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, according to the description instep 150, after obtaining the third rate value, the source network device converts the third rate value into the second capacity value of the token bucket. The second capacity value is a current capacity of the token bucket.
Further, the specific process of the source end network device converting the third rate value into the second capacity value of the token bucket is as follows:
and the source end network device multiplies the third rate value by a preset sixth value to obtain a first product value. The source end 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 scaling 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 of:
(((20.625*10000001)/1000)*50)/8=128906Byte
therefore, by applying the communication method provided by the application, according to the exit speed limit value and the first capacity value of the token bucket, the source end network device converts the first capacity value into a first rate value for sending the traffic flow, wherein the traffic flow is the traffic which can be sent within the network burst accommodation time; according to the first rate value, the source end network equipment sends a first detection flow which can be sent in the network burst accommodation time to the destination end network equipment; if the current packet loss is determined according to the first detection flow, the source end network device calculates a second speed value according to the first speed value; repeatedly executing the process of sending the detection flow which can be sent within the network burst accommodation time to the destination network equipment according to the rate value, and if the current packet loss is determined according to the detection flow, calculating the next rate value according to the last rate value until the current packet loss is determined according to the detection flow; the source end network equipment acquires a third rate value, wherein the third rate value is a current rate value for sending detection flow when packet loss is not currently determined according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and uses the second capacity value as the current capacity of the token bucket.
Therefore, whether packet loss exists or not is judged by sending the detection flow, and the current capacity of the token bucket is converted according to the current speed value of the sending detection flow when packet loss does not exist. The capacity of the local token bucket is automatically updated according to the size of the burst flow allowed by the detection operator side. The method and the device solve the problem that in the existing mode of configuring a smaller token bucket on a 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 device is applied to a source end network device, the source end network device comprises a first outlet configured with an outlet speed limit value, and a token bucket is configured in the source end network device, and the device comprises:
aconversion unit 310, configured to convert the first capacity value into a first rate value for sending a service traffic according to the exit speed limit value and the first capacity value of the token bucket, where the service traffic is a traffic that can be sent within a network burst accommodating time;
a sendingunit 320, configured to send, to the destination network device, a first probe traffic that can be sent within a network burst accommodating time according to the first rate value;
a calculatingunit 330, configured to calculate a second rate value according to the first rate value if it is determined that the packet has been lost currently according to the first probe traffic;
the sendingunit 320 and the calculatingunit 330 are further configured to repeatedly execute a process of sending, according to the rate value, the detection traffic that can be sent within the network burst accommodating time to the destination network device, and if the current packet is determined to be lost according to the detection traffic, calculating a next rate value according to the last rate value until the current packet is determined to be not lost according to the detection traffic;
an obtainingunit 340, configured to obtain a third rate value, where the third rate value is a current rate value of sending a detection traffic when it is determined that there is no packet loss according to the detection traffic;
theconversion unit 310 is further configured to convert the third rate value into a second capacity value of the token bucket, and use the second capacity value as the current capacity of the token bucket.
Optionally, thescaling unit 310 is specifically configured to add the first value and the second value to obtain a third value;
multiplying the third value by the fourth value to obtain a fifth value;
taking the quotient of the fifth value and a preset sixth value as the first speed value;
wherein the first value is a product of the first capacity value and a fixed conversion ratio; the second value is the product of the quotient of the exit 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 accommodating time.
Optionally, the calculatingunit 330 is specifically configured to use half of the first speed value as the second speed value.
Optionally, the calculatingunit 330 is specifically configured to, if it is determined that a packet has been lost according to the detection traffic sent last time and the detection traffic sent next time, and it is determined that a packet is not lost currently according to the detection traffic sent currently, determine whether a difference between the current rate value and the next rate value is smaller than a preset difference threshold;
if the packet loss rate is smaller than the third rate value, determining that no packet is lost currently, and taking the current rate value as the third rate value.
Optionally, thescaling unit 310 is further specifically configured to specifically include: multiplying the third speed value by 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 exit speed limit value and the first capacity value of the token bucket, the source end network device converts the first capacity value into a first rate value for sending the traffic flow, wherein the traffic flow is the traffic which can be sent within the network burst accommodation time; according to the first rate value, the source end network equipment sends a first detection flow which can be sent in the network burst accommodation time to the destination end network equipment; if the current packet loss is determined according to the first detection flow, the source end network device calculates a second speed value according to the first speed value; repeatedly executing the process of sending the detection flow which can be sent within the network burst accommodation time to the destination network equipment according to the rate value, and if the current packet loss is determined according to the detection flow, calculating the next rate value according to the last rate value until the current packet loss is determined according to the detection flow; the source end network equipment acquires a third rate value, wherein the third rate value is a current rate value for sending detection flow when packet loss is not currently determined according to the detection flow; the source network device converts the third rate value into a second capacity value of the token bucket, and uses the second capacity value as the current capacity of the token bucket.
Therefore, whether packet loss exists or not is judged by sending the detection flow, and the current capacity of the token bucket is converted according to the current speed value of the sending detection flow when packet loss does not exist. The capacity of the local token bucket is automatically updated according to the size of the burst flow allowed by the detection operator side. The method and the device solve the problem that in the existing mode of configuring a smaller token bucket on a 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 application further provides a network device, as shown in fig. 4, including aprocessor 410, atransceiver 420, and a machine-readable storage medium 430, where the machine-readable storage medium 430 stores machine-executable instructions capable of being executed by theprocessor 410, and theprocessor 410 is caused by the machine-executable instructions to perform the communication method provided by the present application. The communication apparatus shown in fig. 3 can be implemented by using the hardware structure of the network device shown in fig. 4.
The computer-readable storage medium 430 may include a Random Access Memory (RAM) or a Non-volatile Memory (NVM), such as at least one disk Memory. Alternatively, the computer-readable storage medium 430 may also be at least one memory device located remotely from theprocessor 410.
TheProcessor 410 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; the Integrated Circuit can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In the embodiment of the present application, theprocessor 410 is caused by machine executable instructions by reading the machine executable instructions stored in the machinereadable storage medium 430 to enable theprocessor 410 itself and thecall transceiver 420 to perform the communication method described in the embodiment 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 theprocessor 410, cause theprocessor 410 itself and the invokingtransceiver 420 to perform the communication methods described in embodiments of the present application.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
As for the embodiments of the communication apparatus and the machine-readable storage medium, since the contents of the related methods are substantially similar to those of the foregoing embodiments of the methods, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the embodiments of the methods.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.