Multi-tenant flow control method and device for distributed system, equipment and medium
By setting total traffic quotas and first traffic quotas for proxy nodes in a distributed system, traffic is allocated reasonably, solving the stability problem caused by a sudden increase in traffic from a single tenant in a multi-tenant shared system, and improving the system's processing efficiency and stability.
Patent Information
- Application Number
- CN202411549097.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-07
AI Technical Summary
In a multi-tenant shared distributed system, a sudden increase in traffic from a single tenant can easily affect the request latency and error rate of other tenants, leading to a decrease in system stability.
Traffic control is achieved by setting total traffic quotas and first traffic quotas for proxy nodes in the proxy layer. This ensures that the traffic of each proxy node is not exceeded and that access requests are assigned to data nodes for execution under certain conditions.
It improves the utilization rate of tenant resources, reduces the probability of traffic surges, avoids the problem of delays or processing failures of other tenant requests caused by traffic surges of a single tenant, and improves the processing efficiency and stability of the distributed system.
Smart Images

Figure CN119276785A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data processing technology, and in particular to a multi-tenant traffic control method, apparatus, device and medium for a distributed system. Background Art
[0002] Distributed systems are widely used in large-scale data processing and high-concurrency access scenarios. When multiple tenants (tenants or tenant groups) share the same distributed system, the complementary characteristics of the load between tenants can be fully utilized, and the resources of various dimensions corresponding to multiple machines in the distributed system can be fully utilized. When multiple tenants share the same distributed system (i.e., multi-tenant colocation), multi-tenant isolation is required to avoid interference between tenants and ensure the data security of each tenant.
[0003] However, when isolating multiple tenants, if the tenant isolation mechanism is not sufficient, the above multi-tenant deployment method is prone to sudden traffic increases of a single tenant, which affects the delay and error rate of all mixed tenant requests. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present disclosure provide a multi-tenant traffic control method, apparatus, device and medium for a distributed system.
[0005] In a first aspect, an embodiment of the present disclosure provides a multi-tenant traffic control method for a distributed system, the method comprising:
[0006] Receiving an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system; the access request is used to request to read or write target traffic;
[0007] According to the access request, determining whether the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant; wherein the distributed system is pre-configured with a corresponding total traffic quota for each tenant in the multi-tenant system;
[0008] When it is determined that the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant, the proxy node of the proxy layer is controlled to perform access control based on a preset proxy node first traffic quota; the proxy node first traffic quota is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant;
[0009] Controlling the target proxy node in the proxy layer to accept the access request, and determining whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node;
[0010] When it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0011] In a second aspect, an embodiment of the present disclosure further provides a multi-tenant traffic control device for a distributed system, the device comprising:
[0012] A receiving unit, configured to receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system; the access request is used to request to read or write target traffic;
[0013] A tenant traffic quota comparison unit, configured to determine, according to the access request, whether the total traffic currently undertaken by the proxy node in the proxy layer that undertakes the target tenant is less than the total traffic quota of the target tenant; wherein the distributed system is pre-configured with a corresponding total traffic quota for each tenant in the multi-tenant system;
[0014] A control unit, for controlling the proxy nodes of the proxy layer to perform access control based on a preset first traffic quota of the proxy nodes when it is determined that the total traffic currently undertaken by the proxy nodes undertaking the target tenant in the proxy layer is less than the total traffic quota of the target tenant; the first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant;
[0015] A proxy node traffic comparison unit, used to control a target proxy node in the proxy layer to accept the access request, and determine whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node;
[0016] An execution unit is used to distribute the access request to the target data node in the distributed system through the target proxy node when it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, and execute the access request through the target data node.
[0017] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0018] processor;
[0019] A memory for storing executable instructions;
[0020] The processor is used to read executable instructions from the memory and execute the executable instructions to implement the multi-tenant traffic control method of the distributed system described in any embodiment of the present disclosure.
[0021] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the multi-tenant traffic control method of the distributed system described in any embodiment of the present disclosure.
[0022] The multi-tenant isolation method, apparatus, device and medium for multi-tenant traffic control of a distributed system of the embodiments of the present disclosure, after receiving an access request sent by a target tenant, first use the total traffic quota of the target tenant to limit the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer, and when the total traffic currently undertaken by the proxy node of the target tenant is less than the total traffic quota of the target tenant, then use the first traffic quota of the proxy node to perform access control on the proxy node of the target tenant, the first traffic quota of the proxy node is based on the total traffic quota of the target tenant. The total traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant, so as to allow a reasonable tilt of the traffic between each proxy node when the overall traffic is not exceeded, thereby improving the utilization rate of tenant resources; and when the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and then the access request is executed through the target data node. In this way, during the processing of access requests in a distributed system with multiple tenants, the total traffic quota of the target tenant can be limited as a whole and reasonable traffic inclination between the proxy nodes can be allowed, which can not only improve the utilization rate of tenant resources, but also greatly reduce the probability of traffic surges of the target tenants, and avoid as much as possible the error problem of delays or failures in processing requests of other tenants due to traffic surges of a single tenant, thereby improving the processing efficiency of tenant requests in the distributed system and the system stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0024] Figure 1 A schematic diagram of the overall framework of a distributed system provided in an embodiment of the present disclosure;
[0025] Figure 2 A flow chart of a multi-tenant traffic control method for a distributed system provided in an embodiment of the present disclosure;
[0026] Figure 3 A flowchart of another multi-tenant traffic control method for a distributed system provided by an embodiment of the present disclosure;
[0027] Figure 4 A flowchart of a multi-tenant traffic control method for a distributed system provided in an embodiment of the present disclosure;
[0028] Figure 5 for Figure 2 A detailed flow chart of S205 in a multi-tenant traffic control method of a distributed system is shown;
[0029] Figure 6 for Figure 2 Another detailed flow diagram of S205 in a multi-tenant traffic control method for a distributed system is shown;
[0030] Figure 7 A detailed flow chart of the step of "executing the access request through the target data shard" in a multi-tenant traffic control method for a distributed system;
[0031] Figure 8 A schematic diagram of scheduling access requests for a multi-tenant traffic control method for a distributed system provided by an embodiment of the present disclosure;
[0032] Fig. 9 A schematic diagram of the structure of a multi-tenant traffic control device for a distributed system provided by an embodiment of the present disclosure;
[0033] Fig.10 A schematic diagram of the structure of a multi-tenant traffic control device for a distributed system provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0035] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0036] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0037] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0038] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0039] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0040] Currently, when multiple tenants share the same distributed system, the data of different tenants needs to be isolated to avoid interference between tenant data. However, when isolating the data of different tenants, the current actual needs may cause a sudden increase in the traffic resources required by a single tenant. Therefore, the single tenant needs to occupy a large amount of traffic resources of the current distributed system. In this case, it will affect the insufficient allocation of traffic resources for other tenants sharing the distributed system, thereby causing delays in requests from other tenants. In severe cases, it will cause the entire distributed system to fail to respond due to errors, resulting in a poor tenant experience.
[0041] Based on the above situation, the embodiment of the present disclosure provides a multi-tenant traffic control solution for a distributed system, which can reasonably allocate the traffic resources of the distributed system, avoid the situation where a single tenant occupies a surge in the traffic of the current distributed system, causing delays in requests from other tenants, and in severe cases, cause the entire distributed system to fail to respond due to errors.
[0042] The multi-tenant traffic control method of a distributed system provided by an embodiment of the present disclosure can be applied to a multi-tenant traffic control scenario of a distributed system. The method can be executed by a multi-tenant traffic control device of a distributed system, which can be implemented by software and / or hardware, and the device can be integrated in a multi-tenant traffic control device of a distributed system. The multi-tenant traffic control device of a distributed system can include but is not limited to a laptop computer, a desktop computer, a server, etc.
[0043] In this disclosure, Figure 1 The schematic diagram of the overall framework corresponding to a multi-tenant traffic control method of a distributed system provided by an embodiment of the present disclosure is shown. The framework includes: a software toolkit interface layer 11, a proxy layer 12, a data node layer 13 and a meta-service center 14. As shown in the figure, the software toolkit interface layer 11 includes multiple software toolkit interfaces (Software Development Kit, SDK), the proxy layer 12 includes multiple proxy nodes (Proxy), the data node layer 13 includes 4 data nodes (DataNode), and 3 corresponding shards 131 in each data node, and the meta-service 14 includes 3 replica meta-servers 141 (MetaServer). Specifically, when the system receives an access request from a target tenant, for example, the access request is for writing data, that is, a request to write target traffic, the meta-server 14 will first control the target proxy node in the proxy layer 12 to undertake the access request, and then assign the access request to the target data node in the data node layer 13 through the target proxy node, and execute the current access request through the target data node, that is, write the target traffic to the target data shard in the target data node. It should be noted that the method for determining the target data shard corresponding to the current tenant in the data node can be to randomly select and determine from multiple shards in the target data node corresponding to the target proxy node that undertakes the current tenant, or to refer to the existing load balancing strategy to determine the target data shard. At the same time, in a distributed system, each tenant can only use one set of proxy nodes.
[0044] Figure 2 FIG. 1 is a flow chart showing a multi-tenant traffic control method for a distributed system provided by an embodiment of the present disclosure. Figure 2 As shown, the multi-tenant traffic control method of the distributed system may include the following S201-S205:
[0045] S201. Receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system.
[0046] Among them, the access request is used to request to read or write the target traffic.
[0047] In the disclosed embodiment, when multiple tenants share the same distributed system, the server corresponding to the distributed system will receive access requests from different tenants. Specifically, the access request can be a request for reading traffic or a request for writing traffic; for example, tenant A wants to query the data stored in the distributed system, so the server receives an access request for reading traffic; for another example, tenant B wants to store data in the distributed system, so the server receives an access request for writing traffic.
[0048] S202: Determine, based on the access request, whether the total traffic currently handled by the proxy node that handles the target tenant in the proxy layer is less than the total traffic quota of the target tenant.
[0049] Among them, the distributed system pre-configures a corresponding total traffic quota for each tenant in the multi-tenant system.
[0050] Specifically, the total traffic quota of the target tenant can be called the tenant quota, which is the usage limit or allocated quantity upper limit set for the tenant, process, resource or service. In the embodiment of the present disclosure, the server needs to complete a large amount of data processing, transmission and other tasks in the process of responding to the target access request, and thus needs to occupy a certain amount of traffic resources, namely the total traffic quota of the target tenant. Therefore, a corresponding total traffic quota will be pre-configured for each tenant in the multi-tenant system for subsequent comparison with the total traffic currently undertaken by the target tenant's proxy node.
[0051] Among them, the total traffic currently undertaken by the target tenant's proxy node can be understood as the sum of the traffic required for the system to complete the access request of the current target tenant; the method for obtaining the total traffic currently undertaken by each proxy node corresponding to the target tenant can be that each proxy node actively reports (each proxy node determines the total traffic currently undertaken by the target proxy node of the proxy node, and sends the total traffic currently undertaken by the target proxy node to the meta server), or the meta server monitors it to obtain the total traffic currently undertaken by the target proxy node corresponding to each proxy node and obtains it by summing up.
[0052] Specifically, after the server receives the access request sent by the target tenant, the meta server will complete the corresponding proxy nodes used for the access request of the target tenant according to the access request configuration, and at the same time, the condition must be met: the sum of the total traffic of the proxy nodes Proxy corresponding to the target tenant forwarding data to all the corresponding data nodes DataNode cannot exceed the total traffic quota of the target tenant. Therefore, in the disclosed embodiment, it is necessary to call the meta server to first compare the total traffic currently undertaken by the proxy nodes corresponding to the target tenant with the total traffic quota of the target tenant. The purpose is to measure whether the total traffic currently undertaken by the proxy nodes corresponding to the target tenant is less than or equal to the traffic demand of the target tenant according to the total traffic currently undertaken by the proxy nodes corresponding to the current target tenant and the total traffic quota of the target tenant, and then explain that the traffic given by the system does not exceed the traffic quota of the total traffic of the target tenant, so as to achieve the purpose of saving traffic occupation; in order to further avoid traffic contention and ensure that the traffic resource usage of each tenant will not affect other tenants, the disclosed embodiment also needs to limit the traffic of each proxy node corresponding to the target tenant through the following steps 203-205.
[0053] It should be noted that after receiving the access request, the server will first intercept and parse the request using the preset authentication filter. During this process, the server will check the authentication information in the request, such as the tenant's identity, to ensure that the request comes from a legitimate tenant, and mark the shard corresponding to the tenant according to the tenant's identity.
[0054] S203: When it is determined that the total traffic currently undertaken by the proxy nodes that undertake the target tenant in the proxy layer is less than the total traffic quota of the target tenant, the proxy nodes of the proxy layer are controlled to perform access control based on a preset first traffic quota of the proxy nodes.
[0055] The first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant.
[0056] In some embodiments, in the above S202, the total traffic currently undertaken by each proxy node corresponding to the target tenant is compared with the total traffic quota of the target tenant. After obtaining the comparison result that the total traffic currently undertaken is less than or equal to the total traffic quota, in order to complete the access request of the target tenant, the traffic of each proxy node corresponding to the target tenant is more reasonably restricted, which will immediately trigger access control of each proxy node in the proxy layer that undertakes the target tenant using the first traffic quota of the proxy node to save the traffic occupation of each proxy node.
[0057] Specifically, the first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant, and is sent in advance by the meta server to each proxy node; it should be noted that the average traffic tilt quota is obtained by multiplying the average traffic result obtained by the ratio of the total traffic quota to the number of configured proxy nodes by a reasonable tilt multiple to obtain the average traffic tilt quota; for example, for the access request of tenant A with a total traffic quota of 10,000 traffic, the meta server configures 10 proxy nodes Proxy for the access request of tenant A, and the tilt multiple can be set to 2; according to the above conditions and the above method, the meta server sends the corresponding traffic quota information to each proxy node Proxy as follows: 10,000 / 10*2=2000, that is, a traffic limit of 2000 is configured for each proxy node Proxy. That is, when the total traffic of these 10 proxy nodes Proxy does not exceed 10000, each proxy node Proxy is limited to 2000 traffic. In other words, traffic skew is allowed between proxy nodes, and the upper limit of traffic skew is 2000. For example, the total traffic quota is 10000 traffic, which needs to be allocated to 10 proxy nodes, that is, the average traffic configured for a single proxy node is 1000. At this time, proxy node a needs to occupy 2000 traffic due to business reasons. In this case, part of the traffic of 1000 traffic from other nodes can be appropriately drawn to proxy node a to meet the needs of proxy node a, thereby allocating traffic resources more reasonably and avoiding resource waste.
[0058] It should be noted that the tilt multiple can be understood as the multiple of the traffic mean quota of the total traffic quota that each proxy node is currently allowed to tilt among proxy nodes, which is evenly distributed among the proxy nodes. For example, when the tilt multiple is set to 2, each proxy node can get at most 2 times the total traffic quota of the first traffic mean evenly distributed among the proxy nodes. In the embodiment of the present disclosure, the size of the tilt multiple can be set by the developer according to actual conditions, and the present disclosure does not make any specific limitations on this.
[0059] S204: Control the target proxy node in the proxy layer to accept the access request, and determine whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node.
[0060] In some embodiments, after each proxy node is access controlled using the first traffic quota of the proxy node, the server can call a target proxy node in each proxy node to receive an access request to further complete the access request of the target tenant. It should be noted that when calling a target proxy node in each proxy node to receive an access request, it is also necessary to compare the total traffic currently undertaken by the target proxy node with the first traffic quota of the proxy node. The purpose is to avoid uneven traffic distribution among the proxy nodes. If a proxy node is allocated traffic that exceeds the load, the traffic of a single shard of the data node corresponding to the proxy node may be too high, and the virtual machine corresponding to the data node may be paralyzed and unable to operate. Therefore, in the present disclosure, a corresponding first traffic quota of the proxy node is pre-set for each proxy node. When calling a target proxy node in each proxy node to receive an access request, the total traffic currently undertaken by the target proxy node is compared with the size of the first traffic quota of the proxy node. When the total traffic currently undertaken by the target proxy node is less than or equal to the first traffic quota of the proxy node, the following S205 is executed to distribute the access request to the target data node for request processing and generate response information.
[0061] Specifically, the total traffic currently undertaken by the target proxy node can be understood as the traffic currently transmitted in the proxy node (including the traffic being allocated for transmission and the traffic waiting for transmission). The total traffic currently undertaken by the target proxy node or the method of obtaining it can be actively reported by the proxy node (each proxy node determines the total traffic currently undertaken by the target proxy node of the proxy node, and sends the total traffic currently undertaken by the target proxy node to the meta server), or it can be monitored by the meta server.
[0062] S205: When it is determined that the total traffic currently handled by the target proxy node is less than the first traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0063] In some embodiments, the total traffic currently undertaken by the target proxy node is less than or equal to the first traffic quota of the proxy node, which means that the total traffic currently undertaken by one of the proxy nodes is less than or equal to the first traffic quota of the proxy node. This means that the target proxy node meets the speed limit conditions, that is, the total traffic currently undertaken by the target proxy node is less than or equal to the first traffic quota of the proxy node. The target proxy node is then called to allocate the access request to the target data node for request processing and generate response information.
[0064] Specifically, after the target proxy node distributes the access request to the target data node for request processing, corresponding response information will be generated. For example, when the target tenant's access request is a request for querying and reading data, the response information finally generated may include the read data itself, so that the tenant can read the corresponding data; when the target tenant's access request is a request for storing and writing data, the response information finally generated may be information on successful saving, so that the tenant can obtain the response result of the access request.
[0065] It should be noted that, when comparing the total traffic currently undertaken by the target proxy node with the first traffic quota of the proxy node, the above S204 may also obtain a comparison result: the total traffic currently undertaken by the target proxy node is greater than the first traffic quota of the proxy node, which means that the traffic that the current target proxy node needs to transmit is greater than the corresponding first traffic quota of the proxy node, that is, it exceeds the maximum traffic limit of the target proxy node. In this case, it is very easy to cause the current target proxy node to fail to operate normally, affecting the execution of the target tenant's access request, and in severe cases causing the entire distributed system to report an error. Therefore, in order to prevent the above situation from occurring, the embodiment of the present disclosure will issue a corresponding response message to notify the tenant that the access request cannot be completed.
[0066] The multi-tenant isolation method, apparatus, device and medium for multi-tenant traffic control of a distributed system of the embodiments of the present disclosure, after receiving an access request sent by a target tenant, first use the total traffic quota of the target tenant to limit the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer, and when the total traffic currently undertaken by the proxy node of the target tenant is less than the total traffic quota of the target tenant, then use the first traffic quota of the proxy node to perform access control on the proxy node of the target tenant, the first traffic quota of the proxy node is based on the total traffic quota of the target tenant. The total traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant, so as to allow a reasonable tilt of the traffic between each proxy node when the overall traffic is not exceeded, thereby improving the utilization rate of tenant resources; and when the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and then the access request is executed through the target data node. In this way, during the processing of access requests in a distributed system with multiple tenants, the total traffic quota of the target tenant can be limited as a whole and reasonable traffic inclination between the proxy nodes can be allowed, which can not only improve the utilization rate of tenant resources, but also greatly reduce the probability of traffic surges of the target tenants, and avoid as much as possible the error problem of delays or failures in processing requests of other tenants due to traffic surges of a single tenant, thereby improving the processing efficiency of tenant requests in the distributed system and the system stability.
[0067] As an extension and refinement of the above embodiment, refer to Figure 3 As shown, the embodiment of the present disclosure also provides another multi-tenant traffic control method for a distributed system, which specifically includes the following S301 to S305:
[0068] S301. Receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system.
[0069] Among them, the access request is used to request to read or write the target traffic.
[0070] In the embodiment of the present disclosure, S301 may refer to the description of S201 above, which will not be repeated here.
[0071] S302: Determine, based on the access request, whether the total traffic currently handled by the proxy node that handles the target tenant in the proxy layer is less than the total traffic quota of the target tenant.
[0072] Among them, the distributed system pre-configures a corresponding total traffic quota for each tenant in the multi-tenant system.
[0073] In the embodiment of the present disclosure, S302 may refer to the description of S202 above, which will not be repeated here.
[0074] S303: When it is determined that the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is not less than the total traffic quota of the target tenant, the proxy node of the control proxy layer performs access control based on a preset proxy node second traffic quota.
[0075] The second traffic quota of the proxy node is an average traffic quota configured for a single proxy node based on the total traffic quota of the target tenant.
[0076] In some embodiments, when the above S302 determines whether the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant based on the access request, the comparison result may be: the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is not less than the total traffic quota of the target tenant, which means that the current distributed system needs to use more traffic than the total traffic quota of the target tenant when completing the access request of the target tenant. If the proxy node first traffic quota is still used for access control according to the above S203, the system cannot provide traffic exceeding the total traffic quota of the target tenant to support the response to the target tenant. The access request of the user; therefore, the embodiment of the present disclosure in this case will trigger each proxy node to use the preset proxy node second traffic quota for access control, which is different from the method in S203 where each proxy node uses the proxy node first traffic quota for access control. In the embodiment of the present disclosure, the proxy node second traffic quota is directly configured as the average traffic quota configured for a single proxy node, and no traffic tilt processing will be performed; the purpose is to evenly divide the total traffic quota of the target tenant, and no longer allow traffic tilt between the proxy nodes, so as to avoid a certain proxy node occupying more traffic from other proxy nodes, resulting in uneven distribution of traffic resources and failure of other nodes to operate normally.
[0077] Exemplarily, for the access request of tenant B with a total traffic quota of 5000 traffic, the meta server configures 5 proxy nodes Proxy for the access request of tenant B; according to the above conditions, the preset second traffic quota of the proxy node is configured as the average traffic quota configured for a single proxy node for calculation, and the meta server sends the corresponding traffic quota information to each proxy node Proxy: 5000 / 5=1000, that is, a traffic limit of 1000 is configured for each proxy node Proxy, that is, when the total traffic of these 5 proxy nodes Proxy exceeds 5000, each proxy node Proxy is limited to 1000 traffic, that is, the total traffic quota of the target tenant is evenly divided, which can at least ensure the normal operation of each current proxy node.
[0078] In some embodiments, after receiving the access request from the target tenant, the meta-server may return a call failure message due to an abnormality in the current replica server. In this case, since the meta-server cannot be called, it is impossible to compare the total traffic currently undertaken by each proxy node corresponding to the target tenant with the total traffic quota of the target tenant. In order to enable the normal operation of the entire distributed system, when the meta-server cannot be called, the embodiment of the present disclosure selects by default that each proxy node adopts the preset proxy node second traffic quota for access control, so as to limit the traffic of each proxy node while ensuring the normal operation of each proxy node as much as possible.
[0079] It should be noted that in order to better meet the tenant experience and avoid the situation where the total traffic currently undertaken as fed back by the meta-server is greater than the total traffic quota, the present disclosure can predict the total traffic in the current time period and a short period of time in the future corresponding to the access request, so as to remind the tenant to expand capacity in time and try not to trigger each proxy node to use the preset proxy node second traffic quota for access control.
[0080] S304: Control the target proxy node in the proxy layer to accept the access request, and determine whether the total traffic currently accepted by the target proxy node is less than the second traffic quota of the proxy node.
[0081] In some embodiments, S304 is similar to the above S204. After each proxy node is access controlled using a preset proxy node second traffic quota, the server can control the target proxy node in the proxy layer to accept the access request to further complete the access request of the target tenant.
[0082] It should be noted that when calling the target proxy node to receive an access request, it is also necessary to compare the total traffic currently undertaken by the target proxy node with the preset proxy node second traffic quota, in order to avoid uneven traffic distribution among the proxy nodes. In the event that a proxy node is allocated traffic that exceeds the load, the traffic of a single shard of the data node corresponding to the proxy node may be too high, and the virtual machine corresponding to the data node may become paralyzed and unable to operate. Therefore, in the present disclosure, a corresponding preset proxy node second traffic quota is pre-set for each proxy node. When calling the target proxy node to receive an access request, the total traffic currently undertaken by the target proxy node is compared with the preset proxy node second traffic quota. When the total traffic currently undertaken by the target proxy node is less than or equal to the preset proxy node second traffic quota, the following S305 is executed to distribute the access request to the target data node in the distributed system and execute the access request through the target data node.
[0083] S305: When it is determined that the total traffic currently undertaken by the target proxy node is less than the second traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0084] Exemplarily, the total traffic quota of tenant B is 5000 traffic, and the meta-server configures 5 proxy nodes Proxy for tenant B's access request; according to the above conditions, the preset second traffic quota of the proxy node is configured as the first traffic average method for calculation, and the meta-server sends the corresponding traffic quota information to each proxy node Proxy: 5000 / 5=1000, that is, the preset second traffic quota of the proxy node is 1000, that is, each proxy node Proxy is configured with a traffic upper limit of 1000, then the total traffic currently undertaken by the target proxy node needs to be less than or equal to the preset second traffic quota of the proxy node, that is, 1000.
[0085] In the embodiment of the present disclosure, by triggering each proxy node to use the preset proxy node second traffic quota for access control when it is determined that the total traffic currently undertaken by the target proxy node is not less than the second traffic quota of the proxy node, the total traffic quota of the target tenant can be evenly divided, and traffic imbalance between the proxy nodes is no longer allowed, thereby preventing a certain proxy node from occupying more traffic from other proxy nodes, resulting in uneven distribution of traffic resources and other nodes being unable to operate normally. It is possible to limit the traffic of each proxy node while ensuring the normal operation of each proxy node as much as possible.
[0086] As an extension and refinement of the above embodiment, the embodiment of the present disclosure also provides a flow chart of a multi-tenant traffic control method of a distributed system, such as Figure 4 As shown, the multi-tenant traffic control method of the distributed system includes the following S401 to S405:
[0087] S401. Receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system.
[0088] Among them, the access request is used to request to read or write the target traffic.
[0089] S402: If the access request is for requesting to read the target traffic, then according to the access request, it is preferred to search for target traffic related data in the cache data maintained by the target proxy node.
[0090] Among them, each proxy node in the proxy layer is pre-configured with a cache space for maintaining data cache based on data access popularity.
[0091] It should be noted that when the access request is used to request to read the target traffic, in order to further improve the efficiency of the tenant in obtaining the target traffic, it will be prioritized to find out whether there is data related to the target traffic from the cache data maintained by the target proxy node. Specifically, the disclosed embodiment will pre-configure the corresponding cache space according to the data access popularity, so as to cache the traffic data with high access popularity through the cache space, and then when the target traffic requested to be read is the traffic with high access popularity, it can be read directly from the cache space, avoiding traffic control on the traffic with high access popularity, and improving the efficiency of the tenant in obtaining the target traffic.
[0092] For example, in an actual application scenario, when the distributed system serves a shopping platform, the shopping platform will periodically launch certain specific activities (such as pre-selling a product at 8 pm). In this case, a hot key phenomenon will occur, wherein the hot key phenomenon refers to the key (data in the Key-Value structure) that is frequently accessed in the system, that is, the traffic with high data access heat; this phenomenon will cause a surge in the shard access volume of the data node corresponding to a certain proxy node within a specific period of time, and a transition tilt in the traffic between shards, causing the entire system to crash. Therefore, it is no longer possible to control the traffic in any of the above embodiments. Therefore, in the disclosed embodiment, before certain specific activities, the function of maintaining cached data based on data access heat at the target proxy node will be enabled, so that the data of the hot key is cached in the target proxy node Proxy, and the traffic will not be scheduled to the shard of the data node corresponding to the target proxy node Proxy.
[0093] It should be noted that the proxy node with hot key phenomenon may change dynamically with time and other reasons. Therefore, when accessing the cache data of the target proxy node, it is necessary to query the proxy node of the cache data according to the proxy node corresponding to the current hot key phenomenon.
[0094] S403: When it is determined that target traffic related data exists in the cache data, the access request is directly executed through the target proxy node.
[0095] Therefore, when it is determined that there is target traffic related data in the cache data, the corresponding target traffic related data can be directly read from the cache data maintained by the target proxy node through the target proxy node, thereby improving the efficiency of tenants reading traffic data in scenarios where a large number of tenants are likely to request the same traffic data at the same time.
[0096] S404: When it is determined that the target traffic-related data does not exist in the cache data, the step of allocating the access request to the target data node in the distributed system through the target proxy node and executing the access request through the target data node is triggered.
[0097] In the disclosed embodiment, when no relevant data of the target traffic is found after preferentially searching the cache data maintained by the target proxy node according to the access request, traffic control is still required according to the above steps S202-S205, or S302-S205.
[0098] The disclosed embodiment preferentially searches the cache data maintained by the target proxy node for target traffic-related data based on the access request. When it is determined that the target traffic-related data exists in the cache data, the access request is directly executed through the target proxy node, thereby caching the traffic data with high data access popularity using a pre-configured cache space according to the data access popularity, and no longer occupies the traffic of the shards in the data node, thereby avoiding the situation where the system crashes due to traffic skew at the data node corresponding to a certain proxy node.
[0099] As an extension and refinement of the above embodiment, refer to Figure 5 As shown, in the above S205 and S305: allocating the access request to the target data node in the distributed system through the target proxy node, and executing the access request through the target data node specifically includes the following S501 to S502:
[0100] S501: Determine whether the total traffic currently handled by the target proxy node is less than the first traffic quota of the data node configured for the data node.
[0101] The first traffic quota of the data node is an average traffic quota configured for a single data shard and a single proxy node in sequence based on the total traffic quota of the data node.
[0102] In the embodiment of the present disclosure, the above-mentioned first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant with the participation of the meta server, and the first traffic quota of the data node involved in this step is set according to the local speed limit logic of the target proxy node. The specific first traffic of the data node is the average traffic quota configured for a single data shard and a single proxy node in sequence based on the total traffic quota of the data node, wherein the traffic quota of a single proxy node can be understood as the upper limit of the physical machine traffic corresponding to the target data node.
[0103] Exemplarily, a method for calculating the first traffic quota of a data node may be: divide the upper limit of the physical machine traffic corresponding to the target data node by the number of shards in the target data node, and then divide by the number of proxy nodes, to obtain the average traffic quota, i.e., the first traffic quota of the data node.
[0104] It should be noted that local flow limiting on the target proxy node is mainly to ensure that the single-shard traffic configured to the target proxy node is not too high, so as to fill the corresponding shard traffic. Therefore, the first traffic quota of the data node is generally larger, mainly to deal with extreme situations.
[0105] S502: When it is determined that the total traffic currently handled by the target proxy node is less than the first traffic quota of the data node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0106] In some embodiments, when the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the data node, it means that the total traffic currently undertaken by the current target proxy node meets the traffic upper limit of the target proxy node itself, and thus the access request can be executed through the target data node under the condition of current limiting.
[0107] As an extension and refinement of the above embodiment, refer to Figure 6 As shown, the specific implementation method of executing the access request through the target data node in the above step S205 includes the following S601 to S602:
[0108] S601. Control the target data node to accept the access request, and determine whether the total traffic currently accepted by the target data node for the target tenant is less than the second traffic quota of the data node configured for the data node.
[0109] The second traffic quota of the data node is an average traffic tilt quota configured for a single data node based on the total traffic quota of the target tenant.
[0110] In the disclosed embodiment, the target tenant's access request needs to be accepted by the target proxy node and then distributed to the target data node by the target proxy node. After the target data node accepts the access request, the target data shard in the target data node executes the access request.
[0111] In some embodiments, the target data node includes multiple corresponding data shards. Therefore, when limiting the flow, the flow limiting on the corresponding data shards in the target data node also needs to be considered; specifically, the total flow currently undertaken by the target data node for the target tenant is the flow that the target data shard needs to transmit at the current moment (including the flow being allocated for transmission and waiting for transmission); the second flow quota of the data node can be understood as the range of flow inclination allowed between the shards in the target data node, that is, the flow upper limit of the target data shard.
[0112] For example, the total traffic quota of the target tenant is 10,000, and the number of shards included in the current target data node is 100, that is, the actual speed limit value of each shard is: 10k / 100*n, n represents the tilt multiple. When n is 3, the maximum allowed traffic tilt between shards is 3 times, and the total speed limit of each shard is 10k / 100*3=300.
[0113] S602: When it is determined that the total traffic currently undertaken by the target data node for the target tenant is less than the second traffic quota of the data node, the access request is allocated to the target data shard in the target data node through the target data node, and the access request is executed through the target data shard.
[0114] It should be noted that, when the above S601 determines whether the total traffic currently undertaken by the target data node to undertake the target tenant is less than the second traffic quota of the data node configured for the data node, the comparison result may also be: when the total traffic currently undertaken by the target data node to undertake the target tenant is greater than or equal to the second traffic quota of the data node, it means that the traffic that the current target data shard node needs to transmit is greater than the corresponding second traffic quota of the data node, that is, it exceeds the traffic upper limit of the target data shard. In this case, it is very easy to cause the current target data shard to fail to operate normally, and in serious cases it will cause the entire distributed system to report an error. Therefore, in order to prevent the above situation from occurring, a corresponding notification message will be generated at this time to notify the tenant that the access request cannot be completed.
[0115] As an extension and refinement of the above embodiment, the multi-tenant traffic control method of the distributed system further includes the following step 1:
[0116] Step 1:
[0117] According to the data node first concurrency quota and the data node second concurrency quota of the target data node, the target data node is respectively subjected to data node-oriented concurrent access control and single tenant-oriented concurrent access control.
[0118] The first concurrency quota of the data node represents the upper limit of the concurrency of a single data node; the second concurrency quota of the data node is a concurrency quota configured for a single tenant based on the first concurrency quota of the data node.
[0119] In some embodiments, each distributed system has a corresponding extreme service capacity. In order to prevent the distributed system from avalanching (for example, all tenant requests time out), the disclosed embodiment performs concurrent access control for the target data node and concurrent access control for a single tenant, respectively.
[0120] Specifically, when performing concurrent access control on data nodes, it is necessary to first obtain the current node concurrency of the target data node itself, and then compare it with the first concurrency quota of the data node corresponding to the target data node. It should be noted that the first concurrency quota of the data node corresponding to the target data node can be obtained through distributed system monitoring. When the number of accumulated requests in the system exceeds the first concurrency quota of the data node, the system capacity will degrade sharply, causing all requests to time out and fail.
[0121] Specifically, when performing concurrent access control for a single tenant, it is necessary to limit the concurrency occupied by a single tenant from the tenant's perspective. Therefore, it is necessary to compare the concurrency of the current tenant with the size of the second concurrency quota of the data node.
[0122] For example, when the maximum concurrency of shards corresponding to a single data node is 4000, the concurrency limit of tenants is mainly to prevent 4000 shards from being monopolized by a single tenant. If a single tenant occupies the full concurrency of 4000, this will cause other tenants to be unable to call any shards once they are assigned to the same data node, thereby causing all requests from other tenants to fail.
[0123] It should be noted that when setting the second concurrency quota of the data node corresponding to the target data shard, since the probability of a large number of concurrent shards of all tenants in the physical machine is very small, there is no need to set the total number of shards of a single data node to the second concurrency quota of the data node. It can be appropriately set to a value smaller than the total number of shards, as long as the concurrency of a single tenant does not fill up the second concurrency quota of the data node.
[0124] The disclosed embodiment performs data node-oriented concurrent access control and single tenant-oriented concurrent access control on the target data node according to the first data node concurrency quota and the second data node concurrency quota of the target data node, respectively, and limits the concurrency from the perspectives of the data node and the single tenant. After the conditions corresponding to the above two perspectives are met, the target data shard in the target data node is controlled to accept the access request, thereby ensuring that the operation of the distributed system is more stable.
[0125] As an extension and refinement of the above embodiment, the multi-tenant traffic control method of the distributed system further includes the following step 1:
[0126] Step 1: According to the data node first throughput quota and the data node second throughput quota of the target data node, data node-oriented write control and single tenant-oriented write control are respectively performed on the target data node.
[0127] The first throughput quota of the data node represents the throughput upper limit of a single data node; the second throughput quota of the data node is a throughput quota configured for a single tenant based on the first throughput quota of the data node.
[0128] In some embodiments, the distributed system writes data through RocksDB, the underlying storage of the distributed database. Since RocksDB's ability to write data is not stable, the early data writing capacity is very strong. If the early write throughput is at the upper limit, the write capacity will be 0 in the later stage. In order to make the data nodes show stable data writing capabilities, it is necessary to limit the overall write throughput of the data nodes, and then limit the write throughput of a single tenant based on the overall write throughput of the data nodes.
[0129] In some embodiments, a first throughput quota of a data node, i.e., the upper limit of the throughput of a single data node, and a second throughput quota of a data node, i.e., the throughput quota configured for a single tenant based on the first throughput quota of the data node, are pre-set. Then, when the current write throughput is less than the first throughput quota of the data node, and at the same time, the write throughput of a single tenant is less than the second throughput quota of the data node, the target data shard in the target data node is controlled to accept access requests, thereby limiting the write throughput from the perspective of the data node, and limiting the write throughput from the perspective of a single tenant, thereby further ensuring that the distributed system runs more stably.
[0130] As an extension and refinement of the above embodiment, refer to Figure 7 As shown, the multi-tenant traffic control method of the distributed system also includes the following S701 to S704:
[0131] S701. Predict the target execution duration of the access request through the target data slice in the target data node.
[0132] In the disclosed embodiment, the execution time of the access request can also be estimated through target data sharding prediction to determine the target execution time of the access request; based on the target execution time of the access request, the target request queue corresponding to the access request is found to achieve the purpose of dividing the access request by the execution time of the access request.
[0133] S702: Determine a target request queue that is adapted to the access request from multiple request queues based on the target execution time and the reference execution time of the pre-built request queue, and store the access request in the target request queue.
[0134] The request queue is used to store requests with similar execution time; each request queue is accessed by a different working thread.
[0135] For example, access requests that require a long execution time are divided into the first request queue, and access requests that require a short execution time are divided into the second request queue. Each request queue uses the corresponding working thread to execute the corresponding access request, so as to avoid the situation where the same request queue includes both requests with long execution time and requests with short execution time, resulting in the request with short execution time not being responded to for a long time, affecting the tenant experience.
[0136] It should be noted that when dividing access requests into corresponding request queues, they can be divided from the perspective of the type of access request and the request size. For example, they can be divided into access request-Read (ordinary read task), access request-BigRead (large read task), access request-Write (ordinary write task), access request-BigWrite (large write task), that is, according to the type and request size corresponding to different access requests, the corresponding queues are set.
[0137] For example, refer to Figure 8 As shown, it is a schematic diagram of the process of dividing multiple access requests into request queues. Figure 8 (A) in the figure shows multiple access requests, and the execution time of each access request is distinguished by the uppercase and lowercase letters or the area occupied by the schematic box corresponding to each access request. 30 minutes is used as the dividing line. An execution time greater than or equal to 30 minutes is a long execution time, which is marked with uppercase letters, and an execution time less than 30 minutes is a short execution time, which is marked with lowercase letters. According to the above rules, the multiple access requests shown in (A) can be divided into two queues, namely the first request queue 81 and the second request queue 82 shown in (B), wherein the access requests in the first request queue are all access requests with an execution time greater than or equal to 30 minutes, and the access requests in the second request queue are all access requests with an execution time less than 30 minutes.
[0138] S703: Trigger the work thread corresponding to the target request queue through the target data shard to allocate execution time for each access request in the target request queue based on the tenant weight.
[0139] Specifically, after the access request is stored in the target request queue according to the target execution time, the target data shard is called to trigger the work thread corresponding to the target request queue to allocate the execution time of each access request in the target request queue based on the tenant weight.
[0140] When calling the target data shard to trigger the target request queue corresponding to the work thread to allocate the execution time of each access request in the target request queue based on the tenant weight, the weighted fair queue method can be used. This method mainly provides fair bandwidth allocation for different types of data streams, and allocates bandwidth according to the weight of the data stream to achieve fair queuing and transmission. According to this method, different weights are given in combination with the importance or priority of the tenant's access request. Therefore, in the same request queue, the corresponding execution order can be arranged according to the tenant weight. The lower the priority, the less bandwidth is obtained; the higher the priority, the more bandwidth is obtained.
[0141] S704 , scheduling processor resources to execute the access request according to the execution time allocated to the access request through the target data slice.
[0142] Furthermore, after the target data shard is used to trigger the work thread corresponding to the target request queue to allocate the execution time for each access request in the target request queue based on the tenant weight, the access request can be executed by scheduling processor resources according to the execution time allocated to the access request through the target data shard.
[0143] In some embodiments, the execution time allocation based on the tenant weight for each access request in the target request queue needs to be completed using upper-level processor (CPU) resources, and thus the processor resources need to be scheduled to execute the access request and generate response information.
[0144] In the disclosed embodiment, the target execution time of the access request is predicted by the target data sharding; based on the target execution time and the reference execution time of the pre-built request queue, a target request queue adapted to the access request is determined from a plurality of the request queues, and the access request is stored in the target request queue, thereby classifying the access requests into corresponding request queues according to the execution time, and configuring corresponding work threads for execution, so that each request queue uses the corresponding work thread to execute the corresponding access request, thereby avoiding the situation where the same request queue includes both requests with long execution time and requests with short execution time, resulting in the request with short execution time not being responded to for a long time, thereby improving the tenant experience.
[0145] As an extension and refinement of the above embodiment, the multi-tenant traffic control method of the distributed system further includes the following step A:
[0146] Step A: When it is determined that the data corresponding to the access request does not exist in the cache data of the target data shard in the target data node, the access request is allocated input and output resources based on the tenant weight and the number of input and output times through the target data shard, and the input and output resources are scheduled to execute the access request.
[0147] In some embodiments, if the cache data corresponding to the access request does not exist in the cache resources of the target data shard, a Cache Miss phenomenon occurs. In the disclosed embodiment, the corresponding input and output tasks will be triggered, and the processor resources will read the data from the disk. Therefore, when the processor resources read data from the disk according to the access request, it is also necessary to consider the weight of the tenant corresponding to the access request and the input and output resource allocation of the output number to ensure fair scheduling of input and output resources among tenants.
[0148] Specifically, the above-mentioned specific implementation method of calling the target data shard to allocate input and output resources to the access request based on the tenant weight and the number of input and output times, and scheduling the processor resources and input and output resources to execute the access request and generate response information can be achieved through a scheduling mechanism of a weighted fair queue based on IOPS (Input / Output Per Second, that is, the input and output volume per second), setting corresponding tenant weights for different tenants, and input and output resource allocation obtained according to the number of input and output resources corresponding to the current access request, and then, after obtaining the priority of each tenant according to the corresponding tenant weight, the processor resources and input and output resources read data from the corresponding disk, that is, execute the access request and generate response information.
[0149] It should be noted that in the above S701-S704, when executing the access request through the target data shard, it may happen that the data corresponding to the access request does not exist in the cache data of the target data shard. Therefore, after triggering the work thread corresponding to the target request queue through the target data shard in accordance with S701-S703 to allocate the execution time of each access request in the target request queue based on the tenant weight, the method of the embodiment of the present disclosure can also be used, that is, the input and output resources are allocated to the access request based on the tenant weight and the number of input and output times through the target data shard, and the input and output resources are scheduled to execute the access request. Furthermore, when dealing with the situation that the data corresponding to the access request does not exist in the cache data of the target data shard, although the processor resources cannot be scheduled to execute the access request, the input and output resources can be scheduled to execute the access request.
[0150] The following is an embodiment of a multi-tenant traffic control device for a distributed system provided in an embodiment of the present invention. The device and the multi-tenant traffic control method for a distributed system in the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the multi-tenant traffic control device for a distributed system, reference can be made to the embodiment of the multi-tenant traffic control method for the above-mentioned distributed system.
[0151] Fig. 9FIG. 1 is a schematic diagram showing a structure of a multi-tenant traffic control device for a distributed system provided by an embodiment of the present disclosure. Fig. 9 As shown, the multi-tenant traffic control device 900 of the distributed system may include:
[0152] The receiving unit 901 is used to receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system; the access request is used to request to read or write target traffic;
[0153] The tenant traffic quota comparison unit 902 is used to determine whether the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant according to the access request; wherein the distributed system pre-configures a corresponding total traffic quota for each tenant in the multi-tenant system;
[0154] A control unit 903 is used to control the proxy nodes of the proxy layer to perform access control based on a preset first traffic quota of the proxy node when it is determined that the total traffic currently undertaken by the proxy node undertaking the target tenant in the proxy layer is less than the total traffic quota of the target tenant; the first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant;
[0155] The proxy node traffic comparison unit 904 is used to control the target proxy node in the proxy layer to accept the access request, and determine whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node;
[0156] The execution unit 905 is used to distribute the access request to the target data node in the distributed system through the target proxy node when it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, and execute the access request through the target data node.
[0157] As an optional implementation of the embodiment of the present disclosure, the tenant traffic quota comparison unit 902 is further configured to:
[0158] When it is determined that the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is not less than the total traffic quota of the target tenant, the proxy node of the control proxy layer performs access control based on the preset proxy node second traffic quota;
[0159] The second traffic quota of the proxy node is an average traffic quota configured for a single proxy node based on the total traffic quota of the target tenant;
[0160] Controlling the target proxy node in the proxy layer to accept the access request, and determining whether the total flow currently accepted by the target proxy node is less than the second flow quota of the proxy node;
[0161] When it is determined that the total traffic currently undertaken by the target proxy node is less than the second traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0162] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is further configured to:
[0163] If the access request is for requesting to read the target traffic, the cache data maintained by the target proxy node is preferentially searched for data related to the target traffic according to the access request; wherein each proxy node in the proxy layer is pre-configured with cache space for maintaining data cache based on data access popularity;
[0164] When it is determined that the target traffic related data exists in the cache data, the access request is executed through the target proxy node;
[0165] When it is determined that there is no target traffic related data in the cache data, the step of allocating the access request to the target data node in the distributed system through the target proxy node and executing the access request through the target data node is triggered.
[0166] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is specifically used to:
[0167] Determine whether the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the data node configured for the data node; the first traffic quota of the data node is the average traffic quota configured for a single data shard and a single proxy node in sequence based on the total traffic quota of the data node;
[0168] When it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the data node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
[0169] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is specifically used to:
[0170] Control the target data node to accept access requests, and determine whether the total traffic currently accepted by the target data node for the target tenant is less than the second traffic quota of the data node configured for the data node; the second traffic quota of the data node is an average traffic tilt quota configured for a single data node based on the total traffic quota of the target tenant;
[0171] When it is determined that the total traffic currently undertaken by the target data node for the target tenant is less than the second traffic quota of the data node, the access request is allocated to the target data shard in the target data node through the target data node, and the access request is executed through the target data shard.
[0172] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is further configured to:
[0173] According to the first concurrency quota of the data node and the second concurrency quota of the data node of the target data node, concurrent access control for the data node and concurrent access control for a single tenant are performed on the target data node respectively; wherein the first concurrency quota of the data node represents the upper limit of the concurrency of a single data node; the second concurrency quota of the data node is a concurrency quota configured for a single tenant based on the first concurrency quota of the data node.
[0174] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is further configured to:
[0175] According to the data node first throughput quota and the data node second throughput quota of the target data node, the target data node is respectively subjected to data node-oriented write control and single tenant-oriented write control; wherein the data node first throughput quota represents the throughput upper limit of a single data node; the data node second throughput quota is a throughput quota configured for a single tenant based on the data node first throughput quota.
[0176] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is further configured to:
[0177] Predicting a target execution time of the access request by using a target data slice in the target data node;
[0178] Based on the target execution time and the reference execution time of the pre-built request queue, a target request queue that adapts the access request is determined from multiple request queues, and the access request is stored in the target request queue; wherein the request queue is used to store requests with similar execution time; each request queue is accessed by a different working thread;
[0179] The target data shard is used to trigger the work thread corresponding to the target request queue to allocate the execution time of each access request in the target request queue based on the tenant weight;
[0180] Processor resources are scheduled to execute access requests according to the execution time allocated to the access requests through the target data slices.
[0181] As an optional implementation of the embodiment of the present disclosure, the execution unit 905 is further configured to:
[0182] When it is determined that the data corresponding to the access request does not exist in the cache data of the target data shard in the target data node, the access request is allocated input and output resources based on the tenant weight and the number of input and output times through the target data shard, and the input and output resources are scheduled to execute the access request.
[0183] The multi-tenant traffic control device of a distributed system provided in an embodiment of the present invention can execute the multi-tenant traffic control method of a distributed system provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.
[0184] It is worth noting that in the embodiment of the multi-tenant traffic control device of the above-mentioned distributed system, the various units included are divided only 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 scope of protection of this disclosure.
[0185] The embodiment of the present disclosure also provides a multi-tenant traffic control device for a distributed system, which may include a processor and a memory, and the memory may be used to store executable instructions. The processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the multi-tenant traffic control method for the distributed system in the above embodiment.
[0186] Fig.10 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0187] like Fig.10 As shown, the electronic device 1000 may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output interface (I / O interface) 1005 is also connected to the bus 1004.
[0188] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data.
[0189] It should be noted that Fig.10The electronic device 1000 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure. Fig.10 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0190] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the multi-tenant traffic control method of the distributed system of any embodiment of the present disclosure are executed.
[0191] Based on the same inventive concept, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a computing device implements the audio signal processing method provided in the above embodiment.
[0192] Based on the same inventive concept, an embodiment of the present disclosure further provides a computer program product. When the computer program product is executed on a computer, the computing device implements the audio signal processing method provided in the above embodiment.
[0193] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0194] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0195] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0196] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0197] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.
[0198] An embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the multi-tenant traffic control method of the distributed system in any embodiment of the present disclosure.
[0199] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may 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 of computer-readable storage media may include, but are not limited to: 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 the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0200] In some embodiments, the client and server may communicate using any currently known or future developed network protocol such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0201] The above-mentioned computer-readable medium may be included in the multi-tenant traffic control device of the above-mentioned distributed system; or it may exist independently without being assembled into the multi-tenant traffic control device of the distributed system.
[0202] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the multi-tenant traffic control device of the distributed system, the multi-tenant traffic control device of the distributed system executes the steps of the multi-tenant traffic control method of the distributed system described in any embodiment of the present disclosure.
[0203] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including but not limited to 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 a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving 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).
[0204] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0205] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0206] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0207] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0208] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0209] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A multi-tenant traffic control method for a distributed system, characterized in that: include: Receive access requests sent by target tenants in the multi-tenant system through the proxy layer in the distributed system; The access request is used to request to read or write target traffic; According to the access request, determining whether the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant; wherein the distributed system is pre-configured with a corresponding total traffic quota for each tenant in the multi-tenant system; When it is determined that the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is less than the total traffic quota of the target tenant, the proxy node of the proxy layer is controlled to perform access control based on a preset proxy node first traffic quota; the proxy node first traffic quota is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant; Controlling the target proxy node in the proxy layer to accept the access request, and determining whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node; When it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
2. The method according to claim 1, characterized in that The method further comprises: When it is determined that the total traffic currently undertaken by the proxy node that undertakes the target tenant in the proxy layer is not less than the total traffic quota of the target tenant, the proxy node of the proxy layer is controlled to perform access control based on a preset proxy node second traffic quota; the proxy node second traffic quota is an average traffic quota configured for a single proxy node based on the total traffic quota of the target tenant; Controlling the target proxy node in the proxy layer to accept the access request, and determining whether the total flow currently accepted by the target proxy node is less than the second flow quota of the proxy node; When it is determined that the total traffic currently undertaken by the target proxy node is less than the second traffic quota of the proxy node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: If the access request is used to request to read the target traffic, then according to the access request, the cache data maintained by the target proxy node is preferentially searched for whether there is data related to the target traffic; wherein each proxy node in the proxy layer is pre-configured with a cache space for maintaining data cache based on data access heat; When it is determined that the target traffic related data exists in the cache data, directly executing the access request through the target proxy node; When it is determined that the target traffic related data does not exist in the cache data, the step of allocating the access request to the target data node in the distributed system through the target proxy node and executing the access request through the target data node is triggered again.
4. The method according to claim 1 or 2, characterized in that: The step of allocating the access request to a target data node in the distributed system through the target proxy node and executing the access request through the target data node includes: Determine whether the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the data node configured for the data node; the first traffic quota of the data node is the average traffic quota configured for a single data shard and a single proxy node in sequence based on the total traffic quota of the data node; When it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the data node, the access request is distributed to the target data node in the distributed system through the target proxy node, and the access request is executed through the target data node.
5. The method according to claim 1, characterized in that The executing the access request through the target data node includes: Control the target data node to accept the access request, and determine whether the total traffic currently accepted by the target data node for the target tenant is less than the second traffic quota of the data node configured for the data node; the second traffic quota of the data node is an average traffic tilt quota configured for a single data node based on the total traffic quota of the target tenant; When it is determined that the total traffic currently undertaken by the target data node for the target tenant is less than the second traffic quota of the data node, the access request is allocated to the target data shard in the target data node through the target data node, and the access request is executed through the target data shard.
6. The method according to claim 1, characterized in that The method further comprises: According to the first concurrency quota of the data node and the second concurrency quota of the data node of the target data node, the target data node is respectively subjected to data node-oriented concurrent access control and single tenant-oriented concurrent access control; wherein the first concurrency quota of the data node represents the concurrency upper limit of a single data node; the second concurrency quota of the data node is a concurrency quota configured for a single tenant based on the first concurrency quota of the data node.
7. The method according to claim 1, characterized in that The method further comprises: According to the data node first throughput quota and the data node second throughput quota of the target data node, the target data node is respectively subjected to data node-oriented write control and single tenant-oriented write control; wherein the data node first throughput quota represents the throughput upper limit of a single data node; the data node second throughput quota is a throughput quota configured for a single tenant based on the data node first throughput quota.
8. The method according to claim 1, characterized in that: The executing the access request through the target data node includes: Predicting a target execution time of the access request by using a target data slice in the target data node; Based on the target execution time and the reference execution time of the pre-built request queue, a target request queue adapted to the access request is determined from the multiple request queues, and the access request is stored in the target request queue; wherein the request queue is used to store requests with similar execution time; each of the request queues is accessed by a different working thread; Triggering the working thread corresponding to the target request queue through the target data shard to allocate execution time for each access request in the target request queue based on the tenant weight; Processor resources are scheduled to execute the access request according to the execution time allocated to the access request through the target data slice.
9. The method according to claim 1, characterized in that: The executing the access request through the target data node includes: when it is determined that the data corresponding to the access request does not exist in the cache data of the target data shard in the target data node, allocating input and output resources for the access request based on the tenant weight and the number of input and output times through the target data shard, and scheduling the input and output resources to execute the access request.
10. A multi-tenant traffic control device for a distributed system, characterized in that: include: A receiving unit, configured to receive an access request sent by a target tenant in a multi-tenant system through a proxy layer in a distributed system; The access request is used to request to read or write target traffic; A tenant traffic quota comparison unit, configured to determine, according to the access request, whether the total traffic currently undertaken by the proxy node in the proxy layer that undertakes the target tenant is less than the total traffic quota of the target tenant; wherein the distributed system is pre-configured with a corresponding total traffic quota for each tenant in the multi-tenant system; A control unit, for controlling the proxy nodes of the proxy layer to perform access control based on a preset first traffic quota of the proxy nodes when it is determined that the total traffic currently undertaken by the proxy nodes undertaking the target tenant in the proxy layer is less than the total traffic quota of the target tenant; the first traffic quota of the proxy node is an average traffic tilt quota configured for a single proxy node based on the total traffic quota of the target tenant; A proxy node traffic comparison unit, used to control a target proxy node in the proxy layer to accept the access request, and determine whether the total traffic currently accepted by the target proxy node is less than the first traffic quota of the proxy node; An execution unit is used to distribute the access request to the target data node in the distributed system through the target proxy node when it is determined that the total traffic currently undertaken by the target proxy node is less than the first traffic quota of the proxy node, and execute the access request through the target data node.
11. An electronic device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the multi-tenant traffic control method of the distributed system described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the multi-tenant traffic control method of a distributed system described in any one of claims 1 to 9.