[go: up one dir, main page]

CN111708482B - Method, system, device and medium for limiting bandwidth in distributed storage - Google Patents

Method, system, device and medium for limiting bandwidth in distributed storage Download PDF

Info

Publication number
CN111708482B
CN111708482B CN202010396240.3A CN202010396240A CN111708482B CN 111708482 B CN111708482 B CN 111708482B CN 202010396240 A CN202010396240 A CN 202010396240A CN 111708482 B CN111708482 B CN 111708482B
Authority
CN
China
Prior art keywords
data
maximum capacity
capacity value
token
bandwidth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010396240.3A
Other languages
Chinese (zh)
Other versions
CN111708482A (en
Inventor
赵慧慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010396240.3A priority Critical patent/CN111708482B/en
Publication of CN111708482A publication Critical patent/CN111708482A/en
Application granted granted Critical
Publication of CN111708482B publication Critical patent/CN111708482B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0634Configuration or reconfiguration of storage systems by changing the state or mode of one or more devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种分布式存储中限制带宽的方法、系统、设备和存储介质,方法包括:对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;响应于接收到数据流的令牌申请,判断令牌申请的令牌数量是否大于最大容量值;以及响应于令牌申请的令牌数量不大于最大容量值,在带宽令牌桶中减去令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。

Figure 202010396240

The invention discloses a method, system, device and storage medium for limiting bandwidth in distributed storage. The method includes: fragmenting a data block to obtain multiple data fragments, and setting a preset bandwidth limit value as a bandwidth token The maximum capacity value of the bucket; judge whether the data length value of each data piece is greater than the current maximum capacity value in turn every predetermined time; in response to the data length value of the data piece is not greater than the current maximum capacity value, judge whether the data stream is received In response to receiving the token application of the data stream, it is determined whether the number of tokens in the token application is greater than the maximum capacity value; The number of tokens required for token application is subtracted from the bucket, and the data is delivered through the virtual disk.

Figure 202010396240

Description

一种分布式存储中限制带宽的方法、系统、设备及介质A method, system, device and medium for limiting bandwidth in distributed storage

技术领域technical field

本发明涉及数据处理领域,更具体地,特别是指一种分布式存储中限制带宽的方法、系统、计算机设备及可读介质。The present invention relates to the field of data processing, and more particularly, to a method, system, computer device and readable medium for limiting bandwidth in distributed storage.

背景技术Background technique

存储系统可以为提供给客户端的虚拟磁盘设置带宽限定值,以此提高存储的服务质量。在进行带宽限定时,一般采用令牌桶算法。IO(输入输出)数据流传输时向令牌桶申请令牌成功后,可向存储底层下发数据。在传统的根据令牌桶算法限制带宽的过程中,如果某次IO数据长度超过了令牌桶的最大容量,那么本次IO将会因为获取不到足够的令牌而导致无限阻塞。The storage system can set a bandwidth limit value for the virtual disk provided to the client, so as to improve the service quality of the storage. When performing bandwidth limitation, the token bucket algorithm is generally used. When the IO (input and output) data stream is transmitted, after successfully applying for a token from the token bucket, the data can be delivered to the storage bottom layer. In the traditional process of limiting bandwidth based on the token bucket algorithm, if the data length of a certain IO exceeds the maximum capacity of the token bucket, the IO will be blocked indefinitely because it cannot obtain enough tokens.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例的目的在于提出一种分布式存储中限制带宽的方法、系统、计算机设备及计算机可读存储介质,通过对数据块分片,通过将数据块分片减小最大容量的剧烈变化,并根据数据片大小和带宽限定值动态调整带宽令牌桶最大限制容量,从而在保证数据传输稳定的基础上减少IO阻塞问题的出现。In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device and computer-readable storage medium for limiting bandwidth in distributed storage, by slicing data blocks and reducing the maximum It can dynamically adjust the maximum limit capacity of the bandwidth token bucket according to the data slice size and bandwidth limit value, so as to reduce the occurrence of IO blocking problems on the basis of ensuring stable data transmission.

基于上述目的,本发明实施例的一方面提供了一种分布式存储中限制带宽的方法,包括如下步骤:对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;响应于接收到数据流的令牌申请,判断所述令牌申请的令牌数量是否大于所述最大容量值;以及响应于所述令牌申请的令牌数量不大于所述最大容量值,在所述带宽令牌桶中减去所述令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。Based on the above purpose, one aspect of the embodiments of the present invention provides a method for limiting bandwidth in distributed storage, including the following steps: fragmenting a data block to obtain multiple data fragments, and setting a preset bandwidth limit value to The maximum capacity value of the bandwidth token bucket; judge whether the data length value of each data slice is greater than the current maximum capacity value in turn every predetermined time; in response to the data length value of the data slice being not greater than the current maximum capacity value, judge whether to receive a token request to a data stream; in response to receiving a token request for a data stream, determining whether the token number of the token request is greater than the maximum capacity value; and responsive to the token number of the token request not being If it is greater than the maximum capacity value, the number of tokens required for the token application is subtracted from the bandwidth token bucket, and the data is delivered through the virtual disk.

在一些实施方式中,还包括:响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。In some embodiments, the method further includes: in response to the data length value of the data slice being greater than the current maximum capacity value, updating the maximum capacity value of the bandwidth token bucket to the data length value of the data slice and judging whether a data stream is received Token application.

在一些实施方式中,还包括:响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。In some implementations, the method further includes: in response to the number of tokens applied for by the token being greater than the maximum capacity value, suspending data output to wait for the maximum capacity value to be updated.

在一些实施方式中,还包括:判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In some embodiments, the method further includes: judging whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and responding to the fact that the number of tokens in the bandwidth token bucket is not the current maximum capacity value , adding tokens to the bandwidth token bucket at a preset speed until the number of tokens in the bandwidth token bucket is equal to the current maximum capacity value.

本发明实施例的另一方面,还提供了一种分布式存储中限制带宽的系统,包括:分片模块,配置用于对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;第一判断模块,配置用于每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;第二判断模块,配置用于响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;第三判断模块,配置用于响应于接收到数据流的令牌申请,判断所述令牌申请的令牌数量是否大于所述最大容量值;以及执行模块,配置用于响应于所述令牌申请的令牌数量不大于所述最大容量值,在所述带宽令牌桶中减去所述令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。Another aspect of the embodiments of the present invention further provides a system for limiting bandwidth in distributed storage, including: a fragmentation module, configured to fragment a data block to obtain multiple data fragments, and set a preset bandwidth The limit value is set as the maximum capacity value of the bandwidth token bucket; the first judgment module is configured to sequentially judge whether the data length value of each data slice is greater than the current maximum capacity value every predetermined time; the second judgment module is configured with In response to the data length value of the data slice being not greater than the current maximum capacity value, it is judged whether the token application of the data flow is received; the third judgment module is configured to judge the token application of the data flow in response to the received data flow. whether the number of tokens applied for by the token is greater than the maximum capacity value; and an execution module configured to reduce the number of tokens in the bandwidth token bucket in response to the number of tokens applied for by the token being not greater than the maximum capacity value Go to the token to apply for the required number of tokens, and issue the data through the virtual disk.

在一些实施方式中,还包括:更新模块,配置用于响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。In some embodiments, it further includes: an update module, configured to update the maximum capacity value of the bandwidth token bucket to the data length value of the data slice in response to the data length value of the data slice being greater than the current maximum capacity value, and Determine whether the token request for the data stream is received.

在一些实施方式中,还包括:暂停模块,配置用于响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。In some embodiments, it further includes: a suspending module configured to suspend data output to wait for the maximum capacity value to be updated in response to the token quantity of the token application being greater than the maximum capacity value.

在一些实施方式中,还包括添加模块,配置用于:判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In some implementations, it further includes an adding module configured to: determine whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and in response to the number of tokens in the bandwidth token bucket being different is the current maximum capacity value, adding tokens to the bandwidth token bucket at a preset speed until the number of tokens in the bandwidth token bucket is equal to the current maximum capacity value.

本发明实施例的又一方面,还提供了一种计算机设备,包括:至少一个处理器;以及存储器,所述存储器存储有可在所述处理器上运行的计算机指令,所述指令由所述处理器执行时实现如上方法的步骤。In yet another aspect of the embodiments of the present invention, there is also provided a computer device, comprising: at least one processor; and a memory, where the memory stores computer instructions that can be executed on the processor, and the instructions are executed by the processor. The processor implements the steps of the above method when executed.

本发明实施例的再一方面,还提供了一种计算机可读存储介质,计算机可读存储介质存储有被处理器执行时实现如上方法步骤的计算机程序。In yet another aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, where the computer-readable storage medium stores a computer program that implements the above method steps when executed by a processor.

本发明具有以下有益技术效果:通过对数据块分片,通过将数据块分片减小最大容量的剧烈变化,并根据数据片大小和带宽限定值动态调整带宽令牌桶最大限制容量,从而在保证数据传输稳定的基础上减少IO阻塞问题的出现。The invention has the following beneficial technical effects: by slicing the data block, reducing the drastic change of the maximum capacity by slicing the data block, and dynamically adjusting the maximum limit capacity of the bandwidth token bucket according to the size of the data piece and the bandwidth limit value, so that the maximum limit capacity of the bandwidth token bucket can be adjusted dynamically. On the basis of ensuring stable data transmission, the occurrence of IO blocking problems is reduced.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other embodiments can also be obtained according to these drawings without creative efforts.

图1为本发明提供的分布式存储中限制带宽的方法的实施例的示意图;1 is a schematic diagram of an embodiment of a method for limiting bandwidth in distributed storage provided by the present invention;

图2为本发明提供的分布式存储中限制带宽的计算机设备的实施例的硬件结构示意图。FIG. 2 is a schematic diagram of a hardware structure of an embodiment of a computer device for limiting bandwidth in distributed storage provided by the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本发明实施例进一步详细说明。In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention will be further described in detail below with reference to the specific embodiments and the accompanying drawings.

需要说明的是,本发明实施例中所有使用“第一”和“第二”的表述均是为了区分两个相同名称非相同的实体或者非相同的参量,可见“第一”“第二”仅为了表述的方便,不应理解为对本发明实施例的限定,后续实施例对此不再一一说明。It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities with the same name but not the same or non-identical parameters. It can be seen that "first" and "second" It is only for the convenience of expression and should not be construed as a limitation to the embodiments of the present invention, and subsequent embodiments will not describe them one by one.

基于上述目的,本发明实施例的第一个方面,提出了一种分布式存储中限制带宽的方法的实施例。图1示出的是本发明提供的分布式存储中限制带宽的方法的实施例的示意图。如图1所示,本发明实施例包括如下步骤:Based on the above objective, in a first aspect of the embodiments of the present invention, an embodiment of a method for limiting bandwidth in distributed storage is provided. FIG. 1 shows a schematic diagram of an embodiment of a method for limiting bandwidth in distributed storage provided by the present invention. As shown in Figure 1, the embodiment of the present invention includes the following steps:

S1、对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;S1, fragment the data block to obtain multiple data fragments, and set the preset bandwidth limit value as the maximum capacity value of the bandwidth token bucket;

S2、每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;S2. Judging in turn whether the data length value of each data slice is greater than the current maximum capacity value every predetermined time;

S3、响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;S3, in response to the data length value of the data slice being not greater than the current maximum capacity value, determine whether the token application for the data stream is received;

S4、响应于接收到数据流的令牌申请,判断令牌申请的令牌数量是否大于最大容量值;以及S4. In response to receiving the token application of the data stream, determine whether the number of tokens in the token application is greater than the maximum capacity value; and

S5、响应于令牌申请的令牌数量不大于最大容量值,在带宽令牌桶中减去令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。S5. In response to the number of tokens applied for the token is not greater than the maximum capacity value, the number of tokens required for the token application is subtracted from the bandwidth token bucket, and the data is delivered through the virtual disk.

对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值。可以根据数据保护策略来进行数据块的分片。数据保护策略包括副本冗余策略和纠删码容错策略,副本冗余策略是将原始数据复制成多份,每一份称为一个副本,将这些副本分别存放在集群中的不同节点上;纠删码容错策略是利用纠删码算法将原始数据进行编码得到冗余,并将数据和冗余一并存储。将数据块分成不同大小的数据片,并对数据片进行冗余操作,将其分别存在不同节点中。可以根据需要设置带宽限定值,例如,可以根据数据片的大小设置带宽限定值,如果数据片均较小,可以将带宽限定值设置得较小,如果数据片均较大,可以将带宽限定值设置得较大。The data block is fragmented to obtain multiple data fragments, and the preset bandwidth limit value is set as the maximum capacity value of the bandwidth token bucket. Fragmentation of data blocks can be performed according to data protection policies. Data protection strategies include replica redundancy strategy and erasure code fault tolerance strategy. The replica redundancy strategy is to copy the original data into multiple copies, each of which is called a copy, and store these copies on different nodes in the cluster; The erasure code error tolerance strategy is to use the erasure code algorithm to encode the original data to obtain redundancy, and store the data and redundancy together. Divide the data block into data pieces of different sizes, perform redundant operations on the data pieces, and store them in different nodes. You can set the bandwidth limit value according to your needs. For example, you can set the bandwidth limit value according to the size of the data slice. If the data slices are all small, you can set the bandwidth limit value to a smaller value. If the data slices are all large, you can set the bandwidth limit value. set larger.

每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值。带宽限定值是最原始的带宽令牌桶的最大容量值,可以通过比较数据片的数据长度值和带宽限定值的大小以决定是否对带宽令牌桶的最大容量值进行更新。Whether the data length value of each data piece is larger than the current maximum capacity value is sequentially judged every predetermined time. The bandwidth limit value is the maximum capacity value of the original bandwidth token bucket. Whether to update the maximum capacity value of the bandwidth token bucket can be determined by comparing the data length value of the data slice with the size of the bandwidth limit value.

响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请。如果数据片的数据长度值不大于当前的最大容量值,则表明当前的最大容量值可以保留,同时实时判断是否有来自数据流的令牌申请。In response to the data length value of the data slice being not greater than the current maximum capacity value, it is determined whether a token application for the data stream is received. If the data length value of the data slice is not greater than the current maximum capacity value, it indicates that the current maximum capacity value can be retained, and at the same time, it is judged in real time whether there is a token application from the data stream.

在一些实施方式中,还包括:响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。如果数据片的数据长度值大于当前的最大容量值,则需要将最大容量值更新为当前数据片的数据长度值,同时实时判断是否有来自数据流的令牌申请。In some embodiments, the method further includes: in response to the data length value of the data slice being greater than the current maximum capacity value, updating the maximum capacity value of the bandwidth token bucket to the data length value of the data slice and judging whether a data stream is received Token application. If the data length value of the data slice is greater than the current maximum capacity value, it is necessary to update the maximum capacity value to the data length value of the current data slice, and at the same time judge whether there is a token application from the data stream in real time.

响应于接收到数据流的令牌申请,判断令牌申请的令牌数量是否大于最大容量值。如果接收到来自数据流的令牌申请,比较令牌申请的令牌数量与最大容量值以确定是否可以实施数据的下发。In response to receiving the token application of the data stream, it is determined whether the number of tokens in the token application is greater than the maximum capacity value. If a token request from a data stream is received, the number of tokens requested by the token is compared with the maximum capacity value to determine whether data can be issued.

响应于令牌申请的令牌数量不大于最大容量值,在带宽令牌桶中减去令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。如果令牌申请的令牌数量小于或等于最大容量值,表明可以进行数据的下发,可以在带宽令牌桶中减去令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。In response to the number of tokens applied for the token is not greater than the maximum capacity value, the number of tokens required for the token application is subtracted from the bandwidth token bucket, and the data is delivered through the virtual disk. If the number of tokens in the token application is less than or equal to the maximum capacity value, it indicates that the data can be distributed. The number of tokens required for the token application can be subtracted from the bandwidth token bucket, and the data can be distributed through the virtual disk. .

在一些实施方式中,还包括:响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。如果令牌申请的令牌数量大于最大容量值,表明不可以进行数据的下发,需要等待最大容量值的更新,当最大容量值大于或等于令牌申请的令牌数量时才可以进行数据的下发。In some implementations, the method further includes: in response to the number of tokens applied for by the token being greater than the maximum capacity value, suspending data output to wait for the maximum capacity value to be updated. If the number of tokens applied for by the token is greater than the maximum capacity value, it indicates that the data cannot be distributed, and it is necessary to wait for the update of the maximum capacity value. When the maximum capacity value is greater than or equal to the number of tokens applied for by the token, data can be sent. Issued.

在一些实施方式中,还包括:判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。实时判断带宽令牌桶中的令牌数量是否饱和,如果不饱和,需要按照预定速度向带宽令牌桶中添加令牌直到饱和。In some embodiments, the method further includes: judging whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and responding to the fact that the number of tokens in the bandwidth token bucket is not the current maximum capacity value , adding tokens to the bandwidth token bucket at a preset speed until the number of tokens in the bandwidth token bucket is equal to the current maximum capacity value. Determine in real time whether the number of tokens in the bandwidth token bucket is saturated. If not, add tokens to the bandwidth token bucket at a predetermined rate until it is saturated.

需要特别指出的是,上述分布式存储中限制带宽的方法的各个实施例中的各个步骤均可以相互交叉、替换、增加、删减,因此,这些合理的排列组合变换之于分布式存储中限制带宽的方法也应当属于本发明的保护范围,并且不应将本发明的保护范围局限在实施例之上。It should be particularly pointed out that each step in each embodiment of the method for limiting bandwidth in distributed storage can be crossed, replaced, added, and deleted. Therefore, these reasonable permutations and combinations are limited in distributed storage. The bandwidth method should also belong to the protection scope of the present invention, and the protection scope of the present invention should not be limited to the embodiments.

基于上述目的,本发明实施例的第二个方面,提出了一种分布式存储中限制带宽的系统,包括:分片模块,配置用于对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;第一判断模块,配置用于每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;第二判断模块,配置用于响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;第三判断模块,配置用于响应于接收到数据流的令牌申请,判断所述令牌申请的令牌数量是否大于所述最大容量值;以及执行模块,配置用于响应于所述令牌申请的令牌数量不大于所述最大容量值,在所述带宽令牌桶中减去所述令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。Based on the above purpose, in a second aspect of the embodiments of the present invention, a system for limiting bandwidth in distributed storage is proposed, including: a fragmentation module configured to fragment a data block to obtain a plurality of data fragments, and The preset bandwidth limit value is set as the maximum capacity value of the bandwidth token bucket; the first judgment module is configured to sequentially judge whether the data length value of each data slice is greater than the current maximum capacity value every predetermined time; the second judgment The module is configured to judge whether the token application of the data stream is received in response to the data length value of the data slice being not greater than the current maximum capacity value; the third judging module is configured to respond to the token application of the data stream received , judging whether the number of tokens applied for by the token is greater than the maximum capacity value; and an execution module, configured to respond that the number of tokens applied for by the token is not greater than the maximum capacity value, in the bandwidth command The number of tokens required for the token application is subtracted from the bucket, and the data is delivered through the virtual disk.

在一些实施方式中,还包括:更新模块,配置用于响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。In some embodiments, it further includes: an update module, configured to update the maximum capacity value of the bandwidth token bucket to the data length value of the data slice in response to the data length value of the data slice being greater than the current maximum capacity value, and Determine whether the token request for the data stream is received.

在一些实施方式中,还包括:暂停模块,配置用于响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。In some embodiments, it further includes: a suspending module configured to suspend data output to wait for the maximum capacity value to be updated in response to the token quantity of the token application being greater than the maximum capacity value.

在一些实施方式中,还包括添加模块,配置用于:判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In some implementations, it further includes an adding module configured to: determine whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and in response to the number of tokens in the bandwidth token bucket being different is the current maximum capacity value, adding tokens to the bandwidth token bucket at a preset speed until the number of tokens in the bandwidth token bucket is equal to the current maximum capacity value.

基于上述目的,本发明实施例的第三个方面,提出了一种计算机设备,包括:至少一个处理器;以及存储器,存储器存储有可在处理器上运行的计算机指令,指令由处理器执行以实现如下步骤:S1、对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;S2、每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;S3、响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;S4、响应于接收到数据流的令牌申请,判断令牌申请的令牌数量是否大于最大容量值;以及S5、响应于令牌申请的令牌数量不大于最大容量值,在带宽令牌桶中减去令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发。Based on the above objective, in a third aspect of the embodiments of the present invention, a computer device is provided, including: at least one processor; and a memory, where the memory stores computer instructions that can be executed on the processor, and the instructions are executed by the processor to The following steps are implemented: S1, slicing the data block to obtain a plurality of data slices, and setting the preset bandwidth limit value as the maximum capacity value of the bandwidth token bucket; S2, sequentially judging the size of each data slice every predetermined time Whether the data length value is greater than the current maximum capacity value; S3, in response to the data length value of the data slice being not greater than the current maximum capacity value, determine whether the token application for the data stream is received; S4, in response to receiving the command of the data stream and S5, in response to the token number of the token application being not greater than the maximum capacity value, subtract the tokens required for the token application from the bandwidth token bucket data, and deliver the data through the virtual disk.

在一些实施方式中,还包括:响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。In some embodiments, the method further includes: in response to the data length value of the data slice being greater than the current maximum capacity value, updating the maximum capacity value of the bandwidth token bucket to the data length value of the data slice and judging whether a data stream is received Token application.

在一些实施方式中,还包括:响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。In some implementations, the method further includes: in response to the number of tokens applied for by the token being greater than the maximum capacity value, suspending data output to wait for the maximum capacity value to be updated.

在一些实施方式中,还包括:判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In some embodiments, the method further includes: judging whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and responding to the fact that the number of tokens in the bandwidth token bucket is not the current maximum capacity value , adding tokens to the bandwidth token bucket at a preset speed until the number of tokens in the bandwidth token bucket is equal to the current maximum capacity value.

如图2所示,为本发明提供的上述分布式存储中限制带宽的计算机设备的一个实施例的硬件结构示意图。As shown in FIG. 2 , it is a schematic diagram of the hardware structure of an embodiment of the computer device for limiting bandwidth in the distributed storage provided by the present invention.

以如图2所示的装置为例,在该装置中包括一个处理器301以及一个存储器302,并还可以包括:输入装置303和输出装置304。Taking the device shown in FIG. 2 as an example, the device includes a processor 301 and a memory 302 , and may further include an input device 303 and an output device 304 .

处理器301、存储器302、输入装置303和输出装置304可以通过总线或者其他方式连接,图2中以通过总线连接为例。The processor 301 , the memory 302 , the input device 303 and the output device 304 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 2 .

存储器302作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的分布式存储中限制带宽的方法对应的程序指令/模块。处理器301通过运行存储在存储器302中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例的分布式存储中限制带宽的方法。As a non-volatile computer-readable storage medium, the memory 302 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as bandwidth-limited storage in the distributed storage in the embodiments of the present application. The program instruction/module corresponding to the method. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 302, that is, implementing the method for limiting bandwidth in distributed storage in the above method embodiments.

存储器302可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据分布式存储中限制带宽的方法的使用所创建的数据等。此外,存储器302可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器302可选包括相对于处理器301远程设置的存储器,这些远程存储器可以通过网络连接至本地模块。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 302 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function; data etc. Additionally, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 302 may optionally include memory located remotely from processor 301, which may be connected to the local module via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

输入装置303可接收输入的用户名和密码等信息。输出装置304可包括显示屏等显示设备。The input device 303 can receive input information such as user name and password. The output device 304 may include a display device such as a display screen.

一个或者多个分布式存储中限制带宽的方法对应的程序指令/模块存储在存储器302中,当被处理器301执行时,执行上述任意方法实施例中的分布式存储中限制带宽的方法。One or more program instructions/modules corresponding to the method for limiting bandwidth in distributed storage are stored in memory 302, and when executed by processor 301, execute the method for limiting bandwidth in distributed storage in any of the above method embodiments.

执行上述分布式存储中限制带宽的方法的计算机设备的任何一个实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。Any embodiment of the computer device that executes the method for limiting bandwidth in distributed storage above can achieve the same or similar effects as any of the foregoing method embodiments corresponding to it.

本发明还提供了一种计算机可读存储介质,计算机可读存储介质存储有被处理器执行时执行如上方法的计算机程序。The present invention also provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program that executes the above method when executed by a processor.

最后需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关硬件来完成,分布式存储中限制带宽的方法的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,程序的存储介质可为磁碟、光盘、只读存储记忆体(ROM)或随机存储记忆体(RAM)等。上述计算机程序的实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。Finally, it should be noted that those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing the relevant hardware through a computer program. The program of the method for limiting bandwidth in distributed storage can be stored in a In the computer-readable storage medium, when the program is executed, it may include the processes of the foregoing method embodiments. Wherein, the storage medium of the program may be a magnetic disk, an optical disk, a read only memory (ROM) or a random access memory (RAM) or the like. The above computer program embodiments can achieve the same or similar effects as any of the foregoing method embodiments corresponding thereto.

此外,根据本发明实施例公开的方法还可以被实现为由处理器执行的计算机程序,该计算机程序可以存储在计算机可读存储介质中。在该计算机程序被处理器执行时,执行本发明实施例公开的方法中限定的上述功能。In addition, the methods disclosed according to the embodiments of the present invention may also be implemented as a computer program executed by a processor, and the computer program may be stored in a computer-readable storage medium. When the computer program is executed by the processor, the above-mentioned functions defined in the methods disclosed in the embodiments of the present invention are executed.

此外,上述方法步骤以及系统单元也可以利用控制器以及用于存储使得控制器实现上述步骤或单元功能的计算机程序的计算机可读存储介质实现。In addition, the above-mentioned method steps and system units can also be implemented by using a controller and a computer-readable storage medium for storing a computer program that enables the controller to implement the functions of the above-mentioned steps or units.

此外,应该明白的是,本文的计算机可读存储介质(例如,存储器)可以是易失性存储器或非易失性存储器,或者可以包括易失性存储器和非易失性存储器两者。作为例子而非限制性的,非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦写可编程ROM(EEPROM)或快闪存储器。易失性存储器可以包括随机存取存储器(RAM),该RAM可以充当外部高速缓存存储器。作为例子而非限制性的,RAM可以以多种形式获得,比如同步RAM(DRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据速率SDRAM(DDRSDRAM)、增强SDRAM(ESDRAM)、同步链路DRAM(SLDRAM)、以及直接Rambus RAM(DRRAM)。所公开的方面的存储设备意在包括但不限于这些和其它合适类型的存储器。In addition, it should be understood that computer-readable storage media (eg, memory) herein can be volatile memory or non-volatile memory, or can include both volatile and non-volatile memory. By way of example and not limitation, nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory memory. Volatile memory may include random access memory (RAM), which may act as external cache memory. By way of example and not limitation, RAM is available in various forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to include, but not be limited to, these and other suitable types of memory.

本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实现为软件还是被实现为硬件取决于具体应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种具体应用以各种方式来实现的功能,但是这种实现决定不应被解释为导致脱离本发明实施例公开的范围。Those skilled in the art will also appreciate that the various exemplary logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends on the specific application and design constraints imposed on the overall system. Those skilled in the art may implement the functions in various ways for each specific application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.

结合这里的公开所描述的各种示例性逻辑块、模块和电路可以利用被设计成用于执行这里功能的下列部件来实现或执行:通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或其它可编程逻辑器件、分立门或晶体管逻辑、分立的硬件组件或者这些部件的任何组合。通用处理器可以是微处理器,但是可替换地,处理器可以是任何传统处理器、控制器、微控制器或状态机。处理器也可以被实现为计算设备的组合,例如,DSP和微处理器的组合、多个微处理器、一个或多个微处理器结合DSP和/或任何其它这种配置。The various exemplary logical blocks, modules, and circuits described in connection with the disclosure herein can be implemented or executed using the following components designed to perform the functions herein: general purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, eg, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors in combination with a DSP, and/or any other such configuration.

结合这里的公开所描述的方法或算法的步骤可以直接包含在硬件中、由处理器执行的软件模块中或这两者的组合中。软件模块可以驻留在RAM存储器、快闪存储器、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、可移动盘、CD-ROM、或本领域已知的任何其它形式的存储介质中。示例性的存储介质被耦合到处理器,使得处理器能够从该存储介质中读取信息或向该存储介质写入信息。在一个替换方案中,存储介质可以与处理器集成在一起。处理器和存储介质可以驻留在ASIC中。ASIC可以驻留在用户终端中。在一个替换方案中,处理器和存储介质可以作为分立组件驻留在用户终端中。The steps of a method or algorithm described in connection with the disclosures herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, such that the processor can read information from, and write information to, the storage medium. In an alternative, the storage medium may be integrated with the processor. The processor and storage medium may reside in an ASIC. The ASIC may reside in the user terminal. In an alternative, the processor and storage medium may reside in the user terminal as discrete components.

在一个或多个示例性设计中,功能可以在硬件、软件、固件或其任意组合中实现。如果在软件中实现,则可以将功能作为一个或多个指令或代码存储在计算机可读介质上或通过计算机可读介质来传送。计算机可读介质包括计算机存储介质和通信介质,该通信介质包括有助于将计算机程序从一个位置传送到另一个位置的任何介质。存储介质可以是能够被通用或专用计算机访问的任何可用介质。作为例子而非限制性的,该计算机可读介质可以包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储设备、磁盘存储设备或其它磁性存储设备,或者是可以用于携带或存储形式为指令或数据结构的所需程序代码并且能够被通用或专用计算机或者通用或专用处理器访问的任何其它介质。此外,任何连接都可以适当地称为计算机可读介质。例如,如果使用同轴线缆、光纤线缆、双绞线、数字用户线路(DSL)或诸如红外线、无线电和微波的无线技术来从网站、服务器或其它远程源发送软件,则上述同轴线缆、光纤线缆、双绞线、DSL或诸如红外线、无线电和微波的无线技术均包括在介质的定义。如这里所使用的,磁盘和光盘包括压缩盘(CD)、激光盘、光盘、数字多功能盘(DVD)、软盘、蓝光盘,其中磁盘通常磁性地再现数据,而光盘利用激光光学地再现数据。上述内容的组合也应当包括在计算机可读介质的范围内。In one or more exemplary designs, functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage medium can be any available medium that can be accessed by a general purpose or special purpose computer. By way of example and not limitation, the computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, or may be used to carry or store instructions in the form of or data structures and any other medium that can be accessed by a general purpose or special purpose computer or a general purpose or special purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave are used to send software from a website, server, or other remote source, the above coaxial cable Cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are all included in the definition of medium. As used herein, magnetic disks and optical disks include compact disks (CDs), laser disks, optical disks, digital versatile disks (DVDs), floppy disks, blu-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically with lasers . Combinations of the above should also be included within the scope of computer-readable media.

以上是本发明公开的示例性实施例,但是应当注意,在不背离权利要求限定的本发明实施例公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本发明实施例公开的元素可以以个体形式描述或要求,但除非明确限制为单数,也可以理解为多个。The above are exemplary embodiments of the present disclosure, but it should be noted that various changes and modifications may be made without departing from the scope of the disclosure of the embodiments of the present invention as defined in the claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements disclosed in the embodiments of the present invention may be described or claimed in the singular, unless explicitly limited to the singular, the plural may also be construed.

应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。It should be understood that, as used herein, the singular form "a" is intended to include the plural form as well, unless the context clearly supports an exception. It will also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.

上述本发明实施例公开实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned embodiments of the present invention disclose the serial numbers of the embodiments only for description, and do not represent the advantages and disadvantages of the embodiments.

本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a magnetic disk or an optical disk, and the like.

所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本发明实施例公开的范围(包括权利要求)被限于这些例子;在本发明实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上的本发明实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本发明实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本发明实施例的保护范围之内。Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary, and is not intended to imply that the scope (including the claims) disclosed by the embodiments of the present invention is limited to these examples; under the idea of the embodiments of the present invention , the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention should be included within the protection scope of the embodiments of the present invention.

Claims (8)

1.一种分布式存储中限制带宽的方法,其特征在于,包括以下步骤:1. a method for limiting bandwidth in distributed storage, is characterized in that, comprises the following steps: 对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;Fragment the data block to obtain multiple data fragments, and set the preset bandwidth limit value as the maximum capacity value of the bandwidth token bucket; 每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;Judging in turn whether the data length value of each data piece is greater than the current maximum capacity value every predetermined time; 响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;In response to the data length value of the data slice being not greater than the current maximum capacity value, determine whether a token application for the data stream is received; 响应于接收到数据流的令牌申请,判断所述令牌申请的令牌数量是否大于所述最大容量值;以及In response to receiving a token request for a data stream, determining whether the token quantity of the token request is greater than the maximum capacity value; and 响应于所述令牌申请的令牌数量不大于所述最大容量值,在所述带宽令牌桶中减去所述令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发;In response to the number of tokens applied for by the token is not greater than the maximum capacity value, the number of tokens required by the token application is subtracted from the bandwidth token bucket, and the data is delivered through the virtual disk; 所述方法还包括:响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。The method further includes: in response to the data length value of the data slice being greater than the current maximum capacity value, updating the maximum capacity value of the bandwidth token bucket to the data length value of the data slice and judging whether the token of the data stream is received Application. 2.根据权利要求1所述的方法,其特征在于,还包括:2. The method of claim 1, further comprising: 响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。In response to the number of tokens requested by the token being greater than the maximum capacity value, data output is suspended to wait for the maximum capacity value to be updated. 3.根据权利要求1所述的方法,其特征在于,还包括:3. The method of claim 1, further comprising: 判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及determining whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and 响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In response to the number of tokens in the bandwidth token bucket not being the current maximum capacity value, adding tokens to the bandwidth token bucket at a preset rate until the number of tokens in the bandwidth token bucket is equal to the current the maximum capacity value. 4.一种分布式存储中限制带宽的系统,其特征在于,包括:4. A system for limiting bandwidth in distributed storage, comprising: 分片模块,配置用于对数据块进行分片以得到多个数据片,并将预设带宽限定值设置为带宽令牌桶的最大容量值;The fragmentation module is configured to fragment the data block to obtain multiple data fragments, and set the preset bandwidth limit value as the maximum capacity value of the bandwidth token bucket; 第一判断模块,配置用于每隔预定时间依次判断每个数据片的数据长度值是否大于当前的最大容量值;a first judgment module, configured to sequentially judge whether the data length value of each data piece is greater than the current maximum capacity value every predetermined time; 第二判断模块,配置用于响应于数据片的数据长度值不大于当前的最大容量值,判断是否接收到数据流的令牌申请;The second judgment module is configured to judge whether the token application of the data stream is received in response to the data length value of the data slice being not greater than the current maximum capacity value; 第三判断模块,配置用于响应于接收到数据流的令牌申请,判断所述令牌申请的令牌数量是否大于所述最大容量值;以及a third judging module, configured to, in response to receiving the token application of the data stream, judge whether the number of tokens in the token application is greater than the maximum capacity value; and 执行模块,配置用于响应于所述令牌申请的令牌数量不大于所述最大容量值,在所述带宽令牌桶中减去所述令牌申请需要的令牌数,并通过虚拟磁盘对数据进行下发;an execution module, configured to subtract the number of tokens required for the token application from the bandwidth token bucket in response to the number of tokens applied for by the token being not greater than the maximum capacity value, and pass the number of tokens required for the token application through the virtual disk release the data; 所述系统还包括:更新模块,配置用于响应于数据片的数据长度值大于当前的最大容量值,将带宽令牌桶的最大容量值更新为所述数据片的数据长度值并判断是否接收到数据流的令牌申请。The system further includes: an update module configured to update the maximum capacity value of the bandwidth token bucket to the data length value of the data slice in response to the data length value of the data slice being greater than the current maximum capacity value, and determine whether to receive the data slice or not. Token request to data flow. 5.根据权利要求4所述的系统,其特征在于,还包括:5. The system of claim 4, further comprising: 暂停模块,配置用于响应于所述令牌申请的令牌数量大于所述最大容量值,暂停数据输出以等待最大容量值进行更新。A suspending module, configured to suspend data output in response to the number of tokens applied for by the token being greater than the maximum capacity value to wait for the maximum capacity value to be updated. 6.根据权利要求4所述的系统,其特征在于,还包括添加模块,配置用于:6. The system of claim 4, further comprising an add-on module configured to: 判断所述带宽令牌桶中的令牌数量是否为当前的最大容量值;以及determining whether the number of tokens in the bandwidth token bucket is the current maximum capacity value; and 响应于所述带宽令牌桶中的令牌数量不为当前的最大容量值,按照预设速度向所述带宽令牌桶中添加令牌直到所述带宽令牌桶中的令牌数等于当前的最大容量值。In response to the number of tokens in the bandwidth token bucket not being the current maximum capacity value, adding tokens to the bandwidth token bucket at a preset rate until the number of tokens in the bandwidth token bucket is equal to the current the maximum capacity value. 7.一种计算机设备,其特征在于,包括:7. A computer equipment, characterized in that, comprising: 至少一个处理器;以及at least one processor; and 存储器,所述存储器存储有可在所述处理器上运行的计算机指令,所述指令由所述处理器执行时实现权利要求1-3任意一项所述方法的步骤。a memory storing computer instructions executable on the processor, the instructions implementing the steps of the method of any one of claims 1-3 when executed by the processor. 8.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-3任意一项所述方法的步骤。8. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the steps of the method of any one of claims 1-3 are implemented.
CN202010396240.3A 2020-05-12 2020-05-12 Method, system, device and medium for limiting bandwidth in distributed storage Active CN111708482B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010396240.3A CN111708482B (en) 2020-05-12 2020-05-12 Method, system, device and medium for limiting bandwidth in distributed storage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010396240.3A CN111708482B (en) 2020-05-12 2020-05-12 Method, system, device and medium for limiting bandwidth in distributed storage

Publications (2)

Publication Number Publication Date
CN111708482A CN111708482A (en) 2020-09-25
CN111708482B true CN111708482B (en) 2022-08-09

Family

ID=72537845

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010396240.3A Active CN111708482B (en) 2020-05-12 2020-05-12 Method, system, device and medium for limiting bandwidth in distributed storage

Country Status (1)

Country Link
CN (1) CN111708482B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328613B (en) * 2020-11-04 2022-07-22 迈普通信技术股份有限公司 Online analysis processing method and device, electronic equipment and storage medium
CN113810306B (en) * 2021-09-07 2024-07-26 山石网科通信技术股份有限公司 Bandwidth allocation method, device, storage medium and processor
CN114143267B (en) * 2021-11-26 2023-08-29 北京天融信网络安全技术有限公司 Flow adjustment method, device, electronic equipment and computer readable storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804043A (en) * 2018-06-26 2018-11-13 郑州云海信息技术有限公司 Distributed block storage system bandwidth traffic control method, device, equipment and medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804043A (en) * 2018-06-26 2018-11-13 郑州云海信息技术有限公司 Distributed block storage system bandwidth traffic control method, device, equipment and medium

Also Published As

Publication number Publication date
CN111708482A (en) 2020-09-25

Similar Documents

Publication Publication Date Title
CN111708482B (en) Method, system, device and medium for limiting bandwidth in distributed storage
JP6638024B2 (en) System, smart contract life cycle management method, and non-transitory computer readable medium
US12045143B2 (en) Methods, systems, and media for controlling append-only file rewrites
CN110427342B (en) A method, device and readable medium for creating an image library
JP2020528618A (en) Asynchronous local and remote generation of consistent point-in-time snapshots in a consistency group
CN110519329B (en) A method, device and readable medium for concurrently processing samba protocol requests
CN111708484A (en) A method, system, device and medium for controlling data brushing speed
CN111737201B (en) A method for closing an opened file, computer equipment and storage medium
CN110620793B (en) Method, device and medium for improving audio quality
CN111708486A (en) A method, system, device and medium for balanced optimization of primary placement group
CN111240595A (en) Method, system, equipment and medium for optimizing storage cache
CN111737616A (en) A method, apparatus, device and medium for page caching based on B/S architecture
WO2023116438A1 (en) Data access method and apparatus, and device
CN110753095A (en) Data processing method, device and storage medium for network card
US20190334992A1 (en) Request Multiplexing
CN110932997B (en) Method, device and medium for reducing network traffic packet loss
TWI585593B (en) Method and system for optimizing transfer path
CN111367919B (en) Storage method, device, equipment and medium of database all-in-one machine
CN110752953A (en) A method, device and storage medium for updating the number of connections based on load balancing
CN110442445B (en) A design method and device for computing grid based on large-scale container cloud scenario
CN111625203A (en) Method, system, device and medium for hierarchical storage
CN112148206B (en) Data reading and writing method, device, electronic equipment and medium
CN111314311A (en) Method, system, equipment and medium for improving performance of switch
CN111309264B (en) Method, system, device and medium for making directory quota compatible with snapshot
CN114756527A (en) Method and device for expanding Redis cluster, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant