A data transmission method, related device, equipment and storage medium
By obtaining the token demand of a high-priority control group and the available number of public token buckets in data transmission, and recalling tokens from low-priority token buckets, the packet transmission delay in the prior art is solved in the prior art The problem of packet loss in Yamato realizes low latency and high reliability transmission of high-priority services.
Patent Information
- Application Number
- CN202110246463.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-05
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-03-05
AI Technical Summary
The prior art realizes traffic limitation based on queues during data transmission, resulting in increased packet transmission delay and increased packet loss.
By obtaining the token demand of the high-priority control group and the available number of public token buckets, if insufficient, retrieve tokens from the low-priority token bucket to achieve data transmission and ensure that high-priority services have lower transmission delay and reduce packet loss.
It effectively reduces the transmission delay of high-priority services, reduces packet loss, and improves the reliability and efficiency of data transmission.
Smart Images

Figure CN115022245B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a data transmission method, related apparatus, device and storage medium. Background Art
[0002] Control groups (cgroup) are a function of the Linux kernel that are used to limit, control, and separate the resources of a process group, for example, to limit the number of resources a process group can use, control the priority of a process group, record the number of resources used by a process group, isolate a process group, and control a process group. The Linux kernel controls the speed of network traffic mainly through the Traffic Control (TC) tool.
[0003] See also Figure 1 , Figure 1 This is a schematic diagram of implementing current limiting based on queuing rules in the existing solution. As shown in the figure, during the data transmission process, the data packet in the container is forwarded from the network card interface (ethernet, eth) to the host machine via the virtual network card interface (virtual ethernet, veth). During the data reception process, the intermediate functional block (intermediate functional block, ifb) device forwards the data packet to the container's eth through the bridge.
[0004] exist Figure 1 In the data transmission process shown, whether it is the data sending process or the data receiving process, the queuing discipline (qdisc) needs to be used to queue the data packets. However, implementing traffic restriction based on queues will result in a large transmission delay of the data packets, resulting in additional packet loss. Summary of the invention
[0005] The embodiments of the present application provide a method, related apparatus, device and storage medium for data transmission. High-priority services have higher token calling permissions and can retrieve tokens from a public token bucket and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays and reduce the occurrence of packet loss to a certain extent.
[0006] In view of this, the present application provides, on one hand, a method for data transmission, comprising:
[0007] Obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
[0008] Obtaining the available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the control group, and the public token bucket corresponds to the first priority;
[0009] If the available number of public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority level, the second priority level is less than the first priority level, and the first token set includes at least one first token;
[0010] Data transmission is performed based on the first token set.
[0011] Another aspect of the present application provides a data transmission device, comprising:
[0012] An acquisition module, configured to acquire a token demand of a first control group, wherein the first control group corresponds to a first priority;
[0013] The acquisition module is further used to acquire the available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the controlled group, and the public token bucket corresponds to the first priority;
[0014] The acquisition module is further configured to acquire a first token set from a first token bucket if the available number of public tokens is less than the token demand of the first control group, wherein the first token bucket corresponds to a second priority level, the second priority level is less than the first priority level, and the first token set includes at least one first token;
[0015] A transmission module is used for transmitting data based on the first token set.
[0016] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0017] An acquisition module, specifically used to acquire a preset bandwidth and target bandwidths of N priorities, wherein 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;
[0018] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0019] Determine the available number of public tokens according to the number of existing tokens in the public token bucket, the depth of the token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0020] or,
[0021] An acquisition module, specifically used to acquire a preset bandwidth and target bandwidths of N priorities, wherein 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;
[0022] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0023] The available number of public tokens is determined according to the number of existing tokens in the public token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time.
[0024] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0025] The acquisition module is further configured to acquire a public token set from a public token bucket if the available number of public tokens is greater than or equal to the token demand of the first control group, wherein the public token set includes at least one public token;
[0026] The transmission module is also used for data transmission based on the public token set.
[0027] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0028] An acquisition module, specifically configured to acquire the available number of first tokens in the first token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket;
[0029] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0030] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0031] An acquisition module, specifically configured to acquire the available number of first tokens in the first token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket;
[0032] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0033] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0034] an acquisition module, specifically configured to acquire a public token set from the public token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, wherein the public token set includes at least one public token;
[0035] Obtaining the available number of first tokens in the first token bucket;
[0036] Acquire a first token set from the first token bucket according to the available number of public tokens and the available number of first tokens in the first token bucket;
[0037] The transmission module is specifically used to transmit data based on the first token set and the public token set.
[0038] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0039] The acquisition module is further used to acquire the available number of first tokens in the first token bucket, and if the available number of first tokens is less than the token demand of the first control group, acquire the available number of second tokens in the second token bucket, wherein the second token bucket corresponds to a third priority, the third priority is less than the first priority, and the third priority is greater than the second priority;
[0040] The acquisition module is further configured to acquire a second token set from a second token bucket if the available number of second tokens is greater than or equal to the token demand of the first control group, the second token set including at least one second token;
[0041] The transmission module is further used to transmit data based on the second token set.
[0042] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0043] The acquisition module is further used to acquire the token demand of the second control group, wherein the second control group corresponds to the second priority;
[0044] The acquisition module is further used to acquire the available number of first tokens in the first token bucket;
[0045] The acquisition module is further configured to acquire a third token set from the first token bucket if the available quantity of the first token is less than the token demand of the second control group, wherein the third token set includes at least one third token;
[0046] The transmission module is further used to transmit data based on the third token set.
[0047] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0048] The acquisition module is further configured to acquire, after acquiring the available number of first tokens in the first token bucket, a fourth token set from the first token bucket if the available number of first tokens is greater than or equal to the token demand of the second control group, wherein the fourth token set includes at least one first token;
[0049] The transmission module is further used to transmit data based on the fourth token set.
[0050] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0051] The acquisition module is also used to acquire the target bandwidth of the second priority;
[0052] The determination module is further used to determine the available number of first tokens according to the number of existing tokens in the first token bucket, the target bandwidth of the second priority, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0053] The determination module is further configured to determine the token excess usage rate according to the available number of the first token and the bucket depth of the first token if the available number of the first token is less than zero;
[0054] The determination module is further configured to determine that the token excess usage rate is zero if the available quantity of the first token is equal to zero.
[0055] In one possible design, in another implementation of another aspect of the embodiment of the present application, the data transmission device further includes an establishment module;
[0056] Establishing module, used for establishing transmission control protocol TCP connection;
[0057] The acquisition module is also used to obtain the maximum flow receiving cache value for the TCP connection;
[0058] The determination module is further used to determine the size of the second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess usage rate;
[0059] The determination module is further used to determine the size of the target receiving window according to the size of the second receiving window and the TCP maximum transmission unit.
[0060] In one possible design, in another implementation of another aspect of the embodiment of the present application, the data transmission device further includes an establishment module;
[0061] Establishing module, used for establishing transmission control protocol TCP connection;
[0062] The acquisition module is also used to obtain the maximum flow sending cache value for the TCP connection;
[0063] The determination module is further used to determine the size of the second congestion window according to the maximum flow sending buffer value, the size of the first congestion window, the token excess utilization rate and the TCP maximum transmission unit;
[0064] The determination module is further used to determine the size of the target congestion window according to the size of the second congestion window and the preset number of segments.
[0065] Another aspect of the present application provides a network device, including: a memory, a processor, and a bus system;
[0066] Wherein, the memory is used to store programs;
[0067] The processor is used to execute the program in the memory, and the processor is used to execute the methods provided by the above aspects according to the instructions in the program code;
[0068] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0069] Another aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0070] Another aspect of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are 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, so that the network device executes the methods provided by the above aspects.
[0071] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0072] In an embodiment of the present application, a method for data transmission is provided, firstly, the token demand of the first control group is obtained, the first control group corresponds to the first priority, if the actual bandwidth of the first control group is greater than the target bandwidth of the first control group, then the available number of public tokens in the public token bucket is obtained, the public token bucket is used to store the public tokens retrieved by the control group, and the public token bucket corresponds to the first priority, if the available number of public tokens is less than the token demand of the first control group, then the first token set can be obtained from the first token bucket, the first token bucket corresponds to the second priority, the second priority is less than the first priority, the first token set includes at least one first token, and finally the first token set is used for data transmission. In the above manner, an ideal network load bandwidth (i.e., target bandwidth) of a system is manually set, and based on the priority of the control group, it is determined whether more bandwidth can be used. That is, when the total bandwidth of high priority and low priority is higher than the ideal load bandwidth, the high priority can preempt the low priority bandwidth, but the minimum available bandwidth of the low priority will still be guaranteed. During the data transmission process, for high-priority services, it can first be determined whether it can support data transmission based on the available number of public tokens. If the available number of public tokens cannot fully support data transmission based on high-priority services, tokens can be retrieved from low-priority token buckets for data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from public token buckets and other low-priority token buckets, which can, to a certain extent, make high-priority services have lower transmission delays and reduce the occurrence of packet loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 This is a schematic diagram of implementing current limiting based on queuing rules in the existing solution;
[0074] Figure 2 A schematic diagram of the architecture of a data transmission system in an embodiment of the present application;
[0075] Figure 3 This is a schematic diagram of an embodiment of a data transmission method in an embodiment of the present application;
[0076] Figure 4 A schematic diagram of the working principle of a token bucket in an embodiment of the present application;
[0077] Figure 5 A schematic diagram of implementing data processing based on a public token bucket and a first token bucket in an embodiment of the present application;
[0078] Figure 6 A schematic diagram of implementing data processing based on a token bucket in an embodiment of the present application;
[0079] Figure 7A schematic diagram of calling a full amount of tokens from a first token bucket in an embodiment of the present application;
[0080] Figure 8 Another schematic diagram of calling full tokens from the first token bucket in an embodiment of the present application;
[0081] Fig. 9 A schematic diagram of calling some tokens from the first token bucket in an embodiment of the present application;
[0082] Fig.10 A schematic diagram of calling a full amount of tokens from a second token bucket in an embodiment of the present application;
[0083] Fig.11 A schematic diagram of calling some tokens from the second token bucket in an embodiment of the present application;
[0084] Fig.12 A schematic diagram of calling a token from a public token bucket in an embodiment of the present application;
[0085] Fig.13 A schematic diagram of a data transmission framework in an embodiment of the present application;
[0086] Fig.14 A schematic diagram of a process of receiving a data packet in an embodiment of the present application;
[0087] Fig.15 A schematic diagram of a process of sending a data packet in an embodiment of the present application;
[0088] Fig.16 This is a schematic diagram of an embodiment of a data transmission device in an embodiment of the present application;
[0089] Fig.17 A schematic diagram of the structure of a network device in an embodiment of the present application. DETAILED DESCRIPTION
[0090] The embodiments of the present application provide a method, related apparatus, device and storage medium for data transmission. High-priority services have higher token calling permissions and can retrieve tokens from a public token bucket and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays and reduce the occurrence of packet loss to a certain extent.
[0091] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0092] Container technology is the core technology of cloud computing. The use of container technology can not only achieve resource isolation and restriction between applications, but also unify the application runtime environment to prevent the application from failing to run normally due to inconsistent environments. In production environments, containers are usually not used directly, but cloud platforms with container orchestration functions are used to manage and deploy containers in a unified manner. Cloud computing technology belongs to a type of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks in a wide area network or a local area network to achieve data computing, storage, processing, and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of technical network systems require a large amount of computing and storage resources, such as video websites, image websites, and more portal websites. With the rapid development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backend support, which can only be achieved through cloud computing.
[0093] Cloud computing refers to the delivery and use model of Internet technology (IT) infrastructure, which means obtaining required resources through the network in an on-demand and easily scalable manner; in a broad sense, cloud computing refers to the delivery and use model of services, which means obtaining required services through the network in an on-demand and easily scalable manner. This service can be related to IT and software, the Internet, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing. With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the promotion of search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel and distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model in terms of concept.
[0094] Generally speaking, a container consists of four parts: control groups (cgroup), namespace, rootfs, and container engine. Among them, control groups are used for resource control, namespace is used for access isolation, rootfs is used for file system isolation, and container engine is used to control the life cycle. Among them, control groups can not only limit the resources isolated by namespace, but also set weights for resources, calculate usage, and control the start and stop of tasks (processes or threads). The principle is to put a group of processes in a control group, and by allocating specified available resources to this control group, the purpose of controlling the available resources of this group of processes can be achieved.
[0095] At present, container technology is developing rapidly. Network Function Virtualization (NFV) systems have proposed to introduce container technology for business deployment. Virtual Network Function (VNF) can be deployed in containers, and containers can be deployed in both physical machines and virtual machines. Based on this, this application provides a data transmission method based on container technology. For easy understanding, please refer to Figure 2 , Figure 2This is an architectural diagram of the data transmission system in an embodiment of the present application. As shown in the figure, container 1 is a high-priority container. Therefore, container 1 can take out tokens from the high-priority token bucket, and container 2 is a low-priority container. For container 2, if there are tokens in the high-priority token bucket, container 2 can take out tokens from the high-priority token bucket first. If there are not enough tokens in the high-priority token bucket, container 2 will take out tokens from the corresponding low-priority token bucket.
[0096] However, assuming that container 1 needs more tokens, the current high-priority token bucket can no longer provide enough tokens, so the high-priority token bucket will grab tokens from the low-priority token bucket to prioritize the normal transmission of data packets in container 1. At this time, container 2 with a lower priority cannot continue to use the tokens in the high-priority token bucket, so it can only take out a certain number of tokens from the low-priority token bucket to ensure that the control group in container 2 has the minimum guaranteed bandwidth. It can be understood that containers with the same priority share a token bucket, and a container corresponds to at least one control group. Therefore, for a control group, its priority is the priority of the corresponding container, and control groups with the same priority use the same token bucket.
[0097] It should be noted that, as can be seen from the above content, the container can be deployed in a physical machine, which can be a server or a terminal device. The server involved in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal device can be a smart phone, tablet computer, laptop, PDA, personal computer, smart TV, smart watch, etc., but is not limited to this.
[0098] Combined with the above introduction, the following will introduce the method of data transmission in this application, please refer to Figure 3 , an embodiment of the data transmission method in the embodiment of the present application includes:
[0099] 101. Obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
[0100] In this embodiment, the token demand of the first control group of the data transmission device, wherein the token demand of the first control group is associated with the data packet length of the first control group, and generally, one token is used to transmit 1 bit of data. The first control group corresponds to the first priority, and the first priority is used as an example to introduce the highest priority in this application. However, it should be emphasized that the first priority in this application may also refer to a priority other than the lowest priority.
[0101] It should be noted that the data transmission device can be deployed on a processor, and the processor can be deployed on a network device, wherein the network device can be a server or a terminal device, which is not limited here.
[0102] 102. According to the token demand of the first control group, obtain the available number of public tokens in a public token bucket, wherein the public token bucket is used to store the public tokens retrieved by the control group, and the public token bucket corresponds to the first priority;
[0103] In this embodiment, the data transmission device can obtain the available number of public tokens in the public token bucket at the current moment. If the available number of public tokens at the current moment is greater than the available number of public tokens at the previous moment, it means that the public tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. On the contrary, if the available number of public tokens at the current moment is less than the available number of public tokens at the previous moment, it means that the public tokens are being consumed, that is, the actual bandwidth is greater than the target bandwidth, that is, the first control group needs to use more tokens to transmit data, so step 103 can be executed.
[0104] It should be noted that the difference between the current moment and the previous moment may be 1 second, or other times, which is not limited here.
[0105] Specifically, see Figure 4 , Figure 4 This is a schematic diagram of the working principle of the token bucket in the embodiment of the present application. Figure 4 The token bucket shown can be a public token bucket or a token bucket corresponding to other priorities, and the token can be a public token in a public token bucket or a token in a non-public token bucket, which is not limited here. The token bucket is used to implement flow control and evaluate whether the flow rate exceeds the specified value. The token bucket is a container for storing tokens, and the token refers to a virtual information packet that fills the token bucket at a given rate. For the token bucket, the depth (i.e., capacity) of the token bucket needs to be set in advance, and the system places tokens in the token bucket at the set rate. When the token bucket is full of tokens, the excess tokens will overflow.
[0106] 103. If the available number of public tokens is less than the token demand of the first control group, obtain 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 includes at least one first token;
[0107] In this embodiment, the data transmission device determines the token demand of the first control group, and the token demand indicates the number of tokens required by the first control group to transmit data in the current unit time. If the available number of public tokens is less than the token demand of the first control group, it means that the number of public tokens in the public token bucket is insufficient to support the data transmission of the first control group. At this time, the first token set is obtained from the first token bucket, and the first token set includes at least one first token. It should be noted that the first token bucket corresponds to the second priority, and the second priority is lower than the first priority.
[0108] Specifically, for ease of introduction, see Figure 5 , Figure 5 This is a schematic diagram of implementing data processing based on a public token bucket and a first token bucket in an embodiment of the present application. As shown in the figure, assuming that there are no public tokens in the public token bucket, the public token bucket can seize the tokens in the first token bucket, that is, the first token bucket lends tokens to the public token bucket. Thus, the first control group can obtain the first token set from the first token bucket.
[0109] 104. Perform data transmission based on the first token set.
[0110] In this embodiment, the data transmission device uses the first token set to implement data transmission.
[0111] Specifically, for ease of understanding, see Figure 6 , Figure 6 This is a schematic diagram of implementing data processing based on a token bucket in an embodiment of the present application. Figure 6 The token bucket shown can be the first token bucket, or a public token bucket or a token bucket corresponding to other priorities, and the token can be a token in a non-public token bucket or a public token in a public 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 will first be taken out from the token bucket according to the data size for data transmission. Data transmission needs to ensure that there are enough tokens. If the number of tokens is insufficient, the data will be discarded or cached.
[0112] It should be noted that the token poke algorithm means that tokens are added to the token poke every second, and usually, each token is 1 bit. Data will be forwarded only after the token in the token poke is taken out. If the token is not taken out, it will not be forwarded by the network device. For the first control group, public tokens can be taken out from the public token bucket first. If the public tokens in the public token bucket are exhausted, the first control group can take tokens from the first token bucket with a lower priority for data transmission. However, it should be noted that if the first token in the first token bucket is already a negative number (i.e., less than 0), the first control group can no longer use the first token, but for the second control group, even if the first token in the first token bucket is already a negative number, the first token can continue to be used. Among them, the second control group corresponds to the second priority, that is, the priority of the second control group is consistent with that of the first token bucket.
[0113] In an embodiment of the present application, a method for data transmission is provided. Through the above method, an ideal network load bandwidth (i.e., target bandwidth) of a system is manually set, and based on the priority of the control group, it is determined whether more bandwidth can be used. That is, when the total bandwidth of high priority and low priority is higher than the ideal load bandwidth, the high priority can preempt the low priority bandwidth, but the minimum available bandwidth of the low priority will still be guaranteed. In the data transmission process, for high-priority services, it can be determined whether it can support data transmission based on the available number of public tokens. If the available number of public tokens cannot fully support data transmission based on high-priority services, tokens can be retrieved from low-priority token buckets to perform data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from public token buckets and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays to a certain extent and reducing the occurrence of packet loss.
[0114] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, obtaining the available number of public tokens in the public token bucket may specifically include:
[0115] Obtain a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities include a target bandwidth corresponding to a first priority and a target bandwidth corresponding to a second priority, and N is an integer greater than or equal to 2;
[0116] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0117] Determine the available number of public tokens according to the number of existing tokens in the public token bucket, the depth of the token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0118] Or, obtain the available number of public tokens in the public token bucket, which may include:
[0119] Obtain a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities include a target bandwidth corresponding to a first priority and a target bandwidth corresponding to a second priority, and N is an integer greater than or equal to 2;
[0120] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0121] The available number of public tokens is determined based on the number of existing tokens in the public token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time.
[0122] In this embodiment, a method for obtaining the number of available tokens in a public token bucket is introduced. The data transmission device obtains a preset bandwidth set manually and a target bandwidth corresponding to N priorities. Since at least a public token bucket and a first token bucket are included in this application, the N priorities include at least a first priority and a second priority. Based on this, the method for calculating the number of available public tokens will be introduced below in combination with relevant formulas.
[0123] Specifically, the data transmission device obtains the preset bandwidth and the target bandwidth of N priorities. Assuming that N is equal to 2, the generation rate of the public token is calculated using the following formula:
[0124] BW_public=BW_ideal-BW_level_1-BW_level_2;
[0125] Among them, BW_public represents the rate of generating public tokens, BW_ideal represents the preset bandwidth, BW_level_1 represents the target bandwidth corresponding to the first priority, and BW_level_2 represents the target bandwidth corresponding to the second priority. It should be noted that if there are more priorities, the preset bandwidth minus the target bandwidth corresponding to other priorities can be used.
[0126] Based on this, after obtaining the generation rate of the public token, the following formula can be used to calculate the filling quantity of the public token:
[0127] TOKEN_public_fill=BW_public×△t;
[0128] Among them, TOKEN_public_fill represents the filling quantity of the public token, BW_public represents the generation rate of the public token, and △t represents the time difference (that is, the difference between the last token update time and the current time).
[0129] At the same time, public tokens can continue to be consumed, and the consumption amount of public tokens can be calculated using the following formula:
[0130] TOKEN_public_consume=TOKEN_Existing-skb->len;
[0131] Among them, TOKEN_public_consume indicates the number of public tokens consumed, TOKEN_Existing indicates the number of existing tokens in the public token bucket at the current moment, and skb->len indicates the length of the data packet.
[0132] Combining the number of public tokens filled and the number of public tokens consumed, the available number of public tokens is calculated as follows:
[0133] TOKEN_public_surplus=BW_public×△t+TOKEN_Existing-skb->len
[0134] =TOKEN_public_fill+TOKEN_Existing-skb->len;
[0135] Among them, TOKEN_public_surplus indicates the available number of public tokens, TOKEN_Existing indicates the number of tokens already in the public token bucket, BW_public indicates the generation rate of public tokens, △t indicates the time difference, and skb->len indicates the length of the data packet.
[0136] In one example, it is agreed that a public token bucket cannot exceed the public token depth of the token bucket.
[0137] In another example, it is agreed that a public token bucket can use public tokens with a token bucket depth in excess. Based on this, the maximum number of public tokens that can be used in excess can be determined according to the preset ratio corresponding to the token bucket depth. Exemplarily, assuming that the token bucket depth of a public token bucket is 1000, and the preset ratio corresponding to the token bucket depth of the public token bucket is 100%, the maximum number of public tokens that can be used in excess is 1000. At this time, if the available number of public tokens is -100, then the number of public tokens that need to be used is 100. Exemplarily, assuming that the token bucket depth of a public token bucket is 1000, and the preset ratio corresponding to the token bucket depth of the public token bucket is 80%, the maximum number of public tokens that can be used in excess is 800. At this time, if the available number of public tokens is -500, then the number of public tokens that need to be used is 500.
[0138] It should be noted that, in actual applications, the preset bandwidth can be set to 1 Gigabyte (GB) / second (s), and can also be set to other values according to the situation. This is only an illustration and should not be understood as a limitation on the present application. In addition, the time difference value can be a fixed value, for example, a time difference value is 1 second. Alternatively, the time difference value can be determined according to the actual update situation, and is not a fixed value. Therefore, it is not limited here.
[0139] Secondly, in an embodiment of the present application, a method for obtaining the available number of tokens in a public token bucket is provided. Through the above method, the generation rate of public tokens in the public token bucket is limited, and based on the generation rate of public tokens, combined with the existing number of tokens, time difference and length of the data packet, the available number of public tokens at the current moment can be calculated, thereby obtaining real-time calculation results, which helps to more accurately estimate whether it is necessary to obtain tokens from token buckets of other priorities, thereby improving the feasibility and operability of the solution.
[0140] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, another optional embodiment provided by the embodiment of the present application may further include:
[0141] If the available number of public tokens is greater than or equal to the token demand of the first control group, obtaining a public token set from a public token bucket, wherein the public token set includes at least one public token;
[0142] Data transfer is based on a set of public tokens.
[0143] In this embodiment, a method of directly using public tokens to achieve data transmission is introduced. The token demand of the first control group of the data transmission device, wherein the token demand of the first control group is associated with the data packet length of the first control group. Generally, one token is used to transmit 1 bit of data. If the available number of public tokens is greater than or equal to the token demand of the first control group, it means that the public tokens in the public token bucket are sufficient to support the data transmission of the first control group, so the data transmission device directly obtains the public token set for data transmission from the public token bucket.
[0144] Specifically, the data transmission device determines whether the available number of public tokens is greater than or equal to the token demand of the first control group. If the available number of public tokens is greater than or equal to the token demand of the first control group, the public token set is directly obtained from the public token bucket, and then data transmission is performed based on the public token set. On the contrary, if the available number of public tokens is less than the token demand of the first control group, the public token bucket needs to seize more tokens from other low-priority token buckets (for example, the first token bucket or the second token bucket) so that the high-priority first control group can use the token set for data transmission.
[0145] Secondly, in an embodiment of the present application, a method for directly utilizing public tokens to implement data transmission is provided. Through the above method, if the available number of public tokens is greater than or equal to the token demand of the first control group, then the public tokens are preferentially obtained from the public token bucket, thereby enabling the control group with a higher priority to seize more tokens for data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from the public token bucket and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays to a certain extent and reducing the occurrence of packet loss.
[0146] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, if the available number of public tokens is less than the token demand of the first control group, obtaining the first token set from the first token bucket may specifically include:
[0147] If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket, then obtaining the available number of first tokens in the first token bucket;
[0148] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0149] In this embodiment, a processing method based on the absence of available public tokens in the public token bucket is introduced. The token demand of the first control group of the data transmission device, wherein the token demand of the first control group is associated with the data packet length of the first control group. Generally, one token is used to transmit 1 bit of data. If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket, it means that the public tokens in the public token bucket are insufficient to support the data transmission of the first control group, so the data transmission device obtains a token set for data transmission from other token buckets.
[0150] Based on this, the data transmission device determines whether the available number of public tokens is less than the token demand of the first control group, and determines whether the available number of public tokens is less than the available number threshold corresponding to the public token bucket. If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket, it is determined that the public token bucket can no longer provide public tokens to the first control group. Therefore, the public token bucket needs to grab more tokens from other low-priority token buckets (for example, the first token bucket) so that the high-priority first control group can use the first token set for data transmission.
[0151] If the available number of public tokens is less than the token demand of the first control group, but the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, it means that although the public token bucket cannot provide all the tokens for the first control group, there are still a certain number of available tokens. Therefore, some public tokens can be provided to the first control group.
[0152] Specifically, for ease of understanding, see Figure 7 , Figure 7 This is a schematic diagram of calling the full amount of tokens from the first token bucket in an embodiment of the present application. As shown in the figure, assuming that the available quantity threshold corresponding to the public token bucket is 0, the token demand of the first control group is 100, and the available quantity of public tokens is 0, then the available quantity of public tokens (i.e., 0) is less than the token demand of the first control group (i.e., 100), and the available quantity of public tokens (i.e., 0) is equal to the available quantity threshold corresponding to the public token bucket (i.e., 0), so the public token bucket can seize the first token in the first token bucket. In other words, if the available quantity of the first token in the first token bucket is greater than or equal to the token demand of the first control group, then the public token bucket needs to seize more tokens from other low-priority token buckets (e.g., the first token bucket) so that the high-priority first control group can use the first token set for data transmission.
[0153] It is understandable that based on Figure 7 In the transmission scenario shown, the tokens used by the first control group are all from the first token bucket, so the first control group uses the first token set for data transmission. For example, if the token demand of the first control group is 100, the first token set used includes 100 first tokens.
[0154] Secondly, in the embodiment of the present application, a processing method based on the absence of available public tokens in the public token bucket is provided. Through the above method, if there are no available public tokens in the public token bucket, the tokens provided to the first control group will all come from the token buckets with lower priorities, thereby achieving to a certain extent that high-priority services have lower transmission delays and reduce the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0155] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, if the available number of public tokens is less than the token demand of the first control group, obtaining the first token set from the first token bucket may specifically include:
[0156] If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, then obtaining the available number of first tokens in the first token bucket;
[0157] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0158] In this embodiment, a processing method based on the available public tokens in the public token bucket is introduced. The token demand of the first control group of the data transmission device, wherein the token demand of the first control group is associated with the data packet length of the first control group, and usually, one token is used to transmit 1 bit of data. If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket, it means that the public tokens in the public token bucket are not enough to support the data transmission of the first control group, so the data transmission device obtains the token set for data transmission from other token buckets.
[0159] Based on this, the data transmission device determines whether the available number of public tokens is less than the token demand of the first control group, and determines whether the available number of public tokens is less than the available number threshold corresponding to the public token bucket. If the available number of public tokens is less than the token demand of the first control group, but the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, it means that although the public token bucket cannot provide all tokens for the first control group, there are still a certain number of available tokens, so some public tokens can be provided for the first control group. In this embodiment, even if the public token bucket has available tokens, the first token bucket still provides all tokens for data transmission to the first control group (i.e., provides the first token set).
[0160] Specifically, for ease of understanding, see Figure 8 , Figure 8 Another schematic diagram of calling full tokens from the first token bucket in the embodiment of the present application, as shown in the figure, assuming that the available quantity threshold corresponding to the public token bucket is 0, the token demand of the first control group is 100, and the available quantity of public tokens is 20, then the available quantity of public tokens (i.e., 20) is less than the token demand of the first control group (i.e., 100), but the available quantity of public tokens (i.e., 20) is greater than the available quantity threshold corresponding to the public token bucket (i.e., 0), so the public token bucket can seize the first token in the first token bucket. In other words, if the available quantity of the first token in the first token bucket is greater than or equal to the token demand of the first control group, then the public token bucket can seize more tokens from other low-priority token buckets (e.g., the first token bucket) so that the high-priority first control group can use the first token set for data transmission.
[0161] It is understandable that based on Figure 8 In the transmission scenario shown, the tokens used by the first control group are all from the first token bucket, so the first control group uses the first token set for data transmission. For example, if the token demand of the first control group is 100, the first token set used includes 100 first tokens.
[0162] Secondly, in the embodiment of the present application, a processing method based on the available public tokens in the public token bucket is provided. Through the above method, if there are available public tokens in the public token bucket, but the number of available public tokens is insufficient to support the data transmission of the first control group, the tokens provided to the first control group can all come from the token bucket with lower priority, thereby achieving to a certain extent that high-priority services have lower transmission delays and reduce the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0163] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, if the available number of public tokens is less than the token demand of the first control group, obtaining the first token set from the first token bucket may specifically include:
[0164] If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, obtaining a public token set from the public token bucket, wherein the public token set includes at least one public token;
[0165] Obtaining the available number of first tokens in the first token bucket;
[0166] Acquire a first token set from the first token bucket according to the available number of public tokens and the available number of first tokens in the first token bucket;
[0167] The data transmission based on the first token set may specifically include:
[0168] Data transmission is performed based on the first token set and the public token set.
[0169] In this embodiment, a method of extracting tokens from multiple different token buckets for data transmission is introduced. The data transmission device determines the token demand of the first control group, wherein the token demand of the first control group is associated with the data packet length of the first control group. Generally, one token is used to transmit 1 bit of data. If the available number of public tokens is less than the token demand of the first control group, and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket, it means that the public tokens in the public token bucket are insufficient to support the data transmission of the first control group, so the data transmission device obtains a token set for data transmission from other token buckets.
[0170] Based on this, the data transmission device determines whether the available number of public tokens is less than the token demand of the first control group, and determines whether the available number of public tokens is less than the available number threshold corresponding to the public token bucket. If the available number of public tokens is less than the token demand of the first control group, but the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, it means that although the public token bucket cannot provide all tokens for the first control group, there are still a certain number of available tokens, so some public tokens can be provided to the first control group. In this embodiment, since the public token bucket has available tokens, the public token bucket and the first token bucket jointly provide the first control group with all tokens used for data transmission (i.e., provide a public token set and a first token set).
[0171] Specifically, for ease of understanding, see Fig. 9 , Fig. 9 This is a schematic diagram of calling some tokens from the first token bucket in an embodiment of the present application. As shown in the figure, assuming that the available quantity threshold corresponding to the public token bucket is 0, the token demand of the first control group is 100, and the available quantity of public tokens is 20, then the available quantity of public tokens (i.e., 20) is less than the token demand of the first control group (i.e., 100), but the available quantity of public tokens (i.e., 20) is greater than the available quantity threshold corresponding to the public token bucket (i.e., 0), so the public token bucket can seize the first token in the first token bucket. If the sum of the available quantity of public tokens and the available quantity of the first token in the first token bucket is greater than or equal to the token demand of the first control group, then the public token bucket can seize more tokens from other low-priority token buckets (e.g., the first token bucket) so that the high-priority first control group can use the first token set for data transmission.
[0172] It is understandable that based on Fig. 9 In the transmission scenario shown, a portion of the tokens used by the first control group come from the public token bucket, and another portion comes from the first token bucket. Therefore, the first control group uses the public token set and the first token set for data transmission. For example, if the token demand of the first control group is 100, then the public token set used includes 20 public tokens, and the first token set used includes 80 first tokens.
[0173] Secondly, in the embodiment of the present application, a method of extracting tokens from multiple different token buckets for data transmission is provided. Through the above method, when there are available public tokens in the public token bucket, although the number of available public tokens is not enough to complete the data transmission supporting the first control group, some public tokens can still be provided. Based on this, the tokens provided to the first control group can be partially from the public token bucket and partially from the token bucket with lower priority, thereby achieving to a certain extent that high-priority services have lower transmission delays and reduce the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0174] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, after obtaining the available number of first tokens in the first token bucket, the following may also be included:
[0175] If the available number of first tokens is less than the token demand of the first control group, obtaining the available number of second tokens in the second token bucket, wherein the second token bucket corresponds to a third priority, the third priority is less than the first priority, and the third priority is greater than the second priority;
[0176] If the available number of second tokens is greater than or equal to the token demand of the first control group, obtaining a second token set from the second token bucket, the second token set including at least one second token;
[0177] Data transmission is performed based on the second token set.
[0178] In this embodiment, a method for processing when the available number of first tokens is insufficient to support the token demand is introduced. As can be seen from the above embodiments, the data transmission device can calculate the generation rate of public tokens based on the preset bandwidth and the target bandwidth corresponding to N priorities. The token generation rate of other token buckets (for example, the first token bucket) can be set to the target bandwidth corresponding to the priority of the token bucket.
[0179] Specifically, the filling quantity of the first token can be calculated using the following formula:
[0180] TOKEN_level_2_fill=BW_level_2×△t;
[0181] Among them, TOKEN_level_2_fill represents the filling quantity of the first token, BW_level_2 represents the target bandwidth of the second priority, and Δt represents the time difference (ie, the difference between the last token update time and the current time).
[0182] At the same time, the first token can continue to be consumed, and the consumption amount of the first token can be calculated using the following formula:
[0183] TOKEN level_2_consume=TOKEN_Existing_level_2-skb->len;
[0184] Among them, TOKEN level_2_consume indicates the consumption quantity of the first token, TOKEN_Existing_level_2 indicates the existing token quantity of the first token bucket at the current moment, and skb->len indicates the length of the data packet.
[0185] Combined with the filling quantity of the first token and the consumption quantity of the first token, the available quantity of the first token is calculated as follows:
[0186] TOKEN_level_2_surplus=BW_level_2×Δt+TOKEN_Existing_level_2-skb->len
[0187] =TOKEN_level_2_fill+TOKEN_Existing_level_2-skb->len;
[0188] Among them, TOKEN_level_2_surplus represents the available number of the first token, TOKEN_Existing_level_2 represents the number of tokens already in the first token bucket, BW_level_2 represents the target bandwidth of the second priority, △t represents the time difference, and skb->len represents the length of the data packet.
[0189] In one example, it is agreed that the first token bucket cannot exceed the first token of the token bucket depth. In another example, it is agreed that the first token bucket can exceed the first token of the token bucket depth. Based on this, the maximum number of first tokens that can be exceeded can be determined according to the preset ratio corresponding to the token bucket depth. Exemplarily, assuming that the token bucket depth of the first token bucket is 1000, and the preset ratio corresponding to the token bucket depth of the first token bucket is 100%, the maximum number of first tokens that can be exceeded is -1000. Exemplarily, assuming that the token bucket depth of the first token bucket is 1000, and the preset ratio corresponding to the token bucket depth of the first token bucket is 80%, the maximum number of first tokens that can be exceeded is -800.
[0190] In combination with the above introduction, when the available number of the first token is less than the token demand of the first control group, the corresponding second token can continue to be obtained from the second token bucket for data transmission. The following will be combined with two examples for explanation.
[0191] 1. A method of calling all tokens from the second token bucket;
[0192] Specifically, for ease of understanding, see Fig.10 , Fig.10This is a schematic diagram of calling the full amount of tokens from the second token bucket in an embodiment of the present application. As shown in the figure, assuming that the available quantity thresholds corresponding to the public token bucket and the first token bucket are both 0, the token demand of the first control group is 100, and the available quantities of the public token and the first token are both 0, then the available quantity of the public token (i.e., 0) and the available quantity of the first token (i.e., 0) are less than the token demand of the first control group (i.e., 100). In addition, the available quantity of the public token (i.e., 0) is equal to the available quantity threshold (i.e., 0) corresponding to the public token bucket, and the available quantity of the first token (i.e., 0) is equal to the available quantity threshold (i.e., 0) corresponding to the first token bucket, so the public token bucket can seize the second token in the second token bucket. In other words, if the available quantity of the second token in the second token bucket is greater than or equal to the token demand of the first control group, then the public token bucket needs to seize more tokens from other low-priority token buckets (e.g., the second token bucket) so that the high-priority first control group can use the second token set for data transmission.
[0193] It can be understood that the second token bucket corresponds to the third priority, and the third priority is lower than the second priority. Fig.10 In the transmission scenario shown, the tokens used by the first control group are all from the second token bucket, so the first control group uses the second token set for data transmission. For example, if the token demand of the first control group is 100, the second token set used includes 100 second tokens.
[0194] 2. A method of calling some tokens from the second token bucket;
[0195] Specifically, for ease of understanding, see Fig.11 , Fig.11This is a schematic diagram of calling some tokens from the second token bucket in an embodiment of the present application. As shown in the figure, it is assumed that the available quantity threshold corresponding to the public token bucket is 0, and the token demand of the first control group is 100. The available quantity of public tokens is 20, so the available quantity of public tokens (i.e., 20) is less than the token demand of the first control group (i.e., 100), but the available quantity of public tokens (i.e., 20) is greater than the available quantity threshold corresponding to the public token bucket (i.e., 0). Assuming that the available quantity of the first token is 30, the sum of the available quantity of the first token and the available quantity of the public token (i.e., 50) is less than the token demand of the first control group (i.e., 100), but the available quantity of the first token (i.e., 30) is greater than the available quantity threshold corresponding to the public token bucket (i.e., 0). Therefore, the public token bucket can seize the first token in the first token bucket and the second token in the second token bucket. If the sum of the available number of public 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 public token bucket can seize more tokens from other low-priority token buckets (for example, the first token bucket and the second token bucket) to allow the high-priority first control group to use the first token set for data transmission.
[0196] It is understandable that based on Fig.11 In the transmission scenario shown, a portion of the tokens used by the first control group come from the public token bucket, another portion comes from the first token bucket, and another portion comes from the second token bucket. Therefore, the first control group uses the public token set, the first token set, and the second token set for data transmission. For example, if the token demand of the first control group is 100, then the public token set used includes 20 public tokens, the first token set used includes 30 first tokens, and the second token set used includes 50 second tokens.
[0197] Again, in the embodiment of the present application, a method for processing the case where the available number of first tokens is insufficient to support the token demand is provided. Through the above method, the data of the first token in the first token bucket is first calculated. If the available number of the first token is less than the token demand of the first control group, more tokens can be seized from the token bucket with a lower priority for data transmission, thereby achieving lower transmission delay for high-priority services to a certain extent and reducing the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0198] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, another optional embodiment provided by the embodiment of the present application may further include:
[0199] Obtaining a token demand of a second control group, wherein the second control group corresponds to a second priority;
[0200] Obtaining the available number of first tokens in the first token bucket;
[0201] If the available quantity of the first token is less than the token demand of the second control group, obtaining a third token set from the first token bucket, wherein the third token set includes at least one third token;
[0202] Data transmission is performed based on the third token set.
[0203] In this embodiment, a method for allocating tokens to the second control group is introduced. The token demand of the second control group of the data transmission device is related to the data packet length of the second control group. Generally, one token is used to transmit 1 bit of data. The second control group corresponds to the second priority, and the second priority also has a corresponding relationship with the first token bucket.
[0204] The data transmission device can obtain the available number of first tokens in the first token bucket at the current moment. If the available number of first tokens at the current moment is greater than the available number of first tokens at the previous moment, it means that the first tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. On the contrary, if the available number of first tokens at the current moment is less than the available number of first tokens at the previous moment, it means that the first token is being consumed, that is, the actual bandwidth is greater than the target bandwidth, that is, the second control group needs to use more tokens to transmit data. It should be noted that the difference between the current moment and the previous moment can be 1 second, or it can be other times, which is not limited here.
[0205] Specifically, if the available number of first tokens is less than the token demand of the second control group, it means that the number of first tokens in the first token bucket is insufficient to support the data transmission of the second control group. At this time, a third token set can be obtained from the public token bucket, and the third token set includes at least one third token. Finally, the third token set can be used to implement data transmission.
[0206] For the second control group, the first token can be taken out from the first token bucket corresponding to its priority. If the first token in the first token bucket is exhausted, the second control group can take out the token from the public token bucket for data transmission. However, it should be noted that if the first token in the first token bucket is less than or equal to 0, then as long as the first token bucket can continue to overdraw the first token, the second control group can give priority to using the first token, that is, for the second control group, even if the first token in the first token bucket is already negative, the first token can continue to be used. Among them, the second control group corresponds to the second priority, that is, the second control group has the same priority as the first token bucket.
[0207] Secondly, in an embodiment of the present application, a method for allocating tokens to the second control group is provided. Through the above method, during the data transmission process, for lower priority services, the public tokens in the public token bucket can also be used preferentially. If the public tokens are not sufficient to support the data transmission of the second control group, the tokens are obtained from the tokens corresponding to the second control group, thereby achieving the purpose of flexible resource scheduling and improving the feasibility and operability of the solution. In addition, a device includes multiple containers. Currently, the TC tool can only be used for network card level configuration, that is, it is necessary to configure the Internet Protocol (IP) rules for each container, which leads to high configuration complexity and difficulty. The present application is configured for each control group, and there is no need to set additional IP corresponding rules.
[0208] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, after obtaining the available number of first tokens in the first token bucket, the following may also be included:
[0209] If the available quantity of the first token is greater than or equal to the token demand of the second control group, obtaining a fourth token set from the first token bucket, wherein the fourth token set includes at least one first token;
[0210] Data transmission is performed based on the fourth token set.
[0211] In this embodiment, another method of allocating tokens to the second control group is introduced. The token demand of the second control group of the data transmission device is related to the data packet length of the second control group. Generally, one token is used to transmit 1 bit of data. The second control group corresponds to the second priority, and the second priority also has a corresponding relationship with the first token bucket.
[0212] The data transmission device can obtain the available number of first tokens in the first token bucket at the current moment. If the available number of first tokens at the current moment is greater than the available number of first tokens at the previous moment, it means that the first tokens are increasing, that is, the target bandwidth is greater than the actual bandwidth. On the contrary, if the available number of first tokens at the current moment is less than the available number of first tokens at the previous moment, it means that the first token is being consumed, that is, the actual bandwidth is greater than the target bandwidth, that is, the second control group needs to use more tokens to transmit data. It should be noted that the difference between the current moment and the previous moment can be 1 second, or it can be other times, which is not limited here.
[0213] Specifically, if the available number of first tokens is greater than or equal to the token demand of the second control group, it means that the number of first tokens in the first token bucket is sufficient to support the data transmission of the first control group. At this time, the fourth token set is directly obtained from the first token bucket, and the fourth token set includes at least one public token. Finally, the public token set can be used to realize data transmission.
[0214] For easier understanding, see Fig.12 , Fig.12 This is a schematic diagram of calling a token from a public token bucket in an embodiment of the present application. As shown in the figure, the second control group can first use the first token in the first token bucket, and the first token bucket will set a minimum guaranteed token amount, that is, to ensure that the second control group can obtain the token. The tokens used by the second control group can be partly derived from the public token bucket and partly derived from the first token bucket. Alternatively, the tokens used by the second control group are all derived from the public token bucket. Alternatively, the tokens used by the second control group are all derived from the first token bucket. If there are no available tokens in the first token bucket and the public token bucket, the second control group can also use the tokens in the token bucket corresponding to the lower priority.
[0215] It should be noted that the minimum guaranteed token amount can also be a negative number. For example, -100 means that the second control group can overdraw up to 100 first tokens, but the control groups corresponding to other priorities cannot use the overdrawn first tokens, thereby further ensuring that low-priority services can also be carried out.
[0216] Again, in an embodiment of the present application, a method for allocating tokens to a second control group is provided. Through the above method, during the data transmission process, for lower priority services, the public tokens in the public token bucket can also be used preferentially, thereby achieving the purpose of flexible resource scheduling and improving the feasibility and operability of the solution. In addition, a device includes multiple containers. Currently, the TC tool can only be used for network card level configuration, that is, IP rules need to be configured for each container, which leads to high configuration complexity and difficulty. The present application is configured for each control group, and no additional IP corresponding rules need to be set.
[0217] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, another optional embodiment provided by the embodiment of the present application may further include:
[0218] Obtain the target bandwidth of the second priority;
[0219] Determine the available number of first tokens according to the number of tokens already in the first token bucket, the target bandwidth of the second priority, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0220] If the available number of first tokens is less than zero, determining the token excess usage rate according to the available number of first tokens and the bucket depth of the first tokens;
[0221] If the available number of the first token is equal to zero, the token excess usage rate is determined to be zero.
[0222] In this embodiment, a method for determining the excess utilization rate is introduced. As can be seen from the above embodiments, the available number of first tokens can be determined based on the number of tokens in the first token bucket, the target bandwidth of the second priority, the time difference, and the length of the data packet. Assuming that N is equal to 2, the generation rate of public tokens is calculated using the following formula:
[0223] BW_public=BW_ideal-BW_level_1-BW_level_2;
[0224] Among them, BW_public represents the rate of generating public tokens, BW_ideal represents the preset bandwidth, BW_level_1 represents the target bandwidth corresponding to the first priority, and BW_level_2 represents the target bandwidth corresponding to the second priority. It should be noted that if there are more priorities, the preset bandwidth minus the target bandwidth corresponding to other priorities can be used.
[0225] Based on this, after obtaining the generation rate of the public token, the following formula can be used to calculate the filling quantity of the public token:
[0226] TOKEN_public_fill=BW_public×△t;
[0227] Among them, TOKEN_public_fill represents the fill quantity of the public token, BW_public represents the generation rate of the public token, and △t represents the time difference (that is, the difference between the last token update time and the current time).
[0228] At the same time, public tokens can continue to be consumed, and the consumption amount of public tokens can be calculated using the following formula:
[0229] TOKEN_public_consume=TOKEN_Existing-skb->len;
[0230] Among them, TOKEN_public_consume indicates the number of public tokens consumed, TOKEN_Existing indicates the number of existing tokens in the public token bucket at the current moment, and skb->len indicates the length of the data packet.
[0231] Combining the number of public tokens filled and the number of public tokens consumed, the available number of public tokens is calculated as follows:
[0232] TOKEN_public_surplus=BW_public×△t+TOKEN_Existing-skb->len
[0233] =TOKEN_public_fill+TOKEN_Existing-skb->len;
[0234] Among them, TOKEN_public_surplus indicates the available number of public tokens, TOKEN_Existing indicates the number of tokens already in the public token bucket, BW_public indicates the generation rate of public tokens, △t indicates the time difference, and skb->len indicates the length of the data packet.
[0235] Specifically, when the available number of the first token is less than zero, the token excess usage rate is calculated in the following manner:
[0236] α=|TOKEN| / depth;
[0237] Wherein, α represents the token excess utilization rate, TOKEN represents the available number of the first token, and depth represents the depth of the first token bucket.
[0238] When the available number of first tokens is equal to zero, since the first tokens are not overdrawn, the token excess usage rate is 0. When the available number of first tokens is greater than zero, it means that the first token bucket can lend the first token, that is, it can be preempted by a higher priority token bucket (e.g., a public token bucket).
[0239] When the token excess usage rate is greater than or equal to 0, the sending and receiving windows can be controlled based on the token excess usage rate. For ease of introduction, please refer to Fig.13 , Fig.13 A schematic diagram of a framework for data transmission in an embodiment of the present application is shown in the figure. When receiving and sending Transmission Control Protocol (TCP) data packets, the TCP window can be flexibly adjusted by means of network isolation. Among them, network isolation includes the token bucket preemption mechanism provided by the present application.
[0240] Secondly, in the embodiment of the present application, a method for determining the excess utilization rate is provided. Through the above method, the excess utilization rate of tokens can be calculated in real time. Network isolation manages the issuance of tokens through leaky buckets, and the excess utilization rate of tokens is calculated based on the total target bandwidth of the system and the real-time actual bandwidth. In addition, the present application not only supports the traffic statistics of a single control group, but also supports the traffic statistics of all sub-control groups, which can express the traffic consumption of the container in more detail.
[0241] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, another optional embodiment provided by the embodiment of the present application may further include:
[0242] Establish a Transmission Control Protocol TCP connection;
[0243] Get the maximum traffic receiving buffer value for TCP connection;
[0244] Determine the size of the second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess usage rate;
[0245] The size of the target receiving window is determined according to the size of the second receiving window and the TCP maximum transmission unit.
[0246] In this embodiment, a method for calculating the receiving window of a TCP connection is introduced. In practical applications, multiple TCP connections can be established, and the following will be introduced by taking one TCP connection as an example.
[0247] Specifically, based on the token excess utilization rate α, the target receiving window of TCP is attenuated, that is, the size of the target receiving window is calculated in the following way:
[0248] N = log K(rmem_max);
[0249] N = roundup(N);
[0250] rwnd_2=min(rwnd_1,rmem_max*α N );
[0251] rwnd_3 = max(rwnd_2, mss)
[0252] Among them, rwnd_3 represents the size of the target receive window, rwnd_2 represents the size of the second receive window, rwnd_1 represents the size of the first receive window, rmem_max represents the maximum TCP receive buffer value in the Linux system (for example, 6291456), N represents the scaling factor, and N is an integer greater than or equal to 1, K represents the minimum attenuation coefficient (for example, 1024), roundup() represents rounding up, α represents the token excess utilization rate, and mss represents the TCP maximum transmission unit (for example, 1460 bytes).
[0253] For easier understanding, see Fig.14 , Fig.14 This is a flow chart of receiving a data packet in an embodiment of the present application, as shown in the figure, specifically:
[0254] In step A1, the network card receives a data packet.
[0255] In step A2, the processor at the receiving end searches for a socket (sock) according to the description (skb) of the data packet in the kernel, and determines the corresponding control group according to the skb.
[0256] In step A3, TCP inbound flow control is performed, thereby entering the inbound flow control process.
[0257] In step A4, protocol stack processing is performed.
[0258] In step A5, in the control process of the incoming traffic, the control group consumes the tokens of the corresponding priority according to the priority.
[0259] In step A6, the control group first attempts to use the public token in the public token bucket.
[0260] In step A7, if the public tokens are insufficient, the control group tries to use lower priority tokens.
[0261] In step A8, the token excess usage rate is calculated according to the method described in the above embodiment.
[0262] In step A9, the transmission rate of the control group is statistically controlled.
[0263] In step A10, a response data packet is received.
[0264] In step A11, after receiving the response data packet, a TCP receive window is calculated
[0265] In step A12, the TCP receiving window is attenuated according to the token excess utilization rate.
[0266] In step A13, a window scaling response is sent.
[0267] Again, in the embodiment of the present application, a method for calculating the receiving window of the TCP connection is provided. Through the above method, based on this, the present application can provide better connection fairness guarantee, improve the data packet priority of the connection life cycle, and ensure that the connection can be established and destroyed in time, so that each connection can communicate with the minimum resources. In addition, the offline sending and receiving speed can also be actively suppressed, and the sending and receiving speed of the low-priority service kernel protocol stack can be affected according to the over-sending ratio of high-priority services, so as to achieve the purpose of suppressing the sending and receiving speed of low-priority services and reducing packet loss and delay.
[0268] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, another optional embodiment provided by the embodiment of the present application may further include:
[0269] Establish a Transmission Control Protocol TCP connection;
[0270] Get the maximum traffic send buffer value for TCP connection;
[0271] Determine the size of the second congestion window according to the maximum flow sending buffer value, the size of the first congestion window, the token excess utilization rate, and the TCP maximum transmission unit;
[0272] The size of the target congestion window is determined according to the size of the second congestion window and the preset number of segments.
[0273] In this embodiment, a method for calculating the congestion window of a TCP connection is introduced. In practical applications, multiple TCP connections can be established, and the following will be introduced by taking one TCP connection as an example.
[0274] Specifically, based on the token excess utilization rate α, the target congestion window of TCP is attenuated, that is, the size of the target congestion window is calculated in the following way:
[0275] N = log K (wmem_max);
[0276] N = roundup(N);
[0277] cwnd_2=min(cwnd_1, wmem_max*α N / mss);
[0278] cwnd_3 = max(cwnd_2, 1)
[0279] Among them, cwnd_3 represents the size of the target congestion window, cwnd_2 represents the size of the second congestion window, cwnd_1 represents the size of the first congestion window, wmem_max represents the maximum TCP send buffer value in the Linux system (for example, 4194304), N represents the scaling factor, and N is an integer greater than or equal to 1, K represents the minimum decay coefficient (for example, 1024), roundup() represents rounding up, α represents the token excess utilization rate, and mss represents the TCP maximum transmission unit (for example, 1460 bytes).
[0280] For easier understanding, see Fig.15 , Fig.15 This is a flow chart of sending a data packet in an embodiment of the present application, as shown in the figure, specifically:
[0281] In step B1, both the offline control group and the online control group can send TCP data packets.
[0282] In step B2, the congestion window is calculated.
[0283] In step B3, TCP outbound flow control is performed, thereby entering the outbound flow control process.
[0284] In step B4, protocol stack processing is performed.
[0285] In step B5, in the control process of outbound traffic, the control group consumes tokens of corresponding priorities according to the priorities.
[0286] In step B6, the control group first attempts to use the public token in the public token bucket.
[0287] In step B7, if the public token is insufficient, the control group tries to use a lower priority token, for example, the first token.
[0288] In step B8, the token excess usage rate is calculated according to the method described in the above embodiment.
[0289] In step B9, the transmission rate of the group is statistically controlled.
[0290] Again, in the embodiment of the present application, a method for calculating the congestion window of a TCP connection is provided. Through the above method, based on this, the present application can provide better connection fairness guarantee, improve the priority of data packets in the connection life cycle, and ensure that the connection can be established and destroyed in time, so that each connection can communicate with the minimum resources. In addition, the offline sending and receiving speed can also be actively suppressed, and the sending and receiving speed of the low-priority service kernel protocol stack can be affected according to the over-sending ratio of high-priority services, so as to achieve the purpose of suppressing the sending and receiving speed of low-priority services and reducing packet loss and delay.
[0291] The data transmission device in this application is described in detail below. Fig.16 , Fig.16 This is a schematic diagram of an embodiment of a data transmission device in an embodiment of the present application. The data transmission device 20 includes:
[0292] An acquisition module 201 is used to acquire a token demand of a first control group, wherein the first control group corresponds to a first priority;
[0293] The acquisition module 201 is further used to acquire the available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the controlled group, and the public token bucket corresponds to the first priority;
[0294] The acquisition module 201 is further configured to acquire a first token set from a first token bucket if the available number of public tokens is less than the token demand of the first control group, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set includes at least one first token;
[0295] The transmission module 202 is configured to perform data transmission based on the first token set.
[0296] In an embodiment of the present application, a data transmission device is provided. The above device is used to manually set an ideal network load bandwidth (i.e., target bandwidth) of a system, and determine whether more bandwidth can be used based on the priority of the control group. That is, when the total bandwidth of high priority and low priority is higher than the ideal load bandwidth, the high priority can preempt the low priority bandwidth, but the minimum available bandwidth of the low priority will still be guaranteed. In the data transmission process, for high-priority services, it can be determined whether it can support data transmission based on the available number of public tokens. If the available number of public tokens cannot fully support data transmission based on high-priority services, tokens can be retrieved from low-priority token buckets to perform data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from public token buckets and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays to a certain extent and reduce the occurrence of packet loss. During the data transmission process, for high-priority services, it can first be determined whether it can support data transmission based on the available number of public tokens. If the available number of public tokens cannot fully support data transmission based on high-priority services, tokens can be retrieved from low-priority token buckets for data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from public token buckets and other low-priority token buckets, which can, to a certain extent, make high-priority services have lower transmission delays and reduce the occurrence of packet loss.
[0297] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0298] The acquisition module 201 is specifically used to acquire a preset bandwidth and target bandwidths of N priorities, wherein 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;
[0299] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0300] Determine the available number of public tokens according to the number of existing tokens in the public token bucket, the depth of the token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0301] or,
[0302] The acquisition module 201 is specifically used to acquire a preset bandwidth and target bandwidths of N priorities, wherein 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;
[0303] Subtract the preset bandwidth from the target bandwidth of N priorities to obtain the generation rate of the public token;
[0304] The available number of public tokens is determined based on the number of existing tokens in the public token bucket, the generation rate of public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time.
[0305] In an embodiment of the present application, a data transmission device is provided. The above-mentioned device is used to limit the generation rate of public tokens in a public token bucket. Based on the generation rate of public tokens, combined with the number of existing tokens, the time difference and the length of the data packet, the available number of public tokens at the current moment can be calculated. The real-time calculation result is obtained, which helps to more accurately estimate whether it is necessary to obtain tokens from token buckets of other priorities, thereby improving the feasibility and operability of the solution.
[0306] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0307] The acquisition module 201 is further configured to acquire a public token set from a public token bucket if the available number of public tokens is greater than or equal to the token demand of the first control group, wherein the public token set includes at least one public token;
[0308] The transmission module 202 is further configured to transmit data based on the public token set.
[0309] In an embodiment of the present application, a data transmission device is provided. When the above device is used, if the available number of public tokens is greater than or equal to the token demand of the first control group, the public tokens are preferentially obtained from the public token bucket, thereby enabling the control group with a higher priority to seize more tokens for data transmission. It can be seen that high-priority services have higher token calling permissions and can retrieve tokens from the public token bucket and other low-priority token buckets, thereby enabling high-priority services to have lower transmission delays to a certain extent and reducing the occurrence of packet loss.
[0310] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0311] The acquisition module 201 is specifically configured to acquire the available number of first tokens in the first token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is less than or equal to the available number threshold corresponding to the public token bucket;
[0312] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0313] In an embodiment of the present application, a data transmission device is provided. With the above device, if there is no available public token in the public token bucket, the tokens provided to the first control group will all come from the token bucket with a lower priority, thereby achieving a lower transmission delay for high-priority services to a certain extent and reducing the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0314] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0315] The acquisition module 201 is specifically configured to acquire the available number of first tokens in the first token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket;
[0316] If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, a first token set is obtained from the first token bucket.
[0317] In an embodiment of the present application, a data transmission device is provided. With the above device, if there are still available public tokens in the public token bucket, but the number of available public tokens is insufficient to support the data transmission of the first control group, the tokens provided to the first control group can all come from the token bucket with a lower priority, thereby achieving to a certain extent that the high-priority service has a lower transmission delay and reduces the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0318] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0319] The acquisition module 201 is specifically configured to acquire a public token set from the public token bucket if the available number of public tokens is less than the token demand of the first control group and the available number of public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, wherein the public token set includes at least one public token;
[0320] Obtaining the available number of first tokens in the first token bucket;
[0321] Acquire a first token set from the first token bucket according to the available number of public tokens and the available number of first tokens in the first token bucket;
[0322] The transmission module 202 is specifically configured to perform data transmission based on the first token set and the public token set.
[0323] In an embodiment of the present application, a data transmission device is provided. By using the above device, when there are available public tokens in the public token bucket, although the number of available public tokens is insufficient to complete the data transmission supporting the first control group, some public tokens can still be provided. Based on this, the tokens provided to the first control group can be partially from the public token bucket and partially from the token bucket with lower priority, thereby achieving to a certain extent that high-priority services have lower transmission delays and reduce the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0324] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0325] The acquisition module 201 is further configured to acquire the available number of first tokens in the first token bucket, and if the available number of first tokens is less than the token demand of the first control group, acquire the available number of second tokens in the second token bucket, wherein the second token bucket corresponds to a third priority, the third priority is less than the first priority, and the third priority is greater than the second priority;
[0326] The acquisition module 201 is further configured to acquire a second token set from a second token bucket if the available number of second tokens is greater than or equal to the token demand of the first control group, the second token set including at least one second token;
[0327] The transmission module 202 is further configured to perform data transmission based on the second token set.
[0328] In an embodiment of the present application, a data transmission device is provided. The above device is used to first calculate the data of the first token in the first token bucket. If the available number of the first token is less than the token demand of the first control group, more tokens can be seized from the token bucket with a lower priority for data transmission, thereby achieving a lower transmission delay for high-priority services to a certain extent and reducing the occurrence of packet loss. At the same time, in practical applications, the flexibility and diversity of token calls are increased, thereby improving the feasibility of the solution.
[0329] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0330] The acquisition module 201 is further used to acquire the token demand of the second control group, wherein the second control group corresponds to the second priority;
[0331] The acquisition module 201 is further used to acquire the available number of first tokens in the first token bucket;
[0332] The acquisition module 201 is further configured to acquire a third token set from the first token bucket if the available quantity of the first token is less than the token demand of the second control group, wherein the third token set includes at least one third token;
[0333] The transmission module 202 is further configured to perform data transmission based on the third token set.
[0334] In an embodiment of the present application, a data transmission device is provided. By using the above device, during the data transmission process, for lower priority services, the public tokens in the public token bucket can also be used preferentially. If the public tokens are not sufficient to support the data transmission of the second control group, the tokens are obtained from the tokens corresponding to the second control group, thereby achieving the purpose of flexible resource scheduling and improving the feasibility and operability of the solution. In addition, a device includes multiple containers. Currently, the TC tool can only be used for network card level configuration, that is, it is necessary to configure IP rules for each container, which leads to high configuration complexity and difficulty. The present application is configured for each control group, and no additional IP corresponding rules need to be set.
[0335] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0336] The acquisition module 201 is further configured to acquire, after acquiring the available number of first tokens in the first token bucket, a fourth token set from the first token bucket if the available number of first tokens is greater than or equal to the token demand of the second control group, wherein the fourth token set includes at least one first token;
[0337] The transmission module 202 is further configured to perform data transmission based on the fourth token set.
[0338] In an embodiment of the present application, a data transmission device is provided. By using the above device, during the data transmission process, for lower priority services, the public tokens in the public token bucket can also be used preferentially, so as to achieve the purpose of flexible resource scheduling and improve the feasibility and operability of the solution. In addition, a device includes multiple containers. Currently, the TC tool can only be used for network card level configuration, that is, IP rules need to be configured for each container, which leads to high configuration complexity and difficulty. However, the present application is configured for each control group, and no additional IP corresponding rules need to be set.
[0339] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, in another embodiment of the data transmission device 20 provided in the embodiment of the present application,
[0340] The acquisition module 201 is further used to acquire the target bandwidth of the second priority;
[0341] The determination module 203 is further used to determine the available number of first tokens according to the number of existing tokens in the first token bucket, the target bandwidth of the second priority, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time;
[0342] The determination module 203 is further configured to determine the token excess usage rate according to the available number of the first token and the bucket depth of the first token if the available number of the first token is less than zero;
[0343] The determination module 203 is further configured to determine that the token excess usage rate is zero if the available number of first tokens is equal to zero.
[0344] In an embodiment of the present application, a data transmission device is provided. By using the above device, the token excess usage rate can be calculated in real time. The network isolation manages the issuance of tokens through a leaky bucket, and the token excess usage rate is calculated based on the total target bandwidth of the system and the real-time actual bandwidth. In addition, the present application not only supports the traffic statistics of a single control group, but also supports the traffic statistics of all sub-control groups, which can express the traffic consumption of the container in more detail.
[0345] Optionally, in the above Fig.16On the basis of the corresponding embodiment, 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;
[0346] Establishing module 204, used for establishing a transmission control protocol TCP connection;
[0347] The acquisition module 201 is further used to obtain the maximum flow receiving cache value for the TCP connection;
[0348] The determination module 203 is further used to determine the size of the second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess usage rate;
[0349] The determination 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.
[0350] In the embodiment of the present application, a data transmission device is provided. By using the above device, better connection fairness guarantee can be provided, the priority of data packets in the connection life cycle can be improved, and the connection can be established and destroyed in time, so that each connection can communicate with the minimum resources. In addition, the offline sending and receiving speed can be actively suppressed, and the sending and receiving speed of the low-priority service kernel protocol stack can be affected according to the over-sending ratio of high-priority services, so as to achieve the purpose of suppressing the sending and receiving speed of low-priority services and reducing packet loss and delay.
[0351] Optionally, in the above Fig.16 On the basis of the corresponding embodiment, 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;
[0352] Establishing module 204, used for establishing a transmission control protocol TCP connection;
[0353] The acquisition module 201 is further used to obtain a maximum flow sending cache value for a TCP connection;
[0354] The determination module 203 is further used to determine the size of the second congestion window according to the maximum flow sending buffer value, the size of the first congestion window, the token excess utilization rate and the TCP maximum transmission unit;
[0355] The determination 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.
[0356] In the embodiment of the present application, a data transmission device is provided. By using the above device, better connection fairness guarantee can be provided, the priority of data packets in the connection life cycle can be improved, and the connection can be established and destroyed in time, so that each connection can communicate with the minimum resources. In addition, the offline sending and receiving speed can be actively suppressed, and the sending and receiving speed of the low-priority service kernel protocol stack can be affected according to the over-sending ratio of high-priority services, so as to achieve the purpose of suppressing the sending and receiving speed of low-priority services and reducing packet loss and delay.
[0357] Fig.17 3 is a schematic diagram of the structure 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 embodiment of the present application may be a display device.
[0358] The memory 340 may include a read-only memory and a random access memory, and provides instructions and data to the processor 330. A portion of the memory 340 may also include a non-volatile random access memory (NVRAM).
[0359] The memory 340 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
[0360] Operation instructions: include various operation instructions, used to implement various operations.
[0361] Operating system: includes various system programs used to implement various basic businesses and handle hardware-based tasks.
[0362] In the embodiment of the present application, the processor 330 is used for:
[0363] Obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority;
[0364] Obtaining the available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the control group, and the public token bucket corresponds to the first priority;
[0365] If the available number of public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority level, the second priority level is less than the first priority level, and the first token set includes at least one first token;
[0366] Data transmission is performed based on the first token set.
[0367] The processor 330 controls the operation of the network device 30, and the processor 330 may also be referred to as a central processing unit (CPU). The memory 340 may include a read-only memory and a random access memory, and provides instructions and data to the processor 330. A portion of the memory 340 may also include an NVRAM. In a specific application, the various components of the network device 30 are coupled together through a bus system 350, wherein the bus system 350 may include a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, various buses are labeled as bus systems 350 in the figure.
[0368] The method disclosed in the above embodiment 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 with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 330. The above processor 330 may be a general-purpose processor, a digital signal processor (Digital Signal Processing, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 340, and the processor 330 reads the information in the memory 340 and completes the steps of the above method in combination with its hardware.
[0369] Fig.17 For a description of Figure 3 You can understand the relevant descriptions and effects in the method part, and will not go into details here.
[0370] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0371] The present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0372] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0373] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0374] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0375] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0376] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a network device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0377] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for data transmission, characterized in that: include: Obtaining a token demand of a first control group, wherein the first control group corresponds to a first priority; Acquire an available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the control group, and the public token bucket corresponds to the first priority; If the available number of the public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket, wherein the first token bucket corresponds to a second priority level, the second priority level is less than the first priority level, and the first token set includes at least one first token; Data transmission is performed based on the first token set.
2. The method according to claim 1, characterized in that The obtaining of the available number of public tokens in the public token bucket includes: Obtain a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities include 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 bandwidth of the N priorities to obtain a generation rate of the public token; Determine the available number of the public tokens according to the number of existing tokens in the public token bucket, the depth of the token bucket, the generation rate of the public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time; Or, obtaining the available number of public tokens in the public token bucket includes: Obtain a preset bandwidth and target bandwidths of N priorities, wherein the target bandwidths of the N priorities include 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 bandwidth of the N priorities to obtain a generation rate of the public token; The available number of public tokens is determined according to the number of existing tokens in the public token bucket, the generation rate of the public tokens, the time difference and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time.
3. The method according to claim 1, characterized in that: The method further comprises: If the available number of the public tokens is greater than or equal to the token demand of the first control group, obtaining a public token set from the public token bucket, wherein the public token set includes at least one public token; Data transmission is performed based on the public token set.
4. The method according to claim 1, characterized in that: If the available number of the public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket includes: If the available number of the public tokens is less than the token demand of the first control group, and the available number of the public tokens is less than the available number threshold corresponding to the public token bucket, then obtaining the available number of first tokens in the first token bucket; If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, the first token set is obtained from the first token bucket.
5. The method according to claim 1, characterized in that If the available number of the public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket includes: If the available number of the public tokens is less than the token demand of the first control group, and the available number of the public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, then obtaining the available number of first tokens in the first token bucket; If the available quantity of the first tokens is greater than or equal to the token demand of the first control group, the first token set is obtained from the first token bucket.
6. The method according to claim 1, characterized in that If the available number of the public tokens is less than the token demand of the first control group, obtaining a first token set from a first token bucket includes: If the available number of the public tokens is less than the token demand of the first control group, and the available number of the public tokens is greater than or equal to the available number threshold corresponding to the public token bucket, a public token set is obtained from the public token bucket, wherein the public token set includes at least one public token; Obtaining the available number of first tokens in the first token bucket; Acquire the first token set from the first token bucket according to the available number of the public tokens and the available number of first tokens in the first token bucket; The performing data transmission based on the first token set includes: Data transmission is performed based on the first token set and the public token set.
7. The method according to any one of claims 4 to 6, characterized in that After obtaining the available number of first tokens in the first token bucket, the method further includes: If the available number of the first tokens is less than the token demand of the first control group, obtaining 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 less than the first priority, and the third priority is greater than the second priority; If the available quantity of the second token is greater than or equal to the token demand of the first control group, obtaining a second token set from a second token bucket, the second token set including at least one second token; Data transmission is performed based on the second token set.
8. The method according to claim 1, characterized in that The method further comprises: Obtaining a token demand of a second control group, wherein the second control group corresponds to the second priority; Obtaining the available number of first tokens in the first token bucket; If the available quantity of the first token is less than the token demand of the second control group, obtaining a third token set from the first token bucket, wherein the third token set includes at least one third token; Data transmission is performed based on the third token set.
9. The method according to claim 8, characterized in that After obtaining the available number of first tokens in the first token bucket, the method further includes: If the available quantity of the first token is greater than or equal to the token demand of the second control group, obtaining a fourth token set from the first token bucket, wherein the fourth token set includes at least one first token; Data transmission is performed based on the fourth token set.
10. The method according to any one of claims 1 to 6, 8 and 9, characterized in that The method further comprises: Obtaining a target bandwidth of the second priority; Determine the available number of the first tokens according to the number of tokens already in the first token bucket, the target bandwidth of the second priority, the time difference, and the length of the data packet, wherein the time difference represents the difference between the last token update time and the current time; If the available number of the first tokens is less than zero, determining a token excess usage 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 equal to zero, the token excess usage rate is determined to be zero.
11. The method according to claim 10, characterized in that The method further comprises: Establish a Transmission Control Protocol TCP connection; Obtaining a maximum flow receiving cache value for the TCP connection; Determine the size of the second receiving window according to the maximum flow receiving cache value, the size of the first receiving window and the token excess usage rate; The size of the target receiving window is determined according to the size of the second receiving window and the TCP maximum transmission unit.
12. The method according to claim 10, characterized in that The method further comprises: Establish a Transmission Control Protocol TCP connection; Obtaining a maximum flow rate sending cache value for the TCP connection; Determine the size of the second congestion window according to the maximum flow sending buffer value, the size of the first congestion window, the token excess utilization rate and the TCP maximum transmission unit; The size of the target congestion window is determined according to the size of the second congestion window and the preset number of segments.
13. A data transmission device, characterized in that: include: An acquisition module, configured to acquire a token demand of a first control group, wherein the first control group corresponds to a first priority; The acquisition module is further used to acquire the available number of public tokens in a public token bucket, wherein the public token bucket is used to store public tokens retrieved by the controlled group, and the public token bucket corresponds to the first priority; The acquisition module is further configured to acquire a first token set from a first token bucket if the available number of the public tokens is less than the token demand of the first control group, wherein the first token bucket corresponds to a second priority, the second priority is less than the first priority, and the first token set includes at least one first token; A transmission module is used for transmitting data based on the first token set.
14. A network device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, and the processor is used to execute the method according to any one of claims 1 to 12 according to the instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
15. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method and device for realizing promised access rate
CN101242394A
Method and device for identifying congestion status of data transmission channel
CN101267382A
