A method, system and device for allocating operation tokens for distributed storage
By monitoring and adjusting the number of tokens in the token bucket in the distributed storage system, the problem of mismatch between the token deposit rate and the consumption rate is solved, resource utilization and service quality control are improved, and a more efficient system is achieved. manage.
Patent Information
- Application Number
- CN202110260550.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-10
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-03-10
AI Technical Summary
In existing distributed storage systems, token bucket technology causes a waste of resources when the token storage rate is greater than the consumption rate for a long time, and cannot effectively control user read and write operations when the token storage rate is lower than the consumption rate.
By monitoring the number of operation tokens between the global token bucket and the user token bucket, adjust the number of tokens in the user token bucket, including discarding or storing into the global token bucket when tokens overflow, and dynamically based on user behavior Adjust the issuance rate.
It improves system resource utilization, avoids resource waste caused by token overflow, and achieves more effective quality of service (QoS) control.
Smart Images

Figure CN115080657B
Abstract
Description
[Technical field]
[0001] The present invention relates to the field of information technology, and in particular to a method, system and device for allocating operation tokens applied to distributed storage. [Background technology]
[0002] Distributed storage is a more advanced storage method. Compared with traditional centralized storage, distributed storage has the characteristics of stronger scalability, lower cost, wider application range, etc. However, distributed storage often adopts storage pool technology, which can only manage basic quotas such as the number of supported objects and capacity, and cannot achieve accurate quality of service (QoS) control. In the prior art, QoS control can be achieved by controlling the user's read and write operation instructions by adopting token bucket technology. Specifically, the number of read and write operations and the throughput per second are controlled by setting a read and write operation token bucket and a read and write operation broadband token bucket. When a user wants to perform a read and write operation, he needs to request a token from both the operation token bucket and the bandwidth token bucket before the read and write operation is allowed. The number of tokens stored in each token bucket depends on the token deposit rate and the token consumption rate. Among them, the token deposit rate depends on the user's QoS quota, and the token consumption rate depends on the user's behavior. However, this method also has some defects. When the token deposit rate is greater than the token consumption rate for a long time, the excess tokens will be discarded, wasting computing and storage resources. When the token deposit rate is lower than the token consumption rate for a long time, users cannot perform effective read and write operations. [Summary of the invention]
[0003] In order to solve the above problems, an embodiment of the present invention provides an operation token allocation method, system and device applied to distributed storage, which monitors the number of operation tokens in the global token bucket and the user token bucket, and determines whether to adjust the number of operation tokens in the corresponding user token bucket based on the number of operation tokens in the user token bucket.
[0004] In a first aspect, an embodiment of the present invention provides an operation token allocation method, which is applied to an operation token allocation system, comprising:
[0005] Writing an operation token into a global token bucket at a first rate, wherein the global token bucket is associated with a plurality of user token buckets, and the plurality of user token buckets respectively correspond to a plurality of users;
[0006] Determining, according to the configuration information of the multiple users, issuance rates of the operation tokens to the multiple user token buckets respectively;
[0007] According to the determined issuance rate, the operation tokens in the global token bucket are respectively issued to the multiple user token buckets;
[0008] According to the numbers of operation tokens in the multiple user token buckets, it is determined whether to adjust the numbers of operation tokens in the corresponding user token buckets.
[0009] The embodiment of the present invention improves system resource utilization and avoids system resource waste caused by overflow of operation tokens in user token buckets by monitoring the number of operation tokens in a global token bucket and a user token bucket and determining whether to adjust the number of operation tokens in a corresponding user token bucket according to the number of operations in multiple user token buckets.
[0010] In one possible implementation, the method further includes:
[0011] When it is detected that the number of operation tokens in the global token bucket is greater than a first threshold, the operation tokens exceeding the first threshold are discarded.
[0012] In one possible implementation, the issuance rates of the operation tokens to the multiple user token buckets are all fixed values; and according to the number of operation tokens in the multiple user token buckets, determining whether to adjust the number of operation tokens in the corresponding user token bucket includes:
[0013] When the number of operation tokens in at least one user token bucket is greater than a second threshold, the operation tokens in the at least one user token bucket exceeding the second threshold are stored in the global token bucket.
[0014] In one possible implementation, the issuance rates of the operation tokens to the multiple user token buckets are all dynamic values; and determining whether to adjust the number of operation tokens in the corresponding user token bucket according to the number of operation tokens in the multiple user token buckets includes:
[0015] When the number of operation tokens in at least one user token bucket is greater than a third threshold, reducing the issuance rate of the operation tokens to the at least one user token bucket;
[0016] When the number of operation tokens in at least one user token bucket is less than or equal to a third threshold, the issuance rate of the operation tokens to the at least one user token bucket is increased.
[0017] In one possible implementation, the method further includes:
[0018] When it is detected that no operation token is stored in the global token bucket and a read or write operation request for the operation token in the corresponding user token bucket is detected from at least one user, it is determined whether to allocate an operation token to the at least one user from the corresponding user token bucket based on the read or write operation thresholds corresponding to the at least one user.
[0019] In one possible implementation, determining whether to allocate an operation token to the at least one user from a corresponding user token bucket according to the read and write operation thresholds respectively corresponding to the at least one user includes:
[0020] Generating a release reference value for the at least one user respectively according to the read and write operation request of the at least one user;
[0021] If the release reference value corresponding to the user is greater than the read / write operation threshold, no operation token is allocated to the corresponding user; otherwise, an operation token is allocated to the corresponding user from the user token bucket according to the read / write operation request.
[0022] In a second aspect, an embodiment of the present invention provides an operation token allocation system applied to distributed storage, including:
[0023] An operation token generation module, configured to write operation tokens into a global token bucket at a first rate, wherein the global token bucket is associated with a plurality of user token buckets, and the plurality of user token buckets correspond to a plurality of users respectively;
[0024] A user token allocation module, used to determine the issuance rate of issuing the operation tokens to the multiple user token buckets respectively according to the configuration information of the multiple users;
[0025] The user token allocation module is further configured to distribute the operation tokens in the global token bucket to the multiple user token buckets respectively according to the determined distribution rate;
[0026] The user token allocation module is further used to determine whether to adjust the number of operation tokens in the corresponding user token buckets according to the number of operation tokens in the multiple user token buckets.
[0027] One possible implementation method also includes:
[0028] The detection module is used to discard the operation tokens exceeding the first threshold when it is detected that the number of operation tokens in the global token bucket is greater than the first threshold.
[0029] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0030] at least one processor; and
[0031] at least one memory in communication with the processor, wherein:
[0032] The memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method described in the first aspect.
[0033] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method described in the first aspect.
[0034] It should be understood that the second to fourth aspects of the embodiments of the present invention are consistent with the technical solutions of the first aspect of the embodiments of the present invention, and the beneficial effects achieved by the various aspects and corresponding feasible implementation methods are similar, and they will not be elaborated herein.
Brief Description of the Drawings
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 A schematic diagram of a scenario of an operation token allocation method provided by an embodiment of the present invention;
[0037] Figure 2 A flowchart of an operation token allocation method provided by an embodiment of the present invention;
[0038] Figure 3 A flowchart of another operation token allocation method provided by an embodiment of the present invention;
[0039] Figure 4 A schematic diagram of the structure of an operation token allocation system provided by an embodiment of the present invention;
[0040] Figure 5 A schematic diagram of the structure of another operation token allocation system provided by an embodiment of the present invention;
[0041] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. [Specific implementation method]
[0042] In order to better understand the technical solution of this specification, the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0043] The embodiment of the present invention is by arranging the global token bucket of upper layer and the user token bucket of lower layer, and the operation token quantity in the global token bucket and the user token bucket is monitored. According to the operation token quantity in the user token bucket, determine whether to adjust the quantity of the operation token in the response user token bucket.
[0044] Figure 1 A schematic diagram of a scenario of an operation token allocation method for distributed storage provided by an embodiment of the present invention, such as Figure 1 As shown, the operation token generation module operates at a first rate T max Write the operation token into the global token bucket. The global token bucket stores the written operation token. The user token allocation module determines the operation token issuance rate T corresponding to multiple users according to the QoS quota information in the configuration information of multiple users. i , and at the release rate T i The operation token is issued to the corresponding user token bucket. Since the QoS quota information of each user is different, the operation token issuance rate T corresponding to each user is i Each user consumes at a different rate T 0 Use the operation token in the user token bucket. The user consumes the operation token in the user token bucket at a rate T 0 Depends on user behavior. When the user's read and write operation frequency is high, the corresponding operation token consumption rate T 0 Higher, when the user's read and write operation frequency is low, the corresponding operation token consumption rate T 0 Lower.
[0045] Figure 2 A flowchart of an operation token allocation method for distributed storage provided in an embodiment of the present invention, wherein the method is applied to an operation token allocation system, such as Figure 2 As shown, the method includes:
[0046] Step 201, write an operation token into a global token bucket at a first rate, the global token bucket is associated with multiple user token buckets, and the multiple user token buckets correspond to multiple users respectively. Among them, the operation token generation module in the operation token allocation system writes the operation token into the global token bucket at a first rate. The global token bucket is responsible for storing the operation token written by the operation token generation module. The operation token is used to perform read and write operations. Specifically, when a user performs a read and write operation, he needs to request the corresponding operation token before he can perform the read and write operation. In some embodiments, a first threshold value of the storage number of operation tokens can be set for the global token bucket. When it is detected that the number of tokens in the global token bucket is greater than the first threshold value, the operation tokens exceeding the first threshold value can be discarded to avoid excessive accumulation of operation tokens and affect system performance. Optionally, the first threshold value can be the upper limit of the storage of operation tokens in the global token bucket. When the detection module in the operation token allocation system detects that the number of tokens in the global token bucket reaches the storage upper limit, the operation tokens exceeding the storage upper limit can be discarded.
[0047] Step 202, according to the configuration information of the multiple users, determine the issuance rate of the operation tokens to the multiple user token buckets respectively. Optionally, the configuration information of the multiple users can be the QoS quota information of the multiple users, and the user token allocation module in the operation token allocation system determines the issuance rate of the operation tokens corresponding to each user according to the QoS quota information of each user. Since the QoS quota information of each user contains information such as the maximum receiving rate of the operation tokens of the user token bucket corresponding to the user and the upper limit of the storage of the number of operation tokens, etc. Therefore, the issuance rate of the operation tokens issued to the user token bucket can be determined according to the maximum receiving rate of the operation tokens in the QoS configuration information.
[0048] Step 203, according to the determined issuance rate, the operation tokens in the global token bucket are respectively issued to the multiple user token buckets. Optionally, the operation tokens in the global token bucket can be respectively issued to the multiple user token buckets at the issuance rate by the user token allocation module. In some embodiments, the first rate of writing operation tokens into the global token bucket can be equal to the sum of the issuance rates of issuing operation tokens to the associated multiple user token buckets. For example, the global token bucket corresponds to 10 user token buckets, and the sum of the issuance rates of the 10 user token buckets is 100 operation tokens per second, then the first rate of writing operation tokens into the global token bucket is 100 per second.
[0049] In some embodiments, in order to support more users, the issuance rates of multiple user token buckets may be over-allocated. For example, the issuance rate of the user token bucket determined by the user token allocation module according to the configuration information is 10 per second, and the user token allocation module may issue tokens at a rate of 12 per second when actually issuing tokens. At this time, the rate of writing operation tokens in the global token bucket does not change, that is, the first rate of writing operation tokens in the global token bucket is less than the sum of the issuance rates of all user buckets.
[0050] Step 204, according to the number of operation tokens in the plurality of user token buckets, determine whether to adjust the number of operation tokens in the corresponding user token bucket. Specifically, for the scenario of issuing operation tokens to the user token bucket at a fixed issuance rate, the method for adjusting the number of operation tokens in the user token bucket can be: setting a second threshold value of the number of operation tokens for each user token bucket, and when it is detected that the number of operation tokens in at least one user token bucket is greater than the second threshold value, storing the operation tokens exceeding the second threshold value in at least one user token bucket into the global token bucket. Optionally, the user token allocation module can be responsible for monitoring the number of operation tokens in the user token bucket, and storing the operation tokens exceeding the second threshold value into the global token bucket, or an independent detection module can be set to complete the above operation. For example, the second threshold value of the user token bucket is 100, and when the user token allocation module detects that the number of operation tokens in the user token bucket exceeds 100, the operation tokens exceeding 100 are recycled and stored in the global token bucket. Through the above method, when the user reads and writes less, the waste of system resources caused by excessive overflow of the number of operation tokens in the user token bucket can be avoided. Optionally, the second threshold may be an upper limit for storing operation tokens in each user token bucket. When it is detected that the number of operation tokens in the user token bucket reaches the upper limit, the operation tokens exceeding the upper limit of the user token bucket are recycled and stored in the global token bucket.
[0051] In some embodiments, for a scenario where an operation token is issued to a user token bucket at a dynamic issuance rate, the user token allocation module can adjust the issuance rate of the operation token according to the number of operation tokens in each user token bucket, and the method specifically includes: when the number of operation tokens in at least one user token bucket is greater than a third threshold, reducing the issuance rate of the operation token issued to the at least one user token bucket. When the number of operation tokens in at least one user token bucket is less than or equal to the third threshold, increasing the issuance rate of the operation token issued to the at least one user token bucket. For example, the third threshold can be 70% of the upper limit of the user token bucket storage. When the user token allocation module detects that the number of operation tokens in the user token bucket is greater than 70%, the issuance rate of the operation token issued to the user token bucket can be reduced. When the user token allocation module detects that the number of operation tokens in the user token bucket is less than 70%, the issuance rate of the operation token issued to the user token bucket can be increased. Optionally, when increasing the issuance rate of the operation token issued to the user token bucket, it cannot exceed the maximum issuance rate obtained according to the configuration. For example, in the QoS configuration, the maximum issuance rate of the first user is 10 operation tokens per second, and the operation token issuance rate of the user token bucket corresponding to the first user by the user token allocation module may be between 0 and 10 per second.
[0052] In some embodiments, when the storage capacity of operation tokens in the global token bucket is small, and the corresponding multiple users have high-frequency read and write operations, the rate at which the user consumes the operation tokens in the corresponding user token bucket can be controlled. The method includes: when the detection module in the operation token allocation system detects that there is no operation token stored in the global token bucket, a working signal can be sent to the token contention module to make the token contention module enter a working state. When the token requisition module detects a read and write operation request of at least one user for the operation token in the corresponding user token bucket, it can determine whether to allocate an operation token to the at least one user from the corresponding user token bucket according to the read and write operation thresholds corresponding to the at least one user. Since the user needs to request the corresponding operation token from the user token bucket before performing the read and write operation, a read and write operation threshold can be set to control the probability of the user requesting the operation token, thereby reducing the rate at which the user consumes the operation token in the corresponding user token bucket.
[0053] In some embodiments, when controlling the passing probability of a user requesting an operation token, the determination may be made in conjunction with the user's request, such as Figure 3 As shown, the method includes:
[0054] Step 301, based on the read and write operation requests of the at least one user, respectively generate a release reference value for the at least one user. Optionally, since the user's read and write operation request is actually a piece of code, a hash operation can be performed on the read and write operation request, and the result of the hash operation is modulo operation with the maximum value of the read and write operation threshold value range, and the result is the release reference value. For example, the result of the hash operation on the read and write operation request is 10154, and the value range of the read and write operation threshold is 0-100, then the release reference value of the request obtained by performing a modulo operation on 10154 and 100 is 54.
[0055] Step 302, determine whether the release reference value corresponding to the user is greater than the read / write operation threshold. If the release reference value corresponding to the user is greater than the read / write operation threshold, execute step 303. Otherwise, execute step 304.
[0056] Step 303: Do not allocate an operation token to the corresponding user.
[0057] Step 304: allocate an operation token to the corresponding user from the user token bucket according to the read / write operation request.
[0058] For example, the token contention module obtains a release reference value of 60 based on the user's read / write operation request, and the corresponding read / write operation threshold of the user is 70. Since the release reference value 60 is less than the corresponding read / write operation threshold 70, the user's read / write operation request is approved, and an operation token is allocated to the user from the corresponding user token bucket. It can be seen that the larger the user's read / write operation threshold, the higher the probability that the user's read / write operation request is approved. Through the above method, the passing probability of the user's read / write operation request is controlled, and when there are fewer operation tokens in the global token bucket, effective QoS guarantee is achieved.
[0059] Corresponding to the above method, an embodiment of the present invention provides an operation token allocation system applied to distributed storage, such as Figure 4 As shown, the system includes: an operation token generation module 401 and a user token allocation module 402.
[0060] An operation token generation module 401 is used to write operation tokens into a global token bucket at a first rate, wherein the global token bucket is associated with a plurality of user token buckets, and the plurality of user token buckets correspond to a plurality of users respectively;
[0061] A user token allocation module 402, configured to determine, according to the configuration information of the multiple users, the issuance rates of the operation tokens to the multiple user token buckets respectively;
[0062] The user token allocation module 402 is further configured to distribute the operation tokens in the global token bucket to the multiple user token buckets respectively according to the determined distribution rate;
[0063] The user token allocation module 402 is further configured to determine whether to adjust the number of operation tokens in the corresponding user token buckets according to the number of operation tokens in the plurality of user token buckets.
[0064] Figure 4 The operation token allocation system provided by the illustrated embodiment can be used to implement the present invention. Figure 1 to Figure 3 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0065] In some embodiments, Figure 5 As shown, the operation token allocation system may further include a detection module 403 .
[0066] The detection module 403 is configured to discard the operation tokens exceeding the first threshold when it is detected that the number of operation tokens in the global token bucket is greater than the first threshold.
[0067] Figure 5 The operation token allocation system provided by the illustrated embodiment can be used to implement the present invention. Figure 1 to Figure 3 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0068] Figure 6 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Figure 6 As shown, the electronic device may include at least one processor; and at least one memory connected to the processor in communication, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the present invention. Figure 1 to Figure 3 The illustrated embodiment provides an operation token allocation method.
[0069] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present invention is shown. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0070] like Figure 6 As shown, the electronic device is in the form of a general computing device. The components of the electronic device may include but are not limited to: one or more processors 610, communication interface 620 and memory 630, and a communication bus 940 connecting different system components (including memory 630, communication interface 620 and processing unit 610).
[0071] The communication bus 640 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0072] Electronic devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.
[0073] The memory 630 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. The memory 630 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present application.
[0074] A program / utility having a set (at least one) of program modules may be stored in memory 630, such program modules including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules generally perform the functions and / or methods of the embodiments described herein.
[0075] The processor 610 executes various functional applications and data processing by running the programs stored in the memory 630, such as implementing the present application Figure 1 to Figure 3 The illustrated embodiment provides an operation token allocation method.
[0076] The present invention provides a computer-readable storage medium storing computer instructions, which enables the computer to execute the present invention. Figure 1 to Figure 3 The illustrated embodiment provides an operation token allocation method.
[0077] The above-mentioned computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ReadOnly Memory; hereinafter referred to as: ROM), an erasable programmable read-only memory (Erasable Programmable ReadOnly Memory; hereinafter referred to as: EPROM) or flash memory, optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0078] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0079] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0080] The computer program code for performing the operation of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (Local Area Network; hereinafter referred to as: LAN) or a wide area network (Wide Area Network; hereinafter referred to as: WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0081] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0082] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0083] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this specification, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0084] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of this specification includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of this specification belong.
[0085] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0086] It should be noted that the terminals involved in the embodiments of this specification may include but are not limited to personal computers (Personal Computer; hereinafter referred to as: PC), personal digital assistants (Personal Digital Assistant; hereinafter referred to as: PDA), wireless handheld devices, tablet computers (Tablet Computer), mobile phones, MP3 displays, MP4 displays, etc.
[0087] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0088] In addition, each functional unit in each embodiment of this specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0089] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (Processor) to perform some steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), disk or optical disk and other media that can store program codes.
[0090] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
Claims
1. A method for allocating operation tokens for distributed storage, characterized in that: The method is to operate a token distribution system by a user, comprising: Writing an operation token into a global token bucket at a first rate, wherein the global token bucket is associated with a plurality of user token buckets, and the plurality of user token buckets respectively correspond to a plurality of users; Determining, according to the configuration information of the multiple users, issuance rates of the operation tokens to the multiple user token buckets respectively; According to the determined issuance rate, the operation tokens in the global token bucket are respectively issued to the multiple user token buckets; Determining whether to adjust the number of operation tokens in the corresponding user token buckets according to the number of operation tokens in the multiple user token buckets; The issuance rate of the operation tokens to the multiple user token buckets is a dynamic value or a fixed value; When the issuance rate of the operation tokens to the multiple user token buckets is a dynamic value; determining whether to adjust the number of operation tokens in the corresponding user token buckets according to the number of operation tokens in the multiple user token buckets, including: When the number of operation tokens in at least one user token bucket is greater than a third threshold, reducing the issuance rate of the operation tokens to the at least one user token bucket; When the number of operation tokens in at least one user token bucket is less than or equal to a third threshold, the issuance rate of the operation tokens to the at least one user token bucket is increased.
2. The method according to claim 1, characterized in that The method further comprises: When it is detected that the number of operation tokens in the global token bucket is greater than a first threshold, the operation tokens exceeding the first threshold are discarded.
3. The method according to claim 1 or 2, characterized in that: When the issuance rates of the operation tokens to the multiple user token buckets are all fixed values; Determining whether to adjust the number of operation tokens in the corresponding user token buckets according to the number of operation tokens in the multiple user token buckets includes: When the number of operation tokens in at least one user token bucket is greater than a second threshold, the operation tokens in the at least one user token bucket exceeding the second threshold are stored in the global token bucket.
4. The method according to claim 1, characterized in that: The method further comprises: When it is detected that no operation token is stored in the global token bucket and a read or write operation request for the operation token in the corresponding user token bucket is detected from at least one user, it is determined whether to allocate an operation token to the at least one user from the corresponding user token bucket based on the read or write operation thresholds corresponding to the at least one user.
5. The method according to claim 4, characterized in that Determining whether to allocate an operation token to the at least one user from a corresponding user token bucket according to the read and write operation thresholds respectively corresponding to the at least one user includes: Generating a release reference value for the at least one user respectively according to the read and write operation request of the at least one user; If the release reference value corresponding to the user is greater than the read / write operation threshold, no operation token is allocated to the corresponding user; otherwise, an operation token is allocated to the corresponding user from the user token bucket according to the read / write operation request.
6. An operation token allocation system for distributed storage, characterized in that: include: An operation token generation module, configured to write operation tokens into a global token bucket at a first rate, wherein the global token bucket is associated with a plurality of user token buckets, and the plurality of user token buckets correspond to a plurality of users respectively; A user token allocation module, used to determine the issuance rate of issuing the operation tokens to the multiple user token buckets respectively according to the configuration information of the multiple users; The user token allocation module is further configured to distribute the operation tokens in the global token bucket to the multiple user token buckets respectively according to the determined distribution rate; The user token allocation module is further used to determine whether to adjust the number of operation tokens in the corresponding user token bucket according to the number of operation tokens in the multiple user token buckets; The issuance rate of the operation tokens to the multiple user token buckets is a dynamic value or a fixed value; When the issuance rate of the operation tokens to the multiple user token buckets is a dynamic value; the user token allocation module is specifically used to: When the number of operation tokens in at least one user token bucket is greater than a third threshold, reducing the issuance rate of the operation tokens to the at least one user token bucket; When the number of operation tokens in at least one user token bucket is less than or equal to a third threshold, the issuance rate of the operation tokens to the at least one user token bucket is increased.
7. The system according to claim 6, characterized in that Also includes: The detection module is used to discard the operation tokens exceeding the first threshold when it is detected that the number of operation tokens in the global token bucket is greater than the first threshold.
8. An electronic device, characterized in that: include: at least one processor; as well as at least one memory in communication with the processor, wherein: The memory stores program instructions executable by the processor, and the processor can execute the method according to any one of claims 1 to 5 by calling the program instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method according to any one of claims 1 to 5.
