WO2020151324A1 - 一种虚拟私有云的流量控制方法及相关装置 - Google Patents

一种虚拟私有云的流量控制方法及相关装置 Download PDF

Info

Publication number
WO2020151324A1
WO2020151324A1 PCT/CN2019/117922 CN2019117922W WO2020151324A1 WO 2020151324 A1 WO2020151324 A1 WO 2020151324A1 CN 2019117922 W CN2019117922 W CN 2019117922W WO 2020151324 A1 WO2020151324 A1 WO 2020151324A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
tokens
token bucket
size
token
Prior art date
Application number
PCT/CN2019/117922
Other languages
English (en)
French (fr)
Inventor
匡光彩
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020151324A1 publication Critical patent/WO2020151324A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames

Definitions

  • This application relates to the field of cloud computing, and in particular to a flow control method and related devices of a virtual private cloud.
  • the virtual private cloud builds an isolated virtual network environment for elastic cloud servers that users can configure and manage independently, improve the security of the resources in the user cloud, simplify the user's network deployment, and in the network communication process, in order to enable more limited network resources To play a good role in preventing a large number of bursts of user data from congesting the network, user traffic must be controlled.
  • cloud computing vendors traffic control in virtual private clouds restricts the same traffic to each distributed gateway in the virtual private cloud, so that the traffic allocated to each distributed gateway is fixed.
  • the traffic resources on the distributed gateways without traffic demand cannot be used by other distributed gateways with traffic demand, which will cause waste of traffic resources and inaccurate flow control.
  • the embodiments of the present application provide a flow control method and related devices of a virtual private cloud, so as to make the flow control of the virtual private cloud more accurate.
  • the first aspect of the present application provides a flow control method for a virtual private cloud.
  • the controller of the virtual private cloud is provided with a total token bucket
  • the distributed gateway of the virtual private cloud is provided with a sub-token bucket, including:
  • the distributed gateway When the distributed gateway sends a data packet, acquiring the size of the data packet sent by the distributed gateway;
  • the second aspect of the present application provides a flow control device for a virtual private cloud.
  • a total token bucket is set in a controller of the virtual private cloud, and a sub-token bucket is set in a distributed gateway of the virtual private cloud.
  • the device includes:
  • the first obtaining module is configured to obtain the size of the data packet sent by the distributed gateway when the distributed gateway sends the data packet;
  • the first sending module is configured to send a flow request to the controller, and when the flow request carries a token issuance instruction, the flow request is used to instruct the controller to send according to the average transmission set by the virtual private cloud The rate of issuing the tokens in the total token bucket to the sub-token bucket;
  • the second acquiring module is configured to acquire the first token quantity in the token bucket
  • a judging module for judging whether the size of the data packet is smaller than the number of the first tokens
  • the second sending module is configured to send the data packet through the tokens in the token bucket when the size of the data packet is smaller than the number of the first tokens;
  • the deleting module is used to delete a number of tokens corresponding to the size of the data packet from the token bucket.
  • the third aspect of the present application provides an electronic device, the electronic device includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are The configuration is executed by the processor, and the program includes instructions for executing the steps in any method of the first aspect of the present application.
  • the fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the part described in any method of the first aspect of the present application Or all steps.
  • the distributed gateway with flow demand can obtain corresponding flow resources, which avoids the phenomenon that the distributed gateway without flow demand occupies network flow resources.
  • the rate of outgoing data packets can be controlled, thereby avoiding network congestion and achieving more precise flow control.
  • FIG. 1 is a flowchart of a flow control method for a virtual private cloud provided by an embodiment of the application
  • FIG. 2 is a flowchart of another method for flow control of a virtual private cloud provided by an embodiment of the application
  • FIG. 3 is a flowchart of another method for flow control of a virtual private cloud provided by an embodiment of the application
  • FIG. 4 is a flowchart of another method for flow control of a virtual private cloud provided by an embodiment of the application
  • Figure 5 is a schematic structural diagram of a virtual private cloud in an embodiment of the application.
  • FIG. 6 is a schematic diagram of a distributed gateway sending data packets in an embodiment of the application.
  • FIG. 7 is a schematic diagram of another distributed gateway sending data packets in an embodiment of this application.
  • FIG. 8 is a schematic diagram of a flow control device for a virtual private cloud provided by an embodiment of this application.
  • FIG. 9 is a schematic structural diagram of an electronic device in a hardware operating environment involved in an embodiment of the application.
  • the flow control method and related devices of the virtual private cloud provided in the embodiments of the present application make the flow control of the virtual private cloud more accurate.
  • the virtual private cloud includes a controller and a distributed gateway.
  • the controller of the virtual private cloud is provided with a total token bucket
  • the distributed gateway of the virtual private cloud is provided with a sub-token bucket.
  • FIG. 1 is a flowchart of a flow control method for a virtual private cloud provided by an embodiment of the application.
  • a method for traffic control of a virtual private cloud provided by an embodiment of the present application may include:
  • the distributed gateway sends a data packet, acquire the size of the data packet sent by the distributed gateway.
  • the distributed gateway when the distributed gateway sends a data packet, it first verifies the authority of the data packet, that is, before obtaining the size of the data packet, the distributed gateway obtains the source address of the data packet And the destination address, and then the distributed gateway confirms that the distributed gateway has the right to send the data packet to the destination address of the data packet according to the source address and the destination address of the data packet.
  • the total token bucket in the controller continuously generates tokens at a fixed rate.
  • the fixed rate is the average sending rate set by the virtual private cloud, and the capacity of the total token bucket is limited. If the tokens are not consumed or are The consumption rate is less than the generation rate, so the total token bucket will continue to increase until the total token bucket is filled, the tokens generated later will overflow from the total token bucket, and finally the total token bucket The number of tokens in the bucket is consistent with the capacity of the total token bucket.
  • the token bucket in the distributed gateway does not generate tokens. If the distributed gateway wants to send data packets, the total token bucket is required to deliver the tokens to the token buckets. If there are enough token buckets If there are not enough tokens in the token bucket, the data packet is not allowed to be sent. Data packets of different sizes consume different tokens. The larger the data packet, the more it needs to be consumed. The greater the number of tokens, and when the distributed gateway sends a data packet, it needs to delete the number of tokens corresponding to the size of the data packet from the token bucket and send the data packet to the network.
  • the controller When the controller receives a traffic request sent by the distributed gateway, and the traffic request carries a token issuing instruction, the controller sends the tokens in the total token bucket to the distributed gateway according to the average sending rate set by the virtual private cloud In the token bucket, the distributed gateway can send data packets by consuming the tokens in the token bucket.
  • the distributed gateway obtains the first number of tokens in the sub-token bucket before it can judge whether to send the data packet or discard the data packet.
  • the distributed gateway Since the distributed gateway needs to consume a number of tokens corresponding to the size of the data packet when sending a data packet, it is necessary to determine the relationship between the size of the data packet and the number of tokens in the token bucket before sending the data packet.
  • the data packet is discarded.
  • the distributed gateway does not directly discard the data packet, but stores the data packet in the queue to be sent, and after a period of time, obtains the token bucket again Medium number of tokens, when the size of the data packet is smaller than the number of tokens in the token bucket obtained again, send the data packet stored in the queue to be sent, and delete the data packet corresponding to the size of the data packet from the token bucket The number of tokens.
  • FIG. 2 is a flowchart of another method for flow control of a virtual private cloud provided by another embodiment of the application.
  • another method for traffic control of a virtual private cloud provided by another embodiment of the present application may include:
  • the distributed gateway verifies the authority of the data packet.
  • the distributed gateway When the distributed gateway sends a data packet, the distributed gateway first verifies the authority of the data packet. Specifically, the distributed gateway obtains the source address and destination address of the data packet, and then the distributed gateway confirms according to the source address and destination address of the data packet The distributed gateway has the authority to send the data packet to the destination address of the data packet.
  • the distributed gateway obtains the size of the data packet.
  • the distributed gateway sends a traffic request to the controller.
  • the controller sends the tokens in the total token bucket to the sub-token buckets according to the average sending rate set by the virtual private cloud. in.
  • the total token bucket in the controller continuously generates tokens at a fixed rate.
  • the fixed rate is the average sending rate set by the virtual private cloud, and the capacity of the total token bucket is limited. If the tokens are not consumed or are The consumption rate is less than the generation rate, so the total token bucket will continue to increase until the total token bucket is filled, the tokens generated later will overflow from the total token bucket, and finally the total token bucket The number of tokens in the bucket is consistent with the capacity of the total token bucket.
  • the token bucket in the distributed gateway does not generate tokens. If the distributed gateway wants to send data packets, the total token bucket is required to deliver the tokens to the token buckets. If there are enough token buckets If there are not enough tokens in the token bucket, the data packet is not allowed to be sent. Data packets of different sizes consume different tokens. The larger the data packet, the more it needs to be consumed. The greater the number of tokens, and when the distributed gateway sends a data packet, it needs to delete the number of tokens corresponding to the size of the data packet from the token bucket and send the data packet to the network.
  • the controller When the controller receives a traffic request sent by the distributed gateway, and the traffic request carries a token issuing instruction, the controller sends the tokens in the total token bucket to the distributed gateway according to the average sending rate set by the virtual private cloud In the token bucket, the distributed gateway can send data packets by consuming the tokens in the token bucket.
  • the distributed gateway obtains the first token quantity in the token bucket.
  • the distributed gateway obtains the first number of tokens in the sub-token bucket before it can judge whether to send the data packet or discard the data packet.
  • the distributed gateway Since the distributed gateway needs to consume a number of tokens corresponding to the size of the data packet when sending a data packet, it is necessary to determine the relationship between the size of the data packet and the number of tokens in the token bucket before sending the data packet.
  • the distributed gateway stores the data packet in the queue to be sent.
  • the distributed gateway does not directly discard the data packet, but stores the data packet in the queue to be sent, and waits for enough tokens in the token bucket to send the data. package.
  • the distributed gateway obtains the second number of tokens in the token bucket.
  • the controller sends the tokens in the total token bucket to the sub-token buckets according to the average sending rate set by the virtual private cloud, after the first preset time, there may be enough data in the sub-token buckets. Packet sent by the token, so the distributed gateway obtains the second token quantity in the token bucket.
  • the distributed gateway sends the data packet stored in the queue to be sent through the tokens in the token bucket.
  • the distributed gateway deletes a number of tokens corresponding to the size of the data packet from the token bucket.
  • FIG. 3 is a flowchart of another method for flow control of a virtual private cloud provided by another embodiment of the application.
  • another method for traffic control of a virtual private cloud provided by another embodiment of the present application may include:
  • the distributed gateway sends a data packet, obtain the size of the data packet sent by the distributed gateway.
  • the distributed gateway when the distributed gateway sends a data packet, it first verifies the permission of the data packet, that is, before obtaining the size of the data packet, the distributed gateway obtains the source address and destination address of the data packet, and then the distributed gateway The source address and destination address of the packet confirm that the distributed gateway has the authority to send the packet to the destination address of the packet.
  • the total token bucket in the controller continuously generates tokens at a fixed rate.
  • the fixed rate is the average sending rate set by the virtual private cloud, and the capacity of the total token bucket is limited. If the tokens are not consumed or are The consumption rate is less than the generation rate, so the total token bucket will continue to increase until the total token bucket is filled, the tokens generated later will overflow from the total token bucket, and finally the total token bucket The number of tokens in the bucket is consistent with the capacity of the total token bucket.
  • the token bucket in the distributed gateway does not generate tokens. If the distributed gateway wants to send data packets, the total token bucket is required to deliver the tokens to the token buckets. If there are enough token buckets If there are not enough tokens in the token bucket, the data packet is not allowed to be sent. Data packets of different sizes consume different tokens. The larger the data packet, the more it needs to be consumed. The greater the number of tokens, and when the distributed gateway sends a data packet, it needs to delete the number of tokens corresponding to the size of the data packet from the token bucket and send the data packet to the network.
  • the controller When the controller receives the flow request sent by the distributed gateway, and the flow request carries the size of the data packet, the controller obtains the third number of tokens in the total token bucket.
  • the distributed gateway Since the distributed gateway needs to consume a number of tokens corresponding to the size of the data packet when sending a data packet, it is necessary to determine the relationship between the size of the data packet and the number of tokens in the token bucket before sending the data packet.
  • issuing the tokens in the total token bucket to the sub-token bucket includes:
  • All tokens in the total token bucket corresponding to the size of the data packet are issued to the sub-token bucket. For example, if the size of the data packet is K bytes, then all the K tokens in the total token bucket Delivered to the token bucket.
  • the distributed gateway can first use 70 tokens to send the first 70 bytes of the data packet.
  • the total token bucket will then send the remaining 30 tokens to the sub-token bucket, which can shorten The time when the tokens in the total token bucket are issued to the divided token buckets.
  • FIG. 4 is a flowchart of another method for flow control of a virtual private cloud provided by another embodiment of the application.
  • another method for traffic control of a virtual private cloud provided by another embodiment of the present application may include:
  • the distributed gateway when the distributed gateway sends a data packet, it first verifies the permission of the data packet, that is, before obtaining the size of the data packet, the distributed gateway obtains the source address and destination address of the data packet, and then the distributed gateway The source address and destination address of the packet confirm that the distributed gateway has the authority to send the packet to the destination address of the packet.
  • the total token bucket in the controller continuously generates tokens at a fixed rate.
  • the fixed rate is the average sending rate set by the virtual private cloud, and the capacity of the total token bucket is limited. If the tokens are not consumed or are The consumption rate is less than the generation rate, so the total token bucket will continue to increase until the total token bucket is filled, the tokens generated later will overflow from the total token bucket, and finally the total token bucket The number of tokens in the bucket is consistent with the capacity of the total token bucket.
  • the token bucket in the distributed gateway does not generate tokens. If the distributed gateway wants to send data packets, the total token bucket is required to deliver the tokens to the token buckets. If there are enough token buckets If there are not enough tokens in the token bucket, the data packet is not allowed to be sent. Data packets of different sizes consume different tokens. The larger the data packet, the more it needs to be consumed. The greater the number of tokens, and when the distributed gateway sends a data packet, it needs to delete the number of tokens corresponding to the size of the data packet from the token bucket and send the data packet to the network.
  • the controller When the controller receives the flow request sent by the distributed gateway, and the flow request carries the size of the data packet, the controller obtains the third number of tokens in the total token bucket.
  • the distributed gateway Since the distributed gateway needs to consume a number of tokens corresponding to the size of the data packet when sending a data packet, it is necessary to determine the relationship between the size of the data packet and the number of tokens in the token bucket before sending the data packet.
  • issuing the tokens in the total token bucket to the sub-token bucket includes:
  • All tokens in the total token bucket corresponding to the size of the data packet are issued to the sub-token bucket. For example, if the size of the data packet is K bytes, then all the K tokens in the total token bucket Delivered to the token bucket.
  • the sub-token bucket first distribute Q% of the tokens in the total token bucket corresponding to the size of the data packet to the sub-token bucket, where Q is a positive integer less than 100, and then combine the total token bucket with the data
  • the size of the packet corresponds to (100-Q)% of the number of tokens issued to the token bucket, for example, the size of the data packet is 100 bytes, when Q is 70, the total token bucket 70 tokens are issued to the sub-token bucket, and then 30 tokens in the total token bucket are issued to the sub-token bucket.
  • the distributed gateway can first use 70 tokens to send the first 70 bytes of the data packet, and when sending the total token bucket, the remaining 30 tokens will be sent to the sub-token bucket, which can shorten The time when the tokens in the total token bucket are issued to the divided token buckets.
  • the virtual private cloud includes a virtual private cloud controller and N distributed gateways.
  • the virtual private cloud controller is equipped with a total token bucket.
  • the total token bucket in the virtual private cloud controller generates tokens at a fixed rate, and the capacity of the total token bucket is limited.
  • the token bucket in the distributed gateway does not generate tokens. If the distributed gateway wants to send data packets, the total token bucket is required to deliver the tokens to the token buckets.
  • the distributed gateway sends data packets , It is necessary to delete the number of tokens corresponding to the size of the data packet from the token bucket, and send the data packet to the network.
  • FIG. 6 is a schematic diagram of a distributed gateway sending data packets according to an embodiment of the application. As shown in Figure 6, when multiple data packets of different sizes are input, and the data packets are sent through the distributed gateway, if the number of tokens in the token bucket is not enough to send part of the data packets, the part of the data packets is discarded.
  • FIG. 7 is a schematic diagram of another distributed gateway sending a data packet according to an embodiment of the application.
  • distributed gateway 1, distributed gateway 2, distributed gateway N, etc. input data packets respectively.
  • the number of tokens in the token bucket of distributed gateway 1 is not less than the size of the data packet, and distributed gateway 1 sends the data packet; the number of tokens in the token bucket of distributed gateway 2 is less than the size of the data packet, and the distribution The distributed gateway 1 discards the data packet; the number of tokens in the token bucket of the distributed gateway 3 is not less than the size of the data packet, and the distributed gateway 3 sends the data packet.
  • FIG. 8 is a schematic diagram of a flow control apparatus for a virtual private cloud provided by another embodiment of the application.
  • a flow control apparatus for a virtual private cloud provided by another embodiment of the present application may include:
  • the first obtaining module 801 is configured to obtain the size of the data packet sent by the distributed gateway when the distributed gateway sends a data packet.
  • the first sending module 802 is configured to send a flow request to the controller.
  • the flow request carries a token issuance instruction
  • the flow request is used to instruct the controller to set the average value according to the virtual private cloud.
  • the sending rate delivers the tokens in the total token bucket to the divided token buckets.
  • the second acquiring module 803 is configured to acquire the first token quantity in the token bucket.
  • the determining module 804 is configured to determine whether the size of the data packet is smaller than the number of the first tokens.
  • the second sending module 805 is configured to send the data packet through the tokens in the token bucket when the size of the data packet is smaller than the number of the first tokens.
  • the deleting module 806 is configured to delete a number of tokens corresponding to the size of the data packet from the token bucket.
  • FIG. 9 is a schematic structural diagram of an electronic device in a hardware operating environment involved in an embodiment of the application.
  • the electronic device in the hardware operating environment involved in the embodiment of the present application may include:
  • the processor 901 is, for example, a CPU.
  • the memory 902 optionally, the memory may be a high-speed RAM memory, or a stable memory, such as a disk memory.
  • the communication interface 903 is used to implement connection and communication between the processor 901 and the memory 902.
  • FIG. 9 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or different component arrangements. .
  • the memory 902 may include an operating system, a network communication module, and a flow control program of the virtual private cloud.
  • the operating system is a program that manages and controls the hardware and software resources of electronic devices, supports the flow control program of the virtual private cloud and the operation of other software or programs.
  • the network communication module is used to implement communication between various components in the memory 902 and communication with other hardware and software in the electronic device.
  • the processor 901 is configured to execute the flow control program of the virtual private cloud stored in the memory 902, and implement the following steps:
  • the distributed gateway When the distributed gateway sends a data packet, the size of the data packet sent by the distributed gateway is acquired.
  • the traffic request is used to instruct the controller to transfer the total tokens at the average sending rate set by the virtual private cloud
  • the tokens in the bucket are delivered to the sub-token bucket.
  • the data packet is sent through the tokens in the sub-token bucket.
  • Another embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:
  • the distributed gateway When the distributed gateway sends a data packet, the size of the data packet sent by the distributed gateway is acquired.
  • the traffic request is used to instruct the controller to transfer the total tokens at the average sending rate set by the virtual private cloud
  • the tokens in the bucket are delivered to the sub-token bucket.
  • the data packet is sent through the tokens in the sub-token bucket.

