CN115022245A - Data transmission method, related device, equipment and storage medium - Google Patents

Data transmission method, related device, equipment and storage medium Download PDF

Info

Publication number
CN115022245A
CN115022245A CN202110246463.6A CN202110246463A CN115022245A CN 115022245 A CN115022245 A CN 115022245A CN 202110246463 A CN202110246463 A CN 202110246463A CN 115022245 A CN115022245 A CN 115022245A
Authority
CN
China
Prior art keywords
token
tokens
common
control group
priority
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
Application number
CN202110246463.6A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110246463.6A priority Critical patent/CN115022245A/en
Publication of CN115022245A publication Critical patent/CN115022245A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2425Traffic characterised by specific attributes, e.g. priority or QoS for supporting services specification, e.g. SLA
    • H04L47/2433Allocation of priorities to traffic types

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a data transmission method based on container technology. The method comprises the following steps: obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority; obtaining the available number of the public tokens in a public token bucket, wherein the public token bucket is used for storing the public tokens called by the control group, and the public token bucket corresponds to a first priority; if the available quantity of the common tokens is less than the token demand quantity of the first control group, acquiring a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority, and the second priority is less than the first priority; data transmission is performed based on the first set of tokens. The embodiment of the application also provides a device, equipment and a medium. In the method and the device, the high-priority service has higher token calling authority, and tokens can be called from a public token bucket and other low-priority token buckets, so that the high-priority service has lower transmission delay and reduces packet loss.

Description

