Quota management method, device, equipment and medium applied to distributed system

By registering the per-second query rate quota range from the slave node service to the master node service in the distributed system, the master node service periodically determines and manages the per-second query rate quotas of the slave nodes and clients, solving unreasonable quota allocation and resource waste. solve the problem and achieve effective management and dynamic adjustment of quotas.

CN113760940BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011018956.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2024-10-18
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

The existing technology lacks effective management when allocating quotas, leading to problems of unreasonable quota allocation and waste of resources.

Method used

By pre-registering the per-second query rate quota range from the slave node service to the master node service, the master node service periodically determines the per-second query rate quotas of the slave nodes and clients, and controls them to ensure reasonable allocation and use of quotas.

Benefits of technology

It achieves effective management of query rate quotas per second for slave node services and clients, avoids waste of resources, dynamically monitors quotas, and adapts to changes in the number of nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760940B_ABST
    Figure CN113760940B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a quota management method, device, equipment and medium applied to a distributed system. The method is applied to a slave node service, including: when receiving the request information sent by the current client, obtaining the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service; and according to the client query rate quota per second and the used query rate quota per second, the query rate quota per second is controlled for the access client. The technical solution of the embodiment of the present invention solves the problem that the quota of each node cannot be effectively managed at present, resulting in unreasonable quota allocation and waste of resources, and achieves the technical effect of effectively controlling quota resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a quota management method, apparatus, device and medium applied to a distributed system. Background Art

[0002] In order to provide massive data storage, HBase is usually used as a distributed database. HBase distributed database can achieve concurrent access by multiple devices. In actual applications, corresponding quotas can be allocated to each node so that when request information is received, the request information can be processed based on the allocated quota.

[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems:

[0004] At present, although corresponding quotas can be allocated to each node, the allocated quotas are randomly allocated, and the quotas of each node cannot be effectively managed, resulting in unreasonable quota allocation and waste of resources. Summary of the invention

[0005] The present invention provides a quota management method, device, equipment and medium applied to a distributed system, so as to achieve the technical effect of effectively managing quotas and avoiding waste of resources.

[0006] In a first aspect, an embodiment of the present invention provides a quota management method applied to a distributed system, the method being applied to a slave node service, comprising:

[0007] Receive the request information sent by the current client, and obtain the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service;

[0008] The data access request sent by the current client is managed and controlled according to the client query rate quota per second and the used query rate quota per second.

[0009] In a second aspect, an embodiment of the present invention further provides a quota management method applied to a distributed system, the method being applied to a master node service, comprising:

[0010] For each slave node service, determine the node query rate quota per second corresponding to the current slave node service according to the node query rate quota range per second reported by the current slave node service;

[0011] According to the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second of the client associated with the current slave node service, the client query rate quota per second of each client associated with the current slave node service is determined so that the current slave node service obtains the client query rate quota per second, and performs query rate quota per second control on the request information received by the current slave node service according to the client query rate quota per second.

[0012] In a third aspect, an embodiment of the present invention further provides a quota management device applied to a distributed system, the device being configured in a slave node service, comprising:

[0013] The client query rate quota per second acquisition module is used to receive the request information sent by the current client and obtain the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service;

[0014] The quota control module is used to control the data access request sent by the current client according to the client's query rate quota per second and the used query rate quota per second.

[0015] In a fourth aspect, an embodiment of the present invention further provides a quota management device applied to a distributed system, the device being configured in a master node service, comprising:

[0016] A node query rate per second quota determination module is used to determine, for each slave node service, the node query rate per second quota corresponding to the current slave node service according to the node query rate per second quota range reported by the current slave node service;

[0017] A client query rate per second quota determination module is used to determine the client query rate per second quota of each client associated with the current slave node service based on the node query rate per second quota corresponding to the current slave node service and the registered query rate per second quota of the client registered with the current slave node service, so that the current slave node service obtains the client query rate per second quota, and performs query rate per second quota control on the request information received by the current slave node service according to the client query rate per second quota.

[0018] In a fifth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0019] one or more processors;

[0020] a storage device for storing one or more programs,

