CN103346976B - A kind of bandwidth fairness control method based on layering token bucket - Google Patents

A kind of bandwidth fairness control method based on layering token bucket Download PDF

Info

Publication number
CN103346976B
CN103346976B CN201310288258.1A CN201310288258A CN103346976B CN 103346976 B CN103346976 B CN 103346976B CN 201310288258 A CN201310288258 A CN 201310288258A CN 103346976 B CN103346976 B CN 103346976B
Authority
CN
China
Prior art keywords
packet
buffer queue
value
quota restrictions
bandwidth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310288258.1A
Other languages
Chinese (zh)
Other versions
CN103346976A (en
Inventor
张明波
张建轩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wangshi Technology Co ltd
Original Assignee
SHENZHEN NETCORE INDUSTRIAL Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENZHEN NETCORE INDUSTRIAL Co Ltd filed Critical SHENZHEN NETCORE INDUSTRIAL Co Ltd
Priority to CN201310288258.1A priority Critical patent/CN103346976B/en
Publication of CN103346976A publication Critical patent/CN103346976A/en
Application granted granted Critical
Publication of CN103346976B publication Critical patent/CN103346976B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a kind of bandwidth fairness control method based on layering token bucket and realize system, specifically including that and receive packet by transceiver module;By application type and the IP address of identification module identification packet;Application type according to packet is set up into buffer queue, and packet is stored in correspondence enter buffer queue;Set up out buffer queue according to the IP address that packet is corresponding, and packet is stored in correspondence go out buffer queue;Check that currently going out buffer queue sends whether packet reaches quota restrictions value, if not up to, then directly transmit this packet going out in buffer queue, otherwise, then check that the next one goes out buffer queue and sends whether packet reaches quota restrictions value according to polling mode, and the buffer queue that goes out sending packet not up to quota restrictions value all directly transmits packet;Until all go out buffer queue send packet all reach quota restrictions value after, reset all go out buffer queue quota restrictions value, return (6).

Description

A kind of bandwidth fairness control method based on layering token bucket
Technical field
The present invention relates to a kind of network bandwidth control technology, specifically, relate to a kind of band based on layering token bucket Wide fairness control method.
Background technology
The router traffic management that HTB (Hierarchical Token Bucket) algorithm is the most relatively advanced is calculated Method, it can be effectively improved bandwidth availability ratio and limit the use of the mass download softwares such as P2P: for the Intranet of normal online Main frame, system will allow it accidentally to break through maximum speed limit;Conversely, for the intranet host of the softwares such as Long-Time Service P2P, system will Its bandwidth can be reduced so that it is the impact on other main frames is preferably minimized.
HTB algorithm support flows to row major level according to information such as IP address, agreement, ports and arranges data, then for Different classes of data stream carries out bandwidth control, it is intended that main frame or service are reserved bandwidth, limited high bandwidth, also can realize average Distribution bandwidth, row major level of going forward side by side manages, is particularly suitable for the network of voice and video and data mixing.
But, HTB algorithm, owing to using serial mechanism, although it ensure that the primary bandwidth needs of user, exists Can not the defect of Appropriate application bandwidth effective, maximum.
Summary of the invention
It is an object of the invention to provide a kind of bandwidth fairness control method based on layering token bucket, mainly solve existing The problem that HTB algorithm is not ideal enough to flow-control effect, bandwidth availability ratio is not reasonable.
To achieve these goals, the technical solution used in the present invention is as follows:
A kind of bandwidth fairness control method based on layering token bucket, comprises the following steps:
(1) HTB queue and queue bandwidth are initialized;
(2) packet is received by transceiver module;
(3) by application type and the IP address of identification module identification packet;
(4) set up into buffer queue according to the application type of packet, and packet is stored in correspondence enter buffer queue, Perform (5) afterwards;
(5) set up out buffer queue according to the IP address that packet is corresponding, and packet is stored in correspondence go out buffer queue;
(6) check that currently going out buffer queue sends whether packet reaches quota restrictions value, if not up to, the most directly sent out This is given to go out the packet in buffer queue, otherwise, then check that the next one goes out buffer queue transmission packet and is according to polling mode The no quota restrictions value that reaches, and send packet not up to quota restrictions value the buffer queue that goes out all directly transmit packet;
(7) until all go out buffer queue send packet all reach quota restrictions value after, reset all go out buffer queue Quota restrictions value, return (6).
Further, in described (3), the application type of identification module identification includes webpage, download and video three types.
Yet further, in described (6) each go out buffer queue sending after packet, to the quota going out buffer queue Limits value is updated, and the quota restrictions value before i.e. this sends packet deducts this length sending packet.
Further, described (7) reset all go out buffer queue quota restrictions value, refer to go out to cache team by all The quota restrictions value full recovery of row is the state value not sending any packet.
In order to realize above-mentioned bandwidth fairness control method, the invention provides a kind of bandwidth fairness based on HTB and control system System, including
Initialization module: be used for initializing HTB queue and queue bandwidth;
Transceiver module: carry out packet transmission and receive operation;
Identification module: the application type and the IP address that carry out packet judge;
Control module: create into buffer queue according to the application type of packet, and carry out data bag enqueue operations;According to Host IP address is created that buffer queue, check each IP address corresponding go out buffer queue, carry out data according to fairness mechanism Bag dequeue operation, and update or reset each IP address corresponding go out buffer queue quota restrictions value.
Compared with prior art, the method have the advantages that
(1) present invention achieves the equilibrium use of bandwidth on application type, enters to cache team according to what application type was set up Row, enter out buffer queue according to fairness mechanism, make each application type have the opportunity to use Internet resources, it is to avoid existing HTB algorithm causes the problem that the application type that part priority is low cannot use Internet resources all the time because priority arranges;
(2) equilibrium that the present invention achieves bandwidth at different host aspects uses, slow according to going out of host IP address foundation Deposit queue, use polling mode when sending packet, and carry out dequeue operation according to fairness mechanism, it is ensured that each main frame Fair can use bandwidth, it is to avoid the part main frame that existing HTB algorithm causes cannot surf the Net all the time, cannot obtain or send data Problem;
(3) present invention passes through, enters the setting of buffer queue, and the fairness mechanism that packet sends, and substantially increases The utilization rate of bandwidth, decreases bandwidth waste.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the present invention.
Fig. 2 is the system block diagram of the present invention.
Detailed description of the invention
The invention will be further described with embodiment below in conjunction with the accompanying drawings, and embodiments of the present invention include but not limited to The following example.
As depicted in figs. 1 and 2, bandwidth fairness control method based on HTB, its hardware uses initialization module, transmitting-receiving mould Block, identification module and control module composition.Wherein, initialization module is mainly used in carrying out HTB queue and queue bandwidth initially Changing, transceiver module is mainly used in receiving and sending packet, and identification module is then mainly with to the application type of packet and IP ground Location judges, the subsequent operation for packet lays the first stone, and control module is then for setting up into buffer queue and going out slow Deposit queue, and complete packet enter to go out operation, and complete renewal and the replacement of quota restrictions value.
Below by example, operation principle and the implementation process of the present invention are illustrated.
Embodiment 1
As a example by tri-main frames of A, B, C, its IP address corresponding respectively and the packet application type such as table one related to:
Host name IP address Application type
A 192.168.1.1 Online Video
B 192.168.1.2 A sudden peal of thunder is downloaded
C 192.168.1.3 Game on line
Table one
Assume that bandwidth is limited to 800k byte per second, under existing HTB algorithm, the distribution of each main frame actual bandwidth and effect As shown in Table 2:
Host name Actual bandwidth distributes Effect
A 40k byte per second Online Video cannot normally be watched
B 760k byte per second A sudden peal of thunder downloads complete occupied bandwidth
C 0k byte per second Game on line cannot be properly functioning
Table two
Owing to the priority of HTB algorithm is arranged, game on line cannot obtain any data because priority is low, causes Cannot be properly functioning, although and Online Video priority is higher, it is possible to obtain a part of data, be also because obtain data Less and cannot normally watch.Only news thunder is downloaded and is occupied all bandwidth because priority is the highest, can normally use.
And under the bandwidth fairness control method of the present invention, the utilization process of its network data is as follows:
After HTB queue and queue bandwidth initialize, first transceiver module receives from the packet sending port, false If the packet 1 that synchronization receives, packet 2 and packet 3, after identification module identification, its specifying information such as table Three:
Packet Application type Length Corresponding IP address
Packet 1 Online Video 350k byte 192.168.1.1
Packet 2 News thunder is downloaded 450k byte 192.168.1.2
Packet 3 Game on line 30k byte 192.168.1.3
Table three
Now, first look at and the most enter buffer queue about what Online Video, game on line Homeway.com thunder were downloaded, if No, then set up and enter buffer queue accordingly, enter among buffer queue accordingly, i.e. if it has, then directly packet is stored in Entering among buffer queue what packet 1 was stored in Online Video, what packet 2 was stored in game on line enters among buffer queue, number According to bag 3 be stored in news thunder download enter among buffer queue.
When all packets be all stored in correspondence enter buffer queue after, check in table that three IP addresses are the most existing Going out buffer queue, if it is not, set up out buffer queue, what packet 1 was stored in host A afterwards goes out among buffer queue, What packet 2 was stored in host B goes out among buffer queue, and packet 3 is stored in going out among buffer queue of host C.
Assume host A, the current residual bandwidth share limits value of B, C is respectively 350 bytes, 500 bytes, 300 bytes, this Time host A, B, C be polled operation.Whether first look at the current quota restrictions value of host A more than or equal to packet 1 Length, it is assumed that the current quota restrictions value being not yet transmitted across packet, i.e. host A before host A is still 350 bytes, and counts Length according to bag 1 is also 350 bytes, equal to the current quota restrictions value of host A, therefore allows to send the whole of this packet 1 Data;Afterwards, that checks host B goes out whether buffer queue current quota restrictions value is more than or equal to the length of packet 2, now Having sent data 200 byte before assuming host B, its current quota restrictions value is 500 byte-200 byte=300 bytes, due to A length of 450 bytes of packet 2, more than the current quota restrictions value of host B, do not allow to send this packet 2, can only Send after resetting Deng quota restrictions value next time;After having processed host B, then check that the current quota restrictions of host C are the biggest In or equal to the length of packet 3, it is assumed that being the most not yet transmitted across any data before host C, its current quota restrictions value is still 300 bytes, and the length of packet 3 is also 300 bytes, therefore allows to send the total data of packet 3.So far, a next round Asking end of operation, host A, B, C update current quota restrictions value, owing to now updating the current quota restrictions value of aft engine B are 300 bytes, and the current quota restrictions value of host A and C is 0, the most next time during poll, only send a data package size less than or The data corresponding to host B equal to 300, until the current quota restrictions value of host B is that 0 or B no data bag can send, Be default high quota limits value by the current quota restrictions value reset all of host A, B, C again, next time during poll then with Quota restrictions value after replacement is as the criterion and processes.
After being controlled by above-mentioned bandwidth fairness, host A, the application program ruuning situation such as table four of B, C:
Host name Actual bandwidth distributes Effect
A 350k byte per second Online Video is normally watched
B 420k byte per second A sudden peal of thunder downloads complete occupied bandwidth
C 30k byte per second Game on line is properly functioning
Table four
As can be seen here, after applying bandwidth fairness control method of the present invention, three main frames in net can be just Often use bandwidth resources, it is achieved the normal work of each application program, therefore, bandwidth availability ratio is obviously improved, the present invention Practical value and technology content find full expression, creative apparent.
Embodiment 2
The present embodiment is with the difference of embodiment 1, and in terms of setting, in the present embodiment, packet 1 and packet 2 should Being Online Video by type, other are the most identical, and in this case, the present embodiment is adding bandwidth fairness control method, number As follows according to transmitting procedure:
After identification module identification packet 1, packet 2 and the application type of packet 3 and corresponding IP address, first Check whether to exist Online Video and have online enter buffer queue.Have, then packet 1 and packet 2 are stored in Online Video Enter among buffer queue, packet 3 is stored in entering among buffer queue of game on line;Nothing, then set up and enter caching accordingly After queue, then it is stored in packet to enter accordingly among buffer queue.Application type phase due to packet 1 and packet 2 With, be Online Video, therefore, these two packets be stored in same enter among buffer queue, two need not be divided into enter caching Queue stores.
Hereafter transmission data procedures is same as in Example 1, first checks that three main frames have gone out buffer queue, has, Then being stored in by packet according to IP address corresponding to packet goes out among buffer queue accordingly, nothing, then set up go out accordingly slow After depositing queue, then row storage.Afterwards, check that host A, going out of B, C cache whether the corresponding data volume sent reaches quota Limits value, if the transmission data volume of certain main frame has reached quota restrictions value, then to should the packet of main frame stop sending out Send, only send the packet of other main frames corresponding, during until the transmission data volume of All hosts all reaches quota restrictions value, weight Put the quota restrictions value of All hosts, make the transmission data volume of All hosts reset, will quota restrictions value be all set to Maximum quota restrictions value.Re-start polling operation, the packet not sent before is sent, and send newly received The packet arrived.
Update as the current quota restrictions value going out buffer queue, the statistical being gradually increased can be taked, it is also possible to Take the statistical gradually decreased.The statistical that what is called is gradually increased, is that the initial quota pointing out buffer queue is set to 0, the most often send a secondary data, just plus the length of transmission data on the basis of initial quota, go out caching in this, as this The current quota value of queue, when current quota value reaches the quota restrictions value set, this goes out buffer queue and stops sending data. As: the quota restrictions value going out buffer queue of host A is 300 bytes, when sending for the first time data, host A go out to cache team The initial quota value of row is 0, sends a length of 100 bytes of packet for the first time, and it is 150 bytes that second time sends packet, If third time data packet length to be sent is 100 bytes, and now host A only allows to send the data of 50, therefore, then and third time Packet to be sent does not allow to send, and can only send after quota restrictions value resets.The so-called statistical gradually decreased, The statistical being then and be gradually increased is contrary, and the initial quota value of host A is this quota restrictions value 300 going out buffer queue Byte, often sends a secondary data, just on the basis of initial quota value, deducts the length sending data, when current quota value is 0 Time, this goes out buffer queue and stops sending data.With three transmission data instances in the above-mentioned statistical being gradually increased, it is worked as Front quota restrictions value renewal process is 300 byte-100 byte-150 byte=50 bytes, and last packet surpasses due to size Cross the size allowing to send, can only send when poll next time, and only have when in quota restrictions value, remaining 50 bytes complete number After sending, just carry out quota restrictions value replacement.
Use the present embodiment, equally ensure that different main frame, the program of different application type can use network, protect Demonstrate,prove the normal work of each main frame, each application program.
As for the initialization module related in the present invention, transceiver module, identification module, control module, it is existing skill Art, does not repeats them here.
Above-described embodiment is only a preferred embodiment of the present invention, is not defined protection scope of the present invention. In the present invention, the kind of application type, quantity, the quantity of main frame, quota restrictions value setting going out buffer queue etc., the most permissible Change flexibly, therefore, as long as using the simple transformation done by know-why of the present invention and other non-creativeness to change, Within belonging to protection scope of the present invention.

Claims (4)

1. a bandwidth fairness control method based on layering token bucket, it is characterised in that, comprise the following steps:
(1) HTB queue and queue bandwidth are initialized;
(2) packet is received by transceiver module;
(3) by application type and the IP address of identification module identification packet;
(4) set up into buffer queue according to the application type of packet, and packet is stored in correspondence enter buffer queue, it Rear execution (5);
(5) set up out buffer queue according to the IP address that packet is corresponding, and packet is stored in correspondence go out buffer queue;
(6) check that currently going out buffer queue sends whether packet reaches quota restrictions value, if not up to, then directly transmitting this Go out the packet in buffer queue, otherwise, then check that the next one goes out buffer queue and sends whether packet reaches according to polling mode To quota restrictions value, and the buffer queue that goes out sending packet not up to quota restrictions value all directly transmits packet;
(7) until all go out after the packet that sends of buffer queue all reaches quota restrictions value, reset all go out the joining of buffer queue Volume limits value, returns (6).
A kind of bandwidth fairness control method based on layering token bucket the most according to claim 1, it is characterised in that, described (3) in, the application type of identification module identification includes webpage, download and video three types.
A kind of bandwidth fairness control method based on layering token bucket the most according to claim 1, it is characterised in that, described (6) in each go out buffer queue sending after packet, the quota restrictions value going out buffer queue is updated, i.e. this Quota restrictions value before sending packet deducts this length sending packet.
A kind of bandwidth fairness control method based on layering token bucket the most according to claim 1, it is characterised in that, described (7) in reset all go out buffer queue quota restrictions value, refer to by all go out buffer queue quota restrictions value full recovery For not sending the state value of any packet.
CN201310288258.1A 2013-07-10 2013-07-10 A kind of bandwidth fairness control method based on layering token bucket Active CN103346976B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310288258.1A CN103346976B (en) 2013-07-10 2013-07-10 A kind of bandwidth fairness control method based on layering token bucket

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310288258.1A CN103346976B (en) 2013-07-10 2013-07-10 A kind of bandwidth fairness control method based on layering token bucket

Publications (2)

Publication Number Publication Date
CN103346976A CN103346976A (en) 2013-10-09
CN103346976B true CN103346976B (en) 2016-08-17

Family

ID=49281751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310288258.1A Active CN103346976B (en) 2013-07-10 2013-07-10 A kind of bandwidth fairness control method based on layering token bucket

Country Status (1)

Country Link
CN (1) CN103346976B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103618681B (en) * 2013-11-15 2017-04-12 深圳市磊科实业有限公司 Elastic network bandwidth control method and system thereof
CN107682282B (en) * 2017-09-15 2021-04-06 北京外通电子技术公司 Service quality method and network equipment for guaranteeing service bandwidth

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645860A (en) * 2005-01-20 2005-07-27 中国科学院计算技术研究所 Terminal up dispatching method for voice service in wide band wireless cut-in network
CN101616096A (en) * 2009-07-31 2009-12-30 中兴通讯股份有限公司 Array dispatching method and device
CN101964758A (en) * 2010-11-05 2011-02-02 南京邮电大学 Differentiated service-based queue scheduling method
CN102025623A (en) * 2010-12-07 2011-04-20 苏州迈科网络安全技术股份有限公司 Intelligent network flow control method
CN102624625A (en) * 2012-03-13 2012-08-01 网经科技(苏州)有限公司 QoS (Quality of Service) fair scheduling method for large amount of users
CN102638400A (en) * 2012-03-23 2012-08-15 青岛百灵信息科技有限公司 Flow control queuing method of expanding token bucket filter
CN103036803A (en) * 2012-12-21 2013-04-10 南京邮电大学 Flow control method based on application layer detection

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645860A (en) * 2005-01-20 2005-07-27 中国科学院计算技术研究所 Terminal up dispatching method for voice service in wide band wireless cut-in network
CN101616096A (en) * 2009-07-31 2009-12-30 中兴通讯股份有限公司 Array dispatching method and device
CN101964758A (en) * 2010-11-05 2011-02-02 南京邮电大学 Differentiated service-based queue scheduling method
CN102025623A (en) * 2010-12-07 2011-04-20 苏州迈科网络安全技术股份有限公司 Intelligent network flow control method
CN102624625A (en) * 2012-03-13 2012-08-01 网经科技(苏州)有限公司 QoS (Quality of Service) fair scheduling method for large amount of users
CN102638400A (en) * 2012-03-23 2012-08-15 青岛百灵信息科技有限公司 Flow control queuing method of expanding token bucket filter
CN103036803A (en) * 2012-12-21 2013-04-10 南京邮电大学 Flow control method based on application layer detection

Also Published As

Publication number Publication date
CN103346976A (en) 2013-10-09

Similar Documents

Publication Publication Date Title
EP2256640B1 (en) Managing traffic on virtualized lanes between a network switch and a virtual machine
US7855960B2 (en) Traffic shaping method and device
CN103176780B (en) A kind of multi-network interface binding system and method
CN108848038B (en) Token bucket-based traffic management method and token bucket node
US20120207156A1 (en) Method and system for routing network traffic for a blade server
CN102014067A (en) Message fragment sending method, device and network equipment
Siemon Queueing in the Linux network stack
CN101282305A (en) Bandwidth control method for distributed system as well as service plate
WO2015038949A1 (en) High payload data packet transmission system and relay to lower latency
CN103634235A (en) Method for limiting speed of network interface of virtual machine
WO2015038902A1 (en) Packet sharing data transmission system and relay to lower latency
CN101702121A (en) Device for controlling network flow of program in Windows system
CN102594876A (en) Method and system for accelerating speed of mixing game real-time data and updated data
CN101272338B (en) Method for port band width configuration on non-line speed interface plate and non-line speed interface plate
US20200120017A1 (en) Data distribution method, data aggregation method, and related apparatuses
US20130003748A1 (en) Relay apparatus and relay control method
CN102946361A (en) Method and system of flow control based on exchanger cache allocation
CN111585896A (en) Data forwarding method and device and readable storage medium
CN101917646B (en) Message transmitting method and device
CN107135164A (en) Jamming control method and device
CN103346976B (en) A kind of bandwidth fairness control method based on layering token bucket
CN111416775B (en) Data receiving and transmitting method, device and system
CN102497430B (en) System and method for implementing splitting equipment
CN103905327B (en) Stream state information based content-centric network congestion control method and system thereof
CN109995608B (en) Network rate calculation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240207

Address after: 337099 First Floor, Building 6, Tongjiu Road, Pingxiang Economic and Technological Development Zone, Pingxiang City, Jiangxi Province

Patentee after: Wangshi Technology Co.,Ltd.

Country or region after: China

Address before: 518000, No. 902, 9th Floor, Building B, Tsinghua Information Port, High tech Zone, Nanshan District, Shenzhen, Guangdong Province

Patentee before: Shenzhen Leike Industrial Co.,Ltd.

Country or region before: China