User quota management method, program product, electronic device and storage medium

By caching user quota information in the memory cache of the distributed file system client and performing direct detection, the IO delay problem caused by user quota management is solved and IO performance is improved.

CN120821709AInactive Publication Date: 2025-10-21CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511254668.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2025-10-21
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In a distributed file system, user quota management causes IO process delays, affecting overall IO performance.

Method used

Cache user quota information in the client's memory cache and perform user quota detection directly through the client to reduce interaction with the server.

Benefits of technology

Improved quota detection efficiency, reduced IO latency, and improved overall IO performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120821709A_ABST
    Figure CN120821709A_ABST
Patent Text Reader

Abstract

The invention discloses a user quota management method, a program product, electronic equipment and a storage medium. The user quota management method is applied to a client side of a distributed file system and comprises the steps that in the process of executing data input / output operation, user quota detection is carried out based on user quota information in a memory cache of the client side; the memory cache of the client comprises user quota information of a plurality of users, the user quota information of the plurality of users is synchronized to the memory cache of the client by a first server, and the user quota information of the plurality of users is stored in the first server; and if the user quota detection is passed, executing data input / output operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a user quota management method, program product, electronic device and storage medium. Background Art

[0002] When using distributed file systems, individual users often overuse resources, impacting the resource usage of other users. A related technology addresses this issue by setting quotas for each user and limiting their resource usage. This technology manages user quotas through metadata service nodes. During the input / output (IO) process, incremental quota requests must be sent to the metadata service node, and only after receiving a quota response can IO operations be performed. This introduces additional latency to the IO process, impacting overall IO performance. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a user quota management method, a program product, an electronic device, and a storage medium.

[0004] The technical solution of the embodiment of the present invention is achieved as follows: In one aspect, an embodiment of the present invention provides a user quota management method, which is applied to a client of a distributed file system. The method includes: During a data input / output operation, user quota detection is performed based on user quota information in a memory cache of the client; the memory cache of the client includes user quota information of a plurality of users, the user quota information of the plurality of users being synchronized to the memory cache of the client by a first server, the first server storing the user quota information of the plurality of users; If the user quota check passes, the data input / output operation is performed.

[0005] In the above solution, the user quota information includes: the used amount of the user quota and the maximum amount of the user quota used. The memory cache further stores: the newly used amount of the user quota, and the newly used amount of the user quota includes the data usage of the current user of the client from the first time point. The user quota detection based on the user quota information in the memory cache of the client includes: determining, based on the newly added usage of the user quota and the used usage of the user quota, whether the data input / output operation will cause the user quota usage to exceed the maximum usage of the user quota; If it does not exceed, the user quota check passes.

[0006] In the above solution, the memory cache further stores: a newly added user quota usage amount, the newly added user quota usage amount including the data usage amount of the current user of the client from the first time point. If the user quota detection passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the newly added usage of the user quota in the memory cache; The used amount of the user quota in the first server is updated periodically based on the newly used amount of the user quota in the memory cache.

[0007] In the above solution, the memory cache of the client further stores: directory statistics of newly added usage, the directory statistics of newly added usage including the data usage of each directory by the current user of the client starting from the second time point; if the user quota check passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the directory statistics in the memory cache to increase the usage; The directory statistics usage in the first server is regularly updated based on the directory statistics new usage in the memory cache, where the directory statistics usage includes the data usage of the user in each directory.

[0008] In the above solution, before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Receive a first quota setting request, the quota setting request including: a directory path, a user identifier, and user quota information; Based on the directory path, querying metadata of a corresponding directory in a second server, wherein the metadata includes an index identifier of the directory; the second server is a metadata server, storing metadata of multiple directories; A second quota setting request is sent to the first server, where the second quota setting request includes the index identifier, the user identifier, and the user quota information.

[0009] In the above solution, before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Sending a quota information query request to the first server; receiving user quota information of a plurality of users sent by the first server; The user quota information in the memory cache is updated according to the received user quota information of the multiple users.