[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement a quota management method applied to a distributed system as described in any one of the embodiments of the present invention.

[0022] In a sixth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute a quota management method applied to a distributed system as described in any one of the embodiments of the present invention.

[0023] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 A flow chart of a quota management method applied to a distributed system provided in the first embodiment of the present invention;

[0026] Figure 2 A flow chart of a quota management method applied to a distributed system provided in Embodiment 2 of the present invention;

[0027] Figure 3 A flow chart of a quota management method applied to a distributed system provided by Embodiment 3 of the present invention;

[0028] Figure 4 A flow chart of a quota management method applied to a distributed system provided by Embodiment 4 of the present invention;

[0029] Figure 5 A schematic diagram of the system architecture used when the master node service and the slave node service interact with each other provided in the fifth embodiment of the present invention;

[0030] Figure 6A schematic diagram of the structure of a quota management device applied to a distributed system provided by Embodiment 6 of the present invention;

[0031] Figure 7 A schematic diagram of the structure of a quota management device applied to a distributed system provided by Embodiment 7 of the present invention;

[0032] Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 8 of the present invention. DETAILED DESCRIPTION

[0033] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0034] Embodiment 1

[0035] Figure 1 A flow chart of a quota management method applied to a distributed system provided in Embodiment 1 of the present invention is provided. This embodiment can be executed by each slave node service associated with the master node service of the distributed system, and can be applied to determine the client query rate quota per second occupied by each client to the slave node service. The method can be executed by a quota management device applied to a distributed system, and the system can be implemented in the form of software and / or hardware.

[0036] like Figure 1 The method of this embodiment includes:

[0037] S110: Receive request information sent by the current client, and obtain a client query rate quota per second corresponding to the current client.

[0038] Among them, there can be multiple slave node services, and there can be multiple clients associated with each slave node service. The request information can be a read and write request sent by one or more clients associated with the current slave node service. When the slave node service receives the request information from the client, the client query rate quota per second corresponding to the client identifier can be obtained according to the client identifier of the client. The query rate per second (Query Per Second, QPS) can be the number of queries that each service can respond to per second, which is a measure of how much traffic a specific query server handles within a specified time. The QPS quota is a quota that is predetermined by the master node service and sent to the slave node service. The client query rate quota per second is a quota corresponding to each client.

[0039] In order to clearly introduce the technical solution of this embodiment, the solution can be introduced by taking a slave node service and a client as an example.

[0040] It should be noted that the number of clients associated with the current slave node service may include multiple clients, and the client corresponding to the received request information may be used as the current client. The query rate quota per second corresponding to the current client may be used as the client query rate quota per second.

[0041] In this embodiment, the client query rate quota per second corresponding to each client is determined by the master node service based on the node query rate quota range per second reported by the current slave node and the registered query rate quota per second registered by the client associated with the current slave node service.

[0042] Specifically, when the slave node service is started, the stand-alone capacity (QPS) of the current slave node can be registered in the master node service, that is, the master node service can receive the node query rate per second quota range reported by the slave node service. At the same time, the client can also register the client query rate per second quota of the client in the master node service. According to the total quota, the slave node query rate per second quota range and the registered client query rate per second quota, the node query rate per second quota corresponding to the slave node service and the client query rate per second quota from the client to each slave node service can be determined respectively. In this embodiment, the node query rate per second quota range currently registered in the slave node service can be pre-registered in the master node service, so that the master node service determines the client query rate per second quota of each client associated with the current slave node service according to the node query rate per second quota range.

[0043] Among them, a quota information reporting and updating component is set in the slave node service. Based on the quota information reporting and updating component, the local QPS capacity pre-registered in the slave node service can be reported to the quota management component in the master node service. At the same time, the quota information reporting and updating component can also obtain the determined node query rate per second quota and client query rate per second quota from the quota management component. This is because the quota management component in the master node service can determine the client query rate per second quota from the client to the slave node service based on the received node query rate per second quota range, the registered client query rate per second quota and the total quota, and store it so that the quota information reporting and updating component can obtain the determined quota information from the quota management component. Among them, the quota management component is set in the master node service, which is mainly responsible for managing and real-time statistics of all QPS capabilities in the cluster, and optionally, the quota usage and the total quota.

[0044] Specifically, based on the quota information reporting and update component, the node query rate per second quota range preset in the current slave node service can be registered in the master node service. After the master node service receives the node query rate per second quota range reported by the slave node service, the client query rate per second quota of each client associated with the current slave node service can be determined.

[0045] In this embodiment, the advantage of reporting the local QPS capability currently set in the slave node service to the master node service is that the quota management component in the master node service can allocate the corresponding node query rate quota per second to the slave node service, and then determine the client query rate quota per second from each client to the slave node service.

[0046] In this embodiment, in order to determine the client query rate quota per second corresponding to each client, it can be: periodically obtain the client query rate quota per second of each client associated with the current slave node service from the master node service.

[0047] Ten seconds can be regarded as a cycle. During the operation of the distributed system, the number of slave node services associated with the master node service may change. When the number of slave nodes changes, the node query rate per second quota allocated by the master node service to the slave node service will also change accordingly, and accordingly, the client query rate per second quota of each client associated with the slave node service will also change.