Landscapes

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

Abstract

本申请涉及云计算领域,提供一种虚拟私有云的流量控制方法及相关装置。一种虚拟私有云的流量控制方法中,虚拟私有云的控制器中设置总令牌桶,分布式网关中设置分令牌桶,包括:当发送数据包时,获取分布式网关发送数据包的大小;向控制器发送流量请求,当流量请求携带下发令牌指令时,流量请求用于指示控制器按照虚拟私有云设置的平均发送速率将总令牌桶中的令牌下发到分令牌桶中;获取分令牌桶中的第一令牌数量;当数据包的大小比第一令牌数量小时,通过分令牌桶中的令牌发送数据包;从分令牌桶中删除与数据包的大小对应数量的令牌。本申请实施例的技术方案,使得虚拟私有云的流量控制更精确。

Description

一种虚拟私有云的流量控制方法及相关装置
本申请要求于2019年1月23日提交中国专利局、申请号为2019100632201、申请名称为“一种虚拟私有云的流量控制方法及相关装置”的中国专利申请的优先权,其部分内容通过引用结合在本申请中。
技术领域
本申请涉及云计算领域,尤其涉及一种虚拟私有云的流量控制方法及相关装置。
背景技术
虚拟私有云为弹性云服务器构建隔离的、用户自主配置和管理的虚拟网络环境,提升用户云中资源的安全性,简化用户的网络部署,在网络通信过程中,为了使有限的网络资源能够更好地发挥作用,防止大量突发的用户数据使网络发生拥塞,必须对用户流量进行控制。
目前,云计算厂商在虚拟私有云的流量控制,对虚拟私有云中的每个分布式网关限制相同的流量,这样分配给每个分布式网关的流量是固定的,当访问源较少时,没有流量需求的分布式网关上的流量资源不能为其他有流量需求的分布式网关所使用,这样会造成流量资源的浪费,而且流量控制不精确。
发明内容
本申请实施例提供一种虚拟私有云的流量控制方法及相关装置,以使得虚拟私有云的流量控制更精确。
本申请第一方面提供一种虚拟私有云的流量控制方法,所述虚拟私有云的控制器中设置总令牌桶,所述虚拟私有云的分布式网关中设置分令牌桶,包括:
当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小;
向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中;
获取所述分令牌桶中的第一令牌数量;
判断所述数据包的大小是否比所述第一令牌数量小;
当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包;
从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。。
本申请第二方面提供了一种虚拟私有云的流量控制装置,所述虚拟私有云的控制器中设置总令牌桶,所述虚拟私有云的分布式网关中设置分令牌桶,所述装置包括:
第一获取模块,用于当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小;
第一发送模块,用于向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中;
第二获取模块,用于获取所述分令牌桶中的第一令牌数量;
判断模块,用于判断所述数据包的大小是否比所述第一令牌数量小;
第二发送模块,用于当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包;
删除模块,用于从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
本申请第三方面提供了一种电子设备,所述电子设备包括处理器、存储器、通信接口以及一个或多个程序,其中,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行本申请第一方面任一方法中的步骤的指令。
本申请第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行以实现本申请第一方面任一方法中所描述的部分或全部步骤。
可以看到,通过本申请提出虚拟私有云的流量控制方法及相关装置,有流量需求的分布式网关可以得到相应的流量资源,避免了没有流量需求的分布式网关占用网络流量资源的现象。而且通过控制总令牌桶向分令牌桶下发令牌的速率可以控制数据包外发的速率,从而避免了网络拥塞现象,实现更精确的流量控制。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种虚拟私有云的流量控制方法的流程图;
图2为本申请实施例提供的另一种虚拟私有云的流量控制方法的流程图;
图3为本申请实施例提供的另一种虚拟私有云的流量控制方法的流程图;
图4为本申请实施例提供的另一种虚拟私有云的流量控制方法的流程图;
图5为本申请实施例中虚拟私有云的结构示意图;
图6为本申请实施例中一种分布式网关发送数据包的示意图;
图7为本申请实施例中另一种分布式网关发送数据包的示意图;
图8为本申请实施例提供的一种虚拟私有云的流量控制装置的示意图;
图9为本申请实施例涉及的硬件运行环境的电子设备结构示意图。
具体实施方式
本申请实施例提供的虚拟私有云的流量控制方法及相关装置,以使得虚拟私有云的流量控制更精确。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
以下分别进行详细说明。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请的实施例中,虚拟私有云包括控制器和分布式网关,虚拟私有云的控制器中设置总令牌桶,虚拟私有云的分布式网关中设置分令牌桶。
首先参见图1,图1为本申请的一个实施例提供的一种虚拟私有云的流量控制方法的流程图。其中,如图1所示,本申请的一个实施例提供的一种虚拟私有云的流量控制方法可以包括:
101、当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小。
可选的,当所述分布式网关发送数据包时,先对所述数据包的权限进行验证,即在获取所述数据包的大小之前,所述分布式网关获取所述数据包的源地址和目标地址,然后所述分布式网关根据所述数据包的源地址和目标地址确认所述分布式网关有将所述数据包发送到所述数据包的目标地址的权限。
102、向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中。
其中,控制器中的总令牌桶以固定速率源源不断产生令牌,固定速率为虚拟私有云设置的平均发送速率,而且总令牌桶的容量是有限的,如果令牌不被消耗或者被消耗的速度小于产生的速度,那么总令牌桶中的令牌会不断增多,直到把总令牌桶填满,后面再产生的令牌就会从总令牌桶中溢出,最后总令牌桶中的令牌数与总令牌桶的容量保持一致。
分布式网关中的分令牌桶不会产生令牌,如果分布式网关要发送数据包,那么需要总令牌桶将令牌下发到分令牌桶中,如果分令牌桶中有足够的令牌,那么允许发送数据包,如果分令牌桶中没有足够的令牌,则不允许发送数据包, 不同大小的数据包消耗的令牌数量也不一样,数据包越大,需要消耗的令牌数量越多,而且当分布式网关发送数据包时,需要从分令牌桶中删除与数据包的大小对应数量的令牌,将数据包发送到网络。
当控制器接收到分布式网关发送的流量请求,该流量请求携带下发令牌指令时,控制器按照虚拟私有云设置的平均发送速率将总令牌桶中的令牌下发到分布式网关的分令牌桶中,这样分布式网关可以通过消耗分令牌桶中的令牌发送数据包。
103、获取所述分令牌桶中的第一令牌数量。
其中,分令牌桶中不会产生令牌,分令牌桶中的令牌是由总令牌桶以固定速率下发的,而且分令牌桶的容量也是有限的,在发送数据包之前,分布式网关获取分令牌桶中的第一令牌数量,才能判断是发送数据包还是丢弃数据包。
104、判断所述数据包的大小是否比所述第一令牌数量小。
由于分布式网关发送数据包时需要消耗与数据包的大小对应数量的令牌,所以发送数据包之前,需要先判断数据包的大小与分令牌桶中的令牌数量的关系。
105、当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包。
106、从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
可选的,当所述数据包的大小比所述第一令牌数量大时,丢弃所述数据包。
可选的,当数据包的大小比第一令牌数量大时,分布式网关不直接丢弃数据包,而是将数据包存储在待发送队列中,经过一段时间后,再次获取分令牌桶中令牌数量,当数据包的大小比再次获取的分令牌桶中的令牌数量小时,发送存储在待发送队列中的数据包,并且从分令牌桶中删除与数据包的大小对应数量的令牌。
参见图2,图2为本申请的另一个实施例提供的另一种虚拟私有云的流量控制方法的流程图。其中,如图2所示,本申请的另一个实施例提供的另一种虚拟私有云的流量控制方法可以包括:
201、当分布式网关发送数据包时,分布式网关对数据包的权限进行验证。
当分布式网关发送数据包时,分布式网关先对数据包的权限进行验证,具体为分布式网关获取数据包的源地址和目标地址,然后分布式网关根据数据包的源地址和目标地址确认分布式网关有将数据包发送到数据包的目标地址的权限。
202、分布式网关获取数据包的大小。
203、分布式网关向控制器发送流量请求,当流量请求携带下发令牌指令时,控制器按照虚拟私有云设置的平均发送速率将总令牌桶中的令牌下发到分令牌桶中。
其中,控制器中的总令牌桶以固定速率源源不断产生令牌,固定速率为虚 拟私有云设置的平均发送速率,而且总令牌桶的容量是有限的,如果令牌不被消耗或者被消耗的速度小于产生的速度,那么总令牌桶中的令牌会不断增多,直到把总令牌桶填满,后面再产生的令牌就会从总令牌桶中溢出,最后总令牌桶中的令牌数与总令牌桶的容量保持一致。
分布式网关中的分令牌桶不会产生令牌,如果分布式网关要发送数据包,那么需要总令牌桶将令牌下发到分令牌桶中,如果分令牌桶中有足够的令牌,那么允许发送数据包,如果分令牌桶中没有足够的令牌,则不允许发送数据包,不同大小的数据包消耗的令牌数量也不一样,数据包越大,需要消耗的令牌数量越多,而且当分布式网关发送数据包时,需要从分令牌桶中删除与数据包的大小对应数量的令牌,将数据包发送到网络。
当控制器接收到分布式网关发送的流量请求,该流量请求携带下发令牌指令时,控制器按照虚拟私有云设置的平均发送速率将总令牌桶中的令牌下发到分布式网关的分令牌桶中,这样分布式网关可以通过消耗分令牌桶中的令牌发送数据包。
204、分布式网关获取分令牌桶中的第一令牌数量。
其中,分令牌桶中不会产生令牌,分令牌桶中的令牌是由总令牌桶以固定速率下发的,而且分令牌桶的容量也是有限的,在发送数据包之前,分布式网关获取分令牌桶中的第一令牌数量,才能判断是发送数据包还是丢弃数据包。
205、判断数据包的大小是否比第一令牌数量小。
由于分布式网关发送数据包时需要消耗与数据包的大小对应数量的令牌,所以发送数据包之前,需要先判断数据包的大小与分令牌桶中的令牌数量的关系。
206、当数据包的大小比第一令牌数量大时,分布式网关将数据包存储在待发送队列中。
当数据包的大小比第一令牌数量大时,分布式网关不直接丢弃数据包,而是将数据包存储在待发送队列中,等待分令牌桶中有足够的令牌再发送该数据包。
或者,还可以继续发送数据包,但是需要对数据包做特殊标记,数据包发送到网络上后,如果网络过载或者拥塞,那么将有特殊标记的数据包丢弃。
207、经过第一预设时间后,分布式网关获取分令牌桶中的第二令牌数量。
由于控制器按照虚拟私有云设置的平均发送速率将总令牌桶中的令牌下发到分令牌桶中,所以经过第一预设时间后,有可能分令牌桶中已经有足够数据包发送的令牌,所以分布式网关获取分令牌桶中的第二令牌数量。
208、当数据包的大小比第二令牌数量小时,分布式网关通过分令牌桶中的令牌发送存储在待发送队列中的数据包。
209、分布式网关从分令牌桶中删除与数据包的大小对应数量的令牌。
参见图3,图3为本申请的另一个实施例提供的另一种虚拟私有云的流量 控制方法的流程图。其中,如图3所示,本申请的另一个实施例提供的另一种虚拟私有云的流量控制方法可以包括:
301、当分布式网关发送数据包时,获取分布式网关发送数据包的大小。
可选的,当分布式网关发送数据包时,先对数据包的权限进行验证,即在获取数据包的大小之前,分布式网关获取数据包的源地址和目标地址,然后分布式网关根据数据包的源地址和目标地址确认分布式网关有将数据包发送到数据包的目标地址的权限。
302、向控制器发送流量请求,当流量请求携带数据包的大小时,流量请求用于指示控制器获取总令牌桶中的第三令牌数量。
其中,控制器中的总令牌桶以固定速率源源不断产生令牌,固定速率为虚拟私有云设置的平均发送速率,而且总令牌桶的容量是有限的,如果令牌不被消耗或者被消耗的速度小于产生的速度,那么总令牌桶中的令牌会不断增多,直到把总令牌桶填满,后面再产生的令牌就会从总令牌桶中溢出,最后总令牌桶中的令牌数与总令牌桶的容量保持一致。
分布式网关中的分令牌桶不会产生令牌,如果分布式网关要发送数据包,那么需要总令牌桶将令牌下发到分令牌桶中,如果分令牌桶中有足够的令牌,那么允许发送数据包,如果分令牌桶中没有足够的令牌,则不允许发送数据包,不同大小的数据包消耗的令牌数量也不一样,数据包越大,需要消耗的令牌数量越多,而且当分布式网关发送数据包时,需要从分令牌桶中删除与数据包的大小对应数量的令牌,将数据包发送到网络。
当控制器接收到分布式网关发送的流量请求,该流量请求携带数据包的大小时,控制器获取总令牌桶中的第三令牌数量。
303、判断数据包的大小是否比第三令牌数量小。
由于分布式网关发送数据包时需要消耗与数据包的大小对应数量的令牌,所以发送数据包之前,需要先判断数据包的大小与分令牌桶中的令牌数量的关系。
304、当数据包的大小比第三令牌数量小时,将总令牌桶中的令牌下发到分令牌桶中。
其中,将总令牌桶中的令牌下发到分令牌桶中包括:
将总令牌桶中与数据包的大小对应数量的令牌全部下发到分令牌桶中,例如数据包的大小为K个字节,那么将总令牌桶中的K个令牌全部下发到分令牌桶中。
或者,先将总令牌桶中与数据包的大小对应数量的Q%的令牌下发到分令牌桶中,其中,Q为小于100的正整数,再将总令牌桶中与数据包的大小对应数量的(100-Q)%的令牌下发到分令牌桶中,例如,数据包的大小为100个字节,当Q为70时,先将总令牌桶中的70个令牌下发到分令牌桶中,再将总令牌桶中的30个令牌下发到分令牌桶中。这样,分布式网关可以先使用70 个令牌发送数据包的前70个字节,一边发送的时候总令牌桶再将剩余的30个令牌下发到分令牌桶中,这样可以缩短将总令牌桶中的令牌下发到分令牌桶的时间。
305、通过分令牌桶中的令牌发送数据包。
306、从分令牌桶中删除与数据包的大小对应数量的令牌。
307、当数据包的大小比第三令牌数量大时,向分布式网关发送丢弃指令,丢弃指令用于指示分布式网关丢弃数据包。
参见图4,图4为本申请的另一个实施例提供的另一种虚拟私有云的流量控制方法的流程图。其中,如图4所示,本申请的另一个实施例提供的另一种虚拟私有云的流量控制方法可以包括:
401、当分布式网关发送数据包时,获取分布式网关发送数据包的大小。
可选的,当分布式网关发送数据包时,先对数据包的权限进行验证,即在获取数据包的大小之前,分布式网关获取数据包的源地址和目标地址,然后分布式网关根据数据包的源地址和目标地址确认分布式网关有将数据包发送到数据包的目标地址的权限。
402、向所述控制器发送流量请求,当流量请求携带数据包的大小时,流量请求用于指示控制器获取总令牌桶中的第三令牌数量。
其中,控制器中的总令牌桶以固定速率源源不断产生令牌,固定速率为虚拟私有云设置的平均发送速率,而且总令牌桶的容量是有限的,如果令牌不被消耗或者被消耗的速度小于产生的速度,那么总令牌桶中的令牌会不断增多,直到把总令牌桶填满,后面再产生的令牌就会从总令牌桶中溢出,最后总令牌桶中的令牌数与总令牌桶的容量保持一致。
分布式网关中的分令牌桶不会产生令牌,如果分布式网关要发送数据包,那么需要总令牌桶将令牌下发到分令牌桶中,如果分令牌桶中有足够的令牌,那么允许发送数据包,如果分令牌桶中没有足够的令牌,则不允许发送数据包,不同大小的数据包消耗的令牌数量也不一样,数据包越大,需要消耗的令牌数量越多,而且当分布式网关发送数据包时,需要从分令牌桶中删除与数据包的大小对应数量的令牌,将数据包发送到网络。
当控制器接收到分布式网关发送的流量请求,该流量请求携带数据包的大小时,控制器获取总令牌桶中的第三令牌数量。
403、判断数据包的大小是否比第三令牌数量小。
由于分布式网关发送数据包时需要消耗与数据包的大小对应数量的令牌,所以发送数据包之前,需要先判断数据包的大小与分令牌桶中的令牌数量的关系。
404、当数据包的大小比第三令牌数量大时,向分布式网关发送等待指令,等待指令用于指示分布式网关将数据包存储在待发送队列中。
405、经过第二预设时间后,获取总令牌桶中的第四令牌数量。
由于总令牌桶以固定速率源源不断产生令牌,所以经过第二预设挤时间后,有可能总令牌桶中已经有足够下发到分令牌桶的令牌。
406、当数据包的大小比第四令牌数量小时,将总令牌桶中的令牌下发到分令牌桶中。
其中,将总令牌桶中的令牌下发到分令牌桶中包括:
将总令牌桶中与数据包的大小对应数量的令牌全部下发到分令牌桶中,例如数据包的大小为K个字节,那么将总令牌桶中的K个令牌全部下发到分令牌桶中。
或者,先将总令牌桶中与数据包的大小对应数量的Q%的令牌下发到分令牌桶中,其中,Q为小于100的正整数,再将总令牌桶中与数据包的大小对应数量的(100-Q)%的令牌下发到分令牌桶中,例如,数据包的大小为100个字节,当Q为70时,先将总令牌桶中的70个令牌下发到分令牌桶中,再将总令牌桶中的30个令牌下发到分令牌桶中。这样,分布式网关可以先使用70个令牌发送数据包的前70个字节,一边发送的时候总令牌桶再将剩余的30个令牌下发到分令牌桶中,这样可以缩短将总令牌桶中的令牌下发到分令牌桶的时间。
407、通过分令牌桶中的令牌发送存储在待发送队列中的数据包。
408、从分令牌桶中删除与数据包的大小对应数量的令牌。
参见图5,图5为本申请的一个实施例提供的一种虚拟私有云的结构示意图。如图5所示,虚拟私有云包括虚拟私有云控制器和N个分布式网关,虚拟私有云控制器设有总令牌桶,分布式网关1、分布式网关2、分布式网关N等都设有分令牌桶。虚拟私有云控制器中的总令牌桶以固定速率产生令牌,而且总令牌桶的容量是有限的。分布式网关中的分令牌桶不会产生令牌,如果分布式网关要发送数据包,那么需要总令牌桶将令牌下发到分令牌桶中,当分布式网关发送数据包时,需要从分令牌桶中删除与数据包的大小对应数量的令牌,将数据包发送到网络。
参见图6,图6为本申请的一个实施例提供的一种分布式网关发送数据包的示意图。如图6所示,输入大小不同的多个数据包,通过分布式网关发送数据包时,分令牌桶中的令牌数量不够发送部分数据包,即丢弃该部分数据包。
参见图7,图7为本申请的一个实施例提供的另一种分布式网关发送数据包的示意图。如图7所示,分布式网关1、分布式网关2、分布式网关N等分别输入数据包。分布式网关1的分令牌桶中的令牌数不小于数据包的大小,分布式网关1发送数据包;分布式网关2的分令牌桶中的令牌数小于数据包的大小,分布式网关1丢弃数据包;分布式网关3的分令牌桶中的令牌数不小于数据包的大小,分布式网关3发送数据包。
参见图8,图8为本申请的另一个实施例提供的一种虚拟私有云的流量控制装置的示意图。其中,如图8所示,本申请的另一个实施例提供的一种虚拟 私有云的流量控制装置可以包括:
第一获取模块801,用于当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小。
第一发送模块802,用于向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中。
第二获取模块803,用于获取所述分令牌桶中的第一令牌数量。
判断模块804,用于判断所述数据包的大小是否比所述第一令牌数量小。
第二发送模块805,用于当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包。
删除模块806,用于从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
本申请虚拟私有云的流量控制装置的具体实施可参见上述虚拟私有云的流量控制方法的各实施例,在此不做赘述。
参见图9,图9为本申请的实施例涉及的硬件运行环境的电子设备结构示意图。其中,如图9所示,本申请的实施例涉及的硬件运行环境的电子设备可以包括:
处理器901,例如CPU。
存储器902,可选的,存储器可以为高速RAM存储器,也可以是稳定的存储器,例如磁盘存储器。
通信接口903,用于实现处理器901和存储器902之间的连接通信。
本领域技术人员可以理解,图9中示出的电子设备的结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图9所示,存储器902中可以包括操作系统、网络通信模块以及虚拟私有云的流量控制程序。操作系统是管理和控制电子设备硬件和软件资源的程序,支持虚拟私有云的流量控制程序以及其他软件或程序的运行。网络通信模块用于实现存储器902内部各组件之间的通信,以及与电子设备中其他硬件和软件之间通信。
在图9所示的电子设备中,处理器901用于执行存储器902中存储的虚拟私有云的流量控制程序,实现以下步骤:
当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小。
向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中。
获取所述分令牌桶中的第一令牌数量。
判断所述数据包的大小是否比所述第一令牌数量小。
当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包。
从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
本申请电子设备的具体实施可参见上述虚拟私有云的流量控制方法的各实施例,在此不做赘述。
本申请的另一个实施例提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行以实现以下步骤:
当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小。
向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中。
获取所述分令牌桶中的第一令牌数量。
判断所述数据包的大小是否比所述第一令牌数量小。
当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包。
从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
本申请计算机可读存储介质的具体实施可参见上述虚拟私有云的流量控制方法的各实施例,在此不做赘述
还需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (20)

  1. 一种虚拟私有云的流量控制方法,其特征在于,所述虚拟私有云的控制器中设置总令牌桶,所述虚拟私有云的分布式网关中设置分令牌桶,包括:
    当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小;
    向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中;
    获取所述分令牌桶中的第一令牌数量;
    判断所述数据包的大小是否比所述第一令牌数量小;
    当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述数据包的大小比所述第一令牌数量大时,丢弃所述数据包;或者,将所述数据包存储在待发送队列中。
  3. 根据权利要求1或2所述的方法,其特征在于,所述获取所述分布式网关发送数据包的大小之前,所述方法还包括:
    获取所述数据包的源地址和目标地址;
    根据所述数据包的源地址和所述数据包的目标地址确认所述分布式网关有将所述数据包发送到所述数据包的目标地址的权限。
  4. 根据权利要求2所述的方法,其特征在于,所述将所述数据包存储在待发送队列中之后,所述方法还包括:
    经过第一预设时间后,获取所述分令牌桶中的第二令牌数量;
    当所述数据包的大小比所述第二令牌数量小时,通过所述分令牌桶中的令牌发送存储在所述待发送队列中的所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述方法还包括:
    当所述流量请求携带所述数据包的大小时,所述流量请求用于指示所述控制器获取所述总令牌桶中的第三令牌数量;
    判断所述数据包的大小是否比所述第三令牌数量小;
    当所述数据包的大小比所述第三令牌数量小时,将所述总令牌桶中的令牌下发到所述分令牌桶中;
    通过所述分令牌桶中的令牌发送所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    当所述数据包的大小比所述第三令牌数量大时,向所述分布式网关发送丢弃指令,所述丢弃指令用于指示所述分布式网关丢弃所述数据包;
    或者,向所述分布式网关发送等待指令,所述等待指令用于指示所述分布式网关将所述数据包存储在所述待发送队列中。
  7. 根据权利要求5所述的方法,其特征在于,所述将所述总令牌桶中的令牌下发到所述分令牌桶中包括:
    将所述总令牌桶中与所述数据包的大小对应数量的令牌全部下发到所述分令牌桶中;
    或者,先将所述总令牌桶中与所述数据包的大小对应数量的Q%的令牌下发到所述分令牌桶中,其中,Q为小于100的正整数;
    再将所述总令牌桶中与所述数据包的大小对应数量的(100-Q)%的令牌下发到所述分令牌桶中。
  8. 根据权利要求6所述的方法,其特征在于,所述向所述分布式网关发送等待指令之后,所述方法还包括:
    经过第二预设时间后,获取所述总令牌桶中的第四令牌数量;
    当所述数据包的大小比所述第四令牌数量小时,将所述总令牌桶中的令牌下发到所述分令牌桶中;
    通过所述分令牌桶中的令牌发送所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  9. 根据权利要求1至8任一项所述的方法,其特征在于,所述虚拟私有云中有N个分布式网关,所述N个分布式网关中设置N个分令牌桶,其中,所述N个分布式网关与所述N个分令牌桶一一对应,N为正整数,所述N个分布式网关中有M个分布式网关发送数据包,M为不大于N的正整数,所述方法还包括以下步骤:
    S1:获取所述M个分布式网关中的第i个网关发送的数据包的大小,其中,i是初始值为1的正整数;
    S2:向所述控制器发送流量请求,其中,所述流量请求用于指示所述控制器按照预设速率将所述总令牌桶中的令牌下发到所述M个分布式网关中的第i个网关中的分令牌桶,其中,所述预设速率为所述虚拟私有云设置的平均发送速率与(1/M)的乘积;
    S3:获取所述M个分布式网关中的第i个网关中的分令牌桶中的令牌数量;
    S4:当所述M个分布式网关中的第i个网关发送的数据包的大小比所述M个分布式网关中的第i个网关中的分令牌桶中的令牌数量小时,通过所述M个分布式网关中的第i个网关中的分令牌桶中的令牌发送所述数据包,从所述M个分布式网关中的第i个网关中的分令牌桶中删除与所述数据包的大小对应数量的令牌;
    S5:当所述M个分布式网关中的第i个网关发送的数据包的大小比所述M个分布式网关中的第i个网关中的分令牌桶中的令牌数量大时,丢弃所述数 据包;
    S6:将(i+1)的值赋给i,当i不大于M时,执行步骤S1。
  10. 一种虚拟私有云的流量控制装置,其特征在于,所述虚拟私有云的控制器中设置总令牌桶,所述虚拟私有云的分布式网关中设置分令牌桶,所述装置包括:
    第一获取模块,用于当所述分布式网关发送数据包时,获取所述分布式网关发送数据包的大小;
    第一发送模块,用于向所述控制器发送流量请求,当所述流量请求携带下发令牌指令时,所述流量请求用于指示所述控制器按照所述虚拟私有云设置的平均发送速率将所述总令牌桶中的令牌下发到所述分令牌桶中;
    第二获取模块,用于获取所述分令牌桶中的第一令牌数量;
    判断模块,用于判断所述数据包的大小是否比所述第一令牌数量小;
    第二发送模块,用于当所述数据包的大小比所述第一令牌数量小时,通过所述分令牌桶中的令牌发送所述数据包;
    删除模块,用于从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  11. 根据权利要求10所述的装置,其特征在于,所述装置还包括第一处理模块,所述第一处理模块用于:当所述数据包的大小比所述第一令牌数量大时,丢弃所述数据包;或者,将所述数据包存储在待发送队列中。
  12. 根据权利要求10或11所述的装置,其特征在于,所述装置还包括第二处理模块,所述第二处理模块用于:
    获取所述数据包的源地址和目标地址;
    根据所述数据包的源地址和所述数据包的目标地址确认所述分布式网关有将所述数据包发送到所述数据包的目标地址的权限。
  13. 根据权利要求11所述的装置,其特征在于,所述第一处理模块还用于:
    经过第一预设时间后,获取所述分令牌桶中的第二令牌数量;
    当所述数据包的大小比所述第二令牌数量小时,通过所述分令牌桶中的令牌发送存储在所述待发送队列中的所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  14. 根据权利要求10-13任一项所述的装置,其特征在于,所述装置还包括第三处理模块,所述第三处理模块用于:
    当所述流量请求携带所述数据包的大小时,所述流量请求用于指示所述控制器获取所述总令牌桶中的第三令牌数量;
    判断所述数据包的大小是否比所述第三令牌数量小;
    当所述数据包的大小比所述第三令牌数量小时,将所述总令牌桶中的令牌下发到所述分令牌桶中;
    通过所述分令牌桶中的令牌发送所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  15. 根据权利要求14所述的装置,其特征在于,所述第三处理模块还用于:
    当所述数据包的大小比所述第三令牌数量大时,向所述分布式网关发送丢弃指令,所述丢弃指令用于指示所述分布式网关丢弃所述数据包;
    或者,向所述分布式网关发送等待指令,所述等待指令用于指示所述分布式网关将所述数据包存储在所述待发送队列中。
  16. 根据权利要求14所述的装置,其特征在于,所述第三处理模块具体用于:
    将所述总令牌桶中与所述数据包的大小对应数量的令牌全部下发到所述分令牌桶中;
    或者,先将所述总令牌桶中与所述数据包的大小对应数量的Q%的令牌下发到所述分令牌桶中,其中,Q为小于100的正整数;
    再将所述总令牌桶中与所述数据包的大小对应数量的(100-Q)%的令牌下发到所述分令牌桶中。
  17. 根据权利要求15所述的装置,其特征在于,所述第三处理模块还用于:
    经过第二预设时间后,获取所述总令牌桶中的第四令牌数量;
    当所述数据包的大小比所述第四令牌数量小时,将所述总令牌桶中的令牌下发到所述分令牌桶中;
    通过所述分令牌桶中的令牌发送所述数据包;
    从所述分令牌桶中删除与所述数据包的大小对应数量的令牌。
  18. 根据权利要求10-17任一项所述的装置,其特征在于,所述虚拟私有云中有N个分布式网关,所述N个分布式网关中设置N个分令牌桶,其中,所述N个分布式网关与所述N个分令牌桶一一对应,N为正整数,所述N个分布式网关中有M个分布式网关发送数据包,M为不大于N的正整数,所述装置还包括第四处理模块,所述第四处理模块用于执行以下步骤:
    S1:获取所述M个分布式网关中的第i个网关发送的数据包的大小,其中,i是初始值为1的正整数;
    S2:向所述控制器发送流量请求,其中,所述流量请求用于指示所述控制器按照预设速率将所述总令牌桶中的令牌下发到所述M个分布式网关中的第i个网关中的分令牌桶,其中,所述预设速率为所述虚拟私有云设置的平均发送速率与(1/M)的乘积;
    S3:获取所述M个分布式网关中的第i个网关中的分令牌桶中的令牌数量;
    S4:当所述M个分布式网关中的第i个网关发送的数据包的大小比所述 M个分布式网关中的第i个网关中的分令牌桶中的令牌数量小时,通过所述M个分布式网关中的第i个网关中的分令牌桶中的令牌发送所述数据包,从所述M个分布式网关中的第i个网关中的分令牌桶中删除与所述数据包的大小对应数量的令牌;
    S5:当所述M个分布式网关中的第i个网关发送的数据包的大小比所述M个分布式网关中的第i个网关中的分令牌桶中的令牌数量大时,丢弃所述数据包;
    S6:将(i+1)的值赋给i,当i不大于M时,执行步骤S1。
  19. 一种电子设备,其特征在于,所述电子设备包括处理器、存储器、通信接口以及一个或多个程序,其中,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行权利要求1至9任一项方法中的步骤的指令。
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行以实现权利要求1至9任一项所述的方法。
PCT/CN2019/117922 2019-01-23 2019-11-13 一种虚拟私有云的流量控制方法及相关装置 WO2020151324A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910063220.1 2019-01-23
CN201910063220.1A CN109714268B (zh) 2019-01-23 2019-01-23 一种虚拟私有云的流量控制方法及相关装置