[0010] In the above solution, the method further includes: The user quota information of the current user is determined according to the root directory of the tenant corresponding to the current user of the client; the user quota information of each user in the memory cache of the client is bound to the root directory of the corresponding tenant.

[0011] In the above solution, the memory cache of the client further stores: a correspondence between the directories visited by the client within a preset time period and the root directory; The method further comprises: According to the corresponding relationship, the root directory of the directory accessed by the current user of the client is determined.

[0012] On the other hand, an embodiment of the present invention provides another user quota management method, which is applied to a first server, and includes: Receive quota information query requests sent by clients of the distributed file system; Based on the quota information query request, user quota information of multiple users stored in the first server is sent to the client, and the client is used to store the user quota information of the multiple users in the memory cache of the client, and the client is used to perform user quota detection based on the user quota information in the memory cache.

[0013] In the above solution, the method further includes: receiving a second quota setting request sent by the client, where the second quota setting request includes a directory index identifier, a user identifier, and user quota information; User quota setting is performed based on the second quota setting request.

[0014] In the above solution, the user quota information in the first server includes the used amount of the user quota, and the method further includes: receiving a newly added user quota usage amount sent by the client, where the newly added user quota usage amount includes a data usage amount of a current user of the client from a first time point; The used amount of the user quota in the first server is updated according to the newly used amount of the user quota.

[0015] In the above solution, the method further includes: receiving a directory statistics newly added usage amount sent by the client, wherein the directory statistics newly added usage amount includes data usage of each directory by a current user of the client starting from a second time point; The directory statistics usage in the first server is updated according to the newly added usage in the directory statistics, where the directory statistics usage includes the data usage of the user in each directory.

[0016] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, it implements the steps of the above-mentioned user quota management method.

[0017] On the other hand, an embodiment of the present invention provides an electronic device, including a processor and a memory, which are connected to each other, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the steps of the user quota management method provided in the first aspect of the embodiment of the present invention.

[0018] In another aspect, an embodiment of the present invention provides a computer-readable storage medium, comprising: the computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the user quota management method provided in the first aspect of the embodiment of the present invention.

[0019] The memory cache of the client in the distributed file system of the embodiment of the present invention includes user quota information of multiple users, and the user quota information of multiple users is synchronized to the memory cache of the client by the first server. During the execution of data input / output operations, user quota detection is performed based on the user quota information in the memory cache of the client, and if the user quota detection passes, the data input / output operation is executed. Since the embodiment of the present invention caches the user quota information in the memory cache of the client, when the client performs user quota detection, it can directly use the user quota information in the memory cache to perform user quota detection without interacting with other servers, thereby improving the efficiency of quota detection, reducing IO delay, and improving overall IO performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic diagram of a service relationship of a storage cluster provided by an embodiment of the present invention; Figure 2 This is a schematic diagram of an implementation flow of a user quota management method provided by an embodiment of the present invention; Figure 3 This is a schematic diagram of a process for setting user quota information using a CLI command provided by an embodiment of the present invention; Figure 4 This is a schematic diagram of a CLI command flow for querying user quota information provided by an embodiment of the present invention; Figure 5 This is a flow chart of a user quota information synchronization mechanism provided by an embodiment of the present invention; Figure 6 This is a flow chart of a mechanism for maintaining user quota usage provided by an embodiment of the present invention; Figure 7This is a flowchart of a directory usage statistics maintenance mechanism provided by an embodiment of the present invention; Figure 8 This is a schematic diagram of the implementation process of another user quota management method provided by an embodiment of the present invention; Figure 9 This is a schematic diagram of the relationship between an IO process and a user quota service provided by an embodiment of the present invention; Figure 10 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0022] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.

[0023] A distributed file system (DFS) manages physical storage resources that are not necessarily directly connected to local nodes but rather connected to nodes via a computer network. Alternatively, it manages a complete, hierarchical file system composed of several logical disk partitions or volumes. DFS provides a logical, tree-like file system structure for resources distributed anywhere on the network, making it easier for users to access shared files distributed across the network.