[0048] In order to facilitate timely determination of the client query rate quota per second of each client associated with the current slave node service, the client query rate quota per second of each client associated with the current slave node service can be periodically obtained from the quota management component of the master node service so as to timely determine whether the received request information can be processed, thereby achieving the technical effect of dynamically monitoring the quota.

[0049] S120: Control the data access request sent by the current client according to the client query rate quota per second and the used query rate quota per second.

[0050] The used query rate per second quota is the query rate per second quota used when processing the sent request information. Based on the client query rate per second quota and the used query rate per second quota obtained from the master node service, the remaining query rate per second quota can be determined, and based on the remaining query rate per second quota, the query rate per second quota of the access client can be controlled, that is, the data access request sent by the current client can be managed and controlled.

[0051] Optionally, the data access request sent by the current client is managed and controlled based on the client's query rate quota per second and the used query rate quota per second, including: determining the current remaining query rate quota per second based on the client's query rate quota per second and the query rate quota per second used when processing the sent request information; and performing quota control on the access client based on the current remaining query rate quota per second.

[0052] Among them, the client can send read and write requests to the slave node service. When the slave node service receives the read and write request information sent by the client, it can determine whether to perform quota control on the current client based on the current client's query rate quota information per second in the current slave node.

[0053] In this embodiment, the data access request sent by the current client is managed and controlled based on the current remaining query rate quota per second, including: obtaining the request volume query rate quota per second corresponding to the received request information; if the current remaining query rate quota per second is less than the request volume query rate quota per second, quota control is performed on the access client, and feedback information is sent to the client.

[0054] It should be noted that the client can send multiple read and write request information to the slave node service. When processing the read and write requests, a certain query rate quota per second will be occupied. The remaining query rate quota per second can be determined based on the query rate quota per second occupied by the read and write requests currently being processed and the client query rate quota per second corresponding to the current client in the current slave node service.

[0055] Specifically, if it is detected that the remaining query rate quota per second is less than the requested query rate quota per second, quota control can be performed on the access client, and feedback information can be sent to the client. Optionally, the request information is processed abnormally or feedback information of the request is waiting for processing.

[0056] In this embodiment, the advantage of this setting is that it can effectively manage the client's query rate quota per second, thereby avoiding the technical effect of wasting resources.

[0057] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0058] Embodiment 2

[0059] As an alternative embodiment of the above embodiment, Figure 2 This is a flow chart of a quota management method applied to a distributed system provided by Embodiment 2 of the present invention. Technical terms that are the same as or corresponding to those in the above embodiments are not described in detail here.

[0060] like Figure 2 As shown, the method includes:

[0061] S210. Register the query rate per second capability of each slave node service in the master node service.

[0062] Specifically, the slave node service in the HBase cluster, that is, the node service responsible for providing external data reading and writing, will register with the master node service based on the local configured single-machine capacity, that is, the preset node query rate quota range per second, when it is started. In other words, the node query rate quota range per second of the slave node service is registered with the HBaseMaster, that is, the Master node of the HBase cluster. The Master node is responsible for coordinating the RegionServer in the cluster and managing the distribution of Regions in the cluster.

[0063] S220. Periodically obtain from the master node service the client query rate quota per second of each client associated with the current slave node service.

[0064] Specifically, the quota information reporting and updating module in the slave node service can periodically obtain the client query rate quota per second of each client associated with the current slave node service from the quota management component in the master node service. For example, the capacity information that each client should have in the current node is obtained from the quota management component of the master node service every 1 minute.

[0065] It should be noted that the master node service can determine the client query rate quota per second from each client to the slave node service based on the node query rate quota range per second reported by each slave node service, the query rate quota per second registered by the client and the total quota, and store it in the quota management component of the master node service, so as to obtain the corresponding client query rate quota information per second from the quota information reporting and updating in the slave node service.

[0066] S230: Update the client quota mapping table in the content.

[0067] Specifically, after the quota information reporting and updating component of the slave node service obtains the client's query rate quota per second, the client's query rate quota per second can be updated in the slave node service, so as to perform access control on the client according to the updated client's query rate quota per second. It should be noted that when the slave node service receives the request information, the quota verification module in the slave node service can check in real time whether the request amount quota of the client request information exceeds the remaining client quota. If so, the abnormal operation of request information processing is fed back to the client.

[0068] That is to say, when the client sends a request message to the slave node service, the slave node service can determine the specific processing method for the request message based on the query rate quota per second corresponding to the request message and the current capacity information, thereby avoiding the technical problem of excessive query rate per second.

[0069] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0070] Embodiment 3

