CN107465629A - Method for limiting speed and device - Google Patents

Method for limiting speed and device Download PDF

Info

Publication number
CN107465629A
CN107465629A CN201610397490.2A CN201610397490A CN107465629A CN 107465629 A CN107465629 A CN 107465629A CN 201610397490 A CN201610397490 A CN 201610397490A CN 107465629 A CN107465629 A CN 107465629A
Authority
CN
China
Prior art keywords
token
token bucket
data packet
bucket
packet length
Prior art date
Application number
CN201610397490.2A
Other languages
Chinese (zh)
Inventor
杨巧顺
许煜芝
蔡立勇
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to CN201610397490.2A priority Critical patent/CN107465629A/en
Publication of CN107465629A publication Critical patent/CN107465629A/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic regulation in packet switching networks
    • H04L47/10Flow control or congestion control
    • H04L47/21Flow control or congestion control using leaky bucket
    • H04L47/215Token bucket

Abstract

The invention provides a kind of method for limiting speed and device, wherein, this method includes:The data packet length of token bucket is passed through in detection, wherein, the token number in the token bucket includes fractional part and integer part, and when it is determined that the data packet length is less than default token number, the packet passes through inspection.Using above-mentioned technical proposal, solve the problems, such as how to reach high speed limit precision in correlation technique, the precision of limiting speed of token bucket greatly improved.

Description

Method for limiting speed and device

Technical field

The present invention relates to the communications field, in particular to a kind of method for limiting speed and device.

Background technology

In internet arena, current limiting technique is used as controlling the speed of network interface transceiving communication data, can be used for excellent Change performance, reduce delay and improve bandwidth etc..

Token bucket algorithm is in shaping network flow (Traffic Shaping) and rate limit (Rate Limiting) A kind of most-often used algorithm.In typical case, token bucket algorithm is used for controlling the number for the data being sent on network, and permits Perhaps the transmission of bursty data.But traditional token bucket algorithm has certain deviation for the limitation of low discharge, such as:

Assuming that system dominant frequency is 200MHZ, the rate pad cycle is arranged to 1000, and (1000 be representative value, and 1000 clocks are filled out Fill a token), each fill cycle fills 1 token (token is equal to a byte), then total bandwidth is:[(200 ×106)/1000] × 8=1600kbps

Now, when being 1600kbps for speed limit granularity, speed limit is just accurate, but for minimum of many business needs When granularity reaches 64kbps even more small speed limit requirements, this speed limit is clearly that can not reach speed limit requirement.Correlation technique In for it is this very high to speed limit required precision the problem of, mainly have the following two kinds solve method:One kind is to reduce fill cycle, Another kind is to reduce fill rate.

For how to reach the problem of high speed limit required precision in correlation technique, there is presently no effective solution.

The content of the invention

The embodiments of the invention provide a kind of method for limiting speed and device, at least to solve how to reach high limit in correlation technique The problem of fast required precision.

According to one embodiment of present invention, there is provided a kind of method for limiting speed, including:The packet of token bucket is passed through in detection Length, wherein, the token number in the token bucket includes fractional part and integer part;It is determined that the data packet length is less than During default token number, the packet passes through inspection.

Alternatively, methods described also includes:The token of specified quantity is filled into the token bucket according to predetermined period, and Remaining token number in the token bucket is updated to following number:The default token number and the specified quantity and value, Wherein, the token of the specified quantity includes fractional part and integer part.

Alternatively, methods described also includes:When the remaining token number is more than the capacity of the token bucket, by the order Remaining token number in board bucket is updated to following number:The capacity of the token bucket.

Alternatively, after the packet is by inspection, methods described also includes:By the remaining token in the token bucket Number is updated to following number:The difference of the default token number and the data packet length.

Alternatively, after the data packet length by token bucket is detected, methods described also includes:In the long data packet When degree is more than the token number in the token bucket, by the data packet discarding.

According to another embodiment of the invention, there is provided a kind of speed-limiting device, including:Detection module, passed through for detecting The data packet length of token bucket is crossed, wherein, the token number in the token bucket includes fractional part and integer part;Determine mould Block, for when it is determined that the data packet length is less than default token number, the packet to pass through inspection.

Alternatively, the determining module is additionally operable to fill the order of specified quantity into the token bucket according to predetermined period Board, and the remaining token number in the token bucket is updated to following number:The default token number and the specified quantity And value, wherein, the token of the specified quantity includes fractional part and integer part.Alternatively, it is big in the remaining token number When the capacity of the token bucket, the remaining token number in the token bucket is updated to following number:The token bucket Capacity.