[0024] Figure 1 This diagram illustrates the service relationships of a storage cluster provided by an embodiment of the present invention. The core concepts of a storage cluster involve four concepts: a Filesystem in Userspace (FUSE) client, a centralized service cluster, a metadata service cluster, and a data service cluster.

[0025] The FUSE client implements the Portable Operating System Interface of UNIX (POSIX) semantics for the user file system. It forwards file data read and write requests to the data service cluster, and metadata-related requests to the metadata service cluster. It obtains user quota information from the centralized service cluster and uses this information to limit the approval of I / O requests during the I / O process.

[0026] A centralized service cluster is implemented based on a distributed consensus algorithm. Only the master node responds to external service requests, while non-master nodes forward requests to the master node. Internally, a master election mechanism and heartbeat mechanism are implemented. A Hypertext Transfer Protocol (HTTP) server is also implemented to respond to external HTTP requests, such as FUSE user quota requests.

[0027] A metadata service cluster is implemented based on a distributed consensus algorithm, enabling partial reading and writing of file and directory metadata. This provides features such as consistency, availability, and partition tolerance. A Google Remote Procedure Calls (GRPC) interface is provided for FUSE clients to call and read and write file and directory metadata.

[0028] Implements a data service cluster based on a distributed consensus algorithm, enabling partial file data read and write functionality. It achieves consistency, availability, and partition tolerance. It also provides a private protocol for FUSE clients to call and read and write the data portion of a file.

[0029] Figure 2 This is a schematic diagram of the implementation flow of a user quota management method provided by an embodiment of the present invention. The execution subject of the user quota management method is a client in a distributed file system, and the client runs on an electronic device. Figure 2 , user quota management methods include: S201, during a data input / output operation, performing a user quota check based on the user quota information in the memory cache of the client; the memory cache of the client includes user quota information of multiple users, and the user quota information of the multiple users is synchronized to the memory cache of the client by a first server, and the first server stores user quota information of the multiple users.

[0030] Among them, you can refer to Figure 1 The service relationship shown, the first server corresponds to Figure 1 In the centralized service cluster, the first server persistently stores the user quota information of all users. The user quota information may include the maximum usage of the user quota and the used amount of the user quota. The maximum usage of the user quota may include the maximum usage space and the maximum number of used inodes.

[0031] The first server can periodically synchronize user quota information to the client's memory cache. During the data IO process, before the IO is written to the disk, the client performs user quota detection based on the user quota information in the memory cache.

[0032] Specifically, the first server may synchronize user quota information of multiple users to the memory cache of the client. To determine the user quota information of the current user, the client may search for the corresponding user quota information according to the user ID of the user currently logged in on the client.

[0033] When performing user quota detection, the key is to prevent the user's data usage from exceeding the user's maximum quota. That is, the current IO data volume plus the user's used data volume cannot be greater than the user's maximum quota.

[0034] S202: If the user quota check passes, the data input / output operation is performed.

[0035] If the user quota check passes, it means that the IO will not exceed the quota limit and the data input / output operation can continue.

[0036] The memory cache of the client in the distributed file system of the embodiment of the present invention includes user quota information of multiple users, and the user quota information of multiple users is synchronized to the memory cache of the client by the first server. During the execution of data input / output operations, user quota detection is performed based on the user quota information in the memory cache of the client, and if the user quota detection passes, the data input / output operation is executed. Since the embodiment of the present invention caches the user quota information in the memory cache of the client, when the client performs user quota detection, it can directly use the user quota information in the memory cache to perform user quota detection without interacting with other servers, thereby improving the efficiency of quota detection, reducing IO delay, and improving overall IO performance.

[0037] In one embodiment, the user quota information includes: a used amount of the user quota and a maximum amount of the user quota. The memory cache further stores: a newly used amount of the user quota, where the newly used amount of the user quota includes data usage of a current user of the client from a first time point. The user quota detection based on the user quota information in the memory cache of the client includes: determining, based on the newly added usage of the user quota and the used usage of the user quota, whether the data input / output operation will cause the user quota usage to exceed the maximum usage of the user quota; If it does not exceed, the user quota check passes.