[0071] Figure 3 A flow chart of a quota management method applied to a distributed system provided in Embodiment 3 of the present invention is provided. This embodiment can be executed by a master node service of a distributed system and is suitable for situations in which the query rate quota per second is effectively managed and controlled. The method can be executed by a quota management device applied to a distributed system, and the device can be implemented in the form of software and / or hardware.

[0072] like Figure 1 The method of this embodiment includes:

[0073] S310. For each slave node service, determine the node query rate quota per second corresponding to the current slave node service according to the received node query rate quota range reported by the current slave node service.

[0074] Among them, the Master node of the HBase cluster is responsible for coordinating the RegionServer in the cluster and managing the distribution of Regions in the cluster. In the actual application process, there are situations where the capacity of slave nodes is expanded or reduced. In order to ensure that a reasonable node query rate quota per second is allocated to each slave node service, that is, to achieve the aggregation and update of quotas, the number of slave node services can be determined in real time, and the node query rate quota per second corresponding to each slave node service can be determined based on the number of slave node services and the node query rate quota range per second.

[0075] Specifically, the master node service can detect in real time whether the number of slave node services communicating with it has changed. When a change in the number of slave nodes is detected, the node query rate quota per second for each slave node service can be determined based on the node query rate quota range per second reported by each slave node service, the number of nodes after the change, and the total query rate quota per second. When the query rate quota per second of a slave node changes, the client query rate quota per second of each client associated with the slave node will also change accordingly. Based on the updated node query rate quota per second and the registered query rate quota range per second pre-registered by the client in the master node service, the client query rate quota per second for each client to the slave node service can be re-determined.

[0076] In this embodiment, it is possible to periodically determine whether the number of slave node services has changed, and then re-allocate the corresponding QPS for each slave node service and the client query rate per second quota of each client associated with the slave node service. Optionally, the current number of slave node services is periodically determined, and based on the current number of slave node services, the node query rate per second quota of each slave node service and the client query rate per second quota associated with each slave node service are determined.

[0077] In this embodiment, when a change in the number of slave node services is detected, the node query rate quota per second corresponding to each slave node service after the change is determined based on the node query rate quota range per second reported by each slave node service, including: receiving heartbeat information periodically sent by each slave node service, if the number of heartbeat information received within a preset time period changes, determining the current number of slave node services; determining the node query rate quota per second for each slave node service after the change based on the current number of slave node services, the total query rate quota per second and the node query rate quota range per second.

[0078] Among them, the periodicity can be that the slave node service sends a heartbeat message to the master node service once every ten seconds. The master node service can receive the heartbeat messages sent periodically by each slave node service, and based on the received heartbeat messages, it can be determined whether the number of each slave node service associated with the master node service has changed. Optionally, when it is detected that the heartbeat message sent by a slave node service has not been received within a certain period of time, it means that the number of slave node services has changed. In other words, the master node service can check the number of slave nodes in the current cluster every ten seconds. When a change in the number of slave nodes is detected, the node query rate quota per second for each slave node service can be determined based on the total query rate quota per second, the pre-registered node query rate quota range per second, and the updated number of slave node services.

[0079] In this embodiment, the advantage of detecting the number of slave nodes is that a corresponding query rate quota per second and a client query rate quota per second from the client to each slave node service can be dynamically allocated to each slave node, thereby achieving the technical effect of automatic aggregation and updating of quotas.

[0080] Based on the above technical solution, it should be noted that since it is necessary to determine the client query rate quota per second of each client associated with each slave node service, after the number of slave nodes changes and the node query rate quota per second corresponding to each slave node service is determined, it is also necessary to determine the client query rate quota per second of the client based on the node query rate quota per second of the slave node service and the registered client query rate quota per second.

[0081] Optionally, the client query rate per second quota of each client associated with the current slave node service is determined based on the node query rate per second quota corresponding to the current slave node service and the registered query rate per second quota registered by the client associated with the current slave node, including: obtaining the registered query rate per second quota pre-registered by each client; determining the client query rate per second quota of each client associated with the current node based on the current number of slave nodes, the node query rate per second quota corresponding to the current slave node service after the change, and the registered query rate per second quota of each client associated with the current client.

[0082] Among them, before the client accesses the slave node service, the total query rate quota per second of the client can be pre-registered, that is, register the query rate quota per second. The current number of slave nodes refers to the number of slave node services counted by the master node service after each heartbeat message is received. After the number of slave node services changes, the node query rate quota per second corresponding to the slave node service will also change accordingly, and the changed query rate quota per second can be used as the node query rate quota per second. The changed node query rate quota per second and the client query rate quota per second can be updated in the quota management component of the master node service, so that the quota information of the slave node service can be reported and updated. The updated client query rate quota per second can be obtained from the quota management component, and then the slave node service can perform access control on the client according to the client query rate quota per second, thereby achieving the technical effect of effective quota management and control.