Alternatively, after the packet is by inspection, the remaining token number in the token bucket is updated to following number Mesh:The difference of the default token number and the data packet length.

Alternatively, after the data packet length by token bucket is detected, the determining module is additionally operable in the data When packet length is more than the token number in the token bucket, by the data packet discarding.

According to still another embodiment of the invention, a kind of storage medium is additionally provided.The storage medium is arranged to store For performing the program code of following steps:The data packet length of token bucket is passed through in detection, wherein, the token in the token bucket Number includes fractional part and integer part;When it is determined that the data packet length is less than default token number, the packet passes through Examine.

By the present invention, speed limit is carried out to packet using the token bucket in present specification, what present specification was recorded Token number in token bucket includes fractional part and integer part, and packet can be entered using the token bucket that fractional part be present The higher speed limit of row precision, solve the problems, such as how to reach high speed limit precision in correlation technique, token bucket limit greatly improved The precision of speed.

Brief description of the drawings

Accompanying drawing described herein is used for providing a further understanding of the present invention, forms the part of the application, this hair Bright schematic description and description is used to explain the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:

Fig. 1 is a kind of flow chart of method for limiting speed according to embodiments of the present invention;

Fig. 2 is the limiting speed of token bucket schematic diagram according to alternative embodiment of the present invention;

Fig. 3 is the token bucket token filling schematic diagram in alternative embodiment of the present invention;

Fig. 4 is the schematic diagram according to the fill rate metering method one of alternative embodiment of the present invention;

Fig. 5 is the schematic diagram according to the fill rate metering method two of alternative embodiment of the present invention;

Fig. 6 is a kind of structured flowchart of speed-limiting device according to embodiments of the present invention.

Embodiment

Describe the present invention in detail below with reference to accompanying drawing and in conjunction with the embodiments.It should be noted that do not conflicting In the case of, the feature in embodiment and embodiment in the application can be mutually combined.

It should be noted that term " first " in description and claims of this specification and above-mentioned accompanying drawing, " Two " etc. be for distinguishing similar object, without for describing specific order or precedence.

Token bucket is a kind of conventional flow control technique.Token bucket is in itself without discarding and priority policy, token bucket Algorithm is a kind of algorithm most-often used in shaping network flow and rate limit.In typical case, token bucket algorithm is used for controlling System is sent to the number of the data on network, and allows the transmission of bursty data.

Token bucket depth in the capacity for the token bucket recorded in the above-described embodiments i.e. correlation technique, unit bit, takes out The meaning of elephant is similar to the depth of bucket.

Embodiment 1

Embodiments herein is applied to passive optical-fiber network (Passive Optical Network, referred to as PON) net Network.It should be noted that the technical scheme that present specification is recorded can apply to above-mentioned scene but be not limited to above-mentioned scene.

A kind of a kind of method for limiting speed for running on the above-mentioned network architecture is provided in the present embodiment, and Fig. 1 is according to this hair The flow chart of a kind of method for limiting speed of bright embodiment, as shown in figure 1, the flow comprises the following steps:

The data packet length of token bucket is passed through in step S102, detection, wherein, the token number in the token bucket includes fractional part Point and integer part;

Step S104, when it is determined that the data packet length is less than default token number, the packet passes through inspection.

By above-mentioned steps, speed limit, solution are carried out to the packet by token bucket using the token number with fractional part The problem of using limiting speed of token bucket precision low in correlation technique of having determined, greatly improved the precision of limiting speed of token bucket.

After above-mentioned alternative embodiment is to the packet speed limit by token bucket, by the remaining token number in the token bucket It is updated to following number:The difference of the default token number and the data packet length.The remaining token number of token bucket is examined in token bucket Tested after packet, it is necessary to supplement token number, in an alternate embodiment of the present invention where, according to predetermined period to the token The token of specified quantity is filled in bucket, and the remaining token number in the token bucket is updated to following number:The default token number With the specified quantity and value, wherein, the token of the specified quantity includes fractional part and integer part.Supplemented to token bucket What is supplemented during token number is exactly the token number of mixed decimal part.Alternatively, the capacity of the token bucket is more than in the remaining token number When, the remaining token number in the token bucket is updated to following number:The capacity of the token bucket.The capacity of token bucket is correlation Token bucket depth in technology, represent the token number of maximum storage in token bucket, the implication of the capacity expression of similar bucket.

Alternatively, data packet length is less than token number, and the packet is by examining, if data packet length is more than token Number, the packet is subjected to speed limit, by the data-bag lost.