Data transmission method, related device, equipment and storage medium
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a data transmission method, a related apparatus, a device, and a storage medium.
Background
A control group (cgroup) is a function of the Linux kernel, and is used for limiting, controlling and separating resources of a process group, for example, limiting the number of resources that can be used by the process group, controlling the priority of the process group, recording the number of resources used by the process group, isolating the process group, and controlling the process group. The Linux kernel is mainly set for controlling the speed of the network Traffic through a Traffic Control (TC) tool.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating a current limiting implemented based on queuing rules in a conventional scheme, as shown in the figure, during a data transmission process, a data packet in a container is forwarded to a host through a virtual network interface (virtual ethernet, veth) from the network interface (ethernet, eth). During data reception, an intermediate functional block (ifb) device forwards packets to the eth of the container via the bridge.
In the data transmission process shown in fig. 1, no matter in the data transmission process or the data reception process, a queuing rule (qdisc) needs to be adopted to queue a data packet. However, implementing traffic limitation based on the queue may result in a large transmission delay of the data packet, thereby causing extra packet loss.
Disclosure of Invention
The embodiment of the application provides a data transmission method, a related device, equipment and a storage medium, wherein a high-priority service has a higher token calling authority, and tokens can be called from a public token bucket and other low-priority token buckets, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced.
In view of the above, an aspect of the present application provides a method for data transmission, including:
obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
obtaining an available number of common tokens in a common token bucket, wherein the common token bucket is used for storing the common tokens called by the control group, and the common token bucket corresponds to a first priority;
if the available quantity of the common tokens is less than the token demand quantity of the first control group, acquiring a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set comprises at least one first token;
data transmission is performed based on the first set of tokens.
Another aspect of the present application provides a data transmission apparatus, including:
the system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring the token demand of a first control group, and the first control group corresponds to a first priority;
the obtaining module is further used for obtaining the available number of the public tokens in a public token bucket, wherein the public token bucket is used for storing the public tokens called by the control group, and the public token bucket corresponds to the first priority;
the obtaining module is further configured to obtain a first token set from a first token bucket if the available number of the common tokens is smaller than a token requirement of the first control group, where the first token bucket corresponds to a second priority, the second priority is smaller than the first priority, and the first token set includes at least one first token;
and the transmission module is used for carrying out data transmission based on the first token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the acquisition module is specifically used for acquiring a preset bandwidth and target bandwidths with N priorities, wherein the target bandwidths with the N priorities comprise a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
determining the available number of the public tokens according to the number of the existing tokens in the public token bucket, the depth of the token bucket, the generation rate of the public tokens, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
or the like, or a combination thereof,
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is specifically used for acquiring a preset bandwidth and target bandwidths with N priorities, the target bandwidths with the N priorities comprise a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
and determining the available number of the common tokens according to the number of the existing tokens in the common token bucket, the generation rate of the common tokens, a time difference value and the length of the data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is further used for obtaining a common token set from the common token bucket if the available number of the common tokens is larger than or equal to the token requirement amount of the first control group, wherein the common token set comprises at least one common token;
and the transmission module is also used for carrying out data transmission based on the common token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is specifically configured to obtain the available number of the first tokens in the first token bucket if the available number of the common tokens is smaller than the token demand of the first control group and the available number of the common tokens is smaller than or equal to the available number threshold corresponding to the common token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, obtaining a first set of tokens from a first token bucket.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is specifically configured to obtain the available number of the first tokens in the first token bucket if the available number of the common tokens is smaller than the token demand of the first control group and the available number of the common tokens is greater than or equal to the available number threshold corresponding to the common token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, obtaining a first set of tokens from a first token bucket.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is specifically configured to obtain a common token set from the common token bucket if the available number of the common tokens is smaller than a token requirement amount of the first control group and the available number of the common tokens is greater than or equal to an available number threshold corresponding to the common token bucket, where the common token set includes at least one common token;
obtaining an available number of first tokens in a first token bucket;
obtaining a first token set from a first token bucket according to the available number of the common tokens and the available number of first tokens in the first token bucket;
and the transmission module is specifically used for carrying out data transmission based on the first token set and the common token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is further configured to obtain an available number of second tokens in a second token bucket if the available number of first tokens is smaller than a token requirement amount of the first control group after obtaining the available number of first tokens in the first token bucket, where the second token bucket corresponds to a third priority, the third priority is smaller than the first priority, and the third priority is greater than the second priority;
the obtaining module is further configured to obtain a second token set from the second token bucket if the available number of the second tokens is greater than or equal to the token requirement amount of the first control group, where the second token set includes at least one second token;
and the transmission module is also used for carrying out data transmission based on the second token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the acquisition module is further used for acquiring the token demand of a second control group, wherein the second control group corresponds to a second priority;
the obtaining module is further used for obtaining the available number of the first tokens in the first token bucket;
the obtaining module is further configured to obtain a third token set from the first token bucket if the available number of the first tokens is smaller than the token requirement amount of the second control group, where the third token set includes at least one third token;
and the transmission module is further used for carrying out data transmission based on the third token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the obtaining module is further configured to obtain a fourth token set from the first token bucket if the available number of the first tokens is greater than or equal to the token demand of the second control group after obtaining the available number of the first tokens in the first token bucket, where the fourth token set includes at least one first token;
and the transmission module is also used for carrying out data transmission based on the fourth token set.
In one possible design, in another implementation of another aspect of an embodiment of the present application,
the acquisition module is also used for acquiring the target bandwidth of the second priority;
the determining module is further configured to determine the available number of the first tokens according to the number of existing tokens in the first token bucket, the target bandwidth of the second priority, a time difference value and the length of the data packet, where the time difference value represents a difference value between a previous token updating time and a current time;
the determining module is further used for determining the token excess utilization rate according to the available number of the first tokens and the bucket depth of the first tokens if the available number of the first tokens is less than zero;
the determining module is further configured to determine that the token excess usage rate is zero if the available number of the first tokens is equal to zero.
In one possible design, in another implementation manner of another aspect of the embodiment of the present application, the data transmission apparatus further includes an establishing module;
the establishing module is used for establishing a Transmission Control Protocol (TCP) connection;
the acquisition module is also used for acquiring a maximum flow receiving cache value aiming at the TCP connection;
the determining module is further used for determining the size of a second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess utilization rate;
and the determining module is further used for determining the size of the target receiving window according to the size of the second receiving window and the TCP maximum transmission unit.
In one possible design, in another implementation manner of another aspect of the embodiment of the present application, the data transmission apparatus further includes an establishing module;
the establishing module is used for establishing a Transmission Control Protocol (TCP) connection;
the acquisition module is also used for acquiring a maximum flow sending cache value aiming at the TCP connection;
the determining module is further used for determining the size of a second congestion window according to the maximum flow sending cache value, the size of the first congestion window, the token excess utilization rate and the TCP maximum transmission unit;
and the determining module is further used for determining the size of the target congestion window according to the size of the second congestion window and the preset segment number.
Another aspect of the present application provides a network device, including: a memory, a processor, and a bus system;
wherein, the memory is used for storing programs;
the processor is used for executing the program in the memory, and the processor is used for executing the method provided by the aspects according to the instructions in the program code;
the bus system is used for connecting the memory and the processor so as to enable the memory and the processor to communicate.
Another aspect of the present application provides a computer-readable storage medium having stored therein instructions, which when executed on a computer, cause the computer to perform the method of the above-described aspects.
In another aspect of the application, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the network device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the network device to perform the method provided by the above aspects.
According to the technical scheme, the embodiment of the application has the following advantages:
in an embodiment of the present application, a method for data transmission is provided, where token demand of a first control group is first obtained, where the first control group corresponds to a first priority, if an actual bandwidth of the first control group is greater than a target bandwidth of the first control group, an available number of common tokens in a common token bucket is obtained, the common token bucket is used to store common tokens called by the control group, and the common token bucket corresponds to the first priority, and if the available number of common tokens is less than the token demand of the first control group, a first token set may be obtained from the first token bucket, where the first token bucket corresponds to a second priority, and the second priority is less than the first priority, and the first token set includes at least one first token, and finally the first token set is used to perform data transmission. In this way, a system ideal network load bandwidth (i.e., a target bandwidth) is manually set, and whether more bandwidth can be used is determined based on the priority of the control group. That is, when the total bandwidth of the high priority and the low priority is higher than the ideal load bandwidth, the high priority may preempt the low priority bandwidth, but still guarantee the minimum available bandwidth of the low priority. In the data transmission process, for a high-priority service, whether data transmission can be supported or not can be determined according to the available number of common tokens, if the available number of the common tokens cannot completely support the data transmission based on the high-priority service, the tokens can be called from a token bucket with a low priority, and then the data transmission is carried out, so that the high-priority service has a higher token calling authority, and the tokens can be called from the common token bucket and other token buckets with low priorities, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced.
Drawings
Fig. 1 is a schematic diagram of implementing current limiting based on queuing rules in a conventional scheme;
FIG. 2 is a block diagram of a data transmission system according to an embodiment of the present application;
fig. 3 is a schematic diagram of an embodiment of a data transmission method in the embodiment of the present application;
FIG. 4 is a schematic diagram of an operation of a token bucket in an embodiment of the present application;
FIG. 5 is a schematic diagram of data processing based on a common token bucket and a first token bucket in an embodiment of the present application;
FIG. 6 is a schematic diagram of data processing based on token bucket in the embodiment of the present application;
FIG. 7 is a diagram illustrating the retrieval of a full token from a first token bucket in an embodiment of the present application;
FIG. 8 is another illustration of a call for a full token from the first token bucket in an embodiment of the present application;
FIG. 9 is a schematic diagram of a portion of tokens being called from a first token bucket in an embodiment of the present application;
FIG. 10 is a diagram illustrating the retrieval of a full token from a second token bucket in an embodiment of the present application;
FIG. 11 is a schematic diagram of a portion of tokens being called from a second token bucket in an embodiment of the present application;
FIG. 12 is a schematic diagram of the retrieval of tokens from a common token bucket in an embodiment of the present application;
FIG. 13 is a block diagram of a data transmission framework in an embodiment of the present application;
FIG. 14 is a flow chart illustrating the reception of a data packet according to an embodiment of the present application;
FIG. 15 is a schematic flow chart of sending a data packet in the embodiment of the present application;
fig. 16 is a schematic diagram of an embodiment of a data transmission device in the embodiment of the present application;
fig. 17 is a schematic structural diagram of a network device in this embodiment.
Detailed Description
The embodiment of the application provides a data transmission method, a related device, equipment and a storage medium, wherein a high-priority service has a higher token calling authority, and tokens can be called from a public token bucket and other low-priority token buckets, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "corresponding" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The container technology is a core technology of cloud computing (cloud computing), the container technology can be used for not only realizing resource isolation and limitation between applications, but also unifying application runtime environments, and preventing the situation that the applications cannot normally run due to inconsistent environments. The Cloud computing technology belongs to a Cloud technology, wherein the Cloud technology refers to a hosting technology for unifying series resources such as hardware, software, networks and the like in a wide area network or a local area network to realize computing, storing, processing and sharing of data. The cloud technology is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied in the cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
Cloud computing refers to a delivery and use mode of Internet Technology (IT) infrastructure, and refers to obtaining required resources in an on-demand and easily extensible manner through a network; the generalized cloud computing refers to a delivery and use mode of a service, and refers to obtaining a required service in an on-demand and easily-extensible manner through a network. Such services may be IT and software, internet related, or other services. The cloud Computing is a product of development and fusion of traditional computers and Network Technologies, such as Grid Computing (Grid Computing), Distributed Computing (Distributed Computing), Parallel Computing (Parallel Computing), Utility Computing (Utility Computing), Network Storage (Network Storage Technologies), Virtualization (Virtualization), Load balancing (Load Balance), and the like. With the development of diversification of internet, real-time data stream, and connection devices, and the promotion of demands for search services, social networks, mobile commerce, open collaboration, and the like, cloud computing has been rapidly developed. Different from the prior parallel distributed computing, the generation of cloud computing can promote the revolutionary change of the whole internet mode and the enterprise management mode in concept.
Generally, a container includes four parts, which are a control group (cgroups), a namespace (namespace), a root file (rootfs), and a container engine. The control group is used for resource control, namespace is used for access isolation, rootfs is used for file system isolation, and the container engine is used for controlling the life cycle. The control group can limit the resources isolated by namespace, and can set weight, calculate usage amount, control start and stop of tasks (processes or threads) and the like for the resources. The principle is that a group of processes is placed in a control group, and the control group is allocated with specified available resources, so that the purpose of controlling the available resources of the group of processes is achieved.
At present, introduction of a container technology into a Network Function Virtualization (NFV) system has been proposed and considered for service deployment in a container technology development rapid NFV system. A Virtual Network Function (VNF) can be deployed in a container, and the container may be deployed in a physical machine or a Virtual machine. Based on this, the present application provides a data transmission method implemented based on a container technology, and for easy understanding, please refer to fig. 2, where fig. 2 is a schematic diagram of an architecture of a data transmission system in an embodiment of the present application, as shown in the figure, a container 1 is a high-priority container, so that the container 1 can take out tokens from a high-priority token bucket, and a container 2 belongs to a low-priority container, and for the container 2, if there are tokens in the high-priority token bucket, the container 2 can preferentially take out the tokens from the high-priority token bucket, and if there are not enough tokens in the high-priority token bucket, the container 2 will take out the tokens from a corresponding low-priority token bucket.
However, assuming that container 1 needs more tokens, the current high priority token bucket may not provide enough tokens, and the high priority token bucket may preempt tokens from the low priority token bucket, preferably ensuring that the data packets in container 1 can be transmitted normally. At this time, for the container 2 with lower priority, the tokens in the token bucket with high priority cannot be used continuously, so only a certain number of tokens can be taken out from the token bucket with low priority, so as to ensure that the control group in the container 2 has the lowest guaranteed bandwidth. It is understood that containers of the same priority share one token bucket, and one container corresponds to at least one control group, so for a control group, the priority is the priority of the corresponding container, and the control group of the same priority uses the same token bucket.
It should be noted that, as can be seen from the foregoing, the container may be deployed in a physical machine, and the physical machine may be a server or a terminal device. The server related to the application can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and can also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, safety service, Content Delivery Network (CDN), big data and an artificial intelligence platform. The terminal device may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a palm computer, a personal computer, a smart television, a smart watch, and the like.
With reference to fig. 3, an embodiment of the data transmission method in the embodiment of the present application includes:
101. obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
in this embodiment, the data transmission apparatus includes a token requirement amount of a first control group, where the token requirement amount of the first control group has an association relationship with a packet length of the first control group, and in a normal case, one token is used for transmitting 1 bit (bit) of data. The first control group corresponds to a first priority, which is described as the highest priority in this application, however, it should be emphasized that the first priority in this application may also refer to a non-lowest priority.
It should be noted that the data transmission apparatus may be disposed in a processor, and the processor is disposed in a network device, where the network device may be a server or a terminal device, and is not limited herein.
102. Obtaining the available number of the public tokens in a public token bucket according to the token demand of the first control group, wherein the public token bucket is used for storing the public tokens called by the control group and corresponds to a first priority;
in this embodiment, the data transmission device may obtain the available number of the common tokens in the common token bucket at the current time, and if the available number of the common tokens at the current time is greater than the available number of the common tokens at the previous time, it indicates that the common tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. Conversely, if the available number of common tokens at the current time is less than the available number of common tokens at the last time, it indicates that the common tokens are being consumed, i.e. the actual bandwidth is greater than the target bandwidth, i.e. the first control group needs to use more tokens to transmit data, and step 103 can be performed.
It should be noted that, a difference between the current time and the previous time may be 1 second, or other times, which is not limited herein.
Specifically, referring to fig. 4, fig. 4 is a schematic diagram of an operating principle of a Token Bucket in an embodiment of the present application, where the Token Bucket (Token-Bucket) shown in fig. 4 may be a public Token Bucket or Token buckets corresponding to other priorities, and a Token may be a public Token in the public Token Bucket or a Token in a non-public Token Bucket, which is not limited herein. The token bucket is used to implement flow control and to evaluate whether the flow rate exceeds a specified value. A token bucket is a container that holds tokens, which are dummy packets that fill the token bucket at a given rate. For the token bucket, the depth (i.e. capacity) of the token bucket needs to be preset, and the system places tokens into the token bucket at a set rate. When the tokens in the token bucket are full, excess tokens will overflow.
103. If the available quantity of the common tokens is less than the token requirement quantity of the first control group, acquiring a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set comprises at least one first token;
in this embodiment, the data transmission apparatus determines a token requirement amount of the first control group, where the token requirement amount represents a number of tokens required by the first control group to transmit data in a current unit time. If the available number of common tokens is less than the token requirement of the first control group, it indicates that the number of common tokens in the common token bucket is not enough to support data transmission of the first control group, and at this time, a first token set is obtained from the first token bucket, and the first token set comprises at least one first token. It is noted that the first token bucket corresponds to a second priority, and the second priority is lower than the first priority.
Specifically, for convenience of introduction, please refer to fig. 5, where fig. 5 is a schematic diagram illustrating data processing implemented based on a common token bucket and a first token bucket in the embodiment of the present application, and as shown in the figure, assuming that there are no common tokens in the common token bucket, the common token bucket may preempt tokens in the first token bucket, that is, the first token bucket borrows tokens to the common token bucket. Thereby, the first control group is enabled to acquire the first set of tokens from the first token bucket.
104. Data transmission is performed based on the first set of tokens.
In this embodiment, the data transmission apparatus uses the first token set to implement data transmission.
Specifically, for convenience of understanding, please refer to fig. 6, fig. 6 is a schematic diagram illustrating data processing implemented based on a token bucket in the embodiment of the present application, where the token bucket shown in fig. 6 may be a first token bucket, or may be a common token bucket, or a token bucket corresponding to another priority, and a token may be a token in a non-common token bucket, or may be a common token in a common token bucket, which is not limited here. When a data stream arrives at a network device, the number of tokens corresponding to the data size is first taken out of the token bucket according to the data size for transmitting the data. Data transmission needs to be guaranteed with enough tokens, and if the number of tokens is not enough, the data is discarded or buffered.
It should be noted that the token poking algorithm is to add a token to a token poking every second, and in general, each token is 1 bit, and data is forwarded after a token in the token poking is taken out, and if no token is taken out, the data is not forwarded by the network device. For the first control group, the common tokens may be taken out of the common token bucket with priority, and if the common tokens in the common token bucket are exhausted, the first control group may take out the tokens from the lower priority first token bucket for data transmission. It is noted, however, that if the first token in the first token bucket is already negative (i.e., less than 0), then the first control group can no longer use the first token, but for the second control group, the first token can continue to be used even though the first token in the first token bucket is already negative. The second control group corresponds to a second priority, that is, the second control group is consistent with the priority of the first token bucket.
In the embodiment of the application, a data transmission method is provided. In this way, a system ideal network load bandwidth (i.e., a target bandwidth) is manually set, and whether more bandwidth can be used is determined based on the priority of the control group. That is, when the total bandwidth of the high priority and the low priority is higher than the ideal load bandwidth, the high priority may preempt the low priority bandwidth, but still guarantee the minimum available bandwidth of the low priority. In the data transmission process, for a high-priority service, whether data transmission can be supported or not can be determined according to the available number of common tokens, if the available number of the common tokens cannot completely support the data transmission based on the high-priority service, the tokens can be called from a token bucket with a low priority, and then the data transmission is carried out, so that the high-priority service has a higher token calling authority, and the tokens can be called from the common token bucket and other token buckets with low priorities, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced.
Optionally, on the basis of each embodiment corresponding to fig. 3, in another optional embodiment provided in the embodiment of the present application, the obtaining of the available number of common tokens in the common token bucket specifically may include:
acquiring a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities comprise a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
determining the available number of the public tokens according to the number of the existing tokens in the public token bucket, the depth of the token bucket, the generation rate of the public tokens, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
or, acquiring the available number of the common tokens in the common token bucket may specifically include:
acquiring a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities comprise a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
and determining the available number of the common tokens according to the number of the existing tokens in the common token bucket, the generation rate of the common tokens, a time difference value and the length of the data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time.
In this embodiment, a manner of obtaining the available number of tokens in the common token bucket is introduced. The data transmission device obtains a preset bandwidth which is set manually and a target bandwidth which corresponds to N priorities. Based on this, how to calculate the available number of common tokens will be described below in conjunction with a correlation formula.
Specifically, the data transmission apparatus acquires a preset bandwidth and target bandwidths of N priorities, and assuming that N is equal to 2, calculates a generation rate of the common token using the following formula:
BW_public=BW_ideal-BW_level_1-BW_level_2;
wherein, BW _ public represents the generation rate of the public token, BW _ ideal represents a preset bandwidth, BW _ level _1 represents a target bandwidth corresponding to the first priority, and BW _ level _2 represents a target bandwidth of the second priority. It should be noted that, if there are more priorities, the target bandwidth corresponding to other priorities may be subtracted from the preset bandwidth.
Based on this, after obtaining the generation rate of the common tokens, the following formula can be adopted to calculate the filling quantity of the common tokens:
TOKEN_public_fill=BW_public×△t;
wherein TOKEN _ public _ file represents the filling amount of the common TOKEN, BW _ public represents the generation rate of the common TOKEN, and Δ t represents the time difference (i.e. the difference between the previous TOKEN updating time and the current time).
Meanwhile, the common token can also be continuously consumed, and the consumption amount of the common token can be calculated by adopting the following formula:
TOKEN_public_consume=TOKEN_Existing-skb->len;
wherein, TOKEN _ public _ condition represents the consumption number of the public TOKEN, TOKEN _ Existing represents the Existing TOKEN number of the public TOKEN bucket at the current time, and skb- > len represents the length of the data packet.
And calculating the available number of the common tokens by combining the filling number of the common tokens and the consumption number of the common tokens in the following way:
TOKEN_public_surplus=BW_public×△t+TOKEN_Existing-skb->len
=TOKEN_public_fill+TOKEN_Existing-skb->len;
wherein TOKEN _ public _ suprplus represents the available number of common TOKENs, TOKEN _ Existing represents the number of TOKENs in the common TOKEN bucket, BW _ public represents the generation rate of the common TOKENs, Δ t represents the time difference, and skb- > len represents the length of the data packet.
In one example, a common token bucket is agreed not to over-use common tokens of the token bucket depth.
In another example, the common token bucket is agreed to be capable of overusing the common tokens in the token bucket depth, and based on this, the maximum number of the common tokens capable of being overused can be determined according to the preset proportion corresponding to the token bucket depth. For example, assuming that the token bucket depth of the common token bucket is 1000, and the preset proportion corresponding to the token bucket depth of the common token bucket is 100%, the number of common tokens that can be used in excess is 1000 at most, and at this time, if the available number of common tokens is-100, the number of common tokens that still need to be used is 100. For example, assuming that the token bucket depth of the common token bucket is 1000, and the preset proportion of the token bucket depth of the common token bucket is 80%, the number of common tokens that can be used in excess is at most 800, and at this time, if the available number of common tokens is-500, the number of common tokens that still need to be used is 500.
It should be noted that, in practical applications, the preset bandwidth may be set to 1 Gigabyte (GB)/second (second, s), and may also be set to other values according to circumstances, which is only an illustration here and should not be construed as a limitation to the present application. Further, the time difference may be a fixed value, for example, one time difference is 1 second. Alternatively, the time difference may be determined according to actual update conditions and is not a fixed value. And thus is not limited thereto.
Secondly, in the embodiment of the application, a mode for acquiring the available number of tokens in the public token bucket is provided, through the mode, the generation rate of the public tokens in the public token bucket is limited, and the available number of the public tokens at the current moment can be calculated by combining the number of the existing tokens, a time difference value and the length of a data packet based on the generation rate of the public tokens, so that a real-time calculation result is obtained, and the method is helpful for more accurately estimating whether the tokens need to be acquired from the token buckets with other priorities, thereby improving the feasibility and operability of the scheme.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, another optional embodiment provided in the embodiments of the present application may further include:
if the available number of the common tokens is larger than or equal to the token demand of the first control group, acquiring a common token set from a common token bucket, wherein the common token set comprises at least one common token;
data transmission is based on a common set of tokens.
In this embodiment, a manner of directly using a common token to realize data transmission is introduced. The data transmission device comprises a token requirement amount of a first control group, wherein the token requirement amount of the first control group has an association relation with the data packet length of the first control group, and one token is used for transmitting 1-bit data in a normal condition. If the available number of common tokens is greater than or equal to the token requirement of the first control group, it indicates that the common tokens in the common token bucket are sufficient to support data transmission by the first control group, and the data transmission device then obtains the common token set for data transmission directly from the common token bucket.
Specifically, the data transmission device determines whether the available number of the common tokens is greater than or equal to the token demand of the first control group, and if the available number of the common tokens is greater than or equal to the token demand of the first control group, the data transmission device directly obtains the common token set from the common token bucket and then performs data transmission based on the common token set. Conversely, if the available number of common tokens is less than the token demand of the first control group, the common token bucket needs to preempt more tokens from other low priority token buckets (e.g., the first token bucket or the second token bucket) in order for the high priority first control group to use the set of tokens for data transmission.
Secondly, in the embodiment of the present application, a manner of directly utilizing a common token to realize data transmission is provided, and through the manner, if the available number of the common token is greater than or equal to the token demand of the first control group, the common token is preferentially obtained from the common token bucket, so that the control group with higher priority can preempt more tokens to perform data transmission, and thus, a high-priority service has higher token invoking authority, and tokens can be invoked from the common token bucket and other token buckets with lower priority, so that the high-priority service has lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced.
Optionally, on the basis of each embodiment corresponding to fig. 3, in another optional embodiment provided in this application embodiment, if the available number of common tokens is smaller than the token requirement of the first control group, obtaining the first token set from the first token bucket may specifically include:
if the available quantity of the common tokens is smaller than the token demand of the first control group and the available quantity of the common tokens is smaller than or equal to the available quantity threshold corresponding to the common token bucket, acquiring the available quantity of the first tokens in the first token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, a first token set is obtained from the first token bucket.
In this embodiment, a processing method based on no available public token in a public token bucket is introduced. The data transmission device comprises a token requirement amount of a first control group, wherein the token requirement amount of the first control group has an association relation with the data packet length of the first control group, and one token is used for transmitting 1-bit data in a normal condition. If the available number of common tokens is less than the token requirement of the first control group and the available number of common tokens is less than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common tokens in the common token bucket are insufficient to support data transmission for the first control group, and then the data transmission device obtains a set of tokens for data transmission from the other token buckets.
Based on this, the data transmission device determines whether the available number of the common tokens is less than the token requirement amount of the first control group, and determines whether the available number of the common tokens is less than an available number threshold corresponding to the common token bucket. If the available number of common tokens is less than the token demand of the first control group and the available number of common tokens is less than or equal to the available number threshold corresponding to the common token bucket, it is determined that the common token bucket has failed to provide common tokens to the first control group. The common token bucket then needs to preempt more tokens from other low priority token buckets (e.g., the first token bucket) in order for the high priority first control group to use the first set of tokens for data transmission.
If the available number of the common tokens is less than the token requirement of the first control group, but the available number of the common tokens is greater than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common token bucket cannot provide all the tokens for the first control group, but has a certain number of available tokens, and thus, can provide part of the common tokens for the first control group.
Specifically, for ease of understanding, referring to fig. 7, fig. 7 is a schematic diagram of invoking a full amount of tokens from a first token bucket in the embodiment of the present application, and as shown in the figure, it is assumed that an available amount threshold corresponding to a common token bucket is 0, a token requirement amount of a first control group is 100, and an available amount of a common token is 0, then the available amount of the common token (i.e., 0) is smaller than the token requirement amount of the first control group (i.e., 100), and the available amount of the common token (i.e., 0) is equal to the available amount threshold corresponding to the common token bucket (i.e., 0), so that the common token bucket may preempt the first token in the first token bucket. That is, if the available number of first tokens in the first token bucket is greater than or equal to the token demand of the first control group, the common token bucket needs to preempt more tokens from other low priority token buckets (e.g., the first token bucket) for the high priority first control group to use the first set of tokens for data transmission.
It will be appreciated that, based on the transmission scenario illustrated in fig. 7, the tokens used by the first control group are all derived from the first token bucket, and thus the first control group uses the first set of tokens for data transmission. For example, the token requirement for the first control group is 100, then the first set of tokens used comprises 100 first tokens.
Secondly, in the embodiment of the present application, a processing method based on no available public token in a public token bucket is provided, and through the above method, if no available public token is in the public token bucket, all tokens provided for the first control group come from a token bucket with a lower priority, so that a high-priority service has a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of each embodiment corresponding to fig. 3, in another optional embodiment provided in this application embodiment, if the available number of common tokens is smaller than the token requirement of the first control group, obtaining the first token set from the first token bucket may specifically include:
if the available quantity of the common tokens is smaller than the token demand quantity of the first control group and the available quantity of the common tokens is larger than or equal to the available quantity threshold value corresponding to the common token bucket, acquiring the available quantity of the first tokens in the first token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, obtaining a first set of tokens from a first token bucket.
In this embodiment, a processing method based on a common token bucket having available common tokens is introduced. The data transmission device comprises a token requirement amount of a first control group, wherein the token requirement amount of the first control group has an association relation with the data packet length of the first control group, and one token is used for transmitting 1-bit data in a normal condition. If the available number of common tokens is less than the token requirement of the first control group and the available number of common tokens is less than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common tokens in the common token bucket are insufficient to support data transmission for the first control group, and then the data transmission device obtains a set of tokens for data transmission from the other token buckets.
Based on this, the data transmission device determines whether the available number of the common tokens is less than the token requirement amount of the first control group, and determines whether the available number of the common tokens is less than an available number threshold corresponding to the common token bucket. If the available number of the common tokens is less than the token requirement of the first control group, but the available number of the common tokens is greater than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common token bucket cannot provide all the tokens for the first control group, but has a certain number of available tokens, and thus, can provide part of the common tokens for the first control group. In this embodiment, all tokens for data transmission are provided by the first token bucket for the first control group (i.e., the first set of tokens is provided), even though the common token bucket has available tokens.
Specifically, for ease of understanding, referring to fig. 8, fig. 8 is another schematic diagram of invoking a full amount of tokens from a first token bucket in the embodiment of the present application, and as shown in the figure, it is assumed that an available amount threshold corresponding to a common token bucket is 0, a token requirement amount of a first control group is 100, and an available amount of a common token is 20, so that the available amount of the common token (i.e., 20) is smaller than the token requirement amount of the first control group (i.e., 100), but the available amount of the common token (i.e., 20) is greater than the available amount threshold corresponding to the common token bucket (i.e., 0), and the common token bucket may preempt the first token in the first token bucket. That is, if the available number of first tokens in the first token bucket is greater than or equal to the token demand of the first control group, the common token bucket can preempt more tokens from other low priority token buckets (e.g., the first token bucket) so that the high priority first control group uses the first set of tokens for data transmission.
It will be appreciated that, based on the transmission scenario illustrated in fig. 8, the tokens used by the first control group are all derived from the first token bucket, and thus the first control group uses the first set of tokens for data transmission. For example, the token requirement of the first control group is 100, then the first set of tokens used comprises 100 first tokens.
Secondly, in the embodiment of the present application, a processing method based on the fact that the common token bucket has available common tokens is provided, and in the above manner, if there are still available common tokens in the common token bucket, but the number of available common tokens is not enough to support data transmission of the first control group, all the tokens provided for the first control group may come from the token bucket with a lower priority, so that high-priority services can have a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of each embodiment corresponding to fig. 3, in another optional embodiment provided in this application embodiment, if the available number of common tokens is smaller than the token requirement of the first control group, obtaining the first token set from the first token bucket may specifically include:
if the available quantity of the common tokens is smaller than the token demand quantity of the first control group and the available quantity of the common tokens is larger than or equal to the available quantity threshold value corresponding to the common token bucket, acquiring a common token set from the common token bucket, wherein the common token set comprises at least one common token;
obtaining an available number of first tokens in a first token bucket;
obtaining a first token set from a first token bucket according to the available number of the common tokens and the available number of first tokens in the first token bucket;
the data transmission based on the first token set may specifically include:
data transmission is performed based on the first set of tokens and the common set of tokens.
In this embodiment, a manner of extracting tokens from a plurality of different token buckets and performing data transmission is described. The data transmission device comprises a token requirement amount of a first control group, wherein the token requirement amount of the first control group has an association relation with the data packet length of the first control group, and one token is used for transmitting 1-bit data in a normal condition. If the available number of the common tokens is less than the token requirement of the first control group and the available number of the common tokens is less than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common tokens in the common token bucket are not sufficient to support data transmission of the first control group, and then the data transmission apparatus obtains a token set for data transmission from other token buckets.
Based on this, the data transmission device determines whether the available number of the common tokens is less than the token requirement amount of the first control group, and determines whether the available number of the common tokens is less than an available number threshold corresponding to the common token bucket. If the available number of the common tokens is less than the token requirement of the first control group, but the available number of the common tokens is greater than or equal to the available number threshold corresponding to the common token bucket, it indicates that the common token bucket cannot provide all the tokens for the first control group, but has a certain number of available tokens, and thus, can provide part of the common tokens for the first control group. In this embodiment, since the common token bucket has available tokens, all tokens for data transmission are provided by the common token bucket and the first token bucket for the first control group (i.e., the common token set and the first token set are provided).
Specifically, for convenience of understanding, please refer to fig. 9, where fig. 9 is a schematic diagram illustrating that part of tokens are called from the first token bucket in the embodiment of the present application, and as shown in the figure, assuming that the available quantity threshold corresponding to the common token bucket is 0, the token requirement amount of the first control group is 100, and the available quantity of the common tokens is 20, the available quantity of the common tokens (i.e., 20) is smaller than the token requirement amount (i.e., 100) of the first control group, but the available quantity of the common tokens (i.e., 20) is greater than the available quantity threshold corresponding to the common token bucket (i.e., 0), so that the common token bucket may preempt the first tokens in the first token bucket. If the sum of the available number of common tokens and the available number of first tokens in the first token bucket is greater than or equal to the token demand of the first control group, the common token bucket can preempt more tokens from other low priority token buckets (e.g., the first token bucket) so that the high priority first control group uses the first set of tokens for data transmission.
It will be appreciated that, based on the transmission scenario illustrated in fig. 9, a portion of the tokens used by the first control group are derived from the common token bucket, and another portion are derived from the first token bucket, and thus the first control group uses the common set of tokens and the first set of tokens for data transmission. For example, if the token requirement of the first control group is 100, 20 common tokens are included in the used common token set, and 80 first tokens are included in the used first token set.
Secondly, in the embodiment of the present application, a manner of extracting tokens from a plurality of different token buckets for data transmission is provided, and through the manner, when there are available common tokens in a common token bucket, although the number of the available common tokens is not enough to complete data transmission supporting a first control group, a part of the common tokens can still be provided, and based on this, the tokens provided for the first control group can partially come from the common token bucket and partially come from a token bucket with a lower priority, so that high-priority traffic can have a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, in another optional embodiment provided in this application embodiment, after obtaining the available number of first tokens in the first token bucket, the method may further include:
if the available number of the first tokens is smaller than the token demand of the first control group, acquiring the available number of second tokens in a second token bucket, wherein the second token bucket corresponds to a third priority, the third priority is smaller than the first priority, and the third priority is larger than the second priority;
if the available quantity of the second tokens is larger than or equal to the token demand quantity of the first control group, acquiring a second token set from a second token bucket, wherein the second token set comprises at least one second token;
data transmission is performed based on the second set of tokens.
In this embodiment, a processing manner that the available number of the first tokens is not enough to support the token requirement is introduced. As can be seen from the foregoing embodiments, the data transmission device may calculate the generation rate of the common token according to the preset bandwidth and the target bandwidths corresponding to the N priorities. While the token generation rate for other token buckets (e.g., the first token bucket) may be set to the target bandwidth for the corresponding priority for that token bucket.
Specifically, the filling number of the first token can be calculated by using the following formula:
TOKEN_level_2_fill=BW_level_2×△t;
wherein TOKEN _ level _2_ file represents the filling amount of the first TOKEN, BW _ level _2 represents the target bandwidth of the second priority, and Δ t represents the time difference (i.e. the difference between the previous TOKEN updating time and the current time).
At the same time, the first token may also continue to be consumed, and the consumption amount of the first token may be calculated using the following formula:
TOKEN level_2_consume=TOKEN_Existing_level_2-skb->len;
wherein TOKEN level _2_ control represents the consumption number of the first TOKEN, TOKEN _ Existing _ level _2 represents the Existing TOKEN number of the first TOKEN bucket at the current time, and skb- > len represents the length of the data packet.
Calculating the available number of the first tokens by combining the filling number of the first tokens and the consumption number of the first tokens in the following way:
TOKEN_level_2_surplus=BW_level_2×△t+TOKEN_Existing_level_2-skb->len
=TOKEN_level_2_fill+TOKEN_Existing_level_2-skb->len;
wherein TOKEN _ level _2_ zeros represents the available number of first TOKENs, TOKEN _ Existing _ level _2 represents the number of TOKENs in the first TOKEN bucket, BW _ level _2 represents the target bandwidth of the second priority, Δ t represents a time difference, and skb- > len represents the length of a data packet.
In one example, it is agreed that the first token bucket cannot over-use the first tokens of the token bucket depth. In another example, the first token bucket is agreed to be capable of overusing the first tokens in the token bucket depth, and based on this, the maximum number of the first tokens capable of overusing can be determined according to the preset proportion corresponding to the token bucket depth. For example, assuming that the depth of the token bucket of the first token bucket is 1000, and the preset ratio corresponding to the depth of the token bucket of the first token bucket is 100%, the maximum number of the first tokens that can be overused is-1000. For example, assuming that the depth of the first token bucket is 1000 and the preset ratio of the depth of the first token bucket is 80%, the maximum number of the first tokens that can be overused is-800.
In connection with the above description, when the available number of first tokens is less than the token requirement of the first control group, the corresponding second tokens may continue to be obtained from the second token bucket for data transmission, as will be described below with reference to two examples,
firstly, calling a full amount of tokens from a second token bucket;
specifically, for convenience of understanding, please refer to fig. 10, where fig. 10 is a schematic diagram illustrating that the total number of tokens is called from the second token bucket in the embodiment of the present application, as shown in the figure, assuming that the available number thresholds corresponding to the common token bucket and the first token bucket are both 0, the token requirement amount of the first control group is 100, and the available numbers of the common token and the first token are both 0, the available number of the common token (i.e., 0) and the available number of the first token (i.e., 0) are smaller than the token requirement amount of the first control group (i.e., 100). In addition, the available number of common tokens (i.e., 0) is equal to the available number threshold for the common token bucket (i.e., 0), and the available number of first tokens (i.e., 0) is equal to the available number threshold for the first token bucket (i.e., 0), such that the common token bucket may preempt second tokens within the second token bucket. That is, if the available number of second tokens in the second token bucket is greater than or equal to the token demand of the first control group, the common token bucket needs to preempt more tokens from other low priority token buckets (e.g., second token buckets) in order for the high priority first control group to use the second set of tokens for data transmission.
It is to be appreciated that the second token bucket corresponds to a third priority, the third priority being lower than the second priority. Based on the transmission scenario shown in fig. 10, the tokens used by the first control group are all sourced from the second token bucket, and thus the first control group uses the second set of tokens for data transmission. For example, if the token requirement of the first control group is 100, then the second set of tokens used comprises 100 second tokens.
Secondly, calling a part of tokens from a second token bucket;
specifically, for ease of understanding, referring to fig. 11, fig. 11 is a schematic diagram illustrating that part of the tokens are called from the second token bucket in the embodiment of the present application, and as shown in the figure, it is assumed that the available quantity threshold corresponding to the common token bucket is 0 and the token requirement of the first control group is 100. The available number of common tokens is 20, then the available number of common tokens (i.e., 20) is less than the token requirement of the first control group (i.e., 100), but the available number of common tokens (i.e., 20) is greater than the available number threshold (i.e., 0) for the common token bucket. Assuming that the available number of first tokens is 30, the sum of the available number of first tokens and the available number of common tokens (i.e., 50) is less than the token requirement of the first control group (i.e., 100), but the available number of first tokens (i.e., 30) is greater than the available number threshold corresponding to the common token bucket (i.e., 0). The common token bucket may then preempt first tokens in the first token bucket and second tokens in the second token bucket. If the sum of the available number of common tokens, the available number of first tokens in the first token bucket, and the available number of second tokens in the second token bucket is greater than or equal to the token demand of the first control group, then the common token bucket is able to preempt more tokens from other low priority token buckets (e.g., the first token bucket and the second token bucket) for data transmission using the first set of tokens by the high priority first control group.
It is to be understood that, based on the transmission scenario shown in fig. 11, a part of the tokens used by the first control group is derived from the common token bucket, another part is derived from the first token bucket, and another part is derived from the second token bucket, so that the first control group uses the common token set, the first token set, and the second token set for data transmission. For example, if the token requirement of the first control group is 100, 20 common tokens are included in the used common token set, 30 first tokens are included in the used first token set, and 50 second tokens are included in the used second token set.
In this way, data of the first token in the first token bucket is calculated first, and if the available number of the first token is smaller than the token demand of the first control group, more tokens can be preempted from the token bucket with lower priority for data transmission, so that high-priority services have lower transmission delay to a certain extent, and the occurrence of packet loss is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, another optional embodiment provided in the embodiments of the present application may further include:
obtaining a token demand of a second control group, wherein the second control group corresponds to a second priority;
obtaining an available number of first tokens in a first token bucket;
if the available quantity of the first tokens is smaller than the token demand quantity of the second control group, acquiring a third token set from the first token bucket, wherein the third token set comprises at least one third token;
and performing data transmission based on the third token set.
In this embodiment, a manner of allocating tokens to the second control group is described. The data transmission device is used for transmitting the token requirement of a second control group, wherein the token requirement of the second control group has an association relation with the packet length of the second control group, and normally, one token is used for transmitting 1-bit data. The second control group corresponds to a second priority, which also has a correspondence with the first token bucket.
The data transmission device may obtain an available number of first tokens in the first token bucket at the current time, and if the available number of first tokens at the current time is greater than the available number of first tokens at the last time, it indicates that the first tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. Conversely, if the available number of first tokens at the current time is less than the available number of first tokens at the last time, it indicates that the first tokens are being consumed, i.e. the actual bandwidth is greater than the target bandwidth, i.e. the second control group needs to use more tokens to transmit data. It should be noted that, a difference between the current time and the previous time may be 1 second, or other times, which is not limited herein.
In particular, if the available number of first tokens is less than the token requirement of the second control group, indicating that the number of first tokens in the first token bucket is not sufficient to support data transmission for the second control group, a third set of tokens may be obtained from the common token bucket, the third set of tokens including at least one third token. Finally, data transmission may be accomplished using the third set of tokens.
For the second control group, the first token may be preferentially taken from the first token bucket corresponding to its priority, and if the first token in the first token bucket is exhausted, the second control group may take the token from the common token bucket for data transmission. It is noted that if the first token in the first token bucket is a value less than or equal to 0, the second control group can preferentially use the first token as long as the first token bucket can continue to overdraw the first token, that is, for the second control group, the first token can continue to be used even though the first token in the first token bucket is already negative. The second control group corresponds to a second priority, that is, the second control group is consistent with the priority of the first token bucket.
Secondly, in the embodiment of the present application, a manner of allocating tokens to the second control group is provided, and in the data transmission process, for a lower priority service, the common token in the common token bucket may also be used preferentially, and if the common token is not sufficient to support data transmission of the second control group, the token is obtained from the token corresponding to the second control group, so as to achieve the purpose of flexible resource scheduling, and improve feasibility and operability of the scheme. In addition, a device includes a plurality of containers, and currently, only network card level configuration can be performed by using a TC tool, that is, rules of Internet Protocol (IP) need to be configured for each container, which results in high configuration complexity and high configuration difficulty. The method and the device are configured for each control group, and an IP corresponding rule does not need to be additionally set.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, in another optional embodiment provided in this application embodiment, after obtaining the available number of first tokens in the first token bucket, the method may further include:
if the available number of the first tokens is larger than or equal to the token demand of the second control group, acquiring a fourth token set from the first token bucket, wherein the fourth token set comprises at least one first token;
and performing data transmission based on the fourth token set.
In this embodiment, another way of allocating tokens to the second control group is described. The data transmission device comprises a token requirement amount of a second control group, wherein the token requirement amount of the second control group has an association relation with the data packet length of the second control group, and one token is used for transmitting 1-bit data in a normal condition. The second control group corresponds to a second priority, which also has a correspondence with the first token bucket.
The data transmission device may obtain an available number of first tokens in the first token bucket at the current time, and if the available number of first tokens at the current time is greater than the available number of first tokens at the last time, it indicates that the first tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. Conversely, if the available number of first tokens at the current time is less than the available number of first tokens at the last time, it indicates that the first tokens are being consumed, i.e. the actual bandwidth is greater than the target bandwidth, i.e. the second control group needs to use more tokens to transmit data. It should be noted that, a difference between the current time and the previous time may be 1 second, or other times, which is not limited herein.
Specifically, if the available number of first tokens is greater than or equal to the token requirement of the second control group, it indicates that the number of first tokens in the first token bucket is already sufficient to support data transmission of the first control group, at this time, a fourth token set is directly obtained from the first token bucket, and the fourth token set includes at least one common token. Finally, data transfer may be accomplished using a common set of tokens.
For convenience of understanding, please refer to fig. 12, where fig. 12 is a schematic diagram illustrating that a token is called from a common token bucket in the embodiment of the present application, and as shown in the figure, a second control group may first use a first token in a first token bucket, and the first token bucket may set a minimum guaranteed token amount, that is, it is guaranteed that the second control group can obtain the token. The tokens used by the second control group may be derived in part from the common token bucket and in part from the first token bucket. Alternatively, the tokens used by the second control group all originate from a common token bucket. Alternatively, the tokens used by the second control group are all sourced from the first token bucket. The second control group may also use tokens in the token bucket corresponding to the lower priority if no tokens are available in both the first token bucket and the common token bucket.
It should be noted that, the minimum guaranteed token amount may also be a negative number, for example, -100 means that the second control group can overdraw at most 100 first tokens, but the control groups corresponding to other priorities cannot use the overdraw first tokens, thereby further guaranteeing that the low-priority service can also be performed.
In the embodiment of the present application, a manner for allocating tokens to the second control group is provided, and in the data transmission process, for a lower priority service, the common tokens in the common token bucket may also be preferentially used, so that the purpose of flexible resource scheduling is achieved, and the feasibility and operability of the scheme are improved. In addition, a device includes a plurality of containers, and only network card level configuration can be performed by using the TC tool at present, that is, an IP rule needs to be configured for each container, thereby resulting in higher configuration complexity and higher configuration difficulty. The method and the device are configured for each control group, and an IP corresponding rule does not need to be additionally set.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, another optional embodiment provided in the embodiments of the present application may further include:
acquiring a target bandwidth of a second priority;
determining the available number of the first tokens according to the number of the existing tokens in the first token bucket, the target bandwidth of the second priority, the time difference value and the length of the data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
if the available quantity of the first tokens is less than zero, determining the excess token utilization rate according to the available quantity of the first tokens and the bucket depth of the first tokens;
if the available number of first tokens is equal to zero, it is determined that the token excess usage is zero.
In this embodiment, a manner of determining the excess usage is described. As can be seen from the foregoing embodiments, the available number of the first tokens can be determined according to the number of tokens already in the first token bucket, the target bandwidth of the second priority, the time difference value, and the length of the data packet. Assuming that N is equal to 2, the generation rate of the common token is calculated using the following formula:
BW_public=BW_ideal-BW_level_1-BW_level_2;
the BW _ public indicates a generation rate of the public token, BW _ ideal indicates a preset bandwidth, BW _ level _1 indicates a target bandwidth corresponding to the first priority, and BW _ level _2 indicates a target bandwidth of the second priority. It should be noted that, if there are more priorities, the target bandwidth corresponding to other priorities may be subtracted from the preset bandwidth.
Based on this, after obtaining the generation rate of the common tokens, the following formula can be adopted to calculate the filling quantity of the common tokens:
TOKEN_public_fill=BW_public×△t;
wherein TOKEN _ public _ file represents the filling number of the common TOKENs, BW _ public represents the generation rate of the common TOKENs, and Δ t represents a time difference (i.e. a difference between the previous TOKEN updating time and the current time).
Meanwhile, the common token can also be continuously consumed, and the consumption amount of the common token can be calculated by adopting the following formula:
TOKEN_public_consume=TOKEN_Existing-skb->len;
wherein, TOKEN _ public _ condition represents the consumption number of the public TOKEN, TOKEN _ Existing represents the Existing TOKEN number of the public TOKEN bucket at the current time, and skb- > len represents the length of the data packet.
And calculating the available number of the common tokens by combining the filling number of the common tokens and the consumption number of the common tokens in the following way:
TOKEN_public_surplus=BW_public×△t+TOKEN_Existing-skb->len
=TOKEN_public_fill+TOKEN_Existing-skb->len;
wherein TOKEN _ public _ suprplus represents the available number of common TOKENs, TOKEN _ Existing represents the number of TOKENs in the common TOKEN bucket, BW _ public represents the generation rate of the common TOKENs, Δ t represents the time difference, and skb- > len represents the length of the data packet.
Specifically, when the available number of first tokens is less than zero, the token excess usage is calculated as follows:
α=|TOKEN|/depth;
where α represents TOKEN excess usage, TOKEN represents the available number of first TOKENs, and depth represents the depth of the first TOKEN bucket.
When the available number of first tokens is equal to zero, the token excess usage is 0 since the first tokens are not overdrawn. When the available number of first tokens is greater than zero, it indicates that the first token bucket may lend out the first tokens, i.e., may be preempted by a higher priority token bucket (e.g., a common token bucket).
In the case where the token excess usage rate is greater than or equal to 0, the transceiving window may be controlled based on the token excess usage rate. For convenience of introduction, please refer to fig. 13, where fig. 13 is a schematic diagram of a frame of data Transmission in an embodiment of the present application, and as shown in the drawing, in a case of receiving and sending a Transmission Control Protocol (TCP) packet, a TCP window may be flexibly adjusted in a network isolation manner. The network isolation comprises a token bucket preemption mechanism provided by the application.
Secondly, in the embodiment of the application, a mode for determining the excess utilization rate is provided, through the above mode, the excess utilization rate of the token can be calculated in real time, the network isolation manages the issuance of the token through the leaky bucket, and the excess utilization rate of the token is calculated according to the total target bandwidth and the real-time actual bandwidth of the system. In addition, the method and the device support the flow statistics of a single control group, support the flow statistics of all sub-control groups, and can express the flow consumption condition of the container in detail.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, another optional embodiment provided in the embodiments of the present application may further include:
establishing a Transmission Control Protocol (TCP) connection;
acquiring a maximum flow receiving cache value for TCP connection;
determining the size of a second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess utilization rate;
and determining the size of the target receiving window according to the size of the second receiving window and the TCP maximum transmission unit.
In this embodiment, a method for calculating a receive window of a TCP connection is described. In practical applications, multiple TCP connections may be established, and a single TCP connection will be described as an example.
Specifically, based on the token excess usage rate α, the target receive window of TCP is attenuated, i.e. the size of the target receive window is calculated as follows:
N=log K (rmem_max);
N=roundup(N);
rwnd_2=min(rwnd_1,rmem_max*α N );
rwnd_3=max(rwnd_2,mss)
where rwnd _3 denotes the size of the target receive window, rwnd _2 denotes the size of the second receive window, rwnd _1 denotes the size of the first receive window, rmem _ max denotes the TCP maximum receive buffer value (e.g., 6291456) in the Linux system, N denotes a scaling factor, and N is an integer greater than or equal to 1, K denotes a minimum attenuation factor (e.g., 1024), roundup () denotes rounding up, α denotes token over-usage, mss denotes the TCP maximum transmission unit (e.g., 1460 bytes).
For ease of understanding, please refer to fig. 14, fig. 14 is a schematic flow chart of receiving a data packet according to an embodiment of the present application, and specifically:
in step a1, the network card receives the data packet.
In step a2, the processor at the receiving end looks up the socket (sock) according to the description (skb) of the packet in the kernel, and determines the corresponding control group according to skb.
In step a3, TCP ingress control is performed, and the flow of ingress control is entered.
In step a4, protocol stack processing is performed.
In step a5, in the control flow of the ingress traffic, the control group consumes tokens of corresponding priorities according to the priorities.
In step a6, the control group first attempts to use the common tokens in the common token bucket.
In step a7, if the common tokens are not sufficient, the control group attempts to use a lower priority token.
In step A8, token excess usage is calculated in the manner described in the previous embodiments.
In step a9, the transmission rate of the control group is counted.
In step a10, a response packet is received.
In step A11, after receiving the response packet, a TCP receive window is calculated
In step a12, the TCP receive window is attenuated based on token excess usage.
In step a13, a response to the window scaling is sent.
In the embodiment of the application, a mode for calculating a receiving window of the TCP connection is provided, and based on the mode, the application can provide better connection fairness guarantee, improve the priority of data packets in a connection life cycle, and guarantee that the connection can be established and destroyed in time, so that each connection can communicate with the lowest resource. In addition, the off-line receiving and sending speed can be actively inhibited, the receiving and sending speed of the low-priority service kernel protocol stack is influenced according to the high-priority service over-sending proportion, and the purposes of inhibiting the receiving and sending speed of the low-priority service and reducing packet loss and delay are achieved.
Optionally, on the basis of the foregoing respective embodiments corresponding to fig. 3, another optional embodiment provided in the embodiments of the present application may further include:
establishing a Transmission Control Protocol (TCP) connection;
acquiring a maximum flow sending cache value aiming at TCP connection;
determining the size of a second congestion window according to the maximum flow sending cache value, the size of the first congestion window, the token excess utilization rate and the TCP maximum transmission unit;
and determining the size of the target congestion window according to the size of the second congestion window and the preset segment number.
In this embodiment, a method for calculating a congestion window of a TCP connection is described. In practical applications, multiple TCP connections may be established, and a single TCP connection will be described as an example.
Specifically, based on the token excess usage rate α, the target congestion window of TCP is attenuated, i.e. the size of the target congestion window is calculated as follows:
N=log K (wmem_max);
N=roundup(N);
cwnd_2=min(cwnd_1,wmem_max*α N /mss);
cwnd_3=max(cwnd_2,1)
where cwnd _3 denotes the size of the target congestion window, cwnd _2 denotes the size of the second congestion window, cwnd _1 denotes the size of the first congestion window, wmem _ max denotes the TCP maximum send buffer value (e.g., 4194304) in the Linux system, N denotes a scaling factor, N is an integer greater than or equal to 1, K denotes the minimum attenuation factor (e.g., 1024), roundup () denotes rounding-up, α denotes token excess usage, mss denotes the TCP maximum transmission unit (e.g., 1460 bytes).
For ease of understanding, please refer to fig. 15, fig. 15 is a schematic flow chart of sending a data packet according to an embodiment of the present application, and specifically:
in step B1, both the off-line control group and the on-line control group may send TCP packets.
In step B2, a congestion window is calculated.
In step B3, TCP outflow control is performed, and the flow of outflow control is entered.
In step B4, protocol stack processing is performed.
In step B5, in the control flow of the outgoing traffic, the control group consumes tokens corresponding to the priorities according to the priorities.
In step B6, the control group first attempts to use the common tokens in the common token bucket.
In step B7, if the common token is not sufficient, the control group attempts to use a lower priority token, e.g., the first token.
In step B8, token excess usage is calculated in the manner described in the previous embodiments.
In step B9, the transmission rate of the control group is counted.
In the embodiment of the application, a mode for calculating the congestion window of the TCP connection is provided, and based on the mode, the application can provide better connection fairness guarantee, improve the priority of the data packet in the connection life cycle, and guarantee that the connection can be established and destroyed in time, so that each connection can communicate with the lowest resource. In addition, the off-line receiving and sending speed can be actively inhibited, the receiving and sending speed of the kernel protocol stack of the low-priority service is influenced according to the proportion of the high-priority service to be sent out, and the purposes of inhibiting the receiving and sending speed of the low-priority service and reducing packet loss and delay are achieved.
Referring to fig. 16, fig. 16 is a schematic diagram of an embodiment of a data transmission device in an embodiment of the present application, in which the data transmission device 20 includes:
an obtaining module 201, configured to obtain a token requirement of a first control group, where the first control group corresponds to a first priority;
an obtaining module 201, configured to obtain an available number of common tokens in a common token bucket, where the common token bucket is configured to store the common tokens called by the control group, and the common token bucket corresponds to a first priority;
the obtaining module 201 is further configured to obtain a first token set from a first token bucket if the available number of the common tokens is smaller than a token requirement of the first control group, where the first token bucket corresponds to a second priority, the second priority is smaller than the first priority, and the first token set includes at least one first token;
a transmission module 202 configured to perform data transmission based on the first token set.
In the embodiment of the present application, a data transmission apparatus is provided, where the data transmission apparatus is adopted to manually set a system ideal network load bandwidth (i.e., a target bandwidth), and determine whether more bandwidths can be used based on the priority of a control group. That is, when the total bandwidth of the high priority and the low priority is higher than the ideal load bandwidth, the high priority may preempt the low priority bandwidth, but still guarantee the minimum available bandwidth of the low priority. In the data transmission process, for a high-priority service, whether data transmission can be supported or not can be determined according to the available number of common tokens, if the available number of the common tokens cannot completely support the data transmission based on the high-priority service, the tokens can be called from a token bucket with a low priority, and then the data transmission is carried out, so that the high-priority service has a higher token calling authority, and the tokens can be called from the common token bucket and other token buckets with low priorities, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced. In the data transmission process, for a high-priority service, whether data transmission can be supported or not can be determined according to the available quantity of the common tokens, if the available quantity of the common tokens cannot completely support the data transmission based on the high-priority service, the tokens can be called from a token bucket with a low priority, and the data transmission is carried out, so that the high-priority service has a higher token calling authority, and the tokens can be called from the common token bucket and other token buckets with low priorities, so that the high-priority service has a lower transmission delay to a certain extent, and the occurrence of packet loss is reduced.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
an obtaining module 201, configured to specifically obtain a preset bandwidth and target bandwidths of N priorities, where the target bandwidths of the N priorities include a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
determining the available number of the public tokens according to the number of the existing tokens in the public token bucket, the depth of the token bucket, the generation rate of the public tokens, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
or the like, or, alternatively,
an obtaining module 201, configured to specifically obtain a preset bandwidth and target bandwidths of N priorities, where the target bandwidths of the N priorities include a target bandwidth corresponding to a first priority and a target bandwidth of a second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths with the N priorities to obtain the generation rate of the public token;
and determining the available number of the common tokens according to the number of the existing tokens in the common token bucket, the generation rate of the common tokens, a time difference value and the length of the data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time.
In the embodiment of the application, a data transmission device is provided, and by using the device, the generation rate of the public tokens in the public token bucket is limited, and the available number of the public tokens at the current moment can be calculated and obtained by combining the number of the existing tokens, the time difference value and the length of a data packet based on the generation rate of the public tokens, so that a real-time calculation result is obtained, and whether the tokens need to be acquired from the token buckets with other priorities can be accurately estimated, and the feasibility and operability of a scheme are improved.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
the obtaining module 201 is further configured to obtain a common token set from the common token bucket if the available number of common tokens is greater than or equal to the token requirement amount of the first control group, where the common token set includes at least one common token;
the transmission module 202 is further configured to perform data transmission based on the common token set.
In the embodiment of the present application, a data transmission apparatus is provided, and with the above apparatus, if the available number of common tokens is greater than or equal to the token demand of the first control group, the common tokens are preferentially obtained from a common token bucket, so that the control group with a higher priority can preempt more tokens, and thus data transmission is performed.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
an obtaining module 201, configured to obtain an available number of first tokens in a first token bucket if the available number of common tokens is less than a token requirement amount of a first control group and the available number of common tokens is less than or equal to an available number threshold corresponding to the common token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, obtaining a first set of tokens from a first token bucket.
In the embodiment of the present application, a data transmission apparatus is provided, and with the above apparatus, if there is no available public token in a public token bucket, all tokens provided for a first control group come from a token bucket with a lower priority, so that a high-priority service has a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in this application embodiment,
an obtaining module 201, configured to obtain an available number of first tokens in a first token bucket if the available number of common tokens is less than a token requirement amount of a first control group and the available number of common tokens is greater than or equal to an available number threshold corresponding to the common token bucket;
if the available number of first tokens is greater than or equal to the token requirement of the first control group, obtaining a first set of tokens from a first token bucket.
In the embodiment of the present application, a data transmission apparatus is provided, and with the above apparatus, if available common tokens still exist in a common token bucket, but the number of the available common tokens is not enough to support data transmission of a first control group, all tokens provided for the first control group may come from a token bucket with a lower priority, so that a high-priority service has a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Optionally, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in this application embodiment,
an obtaining module 201, configured to obtain a common token set from a common token bucket if an available number of common tokens is smaller than a token requirement amount of the first control group and the available number of common tokens is greater than or equal to an available number threshold corresponding to the common token bucket, where the common token set includes at least one common token;
obtaining an available number of first tokens in a first token bucket;
obtaining a first token set from a first token bucket according to the available number of the common tokens and the available number of first tokens in the first token bucket;
the transmission module 202 is specifically configured to perform data transmission based on the first token set and the common token set.
In the embodiment of the present application, a data transmission apparatus is provided, where, when there are available common tokens in a common token bucket, although the number of the available common tokens is not enough to complete data transmission supporting a first control group, a part of the common tokens can still be provided, and based on this, the tokens provided for the first control group may partially come from the common token bucket and partially come from a token bucket with a lower priority, so as to implement that a high-priority service has a lower transmission delay to a certain extent, and reduce occurrence of a packet loss condition. Meanwhile, in practical application, flexibility and diversity of token calling are increased, and therefore feasibility of the scheme is improved.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
the obtaining module 201 is further configured to, after obtaining the available number of the first tokens in the first token bucket, if the available number of the first tokens is smaller than the token requirement amount of the first control group, obtain the available number of the second tokens in a second token bucket, where the second token bucket corresponds to a third priority, the third priority is smaller than the first priority, and the third priority is greater than the second priority;
the obtaining module 201 is further configured to obtain a second token set from the second token bucket if the available number of the second tokens is greater than or equal to the token requirement amount of the first control group, where the second token set includes at least one second token;
the transmission module 202 is further configured to perform data transmission based on the second token set.
In the embodiment of the present application, a data transmission apparatus is provided, where the data of a first token in a first token bucket is calculated first, and if the available number of the first token is smaller than the token requirement of a first control group, more tokens may be preempted from a token bucket with a lower priority for data transmission, so that a high-priority service has a lower transmission delay to a certain extent, and occurrence of a packet loss situation is reduced. Meanwhile, in practical application, the flexibility and diversity of token calling are increased, and therefore the feasibility of the scheme is improved.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
an obtaining module 201, further configured to obtain a token requirement of a second control group, where the second control group corresponds to a second priority;
an obtaining module 201, configured to obtain an available number of first tokens in a first token bucket;
the obtaining module 201 is further configured to obtain a third token set from the first token bucket if the available number of the first tokens is smaller than the token requirement amount of the second control group, where the third token set includes at least one third token;
the transmission module 202 is further configured to perform data transmission based on the third token set.
In the embodiment of the present application, a data transmission device is provided, and with the above device, in a data transmission process, for a lower priority service, a public token in a public token bucket may also be preferentially used, and if the public token is not enough to support data transmission of a second control group, a token is obtained from a token corresponding to the second control group, so that a purpose of flexible resource scheduling is achieved, and feasibility and operability of a scheme are improved. In addition, a device includes a plurality of containers, and only network card level configuration can be performed currently by using a TC tool, that is, rules of an IP need to be configured for each container, which results in high configuration complexity and high configuration difficulty. The method and the device are configured for each control group, and no IP corresponding rule needs to be additionally set.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
the obtaining module 201 is further configured to, after obtaining the available number of the first tokens in the first token bucket, obtain a fourth token set from the first token bucket if the available number of the first tokens is greater than or equal to a token requirement amount of the second control group, where the fourth token set includes at least one first token;
the transmission module 202 is further configured to perform data transmission based on the fourth token set.
In the embodiment of the application, a data transmission device is provided, and by adopting the device, for a service with a lower priority level, a public token in a public token bucket can be preferentially used, so that the purpose of flexibly scheduling resources is achieved, and the feasibility and operability of a scheme are improved. In addition, a device includes a plurality of containers, and only network card level configuration can be performed currently by using a TC tool, that is, an IP rule needs to be configured for each container, which results in high configuration complexity and high configuration difficulty. The method and the device are configured for each control group, and an IP corresponding rule does not need to be additionally set.
Alternatively, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
the obtaining module 201 is further configured to obtain a target bandwidth of a second priority;
the determining module 203 is further configured to determine the available number of the first tokens according to the number of existing tokens in the first token bucket, the target bandwidth of the second priority, a time difference value, and the length of the data packet, where the time difference value represents a difference value between a previous token updating time and a current time;
the determining module 203 is further configured to determine, if the available number of the first tokens is less than zero, a token excess usage rate according to the available number of the first tokens and a bucket depth of the first tokens;
the determining module 203 is further configured to determine that the token excess usage rate is zero if the available number of the first tokens is equal to zero.
In the embodiment of the application, a data transmission device is provided, and by adopting the device, the excess utilization rate of the token can be calculated in real time, the network isolation manages the issuing of the token through the leaky bucket, and the excess utilization rate of the token is calculated according to the total target bandwidth and the real-time actual bandwidth of the system. In addition, the method and the device support the flow statistics of a single control group and all sub-control groups, and can express the flow consumption condition of the container in detail.
Optionally, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application, the data transmission device 20 further includes an establishing module 204;
an establishing module 204, configured to establish a TCP connection;
an obtaining module 201, configured to obtain a maximum traffic receiving buffer value for the TCP connection;
the determining module 203 is further configured to determine the size of the second receiving window according to the maximum traffic receiving cache value, the size of the first receiving window, and the token excess utilization;
the determining module 203 is further configured to determine the size of the target receiving window according to the size of the second receiving window and the TCP maximum transmission unit.
In the embodiment of the application, a data transmission device is provided, and by adopting the device, better fair connection guarantee can be provided, the priority of a data packet in a connection life cycle is improved, connection can be timely established and destroyed, and the lowest resource which can be communicated in each connection is ensured. In addition, the off-line receiving and sending speed can be actively inhibited, the receiving and sending speed of the low-priority service kernel protocol stack is influenced according to the high-priority service over-sending proportion, and the purposes of inhibiting the receiving and sending speed of the low-priority service and reducing packet loss and delay are achieved.
Optionally, on the basis of the embodiment corresponding to fig. 16, in another embodiment of the data transmission device 20 provided in the embodiment of the present application, the data transmission device 20 further includes an establishing module 204;
an establishing module 204, configured to establish a TCP connection;
an obtaining module 201, configured to obtain a maximum traffic sending buffer value for a TCP connection;
the determining module 203 is further configured to determine the size of the second congestion window according to the maximum traffic sending buffer value, the size of the first congestion window, the token excess usage rate, and the TCP maximum transmission unit;
the determining module 203 is further configured to determine the size of the target congestion window according to the size of the second congestion window and the preset number of segments.
In the embodiment of the application, the data transmission device is provided, and by adopting the device, better fair connection guarantee can be provided, the priority of a data packet in a connection life cycle is improved, and connection can be timely established and destroyed, so that the lowest resource which can be communicated can be realized by each connection. In addition, the off-line receiving and sending speed can be actively inhibited, the receiving and sending speed of the low-priority service kernel protocol stack is influenced according to the high-priority service over-sending proportion, and the purposes of inhibiting the receiving and sending speed of the low-priority service and reducing packet loss and delay are achieved.
Fig. 17 is a schematic structural diagram of a network device 30 according to an embodiment of the present application. The network device 30 may include an input device 310, an output device 320, a processor 330, and a memory 340. The output device in the embodiments of the present application may be a display device.
Memory 340 may include both read-only memory and random-access memory, and provides instructions and data to processor 330. A portion of Memory 340 may also include Non-Volatile Random Access Memory (NVRAM).
Memory 340 stores the following elements, executable modules or data structures, or a subset thereof, or an expanded set thereof:
and (3) operating instructions: including various operational instructions for performing various operations.
Operating the system: including various system programs for implementing various basic services and for handling hardware-based tasks.
In the embodiment of the present application, the processor 330 is configured to:
obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
obtaining an available number of common tokens in a common token bucket, wherein the common token bucket is used for storing the common tokens called by the control group, and the common token bucket corresponds to a first priority;
if the available quantity of the common tokens is less than the token requirement quantity of the first control group, acquiring a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set comprises at least one first token;
data transmission is performed based on the first set of tokens.
Processor 330 controls the operation of network device 30, and processor 330 may also be referred to as a Central Processing Unit (CPU). Memory 340 may include both read-only memory and random-access memory, and provides instructions and data to processor 330. A portion of the memory 340 may also include NVRAM. In particular applications, the various components of network device 30 are coupled together by a bus system 350, where bus system 350 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. For clarity of illustration, however, the various buses are labeled in the figures as bus system 350.
The method disclosed in the embodiments of the present application can be applied to the processor 330, or implemented by the processor 330. The processor 330 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 330. The processor 330 may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules may be located in ram, flash, rom, prom, or eprom, registers, etc. as is well known in the art. The storage medium is located in the memory 340, and the processor 330 reads the information in the memory 340 and performs the steps of the above method in combination with the hardware thereof.
The related description of fig. 17 can be understood with reference to the related description and effects of the method portion of fig. 3, and will not be described in detail herein.
Embodiments of the present application further provide a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the method described in the foregoing embodiments.
Embodiments of the present application also provide a computer program product including a program, which, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
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 units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, which are essential or part of the technical solutions contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a network device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (15)