[0083] In actual applications, if a slave node service fails or a new slave node service is added, the number of slave node services will change. Based on the number of slave node services after the node change, the query rate quota per second allocated to each client to each remaining node can be recalculated.

[0084] S320. Determine the client query rate quota per second of each client associated with the current slave node service based on the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second of the client registered with the current slave node service.

[0085] The number of slave node services associated with the master node service may include multiple slave node services. In order to clearly introduce the technical solution of this embodiment, one of the slave node services may be used as an example. Other slave node services may also adopt the same processing method.

[0086] Among them, the node query rate quota per second can be the node query rate quota per second corresponding to each slave node service that is re-determined after receiving the heartbeat information reported by each slave node service. When receiving the heartbeat information reported by each slave node service, the node query rate quota per second corresponding to the slave node service may change or not change. Whether it changes is related to the number of heartbeat information received within a period of time. Before the client sends a read or write request to the slave node service, it is also necessary to register the client query rate quota per second. The master node service can determine the client query rate quota per second from each client to the slave node service based on the node query rate quota per second of each slave node service and the registered client query rate quota per second, that is, the client query rate quota per second corresponding to the client and each associated slave node service.

[0087] Specifically, the client query rate quota per second corresponding to each client and the current slave node service can be determined based on the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second pre-registered by the client associated with the current slave node service. After determining the client query rate quota per second, it can be stored in the quota management component of the master node service, so that the slave node service periodically obtains the client query rate quota per second determined by the master node from the master node service.

[0088] It should be noted that the slave node service can periodically obtain the updated client query rate quota per second from the master node service. The advantage of this setting is that the client query rate quota per second associated with each slave node service can be dynamically determined.

[0089] It should also be noted that, since the slave node service periodically sends heartbeat information to the master node service, the client query rate quota per second from each client to the slave node service can be periodically determined and stored in the quota management component of the master node service. Since the slave node service also periodically obtains the client query rate quota per second from the quota management component, the technical effect of effectively managing the quota information can be achieved.

[0090] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0091] Embodiment 4

[0092] As an alternative embodiment of the above embodiment, Figure 4 A flow chart of a quota management method applied to a distributed system provided in Embodiment 4 of the present invention. The method can be applied in a master node service to reallocate a corresponding node query rate per second quota and a client query rate per second quota associated with the node to each slave node service according to a determined number of slave node services. Technical terms identical or corresponding to the above embodiments are not repeated here.

[0093] like Figure 4 As shown, the method includes:

[0094] S410, obtaining the number of slave node services.

[0095] Specifically, the slave node service can periodically send heartbeat information to the master node service, and the master node service can determine the number of slave node services associated with the master node service based on the heartbeat information received each time. Optionally, if the heartbeat information sent by a slave node is not received within a period of time, it means that the slave node service has a fault, and accordingly, the number of slave node services has changed.

[0096] S420, determine whether the number of current slave nodes has changed, if so, execute S430; if not, execute S410.

[0097] Specifically, after determining the current number of slave node services based on the received heartbeat information, it is possible to determine whether the current number of slave nodes has changed based on the current number and the number of nodes determined when the heartbeat information was received last time.

[0098] Exemplarily, after receiving the heartbeat information, it is determined that the number of slave node services is 10, and the number of nodes determined when the heartbeat information was received last time can be obtained, optionally 8. Based on the current number of nodes and the previous number of nodes, it can be determined that the number of nodes has changed. At this time, S430 can be executed; if it is detected that the current number of slave nodes has not changed, there is no need to reallocate the corresponding query rate quota per second to each slave node, and return to execute S410.

[0099] S430, calculating the query rate quota per second from each client to the slave node service.

[0100] Specifically, when it is determined that the number of current slave nodes has changed, the quota of each slave node service will also change accordingly. At the same time, the client query rate quota per second of each client associated with the slave node will also change accordingly. At this time, the query rate quota per second from each client to the slave node service can be calculated.

[0101] S440: Update the client quota mapping table in memory.

[0102] Specifically, after determining the client's client query rate per second quota, the updated client query rate per second quota can be updated in the quota management component in the master node service. The quota reporting and updating component QuotaPlugin in the slave node service can periodically obtain the latest client quota information from the quota management component QuotaManager every ten seconds and update the local content. The slave node service can use the quota reporting and updating component to obtain the client query rate per second quota from the quota management component of the master node service, so as to perform quota control on the client according to the client query rate per second quota.

[0103] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0104] Embodiment 5