In an alternate embodiment of the present invention where, system dominant frequency be 200MHZ and fill cycle 1000 (1000 be allusion quotation Offset, 1000 clocks fill a token) immobilize in the case of, it is accurate to improve speed limit by changing fill rate Degree.

In the related art, token bucket algorithm is all that fill rate is with word using a byte as minimum calculation unit Save for unit carry out token filling, in order to reach smaller granularity, be generally all by increase or reduce fill cycle come Reach required precision, such as in order to reach the requirement of 64kbps granularity, fill cycle is arranged to (dominant frequency 200 × 106)/(64 ×103/ 8)=25000 (represent that 25000 clocks fill a token), but when speed limit reaches 20Mbps during even more high, Each cycle filling (20 × 106×25000)/[(200×106) × 8]=312 byte, this filling mode is due to fill cycle It is long, fluctuation packet loss is caused to small byte data bag.

The alternative embodiment of the present invention, in order to allow packet it is smooth by while considering 1G PON optical-fiber networks Maximum rate (the common 2Gbps speed of 1G ethernet passive optical networks (Ethernet-PON, referred to as EPON) up-downgoing, 1G passive lights Access system (Gigabit-Capable, referred to as PON), referred to as GPON) the common 3.75Gbps speed of up-downgoing), remain compared with Small fill cycle, fill cycle token unit is accurate to 1/n token and is filled, i.e., filling can be as accurate as 1/ every time 8th, 1/16,1/32, even more small token unit is filled.

Such as most of GPON optical-fiber networks Maximum speed limit requirement in correlation technique for 3.75G (up 1.25G, it is descending 2.5G shares a token bucket) for, fill rate requirement is:

(3.75×109)/([(200×106)/1000] × 8)=2343.75 byte, integer part 2343 only accounts for 11 Bit positions.So for 32-bit operating system, if the fractional part of token is represented with 8 bit, integer part 24bit tables Show, it is already possible to reach maximum speed limit requirement.

And to 8bit fractional parts, smallest particles degree can reach 6.25kbps, be calculated as follows::1600/256= 6.25kbps, 1600 is on the books in present specification background technology, (be fill cycle be 1000, each fill cycle is filled out The total bandwidth calculated in the case of filling a token), for there is 8bit fractional part in embodiments of the invention, i.e., each fill out 1/256 token can be filled by filling the cycle.

Fig. 2 is the limiting speed of token bucket schematic diagram according to alternative embodiment of the present invention, as shown in Fig. 2 being wrapped in token speed limit bucket Containing a token bucket that can fill token automatically, the token bucket fills token memory by speed limit, token bucket capacity memory, remains Remaining token memory composition.

When packet passes through speed limit token bucket, first compare whether data packet length (in units of byte) is more than remaining order Token number in board bucket, if data packet length is more than token number, by the data packet discarding, speed limit effect is reached with this;If Data packet length is less than remaining token number, then packet by the remaining token number in remaining token bucket by now subtracting data Packet length obtains new remaining token number.

Fig. 3 is the token bucket token filling schematic diagram in alternative embodiment of the present invention, as shown in figure 3, speed limit token The filling of bucket:Filled by the fixed cycle, for example fill cycle is 1000, then every 1000 clock cycle are that token bucket is filled once Token, finally using the token number of filling add remaining token bucket in token number as newly remaining token number.

It is emphasized that remaining token number and fill rate are all mixed decimal positions in token bucket in present specification , least-significant byte is decimal place.

Fig. 4 be according to the schematic diagram of the fill rate metering method one of alternative embodiment of the present invention, it is assumed that Currently reach minimum speed limit 6.25kbps, then fill rate is

(6.25×103)/([(200×106)/1000] × 8)=0.00390625 byte, integer part 0 is moved to left 8, Least-significant byte records fractional part, i.e. 0.00390625 token, last fill rate token bucket memory metering method is Fig. 4 institutes Show, low 8bit records 0.00390625 token, and high 24 bit record 0 token.

Fig. 5 be according to the schematic diagram of the fill rate metering method two of alternative embodiment of the present invention, as shown in fig. 5, it is assumed that It is 3.75G currently to reach maximum speed limit, then fill rate is 2343.75, integer part 2343 is moved to left into 8, least-significant byte records small Number part, i.e. 0.75 token, last fill rate token bucket memory metering method are low 8bit records 0.75 shown in Fig. 5 Individual token, high 24 bit record 2343 tokens.

Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but a lot In the case of the former be more preferably embodiment.Based on such understanding, technical scheme is substantially in other words to existing The part that technology contributes can be embodied in the form of software product, and the computer software product is stored in a storage In medium (such as ROM/RAM, magnetic disc, CD), including some instructions to cause a station terminal equipment (can be mobile phone, calculate Machine, server, or network equipment etc.) perform the method that each embodiment of the present invention is somebody's turn to do.