[0038] Here, the user quota usage and maximum usage are synchronized from the first server to the client's memory cache, and these two values ​​remain unchanged. The user quota usage is the amount of data used by the user (completed I / O operations) from the first point in time, as counted by the client. Since the current data I / O operation has not yet been executed, the data corresponding to the current data I / O operation is not included in the user quota usage.

[0039] The first time point may be the time point when the client sends the newly added usage of the user quota to the first server, and the first server updates the used user quota in the first server according to the newly added usage of the user quota sent by the client.

[0040] For example, the system checks whether the user quota's newly added usage + the user quota's used usage + the data volume corresponding to the data input / output operation is greater than the user quota's maximum usage. If so, the user quota has been exceeded and the user quota check has failed. If not, the data input / output operation is performed.

[0041] In one embodiment, the memory cache further stores: a newly added user quota usage amount, the newly added user quota usage amount including the data usage amount of the current user of the client from a first time point. If the user quota check passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the newly added usage of the user quota in the memory cache; The used amount of the user quota in the first server is updated periodically based on the newly used amount of the user quota in the memory cache.

[0042] After the data input / output operation is completed, the data volume corresponding to the data input / output operation is added to the new user quota usage in the memory cache. That is, the data volume corresponding to the data input / output operation is added to the original new user quota usage to obtain the latest new user quota usage.

[0043] The client periodically adds the newly added user quota usage in its memory cache to the first server's used user quota. The first server persistently stores the maximum user quota usage and the used user quota. The first server updates the used user quota based on the newly added user quota usage sent by the client. This means the latest used user quota is calculated by adding the newly added user quota usage sent by the client to the original used user quota.

[0044] In one embodiment, after the client sends the newly added user quota usage to the first server, the newly added user quota usage in the memory cache is reset to zero, that is, the counting of the newly added user quota usage is restarted. Here, the first time point may be the time point when the client periodically triggers the sending of the newly added user quota usage to the first server.

[0045] In one embodiment, the memory cache of the client further stores: directory statistics of newly added usage, the directory statistics of newly added usage including data usage of each directory by the current user of the client starting from the second time point; if the user quota check passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the directory statistics in the memory cache to increase the usage; The directory statistics usage in the first server is regularly updated based on the directory statistics new usage in the memory cache, where the directory statistics usage includes the data usage of the user in each directory.

[0046] Here, the newly added usage statistics of the directory in the memory cache are statistics of the data usage of each directory by the current user, and the used usage statistics of the directory in the first server are statistics of the data usage of each directory by the user.

[0047] The second time point may be the same as the first time point, and the second time point may be the time point at which the client periodically triggers the sending of the directory statistics newly added usage to the first server.

[0048] In one embodiment, before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Receive a first quota setting request, the quota setting request including: a directory path, a user identifier, and user quota information; Based on the directory path, querying metadata of a corresponding directory in a second server, wherein the metadata includes an index identifier of the directory; the second server is a metadata server, storing metadata of multiple directories; A second quota setting request is sent to the first server, where the second quota setting request includes the index identifier, the user identifier, and the user quota information.

[0049] Here, the first quota setting request can be a command line interface (CLI) command. The client can receive the CLI command input by the user, set the maximum usage of the user quota (maximum used space and maximum number of used inodes) in the first server through the CLI command, and query the user quota information (maximum used space, maximum number of used inodes, currently used space, and currently used inodes) in the first server through the CLI command.

[0050] like Figure 3 As shown in the figure, the process of setting user quota information through the CLI command includes: 1. The CLI command sends a request to the FUSE client to set a quota.

[0051] The CLI command can be entered by the user on the client interface. The parameters of the quota setting request include the setting directory path, user ID, the user's maximum usage capacity, and the user's maximum number of inodes.

[0052] 2. The FUSE client sends a metadata information query request to the metadata service cluster.