[0105] As an alternative embodiment to the above embodiment, Figure 5 This is a schematic diagram of the system architecture used when the master node service and the slave node service provided in the fifth embodiment of the present invention interact.

[0106] See also Figure 5 , where the Master node in the HBaseMaster cluster is responsible for coordinating the RegionServer in the cluster and managing the distribution of Regions in the cluster. That is, the master node service is responsible for coordinating the slave node services in the cluster. The RegionServer slave node service can be understood as the slave node service of the HBase cluster, which is responsible for providing data reading and writing (QPS service) to the outside (client), that is, the query rate quota service per second. Client business client, the business client can send corresponding read and write requests to the slave node. QuotaManager (quota management component) is set in the master node service, which is responsible for managing and real-time statistics of all query rate quotas per second in the cluster, including the used and total query rate quotas per second. QuotaPlugin (quota information reporting and updating component) is set in each slave node service, which is used to send the query rate quota range of the node registered locally by the slave node to the master node, and is also used to obtain the query rate capacity information per second that the client can use on the current slave node from the quota management component.

[0107] Specifically, when the slave node service RegionServer starts, it can report the slave node query rate quota range of the node to the master node service based on the QuotaPlugin in the slave node service, that is, register the locally configured single-machine capacity (QPSwrite / get) to the QuotaManager management module in the master node service HMaster. QuotaManager periodically checks the number of slave node services in the current cluster at regular intervals, optionally ten seconds. Based on the received node query rate quota per second of the slave node service, the number of nodes, and the registered query rate quota per second pre-registered by the client, the client query rate quota per second from the client to each slave node service can be determined. The slave node service can periodically obtain the reallocated client query rate quota per second from the QuotaManager in the master node service and update it in the local memory. The slave node service can limit the amount of read and write requests sent by the client based on the updated client query rate quota per second. At the same time, the slave node service also includes the RpcQuotaCheck quota verification module, which will determine whether the amount of read and write requests sent by the client exceeds the client's query rate per second quota based on the updated client query rate per second. If so, the excess part can be submitted, that is, the excess part can be fed back to the client so that the client can automatically retry the excess part.

[0108] The technical solution of the embodiment of the present invention, by setting a quota management component in the master node service and a quota reporting and updating component in the slave node service, can control the total quota based on the quota management component, thereby providing more accurate resource management; at the same time, the corresponding query rate quota per second can be dynamically adjusted according to the number of slave node services, thereby achieving the technical effect of convenient expansion and contraction.

[0109] Embodiment 6

[0110] Figure 6 A structural diagram of a quota management device applied to a distributed system provided in Embodiment 6 of the present invention is provided. The device is configured in a slave node service and includes: a client query rate per second quota acquisition module 610 and a quota control module 620 .

[0111] The client query rate quota per second acquisition module 610 is used to receive the request information sent by the current client and obtain the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service based on the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service; the quota control module 620 is used to manage and control the data access request sent by the current client based on the client query rate quota per second and the used query rate quota per second.

[0112] Based on the above technical solution, the device also includes: a node quota registration module, which is used to register the node query rate per second quota range pre-set in the current slave node service to the master node service, so that the master node service determines the client query rate per second quota of each client associated with the current slave node service according to the node query rate per second quota range.

[0113] On the basis of the above technical solution, the client query rate quota per second acquisition module is also used to periodically acquire the client query rate quota per second of each client associated with the current slave node service from the master node service.

[0114] Based on the above technical solution, the quota control module is also used to determine the current remaining query rate quota per second based on the client's query rate quota per second and the query rate quota per second used when processing the sent request information; and perform quota control on the access client based on the current remaining query rate quota per second.

[0115] Based on the above technical solution, the quota control module is also used to obtain the request volume query rate quota per second corresponding to the received request information; if the current remaining query rate quota per second is less than the request volume query rate quota per second, quota control is performed on the access client and feedback information is sent to the client.

[0116] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0117] The quota management device applied to a distributed system provided by the embodiment of the present invention can execute the quota management method applied to a distributed system provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0118] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.

[0119] Embodiment 7

[0120] Figure 7 A structural diagram of a quota management device applied to a distributed system provided in Embodiment 7 of the present invention is provided. The device is configured in a master node service and includes: a node query rate per second quota determination module 710 and a client query rate per second quota determination module 720.

[0121] Among them, the node query rate quota per second determination module 710 is used to determine, for each slave node service, the node query rate quota per second corresponding to the current slave node service according to the node query rate quota per second range reported by the current slave node service; the client query rate quota per second determination module 720 is used to determine the client query rate quota per second of each client associated with the current slave node service according to the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service, so that the current slave node service obtains the client query rate quota per second, and performs query rate quota per second control on the request information received by the current slave node service according to the client query rate quota per second.