Publications (1)

Publication Number Publication Date
WO2020151324A1 true WO2020151324A1 (zh) 2020-07-30

Family

ID=66262813

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117922 WO2020151324A1 (zh) 2019-01-23 2019-11-13 一种虚拟私有云的流量控制方法及相关装置

Country Status (2)

Country Link
CN (1) CN109714268B (zh)
WO (1) WO2020151324A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374652A (zh) * 2022-01-11 2022-04-19 同方有云(北京)科技有限公司 热磁存储和蓝光存储之间的数据传输限速方法及装置
CN115396377A (zh) * 2022-07-29 2022-11-25 天翼云科技有限公司 对象存储的服务质量优化方法、装置、设备及存储介质

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714268B (zh) * 2019-01-23 2022-06-07 平安科技(深圳)有限公司 一种虚拟私有云的流量控制方法及相关装置
CN110213173B (zh) * 2019-06-06 2023-03-24 北京百度网讯科技有限公司 流量控制方法及装置、系统、服务器、计算机可读介质
CN110380986B (zh) * 2019-07-23 2022-05-10 中南民族大学 基于Zuul的流量限制方法、装置、设备及存储介质
CN110417678A (zh) * 2019-08-08 2019-11-05 浪潮云信息技术有限公司 一种应用程序接口限流的方法及装置
CN111158878B (zh) * 2019-12-30 2023-08-29 北京三快在线科技有限公司 资源转移请求线程控制方法、装置及存储介质
CN114095444B (zh) * 2020-07-15 2023-11-10 中移物联网有限公司 限流方法、装置及电子设备
CN115277575B (zh) * 2021-04-29 2023-09-05 中国移动通信集团浙江有限公司 令牌桶控制方法、装置以及存储介质
CN114915596B (zh) * 2022-05-10 2024-06-14 北京奇艺世纪科技有限公司 数据发送方法、装置、设备及存储介质
CN115314441A (zh) * 2022-08-02 2022-11-08 支付宝实验室(新加坡)有限公司 分布式集群的限流方法、装置和电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227410A (zh) * 2008-02-03 2008-07-23 杭州华三通信技术有限公司 流量监管方法及流量监管设备
US20110320631A1 (en) * 2010-06-25 2011-12-29 Cox Communications, Inc. Preloading token buckets for dynamically implementing speed increases
CN103763208A (zh) * 2014-01-29 2014-04-30 华为技术有限公司 数据流量限制方法及装置
CN108650192A (zh) * 2018-04-28 2018-10-12 国网福建省电力有限公司 一种基于令牌桶优化算法的流量控制方法
CN108848038A (zh) * 2018-08-30 2018-11-20 华为技术有限公司 基于令牌桶的流量管理方法和令牌桶节点
CN109714268A (zh) * 2019-01-23 2019-05-03 平安科技(深圳)有限公司 一种虚拟私有云的流量控制方法及相关装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102377641A (zh) * 2010-08-11 2012-03-14 高通创锐讯通讯科技(上海)有限公司 令牌桶算法的实现方法
CN106330755A (zh) * 2015-06-16 2017-01-11 中兴通讯股份有限公司 一种报文流量的监管方法、装置及移动通信网关

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227410A (zh) * 2008-02-03 2008-07-23 杭州华三通信技术有限公司 流量监管方法及流量监管设备
US20110320631A1 (en) * 2010-06-25 2011-12-29 Cox Communications, Inc. Preloading token buckets for dynamically implementing speed increases
CN103763208A (zh) * 2014-01-29 2014-04-30 华为技术有限公司 数据流量限制方法及装置
CN108650192A (zh) * 2018-04-28 2018-10-12 国网福建省电力有限公司 一种基于令牌桶优化算法的流量控制方法
CN108848038A (zh) * 2018-08-30 2018-11-20 华为技术有限公司 基于令牌桶的流量管理方法和令牌桶节点
CN109714268A (zh) * 2019-01-23 2019-05-03 平安科技(深圳)有限公司 一种虚拟私有云的流量控制方法及相关装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114374652A (zh) * 2022-01-11 2022-04-19 同方有云(北京)科技有限公司 热磁存储和蓝光存储之间的数据传输限速方法及装置
CN114374652B (zh) * 2022-01-11 2024-01-16 同方有云(北京)科技有限公司 热磁存储和蓝光存储之间的数据传输限速方法及装置
CN115396377A (zh) * 2022-07-29 2022-11-25 天翼云科技有限公司 对象存储的服务质量优化方法、装置、设备及存储介质
CN115396377B (zh) * 2022-07-29 2024-03-12 天翼云科技有限公司 对象存储的服务质量优化方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN109714268A (zh) 2019-05-03
CN109714268B (zh) 2022-06-07

