CN111726300A - Data sending method and device - Google Patents
Data sending method and device Download PDFInfo
- Publication number
- CN111726300A CN111726300A CN202010542846.3A CN202010542846A CN111726300A CN 111726300 A CN111726300 A CN 111726300A CN 202010542846 A CN202010542846 A CN 202010542846A CN 111726300 A CN111726300 A CN 111726300A
- Authority
- CN
- China
- Prior art keywords
- data
- subunits
- token
- token bucket
- sending
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/215—Flow control; Congestion control using token-bucket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/32—Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a data sending method and a device, wherein the method comprises the following steps: receiving a data unit to be sent, and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to a token in a token bucket at the current moment; if so, cutting the data unit to obtain a plurality of data subunits, wherein the data volume of each data subunit is not more than the maximum data volume corresponding to the token in the token bucket at the current moment; sending out the data subunits according to the sequence; and if not, sending the data unit out. By applying the embodiment of the invention, the loss of data is avoided.
Description
Technical Field
The present invention relates to a method and an apparatus for transmitting data, and more particularly, to a method and an apparatus for transmitting data.
Background
One of application scenarios of the AIRT-ROS (Artificial Intelligence Radio-transmitter Robot operating system) node is capture based on vision. The robot, namely the AIRT-ROS node, can better cooperate by sharing video information. In an actual working environment, the network environment between robots may be unstable due to various reasons such as signal interference. In addition, the video stream has the characteristics of large occupied bandwidth and influence on the next video processing result after key frames are lost. Therefore, the video stream is smoothly spread among the robots, and the influence of the video stream jitter on the video processing of the receiving end can be reduced to the maximum extent. Moreover, when the video frame generation rate to be transmitted exceeds the peak transmission rate, some frames may not be transmitted normally.
To solve the above problem, traffic shaping is generally employed. Traffic shaping forces traffic to follow certain bandwidth allocation constraints by reducing the rate of outgoing traffic. It puts bursty traffic into a traffic shaping buffer and sends it out when bandwidth is available, or when the number of buffered packets is below a configured limit. One typical application of traffic shaping is to control the output of local traffic based on the transmission policy indicators of downstream network nodes. The flow shaping controls the flow speed by means of the token, when the token bucket has enough tokens, the cached messages can be uniformly sent outwards, and the message sending speed is always similar to the token issuing speed. At present, each large manufacturer mainly uses a three-color double-bucket traffic shaping method, and the method marks three colors of green, yellow and red by setting a CIR (Committed Information Rate) and a PIR (peak Information Rate), namely, the message sending Rate is less than the CIR and the message sending Rate is marked as green; the sending rate of the message is greater than CIR but less than PIR, and the message is marked as yellow; the sending rate of the message is greater than PIR and marked as red; the sizes of the double buckets correspond to a Committed Burst Size CBS (Committed Burst Size) and a PBS (Peak Burst Size), respectively. This approach works well for traffic shaping, but the logic to label traffic three colors and compare traffic to buckets is complex, resulting in large delays. On the other hand, the method discards the traffic exceeding the PIR and the PBS, which easily causes that the upper layer application cannot normally receive the required message, thereby affecting the processing result of the upper layer application or consuming more time for the upper layer application to retransmit the message.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a data transmission method and apparatus, so as to avoid data loss.
The invention solves the technical problems through the following technical scheme:
the embodiment of the invention provides a data sending method, which comprises the following steps:
receiving a data unit to be sent, and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to a token in a token bucket at the current moment;
if so, cutting the data unit to obtain a plurality of data subunits, wherein the data volume of each data subunit is not more than the maximum data volume corresponding to the token in the token bucket at the current moment; sending out the data subunits according to the sequence;
and if not, sending the data unit out.
Optionally, the data to be sent is video stream data.
Optionally, after obtaining the plurality of data subunits, buffering other data subunits in the data subunits except the data subunit with the first sending order in the excess buffer.
Optionally, the cutting the data unit to obtain a plurality of data sub-units includes:
and cutting the data unit into a plurality of data subunits according to the maximum data volume corresponding to the tokens in the token bucket at the current moment.
Optionally, the sending the data sub-units in sequence includes:
and according to the sequence of the timestamps corresponding to the data subunits, when the number of the tokens in the token bucket is the same as the number of the tokens required by the data subunits, sending out each data subunit.
Optionally, the method further includes:
and adding tokens into a token bucket at a committed information rate, wherein the capacity of the token bucket is the data volume corresponding to the committed burst size.
An embodiment of the present invention further provides a data sending apparatus, where the apparatus includes:
the judging module is used for receiving a data unit to be sent and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to the token in the token bucket at the current moment;
the cutting module is used for cutting the data unit to obtain a plurality of data subunits under the condition that the judgment result of the judgment module is yes, and the data volume of each data subunit is not greater than the maximum data volume corresponding to the token in the token bucket at the current moment; sending out the data subunits according to the sequence;
and the sending module is used for sending the data unit out under the condition that the judgment result of the judging module is negative.
Optionally, the data to be sent is video stream data.
Optionally, the cutting module is configured to:
after obtaining a plurality of data subunits, caching other data subunits except the data subunit with the first sending order in the data subunits in an excess buffer area.
Optionally, the cutting module is configured to:
and cutting the data unit into a plurality of data subunits according to the maximum data volume corresponding to the tokens in the token bucket at the current moment.
Optionally, the sending module is configured to:
and according to the sequence of the timestamps corresponding to the data subunits, when the number of the tokens in the token bucket is the same as the number of the tokens required by the data subunits, sending out each data subunit.
Optionally, the apparatus further comprises:
and the adding module is used for adding tokens into the token bucket according to the committed information rate, wherein the capacity of the token bucket is the data volume corresponding to the committed burst size.
Compared with the prior art, the invention has the following advantages:
by applying the embodiment of the invention, when the data unit to be sent exceeds the maximum data volume corresponding to the token in the token bucket, the data unit is segmented, the data volume of each data subunit obtained after segmentation is not more than the maximum data volume corresponding to the token in the token bucket at the current moment, and then the data subunits are sent out.
Drawings
Fig. 1 is a schematic flowchart of a data transmission method according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating a data transmission method according to an embodiment of the present invention;
fig. 3 is another schematic diagram of a data transmission method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data transmitting apparatus according to an embodiment of the present invention.
Detailed Description
The following examples are given for the detailed implementation and specific operation of the present invention, but the scope of the present invention is not limited to the following examples.
The embodiment of the present invention provides a data transmission method and apparatus, and first, a data transmission method provided in the embodiment of the present invention is described below.
Example 1
Fig. 1 is a schematic flowchart of a data transmission method according to an embodiment of the present invention; fig. 2 is a schematic diagram illustrating a data transmission method according to an embodiment of the present invention; as shown in fig. 1 and 2, the method includes:
s101: receiving a data unit to be sent, and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to a token in a token bucket at the current moment; if yes, executing S102; if not, go to S1103.
For example, the data to be transmitted is taken as video stream data for explanation. Generally, video stream data is transmitted in frames according to video frames, for example, the video frames are transmitted in sequence according to the playing sequence of the video frames.
At the present moment, a data unit to be transmitted is received, for example, the data unit to be transmitted includes 3 video frames, and the 3 video frames as a whole can be regarded as one data unit.
The size of the data amount of the data unit is 3M, and the size of each video frame is 1M. The token bucket comprises 2 tokens, and the size of the data volume corresponding to each token is 1M. Judging whether the data volume of the data unit exceeds the maximum data volume corresponding to the token in the token bucket or not; that is, it is determined whether the size of the 3M data unit exceeds the total data amount corresponding to all the tokens in the token bucket, that is, 2M, and obviously, the size of the 3M data unit exceeds the total data amount corresponding to all the tokens in the token bucket.
Thus, step S102 is performed.
In practical application, in order to better adapt to the data size of different videos and avoid waste of bandwidth, the data size corresponding to each token may be different or the same, that is, the data size corresponding to token 1 may be 0.5M; the size of the data amount corresponding to token 2 may be 2M.
It is emphasized that the number of token buckets is one in embodiments of the present invention.
S102: cutting the data unit to obtain a plurality of data subunits, wherein the data volume of each data subunit is not more than the maximum data volume corresponding to the token in the token bucket at the current moment; and sending the data subunits in sequence.
Illustratively, data segmentation is performed on the data unit by frame to obtain 3 video frames, and each video frame is taken as a data subunit. The size of the data volume of each data subunit should be guaranteed not to exceed 2M during the slicing.
And after a plurality of video frames are obtained, sending out the video frames combined with the token according to the playing sequence of the video frames.
In addition, the transmission method of the video frame includes, but is not limited to, the following methods:
for example, when the size of each video frame is the same as the data amount corresponding to the corresponding token, one token may be corresponding to each video frame and then transmitted.
When the size of a certain video frame exceeds 1M, two or more tokens may be matched to the video frame. The video frames that are not transmitted are buffered in an excess buffer.
S103: and sending the data unit out.
In practical applications, after the first video frame is sent out, if the sum of the data amounts corresponding to the total number of tokens in the token bucket is smaller than the data amount of the second video frame, the second video frame can be sent after the tokens in the token bucket are accumulated to a sufficient amount.
And according to the sequence of the timestamps corresponding to the data subunits, when the number of the tokens in the token bucket is the same as the number of the tokens required by the data subunits, sending out each data subunit.
By applying the embodiment shown in fig. 1 of the present invention, when the data unit to be sent exceeds the maximum data amount corresponding to the token in the token bucket, the data unit is segmented, the data amount of each data subunit obtained after the segmentation is not greater than the maximum data amount corresponding to the token in the token bucket at the current time, and then the data subunits are sent out.
In addition, in order to ensure that the video traffic transmission between ROS nodes is stable and no packet is lost, the embodiment of the invention provides a single-bucket mechanism combined with dynamic cache, which can ensure that the video traffic transmission is stable and can also cache the packet loss problem of burst rate messages. The embodiment of the invention also provides another data sending method which comprises the following steps: on the basis of the embodiment of the invention shown in FIG. 1, the following steps are added:
and adding tokens into a token bucket at a committed information rate, wherein the capacity of the token bucket is the data volume corresponding to the committed burst size.
For example, the number of tokens in the token bucket is continuously increased as time goes on, and the number of tokens is continuously claimed for data transmission, so that the data of the tokens in the token bucket is balanced in a dynamic change.
That is, the maximum data amount corresponding to the token bucket is the same as the maximum data amount of one data unit allowed to be received set by the system. Meanwhile, the adding speed of the token is equal to the set speed of the system for sending data outwards.
Example 3
Corresponding to the embodiment shown in fig. 1 of the present invention, an embodiment of the present invention further provides a data transmission apparatus.
Fig. 4 is a schematic structural diagram of a data transmitting apparatus according to an embodiment of the present invention, and as shown in fig. 4, the apparatus includes:
a determining module 401, configured to receive a data unit to be sent, and determine whether a data size of the data unit is greater than a maximum data size corresponding to a token in a token bucket at a current time;
a cutting module 402, configured to cut the data unit to obtain a plurality of data sub-units if the determination result of the determining module 401 is yes, where a data amount of each data sub-unit is not greater than a maximum data amount corresponding to a token in the token bucket at the current time; sending out the data subunits according to the sequence;
a sending module 403, configured to send the data unit if the determination result of the determining module 401 is negative.
By applying the embodiment shown in fig. 4 of the present invention, when the data unit to be sent exceeds the maximum data amount corresponding to the token in the token bucket, the data unit is segmented, the data amount of each data subunit obtained after the segmentation is not greater than the maximum data amount corresponding to the token in the token bucket at the current time, and then the data subunits are sent out.
In a specific implementation manner of the embodiment of the present invention, the data to be sent is video stream data.
In a specific implementation manner of the embodiment of the present invention, the cutting module 402 is configured to:
after obtaining a plurality of data subunits, caching other data subunits except the data subunit with the first sending order in the data subunits in an excess buffer area.
In a specific implementation manner of the embodiment of the present invention, the cutting module 402 is configured to:
and cutting the data unit into a plurality of data subunits according to the maximum data volume corresponding to the tokens in the token bucket at the current moment.
In a specific implementation manner of the embodiment of the present invention, the sending module 403 is configured to:
and according to the sequence of the timestamps corresponding to the data subunits, when the number of the tokens in the token bucket is the same as the number of the tokens required by the data subunits, sending out each data subunit.
Example 4
In a specific implementation manner of the embodiment of the present invention, the apparatus further includes:
and the adding module is used for adding tokens into the token bucket according to the committed information rate, wherein the capacity of the token bucket is the data volume corresponding to the committed burst size.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (10)
1. A method for transmitting data, the method comprising:
receiving a data unit to be sent, and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to a token in a token bucket at the current moment;
if so, cutting the data unit to obtain a plurality of data subunits, wherein the data volume of each data subunit is not more than the maximum data volume corresponding to the token in the token bucket at the current moment; sending out the data subunits according to the sequence;
and if not, sending the data unit out.
2. The method according to claim 1, wherein the data to be transmitted is video stream data.
3. The method according to claim 1, wherein after obtaining the plurality of data sub-units, the other data sub-units of the data sub-units except the data sub-unit with the first transmission order are buffered in the excess buffer.
4. The method according to claim 1, wherein the step of dividing the data unit into a plurality of data sub-units comprises:
and cutting the data unit into a plurality of data subunits according to the maximum data volume corresponding to the tokens in the token bucket at the current moment.
5. The method according to claim 1, wherein said sending out said data sub-units in sequence comprises:
and according to the sequence of the timestamps corresponding to the data subunits, when the number of the tokens in the token bucket is the same as the number of the tokens required by the data subunits, sending out each data subunit.
6. A method as claimed in claim 1, wherein the method further comprises:
and adding tokens into a token bucket at a committed information rate, wherein the capacity of the token bucket is the data volume corresponding to the committed burst size.
7. A data transmission apparatus, characterized in that the apparatus comprises:
the judging module is used for receiving a data unit to be sent and judging whether the data volume of the data unit is larger than the maximum data volume corresponding to the token in the token bucket at the current moment;
the cutting module is used for cutting the data unit to obtain a plurality of data subunits under the condition that the judgment result of the judgment module is yes, and the data volume of each data subunit is not greater than the maximum data volume corresponding to the token in the token bucket at the current moment; sending out the data subunits according to the sequence;
and the sending module is used for sending the data unit out under the condition that the judgment result of the judging module is negative.
8. The data transmission apparatus according to claim 7, wherein said data to be transmitted is video stream data.
9. The data transmission apparatus according to claim 7, wherein the cutting module is configured to:
after obtaining a plurality of data subunits, caching other data subunits except the data subunit with the first sending order in the data subunits in an excess buffer area.
10. The data transmission apparatus according to claim 7, wherein the cutting module is configured to:
and cutting the data unit into a plurality of data subunits according to the maximum data volume corresponding to the tokens in the token bucket at the current moment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010542846.3A CN111726300A (en) | 2020-06-15 | 2020-06-15 | Data sending method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010542846.3A CN111726300A (en) | 2020-06-15 | 2020-06-15 | Data sending method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111726300A true CN111726300A (en) | 2020-09-29 |
Family
ID=72566858
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010542846.3A Pending CN111726300A (en) | 2020-06-15 | 2020-06-15 | Data sending method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111726300A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115913462A (en) * | 2022-11-09 | 2023-04-04 | 中国人民解放军32039部队 | Network data sending method and data sending module based on pre-planning |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015096692A1 (en) * | 2013-12-23 | 2015-07-02 | 腾讯科技(深圳)有限公司 | Method and system for controlling data reception traffic and computer storage medium |
CN107465630A (en) * | 2017-08-30 | 2017-12-12 | 郑州云海信息技术有限公司 | A kind of bandwidth traffic monitoring and managing method and system |
CN107743099A (en) * | 2017-08-31 | 2018-02-27 | 华为技术有限公司 | Data flow processing method, device and storage medium |
US20190065425A1 (en) * | 2017-08-25 | 2019-02-28 | Fujitsu Limited | Information processing device, information processing method, and storage medium |
CN109428801A (en) * | 2017-08-23 | 2019-03-05 | 北京华为数字技术有限公司 | File transmitting method and device |
CN110474849A (en) * | 2018-05-10 | 2019-11-19 | 华为技术有限公司 | The method and communication equipment of resource allocation |
CN110971387A (en) * | 2019-12-10 | 2020-04-07 | 上海邦邦机器人有限公司 | Data transmission processing method, sending equipment and receiving equipment |
-
2020
- 2020-06-15 CN CN202010542846.3A patent/CN111726300A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015096692A1 (en) * | 2013-12-23 | 2015-07-02 | 腾讯科技(深圳)有限公司 | Method and system for controlling data reception traffic and computer storage medium |
CN109428801A (en) * | 2017-08-23 | 2019-03-05 | 北京华为数字技术有限公司 | File transmitting method and device |
US20190065425A1 (en) * | 2017-08-25 | 2019-02-28 | Fujitsu Limited | Information processing device, information processing method, and storage medium |
CN107465630A (en) * | 2017-08-30 | 2017-12-12 | 郑州云海信息技术有限公司 | A kind of bandwidth traffic monitoring and managing method and system |
CN107743099A (en) * | 2017-08-31 | 2018-02-27 | 华为技术有限公司 | Data flow processing method, device and storage medium |
CN110474849A (en) * | 2018-05-10 | 2019-11-19 | 华为技术有限公司 | The method and communication equipment of resource allocation |
CN110971387A (en) * | 2019-12-10 | 2020-04-07 | 上海邦邦机器人有限公司 | Data transmission processing method, sending equipment and receiving equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115913462A (en) * | 2022-11-09 | 2023-04-04 | 中国人民解放军32039部队 | Network data sending method and data sending module based on pre-planning |
CN115913462B (en) * | 2022-11-09 | 2023-08-08 | 中国人民解放军32039部队 | Network data transmission method and data transmission module based on advance planning |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7821939B2 (en) | Method, system, and computer program product for adaptive congestion control on virtual lanes for data center ethernet architecture | |
US8014281B1 (en) | Systems and methods for limiting the rates of data to/from a buffer | |
WO2019033857A1 (en) | Packet control method and network device | |
CN108718283B (en) | TCP congestion control method for centralized end network coordination in data center network | |
US20240214323A1 (en) | Packet transmission method and apparatus | |
CN107770085B (en) | Network load balancing method, equipment and system | |
US9515919B2 (en) | Method and apparatus for protection switching in packet transport system | |
CA2675930C (en) | Method for realizing backpressure of masses of ports and device thereof | |
JP2002016637A (en) | Packet scheduling device | |
JP2010500837A (en) | A method for optimizing information transfer in telecommunications networks. | |
CN109714267A (en) | Manage the transfer control method and system of reversed queue | |
JP2006506845A (en) | How to select a logical link for a packet in a router | |
CN108881031B (en) | Self-adaptive reliable data transmission method based on SDN network | |
CN107948103A (en) | A kind of interchanger PFC control methods and control system based on prediction | |
WO2008104100A1 (en) | An apparatus and a method for realizing flow control based on rate restrict for mstp device | |
CN111628999B (en) | SDN-based FAST-CNP data transmission method and system | |
CN110868359B (en) | Network congestion control method | |
KR100408044B1 (en) | Traffic control system and method in atm switch | |
WO2022028342A1 (en) | Method for processing congestion flow and device | |
CN111726300A (en) | Data sending method and device | |
CN112468405B (en) | Data center network congestion control method based on credit and reaction type | |
CN111865813B (en) | Data center network transmission control method and system based on anti-ECN mark and readable storage medium | |
CN103888372B (en) | Traffic shaping method and data processing equipment | |
CN112311623A (en) | Time-sensitive network test platform and test method applied to train | |
JPS61140253A (en) | Packet transfer system |
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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20220928 Address after: 236000 room 316, building 3, Zone C, intelligent technology park, No. 3963 Susong Road, Hefei Economic and Technological Development Zone, Anhui Province Applicant after: Hefei Hagong Xuanyuan Intelligent Technology Co.,Ltd. Address before: Room 6012, Haiheng building, No.6 Cuiwei Road, Hefei Economic and Technological Development Zone, Anhui Province Applicant before: HRG INTERNATIONAL INSTITUTE FOR RESEARCH & INNOVATION |