[0122] Based on the above technical solutions, the device also includes: periodically determining the current number of slave node services, and based on the current number of slave node services, determining the node query rate quota per second for each slave node service and the client query rate quota per second associated with each slave node service.

[0123] On the basis of the above-mentioned technical solutions, the node query rate quota per second determination module is also used to receive the heartbeat information periodically sent by each slave node service. If the number of heartbeat information received within a preset time period changes, the current number of slave node services is determined; based on the current number of slave node services, the total query rate quota per second and the node query rate quota per second range, the node query rate quota per second of each slave node service after the change is determined.

[0124] On the basis of the above-mentioned technical solutions, the client query rate per second quota determination module is used to obtain the registered query rate per second range pre-registered by each client; according to the current number of slave nodes, the node query rate per second quota corresponding to the current slave node service after the change, and the registered query rate per second quota of each client associated with the current client, the client query rate per second quota of each client associated with the current node is determined.

[0125] The technical solution of the embodiment of the present invention is that after the query rate quota range per second pre-registered by the slave node service is registered to the master node service, the master node service can periodically determine the node query rate quota per second corresponding to each slave node and the client query rate quota per second of each client associated with each slave node, and send the client query rate quota per second to the slave node service, thereby achieving effective management and control of the query rate quota per second of the slave node service and the client, thereby avoiding the technical effect of wasting resources.

[0126] The quota management device applied to a distributed system provided by the embodiment of the present invention can execute the quota management method applied to a distributed system provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0127] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.

[0128] Embodiment 8

[0129] Figure 8 A schematic diagram of the structure of a device provided in Embodiment 8 of the present invention. Figure 8 A block diagram of an exemplary apparatus 80 suitable for use in implementing exemplary embodiments of the present invention is shown. Figure 8 The device 80 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0130] like Figure 8 As shown, the device 80 is in the form of a general-purpose computing device. The components of the device 80 may include, but are not limited to: one or more processors or processing units 801, a system memory 802, and a bus 803 connecting different system components (including the system memory 802 and the processing unit 801).

[0131] Bus 803 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics 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 Interconnect (PCI) bus.

[0132] Device 80 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 80, including volatile and non-volatile media, removable and non-removable media.

[0133] System memory 802 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 804 and / or cache memory 805. Device 80 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 806 may be used to read and write non-removable, non-volatile magnetic media ( Figure 8 not shown, usually called a "hard drive"). Although Figure 8 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 803 via one or more data medium interfaces. The memory 802 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.

[0134] A program / utility 808 having a set (at least one) of program modules 807 may be stored, for example, in the memory 802, such program modules 807 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 807 generally perform the functions and / or methods of the embodiments described herein.

[0135] The device 80 may also communicate with one or more external devices 809 (e.g., keyboards, pointing devices, displays 810, etc.), may communicate with one or more devices that enable a user to interact with the device 80, and / or may communicate with any device that enables the device 80 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 811. Furthermore, the device 80 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 812. As shown, the network adapter 812 communicates with the other modules of the device 80 via the bus 803. It should be understood that although Figure 8Not shown, other hardware and / or software modules may be used in conjunction with device 80, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0136] The processing unit 801 executes various functional applications and data processing by running the programs stored in the system memory 802, for example, implementing the quota management method applied to the distributed system provided in the embodiment of the present invention.

[0137] Embodiment 9

[0138] Embodiment 9 of the present invention further provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a quota management method applied to a distributed system when executed by a computer processor.

[0139] The method includes:

[0140] When receiving the request information, obtaining the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service;

[0141] According to the client's query rate quota per second and the used query rate quota per second, the query rate quota per second is controlled for the access client. Or,

[0142] When a change in the number of slave node services is detected, the node query rate quota per second corresponding to each slave node service after the change is determined according to the node query rate quota range per second reported by each slave node service;

[0143] For each node, the client query rate quota per second of each client associated with the current slave node service is determined based on the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node, so that the current slave node service obtains the client query rate quota per second, and performs query rate quota per second control on the request information received by the current slave node service according to the client query rate quota per second.

[0144] The computer storage medium of the embodiment of the present invention 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 (ROM), an erasable programmable read-only memory (EPROM or flash memory), an 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.

[0145] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry 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.

[0146] 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.

[0147] Computer program code for performing the operation of embodiments of the present invention may 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" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a 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 may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0148] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A quota management method applied to a distributed system, characterized in that: Applied to slave node services, including: Receive the request information sent by the current client, and obtain the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service; The slave node service periodically sends heartbeat information to the master node service so that the master node service determines the current number of slave node services, and determines the node query rate quota per second of each slave node service after the change according to the current number of slave node services, the total query rate quota per second and the node query rate quota range per second; The data access request sent by the current client is managed and controlled according to the client query rate quota per second and the used query rate quota per second.