[0053] The parameters of the metadata information query request include the directory path.

[0054] 3. The metadata service cluster returns metadata information to the FUSE client, including the inode number of the directory.

[0055] 4. The FUSE client sends a quota setting request to the centralized service cluster. The parameters include the inode number of the setting directory, the user ID, the user's maximum usage capacity, and the user's maximum number of inodes.

[0056] 5. The centralized service cluster returns a successful setup message to the FUSE client.

[0057] 6. The FUSE client returns a successful setting to the CLI command.

[0058] like Figure 4 As shown in the figure, the process of querying user quota information through the CLI command includes: 1. The CLI command sends a quota query request to the FUSE client.

[0059] The parameters of the quota query request include the setting directory path.

[0060] 2. The FUSE client sends a metadata information query request to the metadata service cluster.

[0061] The parameters of the metadata information query request include the directory path and user ID.

[0062] 3. The metadata service cluster returns metadata information to the FUSE client.

[0063] The metadata information includes the inode number of the directory.

[0064] 4. The FUSE client sends a quota information query request to the centralized service cluster. The parameters include the inode number of the setting directory and the user ID.

[0065] 5. The centralized service cluster returns quota information to the FUSE client, including the user's maximum usage capacity, the user's maximum number of inodes, the user's used capacity, and the user's used inodes.

[0066] 6. The FUSE client returns quota information to the CLI command, including the user's maximum usage capacity, the user's maximum number of inodes, the user's used capacity, and the user's used inodes.

[0067] In one embodiment, before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Sending a quota information query request to the first server; receiving user quota information of a plurality of users sent by the first server; The user quota information in the memory cache is updated according to the received user quota information of the multiple users.

[0068] Here, the client may periodically obtain user quota information from the first server and synchronize the information into the memory cache.

[0069] like Figure 5 As shown in the figure, the process of the user quota information synchronization mechanism includes: The FUSE client starts a timer loop that executes the following steps: 1. The FUSE client sends a quota information query request to the centralized service cluster.

[0070] 2. The centralized service cluster returns user quota information to the FUSE client, including the user's maximum usage space, the user's maximum number of inodes, the user's used space, and the user's used inode number.

[0071] 3. The FUSE client updates the user quota information in the memory cache.

[0072] like Figure 6 As shown in the figure, the process of maintaining the user quota usage includes: The FUSE client starts a timer loop that executes the following steps: 1. The FUSE client submits a request for new user usage to the centralized service cluster, including the new user quota usage (the user's new usage space and the user's new inode number).

[0073] 2. The centralized service cluster adds the user's newly added quota usage to the user's quota usage, including adding the newly added space to the user's used space and adding the user's newly added inode number to the user's used inode number.

[0074] 3. The used user quota is written to disk.

[0075] 4. The centralized service cluster returns a success message to the FUSE client.

[0076] 5. The FUSE client clears the user quota and adds new usage.

[0077] like Figure 7 As shown in the figure, the process of maintaining the directory statistics usage includes: The FUSE client starts a timer loop that executes the following steps: 1. The FUSE client submits a request for directory statistics to the centralized service cluster, including the directory statistics usage (the newly used space and the number of newly added inodes).

[0078] 2. The centralized service cluster appends the newly added usage of the directory statistics to the already used usage of the directory statistics, including appending the newly used space of the directory statistics to the already used space of the directory statistics, and appending the newly added inode number of the directory statistics to the already used inode number of the directory statistics.

[0079] 3. Directory statistics show that the used data has been saved to disk.

[0080] 4. The centralized service cluster returns a success message to the FUSE client.

[0081] 5. The FUSE client clears the directory statistics to add new usage.

[0082] In one embodiment, the method further comprises: The user quota information of the current user is determined according to the root directory of the tenant corresponding to the current user of the client; the user quota information of each user in the memory cache of the client is bound to the root directory of the corresponding tenant.

[0083] In related technologies, the same user exists in different tenants. When the usage of a user in a certain tenant reaches the quota limit, it will affect the reading and writing of the same user in other tenants.