1. A method of data transmission, comprising:
obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
obtaining an available number of common tokens in a common token bucket, wherein the common token bucket is used for storing common tokens invoked by a control group, and the common token bucket corresponds to the first priority;
if the available number of the common tokens is less than the token requirement of the first control group, acquiring a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set comprises at least one first token;
performing data transmission based on the first set of tokens.
2. The method of claim 1, wherein obtaining the available number of common tokens in a common token bucket comprises:
acquiring preset bandwidths and target bandwidths of N priorities, wherein the target bandwidths of the N priorities comprise the target bandwidth corresponding to the first priority and the target bandwidth of the second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths of the N priorities to obtain the generation rate of the public token;
determining the available number of the public tokens according to the number of the existing tokens in the public token bucket, the depth of the token bucket, the generation rate of the public tokens, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
or, the obtaining the available number of the common tokens in the common token bucket includes:
acquiring preset bandwidths and target bandwidths of N priorities, wherein the target bandwidths of the N priorities comprise the target bandwidth corresponding to the first priority and the target bandwidth of the second priority, and N is an integer greater than or equal to 2;
subtracting the preset bandwidth from the target bandwidths of the N priorities to obtain the generation rate of the public token;
and determining the available number of the common tokens according to the number of the existing tokens in the common token bucket, the generation rate of the common tokens, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time.
3. The method of claim 1, further comprising:
if the available quantity of the common tokens is larger than or equal to the token demand quantity of the first control group, acquiring a common token set from the common token bucket, wherein the common token set comprises at least one common token;
and performing data transmission based on the common token set.
4. The method of claim 1, wherein obtaining a first set of tokens from a first token bucket if the available number of common tokens is less than the token requirement of the first control group comprises:
if the available quantity of the common tokens is smaller than the token demand quantity of the first control group and the available quantity of the common tokens is smaller than the available quantity threshold corresponding to the common token bucket, acquiring the available quantity of first tokens in the first token bucket;
if the available number of the first tokens is greater than or equal to the token requirement of the first control group, obtaining the first token set from the first token bucket.
5. The method of claim 1, wherein obtaining a first set of tokens from a first token bucket if the available number of common tokens is less than the token requirement of the first control group comprises:
if the available quantity of the common tokens is smaller than the token demand quantity of the first control group and the available quantity of the common tokens is larger than or equal to the available quantity threshold corresponding to the common token bucket, acquiring the available quantity of first tokens in the first token bucket;
if the available number of the first tokens is greater than or equal to the token requirement of the first control group, obtaining the first token set from the first token bucket.
6. The method of claim 1, wherein obtaining a first set of tokens from a first token bucket if the available number of common tokens is less than the token requirement of the first control group comprises:
if the available quantity of the common tokens is smaller than the token demand of the first control group and is greater than or equal to the available quantity threshold corresponding to the common token bucket, acquiring a common token set from the common token bucket, wherein the common token set comprises at least one common token;
obtaining an available number of first tokens in the first token bucket;
obtaining the first token set from the first token bucket according to the available quantity of the common tokens and the available quantity of first tokens in the first token bucket;
the transmitting data based on the first set of tokens includes:
performing data transmission based on the first set of tokens and the common set of tokens.
7. The method of any of claims 4 to 6, wherein after obtaining the available number of first tokens in the first token bucket, the method further comprises:
if the available number of the first tokens is smaller than the token demand of the first control group, acquiring the available number of second tokens in a second token bucket, wherein the second token bucket corresponds to a third priority, the third priority is smaller than the first priority, and the third priority is larger than the second priority;
if the available number of the second tokens is larger than or equal to the token demand of the first control group, acquiring a second token set from a second token bucket, wherein the second token set comprises at least one second token;
performing data transmission based on the second set of tokens.
8. The method of claim 1, further comprising:
obtaining a token demand for a second control group, wherein the second control group corresponds to the second priority;
obtaining an available number of first tokens in the first token bucket;
if the available quantity of the first tokens is less than the token demand quantity of the second control group, acquiring a third token set from the first token bucket, wherein the third token set comprises at least one third token;
and performing data transmission based on the third token set.
9. The method of claim 8, wherein after obtaining the available number of first tokens in the first token bucket, the method further comprises:
if the available quantity of the first tokens is larger than or equal to the token requirement quantity of the second control group, acquiring a fourth token set from the first token bucket, wherein the fourth token set comprises at least one first token;
and performing data transmission based on the fourth token set.
10. The method according to any one of claims 1 to 9, further comprising:
acquiring the target bandwidth of the second priority;
determining the available number of the first tokens according to the number of the existing tokens in the first token bucket, the target bandwidth of the second priority, a time difference value and the length of a data packet, wherein the time difference value represents the difference value between the previous token updating time and the current time;
if the available quantity of the first tokens is less than zero, determining token excess utilization rate according to the available quantity of the first tokens and the bucket depth of the first tokens;
and if the available number of the first tokens is equal to zero, determining that the token excess utilization rate is zero.
11. The method of claim 10, further comprising:
establishing a Transmission Control Protocol (TCP) connection;
acquiring a maximum flow receiving cache value for the TCP connection;
determining the size of a second receiving window according to the maximum flow receiving cache value, the size of a first receiving window and the token excess utilization rate;
and determining the size of a target receiving window according to the size of the second receiving window and the TCP maximum transmission unit.
12. The method of claim 10, further comprising:
establishing a Transmission Control Protocol (TCP) connection;
acquiring a maximum flow sending cache value aiming at the TCP connection;
determining the size of a second congestion window according to the maximum flow sending buffer value, the size of a first congestion window, the token excess utilization rate and the TCP maximum transmission unit;
and determining the size of the target congestion window according to the size of the second congestion window and the number of the preset sections.
13. A data transmission apparatus, comprising:
an obtaining module, configured to obtain a token requirement of a first control group, where the first control group corresponds to a first priority;
the obtaining module is further configured to obtain an available number of common tokens in a common token bucket, where the common token bucket is configured to store common tokens called by a control group, and the common token bucket corresponds to the first priority;
the obtaining module is further configured to obtain a first token set from a first token bucket if the available number of the common tokens is smaller than a token requirement of the first control group, where the first token bucket corresponds to a second priority, the second priority is smaller than the first priority, and the first token set includes at least one first token;
a transmission module configured to perform data transmission based on the first token set.
14. A network device, comprising: a memory, a processor, and a bus system;
wherein the memory is used for storing programs;
the processor is configured to execute the program in the memory, the processor is configured to perform the method of any of claims 1 to 12 according to instructions in program code;
the bus system is used for connecting the memory and the processor so as to enable the memory and the processor to communicate.
15. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 12.
CN202110246463.6A 2021-03-05 2021-03-05 Data transmission method, related device, equipment and storage medium Pending CN115022245A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110246463.6A CN115022245A (en) 2021-03-05 2021-03-05 Data transmission method, related device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110246463.6A CN115022245A (en) 2021-03-05 2021-03-05 Data transmission method, related device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115022245A true CN115022245A (en) 2022-09-06