Embodiment 2

A kind of speed-limiting device is additionally provided in the present embodiment, and the device is used to realize above-described embodiment and the side of being preferable to carry out Formula, repeating no more for explanation was carried out.As used below, term " module " can realize the software of predetermined function And/or the combination of hardware.Although device described by following examples is preferably realized with software, hardware, or soft The realization of the combination of part and hardware is also what may and be contemplated.

Fig. 6 is a kind of structured flowchart of speed-limiting device according to embodiments of the present invention, as shown in fig. 6, the device includes:

Detection module 62, for detecting the data packet length by token bucket, wherein, the token number in the token bucket includes Fractional part and integer part;

Determining module 64, it is connected with detection module 62, for when it is determined that the data packet length is less than default token number, being somebody's turn to do Packet passes through inspection.

Alternatively, the determining module 64 is additionally operable to fill the token of specified quantity into the token bucket according to predetermined period, And the remaining token number in the token bucket is updated to following number:The default token number and the specified quantity and value, wherein, The token of the specified quantity includes fractional part and integer part.Alternatively, the appearance of the token bucket is more than in the remaining token number During amount, the remaining token number in the token bucket is updated to following number:The capacity of the token bucket.

Alternatively, after the packet is by inspection, the remaining token number in the token bucket is updated to following number:Should The difference of default token number and the data packet length.

Alternatively, after the data packet length by token bucket is detected, the determining module 64 is additionally operable in the packet When length is more than the token number in the token bucket, by the data packet discarding.

It should be noted that above-mentioned modules can be realized by software or hardware, for the latter, Ke Yitong Cross in the following manner realization, but not limited to this:Above-mentioned module is respectively positioned in same processor;Or above-mentioned modules are with any The form of combination is located in different processors respectively.

Embodiment 3

Embodiments of the invention additionally provide a kind of storage medium.Alternatively, in the present embodiment, above-mentioned storage medium can The program code for performing following steps to be arranged to storage to be used for:

S1, detection by token bucket data packet length, wherein, token number in the token bucket includes fractional part and whole Number part;

S2, when it is determined that the data packet length is less than default token number, the packet passes through inspection.