[0084] Because different tenants have different root directories, this embodiment of the present invention writes all user quota information for a tenant into that tenant's root directory. When performing user quota checks, this embodiment only determines whether the user quota limit for that tenant's root directory has been exceeded, and does not check the user quota limits for root directories of other tenants.

[0085] In one embodiment, the client's memory cache further stores: a correspondence between directories accessed by the client within a preset time period and the root directory; the method further includes: According to the corresponding relationship, the root directory of the directory accessed by the current user of the client is determined.

[0086] When checking user quotas, the maximum usage of the user quota belongs to the root directory of the tenant. You need to search up the current directory step by step to the top-level directory (root directory) of the tenant.

[0087] To improve search efficiency, this embodiment designs a dirParents cache mechanism that records the relationship between the current directory and its parent directory and stores it in the FUSE client. The correspondence between the directories accessed by the client within a preset time period and the root directory can be cached in the FUSE client.

[0088] If the parent directory of a directory queried by a FUSE client does not exist in the dirParents cache, it can be retrieved from the metadata service cluster and written to the dirParents cache.

[0089] The embodiment of the present invention utilizes a cache mechanism to improve the efficiency of quota verification, reduce the interaction with centralized services, and improve the overall IO efficiency.

[0090] Figure 8 This is a schematic diagram of the implementation process of another user quota management method provided by an embodiment of the present invention. The execution subject of the user quota management method is the first server, which can be Figure 2 Centralized service cluster in . Reference Figure 8 , user quota management methods include: S801: Receive a quota information query request sent by a client of a distributed file system.

[0091] S802, based on the quota information query request, sending the user quota information of multiple users stored in the first server to the client, the client is used to store the user quota information of the multiple users in the memory cache of the client, and the client is used to perform user quota detection based on the user quota information in the memory cache.

[0092] With reference to the above method embodiment, the first server synchronizes the user quota information of multiple users to the memory cache of the client. When the client performs user quota detection, it can directly use the user quota information in the memory cache for user quota detection without the need to interact with other servers, thereby improving the efficiency of quota detection, reducing IO delay, and improving overall IO performance.

[0093] In one embodiment, the method further comprises: receiving a second quota setting request sent by the client, where the second quota setting request includes a directory index identifier, a user identifier, and user quota information; User quota setting is performed based on the second quota setting request.

[0094] In one embodiment, the user quota information in the first server includes a used amount of the user quota, and the method further includes: receiving a newly added user quota usage amount sent by the client, where the newly added user quota usage amount includes a data usage amount of a current user of the client from a first time point; The used amount of the user quota in the first server is updated according to the newly used amount of the user quota.

[0095] In one embodiment, the method further comprises: receiving a directory statistics newly added usage amount sent by the client, wherein the directory statistics newly added usage amount includes data usage of each directory by a current user of the client starting from a second time point; The directory statistics usage in the first server is updated according to the newly added usage in the directory statistics, where the directory statistics usage includes the data usage of the user in each directory.

[0096] refer to Figure 9 , Figure 9 This is a diagram showing the relationship between the IO process and the user quota business. The user quota business involves five major processes, including: Procedure 1: Use CLI commands to set the maximum user quota usage (maximum space usage and maximum number of inodes used) and query user quota information (maximum space usage, maximum number of inodes used, currently used space, and currently used inodes).

[0097] Process 2: Regularly synchronize the maximum user quota usage (maximum space usage and maximum number of inodes used) and the used user quota of the persistence layer of the centralized service cluster to the memory cache of the FUSE client.

[0098] Process 3: In the IO process, before the IO is written to disk, the user quota is checked based on the "User Quota Used Amount", "User Quota New Amount", and "User Quota Maximum Amount" in the memory cache. After the IO is written to disk, the amount of data generated by the IO is added to the user quota new amount and directory statistics new amount in the memory cache.

[0099] Process 4: Regularly add the newly added user quota usage in the memory cache to the user quota usage in the persistence layer.