Family

ID=83064216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110246463.6A Pending CN115022245A (en) 2021-03-05 2021-03-05 Data transmission method, related device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115022245A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431327A (en) * 2023-03-06 2023-07-14 钛信(上海)信息科技有限公司 Task current limiting processing method and fort machine

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431327A (en) * 2023-03-06 2023-07-14 钛信(上海)信息科技有限公司 Task current limiting processing method and fort machine
CN116431327B (en) * 2023-03-06 2023-11-07 钛信(上海)信息科技有限公司 Task current limiting processing method and fort machine

Similar Documents

Publication Publication Date Title
US10447594B2 (en) Ensuring predictable and quantifiable networking performance
CN100544243C (en) Make the method and system of Network Transmission deceleration in the application layer of emission server
US20190182316A1 (en) Sender system status-aware load balancing
US20140143300A1 (en) Method and Apparatus for Controlling Utilization in a Horizontally Scaled Software Application
US10785163B2 (en) Maintaining a queuing policy with multipath traffic
US10419965B1 (en) Distributed meters and statistical meters
US20190095236A1 (en) Accounting and enforcing non-process execution by container-based software receiving data over a network
KR102612312B1 (en) Electronic apparatus and controlling method thereof
CN113032410B (en) Data processing method, device, electronic equipment and computer storage medium
US8780723B2 (en) Communication system and communication apparatus
CN115022245A (en) Data transmission method, related device, equipment and storage medium
KR20130060350A (en) Method and apparatus for scheduling communication traffic in atca-based equipment
US11108697B2 (en) Technologies for controlling jitter at network packet egress
WO2019167859A1 (en) Estimating device and estimating method
Lee et al. Dynamic network scheduling for virtual routers
To et al. Measurement based fair queuing for allocating bandwidth to virtual machines
CN114884823A (en) Flow congestion control method and device, computer readable medium and electronic equipment
Na et al. Optimal service placement using pseudo service chaining mechanism for cloud-based multimedia services
Sun et al. PACCP: a price-aware congestion control protocol for datacenters
CN114793216B (en) Token management and information sending method and device, electronic equipment and storage medium
Kumar Toward predictable networks
CN114785740B (en) Token management and information forwarding method, device, equipment and storage medium
US20240012459A1 (en) Renewable energy allocation to hardware devices
Shen et al. Rendering differential performance preference through intelligent network edge in cloud data centers
CN116800693A (en) Queue scheduling method and device

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