Similar Documents

Publication Publication Date Title
WO2020151324A1 (zh) 一种虚拟私有云的流量控制方法及相关装置
US11805058B2 (en) Data packet forwarding method, network adapter, host device, and computer system
Jang et al. Silo: Predictable message latency in the cloud
US20200412659A1 (en) Dynamic virtual cut-through and dynamic fabric bandwidth allocation between virtual cut-through and store-and-forward traffic
CN103460199B (zh) 基于业务类别的自适应中断调整
TWI530875B (zh) 施加用以調度在虛擬機器之間的網路頻寬之政策
US10097478B2 (en) Controlling fair bandwidth allocation efficiently
US10834008B2 (en) Arbitration of multiple-thousands of flows for convergence enhanced ethernet
US10536385B2 (en) Output rates for virtual output queses
WO2021120933A1 (zh) 调整资源的方法和装置
Stephens et al. Titan: Fair Packet Scheduling for Commodity Multiqueue {NICs}
US20200259747A1 (en) Dynamic buffer management in multi-client token flow control routers
Sun et al. A price-aware congestion control protocol for cloud services
To et al. Measurement based fair queuing for allocating bandwidth to virtual machines
US20220131810A1 (en) Device, method, and system that virtualize a networks
CN113381939B (zh) 数据传输方法、装置、电子设备及计算机可读存储介质
WO2020158444A1 (ja) 処理装置及び移動方法
WO2021052382A1 (zh) 云业务的带宽管理及配置方法及相关装置
Sun et al. PACCP: a price-aware congestion control protocol for datacenters
CN107888540B (zh) 一种网络防攻击方法及网络设备
Xiaocui et al. A price-aware congestion control protocol for cloud services
Abdelmoniem et al. Implementation and evaluation of data center congestion controller with switch assistance
Hwang et al. FaST: Fine-grained and scalable TCP for cloud data center networks
US20230254259A1 (en) System And Method For Using Dynamic Thresholds With Route Isolation For Heterogeneous Traffic In Shared Memory Packet Buffers
WO2016197810A1 (zh) 报文发送的方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19911790

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19911790

Country of ref document: EP

Kind code of ref document: A1