[0100] Process 5: Regularly append the newly added directory statistics in the memory cache to the directory statistics used in the persistence layer.

[0101] The IO process includes: 1. Mknod command detected.

[0102] The mknod command is used to create device file nodes and named pipes.

[0103] 2. User quota detection.

[0104] The user quota information in the client's memory cache is used to perform user quota detection, which involves the above process three.

[0105] If the test passes, proceed to the next steps.

[0106] 3. Execute the Mknod command to create an inode.

[0107] 4. Modify the user quota to add new usage, which involves the above process three.

[0108] 5. Modify the directory statistics to include new usage, which involves the above process three.

[0109] The embodiment of the present invention provides caching user quota information in a memory cache. When verifying user quota, only the user quota information in the memory cache is verified, which reduces the interaction with other servers, improves the user quota detection efficiency, and improves the overall IO performance.

[0110] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0111] It should be understood that the terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0112] It should be noted that the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.

[0113] In addition, in the embodiments of the present invention, “first”, “second”, etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0114] In practical applications, the above method can be implemented through a processor in an electronic device, such as a central processing unit (CPU), a digital signal processor (DSP), a microcontroller unit (MCU) or a field-programmable gate array (FPGA).

[0115] In order to implement the method of the embodiment of the present application, the embodiment of the present application also provides an electronic device, which is also the host machine of the client and can also be the first server. Figure 10 This is a schematic diagram of the hardware structure of the electronic device according to the embodiment of the present application. Figure 10 As shown, the electronic equipment includes: Communication interface, capable of exchanging information with other devices such as network equipment; The processor is connected to the communication interface to implement information exchange with other devices and is used to execute the methods provided by one or more technical solutions on the electronic device side when running a computer program. The computer program is stored in the memory.

[0116] Of course, in actual applications, the various components in the electronic device are coupled together through a bus system. It is understood that the bus system is used to achieve connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 10 In the text, various buses are labeled as bus systems.

[0117] The memory in the embodiments of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.

[0118] It is understood that the memory can be volatile memory or non-volatile memory, or can include both volatile and non-volatile memory. Among them, non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disk, or compact disc read-only memory (CD-ROM); magnetic surface memory can be magnetic disk memory or magnetic tape memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.

[0119] The methods disclosed in the above embodiments of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, the steps of the above methods can be completed by hardware integrated logic circuits in the processor or instructions in software form. The above processor may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory. The processor reads the program in the memory and completes the steps of the above methods in combination with its hardware.

[0120] Optionally, when the processor executes the program, it implements the corresponding processes implemented by the electronic device in each method of the embodiments of the present application, which will not be described here for the sake of brevity.

[0121] In an exemplary embodiment, the embodiment of the present application further provides a computer program product, including a computer program, which can be executed by a processor of an electronic device to complete the steps described in the method of the embodiment of the present application.

[0122] In an exemplary embodiment, the present application also provides a storage medium, namely, a computer storage medium, specifically a computer-readable storage medium, including, for example, a first memory storing a computer program, wherein the computer program can be executed by a processor of an electronic device to perform the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.

[0123] In the several embodiments provided in this application, it should be understood that the disclosed devices, electronic devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0124] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0125] In addition, all functional units in the embodiments of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0126] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, ROM, RAM, disks or optical disks, etc. Various media that can store program codes.

[0127] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0128] It should be noted that the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0129] In addition, in the examples of this application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0130] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.

Claims

1. A user quota management method, applied to a client of a distributed file system, characterized in that: The method comprises: During a data input / output operation, user quota detection is performed based on user quota information in a memory cache of the client; the memory cache of the client includes user quota information of a plurality of users, the user quota information of the plurality of users being synchronized to the memory cache of the client by a first server, the first server storing the user quota information of the plurality of users; If the user quota check passes, the data input / output operation is performed.