Alternatively, in the present embodiment, above-mentioned storage medium can include but is not limited to:USB flash disk, read-only storage (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. is various can be with the medium of store program codes.

Alternatively, in the present embodiment, processor performs above-mentioned implementation according to the program code stored in storage medium The method and step that example is recorded.

Alternatively, the specific example in the present embodiment may be referred to described in above-described embodiment and optional embodiment Example, the present embodiment will not be repeated here.

Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and formed Network on, alternatively, they can be realized with the program code that computing device can perform, it is thus possible to they are stored Performed in the storage device by computing device, and in some cases, can be with different from shown in order execution herein The step of going out or describing, they are either fabricated to each integrated circuit modules respectively or by multiple modules in them or Step is fabricated to single integrated circuit module to realize.So, the present invention is not restricted to any specific hardware and software combination.

The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies Change, equivalent substitution, improvement etc., should be included in the scope of the protection.

Claims (10)

  1. A kind of 1. method for limiting speed, it is characterised in that including:
    The data packet length of token bucket is passed through in detection, wherein, the token number in the token bucket includes fractional part and integer portion Point;
    When it is determined that the data packet length is less than default token number, the packet passes through inspection.
  2. 2. according to the method for claim 1, it is characterised in that methods described also includes:
    Fill the token of specified quantity into the token bucket according to predetermined period, and by the remaining token number in the token bucket It is updated to following number:The default token number and the specified quantity and value, wherein, the token of the specified quantity includes Fractional part and integer part.
  3. 3. according to the method for claim 2, it is characterised in that methods described also includes:
    When the remaining token number is more than the capacity of the token bucket, the remaining token number in the token bucket is updated to Following number:The capacity of the token bucket.
  4. 4. according to the method for claim 1, it is characterised in that after the packet is by inspection, methods described is also wrapped Include:
    Remaining token number in the token bucket is updated to following number:The default token number and the data packet length Difference.
  5. 5. according to the method for claim 1, it is characterised in that after the data packet length by token bucket is detected, institute Stating method also includes:
    When the data packet length is more than the token number in the token bucket, by the data packet discarding.
  6. A kind of 6. speed-limiting device, it is characterised in that including:
    Detection module, for detecting the data packet length by token bucket, wherein, the token number in the token bucket includes decimal Part and integer part;
    Determining module, for when it is determined that the data packet length is less than default token number, the packet to pass through inspection.
  7. 7. device according to claim 6, it is characterised in that the determining module is additionally operable to according to predetermined period to described The token of specified quantity is filled in token bucket, and the remaining token number in the token bucket is updated to following number:It is described pre- If token number and the specified quantity and value, wherein, the token of the specified quantity includes fractional part and integer part.
  8. 8. device according to claim 7, it is characterised in that be more than the capacity of the token bucket in the remaining token number When, the remaining token number in the token bucket is updated to following number:The capacity of the token bucket.
  9. 9. device according to claim 6, it is characterised in that after the packet is by inspection, by the token bucket In remaining token number be updated to following number:The difference of the default token number and the data packet length.
  10. 10. device according to claim 6, it is characterised in that after the data packet length by token bucket is detected, institute Determining module is stated to be additionally operable to when the data packet length is more than the token number in the token bucket, by the data packet discarding.
CN201610397490.2A 2016-06-06 2016-06-06 Method for limiting speed and device CN107465629A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610397490.2A CN107465629A (en) 2016-06-06 2016-06-06 Method for limiting speed and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610397490.2A CN107465629A (en) 2016-06-06 2016-06-06 Method for limiting speed and device
PCT/CN2017/087298 WO2017211265A1 (en) 2016-06-06 2017-06-06 Speed limiting method and apparatus, and storage medium

Publications (1)

Publication Number Publication Date
CN107465629A true CN107465629A (en) 2017-12-12

Family

ID=60545736

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610397490.2A CN107465629A (en) 2016-06-06 2016-06-06 Method for limiting speed and device

Country Status (2)

Country Link
CN (1) CN107465629A (en)
WO (1) WO2017211265A1 (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7447155B2 (en) * 2002-06-17 2008-11-04 Intel Corporation Guaranteed service in a data network
JP4659654B2 (en) * 2006-03-23 2011-03-30 富士通株式会社 Shaper circuit
CN101026561A (en) * 2007-02-09 2007-08-29 中兴通讯股份有限公司 Token bucket fill rate configuration method and device
CN101778043B (en) * 2010-01-19 2012-07-25 华为技术有限公司 Method and device for dividing filling rate interval based on token bucket algorithm

Also Published As

Publication number Publication date
WO2017211265A1 (en) 2017-12-14

Similar Documents

Publication Publication Date Title
US8301823B2 (en) Bus controller arranged between a bus master and a networked communication bus in order to control the transmission route of a packet that flows through the communication bus, and simulation program to design such a bus controller
CN103889032B (en) A kind of terminal and network selecting method
US7061862B2 (en) Inter-network relay system and method
CN103024825B (en) Method and device of distributing network source among multiple applications of terminal
EP1411684B1 (en) Inter-packet gap generator for a network device and corresponding process
CN1333543C (en) Method and apparatus for controlling data in a wireless communication system
JP2020507866A (en) Data processing method and device
JP3386123B2 (en) Method and apparatus for dynamic bandwidth allocation in digital communication sessions
US7007208B1 (en) Systems and methods for data unit modification
JP4142045B2 (en) Dynamic bandwidth allocation circuit, dynamic bandwidth allocation method, dynamic bandwidth allocation program, and recording medium
US10230481B2 (en) Method and apparatus for bearing flexible ethernet service on optical transport network
US9363184B2 (en) Token bucket-based traffic limiting method and apparatus
US8773980B2 (en) Dynamic bandwidth allocating method and device with hardware reduced and bandwidth usability improved
US7684326B2 (en) Methods and structures for improved buffer management and dynamic adaptation of flow control status in high-speed communication networks
US9326051B2 (en) Method for soft bandwidth limiting in dynamic bandwidth allocation
CA1335834C (en) Methods and apparatus for flexibly allocating bandwidth for a point-to-point, serial, bidirectional communication path
US20170026295A1 (en) Method and apparatus for limiting rate by means of token bucket, and computer storage medium
EP2575273A2 (en) Lossless adjustment method of oduflex channel bandwidth and oduflex channel
KR20040071709A (en) Method and system for rate shaping in packet-based computer networks
US20130039182A1 (en) Congestion control in an optical line terminal
EP2222004B1 (en) Dynamic bandwidth allocation circuit, dynamic bandwidth allocation method, dynamic bandwidth allocation program and recording medium
CN102082693B (en) Method and device for monitoring network traffic
US10051351B2 (en) Method and apparatus for transporting deterministic traffic in a gigabit passive optical network
US7330481B2 (en) Highly channelized port polling in a telecommunications switch
US20030037210A1 (en) System for head and tail caching

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