2. The method according to claim 1, characterized in that Also includes: The node query rate per second quota range pre-set in the current slave node service is registered in the master node service, so that the master node service determines the client query rate per second quota of each client associated with the current slave node service according to the node query rate per second quota range.

3. The method according to claim 1, characterized in that The obtaining of the client query rate quota per second corresponding to the current client includes: The client query rate quota per second of each client associated with the current slave node service is periodically obtained from the master node service.

4. The method according to claim 2, characterized in that: The controlling the data access request sent by the current client according to the client query rate quota per second and the used query rate quota per second includes: Determine the current remaining query rate quota per second according to the query rate quota per second of the client and the query rate quota per second used when processing the sent request information; According to the current remaining query rate quota per second, the data access request sent by the current client is controlled.

5. The method according to claim 4, characterized in that The controlling the data access request sent by the current client according to the current remaining query rate quota per second includes: Get the request query rate quota per second corresponding to the received request information; If the current remaining query rate quota per second is less than the request amount query rate quota per second, the data access request sent by the current client is managed and controlled, and feedback information is sent to the client.

6. A quota management method applied to a distributed system, characterized in that: Applied to the master node service, including: For each slave node service, determine the node query rate quota per second corresponding to the current slave node service according to the node query rate quota range per second reported by the current slave node service; According to the node query rate per second quota corresponding to the current slave node service and the registered query rate per second quota of the client registered with the current slave node service, determine the client query rate per second quota of each client associated with the current slave node service, so that the current slave node service obtains the client query rate per second quota, and performs query rate per second quota control on the request information received by the current slave node service according to the client query rate per second quota; Among them, determine the node query rate quota per second served by each slave node, including: Receive the heartbeat information sent periodically by each slave node service. If the heartbeat information received changes within the preset time, determine the current number of slave node services; According to the current number of slave node services, the total query rate quota per second, and the node query rate quota per second range, the node query rate quota per second for each slave node service after the change is determined.

7. The method according to claim 6, characterized in that Also includes: The current number of slave node services is periodically determined, and based on the current number of slave node services, a client query rate quota per second associated with each slave node service is determined.

8. The method according to claim 6, characterized in that The determining, according to the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service, the client query rate quota per second of each client associated with the current slave node service comprises: Get the pre-registered query rate quota per second for each client; According to the node query rate quota per second corresponding to the current slave node service after the change and the registered query rate quota per second of each client associated with the current client, the client query rate quota per second of each client associated with the current slave node service is determined.

9. A quota management device applied to a distributed system, characterized in that: Configured in the slave node service, including: The client query rate quota per second acquisition module is used to receive the request information sent by the current client and obtain the client query rate quota per second corresponding to the current client; wherein the client query rate quota per second is determined by the master node service according to the node query rate quota range per second reported by the current slave node service and the registered query rate quota per second registered by the client associated with the current slave node service; The slave node service periodically sends heartbeat information to the master node service so that the master node service determines the current number of slave node services, and determines the node query rate quota per second of each slave node service after the change according to the current number of slave node services, the total query rate quota per second and the node query rate quota range per second; The quota control module is used to control the data access request sent by the current client according to the client's query rate quota per second and the used query rate quota per second.

10. A quota management device applied to a distributed system, characterized in that: Configured in the master node service, including: A node query rate per second quota determination module is used to determine, for each slave node service, the node query rate per second quota corresponding to the current slave node service according to the node query rate per second quota range reported by the current slave node service; A client query rate quota per second determination module, configured to determine the client query rate quota per second of each client associated with the current slave node service according to the node query rate quota per second corresponding to the current slave node service and the registered query rate quota per second of the client registered with the current slave node service, so that the current slave node service obtains the client query rate quota per second, and performs query rate quota per second control on the request information received by the current slave node service according to the client query rate quota per second; Among them, the node query rate quota determination module is also used to receive the heartbeat information periodically sent by each slave node service. If the number of heartbeat information received within a preset time period changes, the current number of slave node services is determined; based on the current number of slave node services, the total query rate quota per second and the node query rate quota per second range, the node query rate quota per second of each slave node service after the change is determined.

11. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the quota management method applied to a distributed system as described in any one of claims 1-5 or 6-8.

12. A storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the quota management method applied to a distributed system as claimed in any one of claims 1-5 or 6-8.

Citation Information

Patent Citations

  • Flow control method and device, server and storage medium

    CN110708258A

  • Resource quota management method under public cloud platform

    CN111064602A