2. The method according to claim 1, characterized in that The user quota information includes: the used amount of the user quota and the maximum amount of the user quota used. The memory cache further stores: the newly used amount of the user quota, the newly used amount of the user quota including the data usage of the current user of the client from a first time point. The user quota detection based on the user quota information in the memory cache of the client includes: determining, based on the newly added usage of the user quota and the used usage of the user quota, whether the data input / output operation will cause the user quota usage to exceed the maximum usage of the user quota; If it does not exceed, the user quota check passes.

3. The method according to claim 1, characterized in that The memory cache further stores: a newly added user quota usage, the newly added user quota usage including the data usage of the current user of the client from a first time point. If the user quota detection passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the newly added usage of the user quota in the memory cache; The used amount of the user quota in the first server is updated periodically based on the newly used amount of the user quota in the memory cache.

4. The method according to claim 1, wherein The memory cache of the client also stores: directory statistics newly added usage, the directory statistics newly added usage including data usage of each directory by the current user of the client starting from the second time point; If the user quota check passes, after performing the data input / output operation, the method further includes: Based on the data volume corresponding to the data input / output operation, updating the directory statistics in the memory cache to increase the usage; The directory statistics usage in the first server is regularly updated based on the directory statistics new usage in the memory cache, where the directory statistics usage includes the data usage of the user in each directory.

5. The method according to claim 1, wherein Before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Receive a first quota setting request, the quota setting request including: a directory path, a user identifier, and user quota information; Based on the directory path, querying metadata of a corresponding directory in a second server, wherein the metadata includes an index identifier of the directory; the second server is a metadata server, storing metadata of multiple directories; A second quota setting request is sent to the first server, where the second quota setting request includes the index identifier, the user identifier, and the user quota information.

6. The method according to claim 1, characterized in that Before performing the user quota detection based on the user quota information in the memory cache of the client, the method further includes: Sending a quota information query request to the first server; receiving user quota information of a plurality of users sent by the first server; The user quota information in the memory cache is updated according to the received user quota information of the multiple users.

7. The method according to claim 1, characterized in that The method further comprises: The user quota information of the current user is determined according to the root directory of the tenant corresponding to the current user of the client; the user quota information of each user in the memory cache of the client is bound to the root directory of the corresponding tenant.

8. The method according to claim 7, characterized in that The client's memory cache also stores: a correspondence between directories visited by the client within a preset time period and the root directory; The method further comprises: According to the corresponding relationship, the root directory of the directory accessed by the current user of the client is determined.

9. A user quota management method, applied to a first server, characterized in that: The method comprises: Receive quota information query requests sent by clients of the distributed file system; Based on the quota information query request, user quota information of multiple users stored in the first server is sent to the client, and the client is used to store the user quota information of the multiple users in the memory cache of the client, and the client is used to perform user quota detection based on the user quota information in the memory cache.

10. The method according to claim 9, characterized in that The method further comprises: receiving a second quota setting request sent by the client, where the second quota setting request includes a directory index identifier, a user identifier, and user quota information; User quota setting is performed based on the second quota setting request.

11. The method according to claim 9, characterized in that The user quota information in the first server includes the used amount of the user quota, and the method further includes: receiving a newly added user quota usage amount sent by the client, where the newly added user quota usage amount includes a data usage amount of a current user of the client from a first time point; The used amount of the user quota in the first server is updated according to the newly used amount of the user quota.

12. The method according to claim 9, characterized in that The method further comprises: receiving a directory statistics newly added usage amount sent by the client, wherein the directory statistics newly added usage amount includes data usage of each directory by a current user of the client starting from a second time point; The directory statistics usage in the first server is updated according to the newly added usage in the directory statistics, where the directory statistics usage includes the data usage of the user in each directory.

13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the user quota management method according to any one of claims 1 to 12.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the user quota management method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the steps of the user quota management method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Management and control method for user quota in multi-network storage system

    CN102447736A

  • A directory file number quota method for a mass storage system

    CN109669630A

  • File management system, file management method, electronic device, and storage medium

    CN113342746A

  • Management of directory quotas for file systems

    US7962532B1