A Trino resource group management method and device
By building the metadata table of resource groups and automatically managing resources in Trino, the problem of uneven resource allocation caused by static resource group configurations is solved, dynamic adjustment and elastic management of resource groups are realized, and system performance and user experience are improved.
Patent Information
- Application Number
- CN202411025606.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-30
AI Technical Summary
The existing Trino resource group configuration has the problem that resource limits are difficult to dynamically adjust, resulting in uneven resource allocation, reduced query performance, and affected system stability.
By constructing the metadata table of the resource group, setting the maximum usable resources and resource growth ratio, counting and querying the total resource usage, and automatically applying for and recycling resources, the dynamic expansion and contraction of the resource group can be realized to ensure resource utilization and user experience.
It realizes elastic management of resource group resources and can dynamically adjust resource limits in real time according to actual needs, improve resource utilization, reduce maintenance costs, and ensure system performance and stability.
Smart Images

Figure CN118550934B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a Trino resource group management method and device. Background Art
[0002] In the current era of big data and cloud computing, distributed SQL query engines, as key infrastructure, are essential for achieving efficient and scalable data analysis. Trino (formerly known as PrestoSQL), as a leading open source distributed SQL query engine, occupies an important position in the field of interactive analytical queries with its excellent performance, flexibility and extensive support for multiple data sources. One of its core advantages lies in its innovative resource management mechanism, that is, efficient management and resource isolation of query jobs through resource groups.
[0003] As the core abstract unit in the Trino architecture, resource groups are designed to ensure that different user groups or query types can share cluster resources fairly and reasonably through predefined resource limits and sophisticated scheduling strategies. This mechanism effectively solves the problem of resource competition and improves the overall performance and stability of the system. However, there is a significant challenge in the configuration of resource groups in the existing technology: its resource limit parameters usually need to be preset before the Trino service process is started, and can only be adjusted by manually modifying the database configuration file during service operation.
[0004] This static and manual configuration method undoubtedly increases the difficulty of operation and maintenance costs for system administrators who are not familiar with Trino's internal working principles and resource management mechanisms. At the same time, inappropriate resource configuration may lead to problems such as uneven resource allocation, query performance degradation, and even system crashes, which seriously affect user experience and business continuity. Therefore, how to provide a more intelligent and automated resource group configuration and adjustment solution has become the focus of the Trino community and users. Summary of the invention
[0005] The object of the present invention is to provide a Trino resource group management method and device to solve the problem in the prior art that resource restrictions in a Trino resource group are difficult to dynamically adjust.
[0006] To achieve the above objectives, this application adopts the following technical solutions:
[0007] A Trino resource group management method of the present application includes the following steps:
[0008] Constructing a metadata table corresponding to a resource group, and setting the maximum available resources and resource growth ratio of the resource group in the metadata table;
[0009] receiving a latest query request submitted by a client, and counting a total usage of the first resource of all queries currently running on the resource group before executing the latest query request;
[0010] Determine the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource;
[0011] The total second resource usage of all queries currently running on the resource group is counted, and whether to execute the latest query request on the resource group is determined according to the total second resource usage and the resource limit value after the resource group is expanded.
[0012] Preferably, the metadata table also includes the weight of the resource group and the maximum idle time of the resources.
[0013] Preferably, the method further comprises:
[0014] When any query on the resource group is completed, the latest total resource usage of all queries currently running on the resource group is counted, and the latest total resource usage is compared with the initial resource amount of the resource group. If the time when the latest total resource usage is less than the initial resource amount exceeds the maximum idle time of the resources, the expansion resources allocated to the resource group are reclaimed.
[0015] Preferably, determining the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total usage of the first resource includes:
[0016] Compare the first total resource usage with the initial resource limit value of the resource group. When the first total resource usage is greater than the initial resource limit value and the initial resource limit value is less than the maximum usable resources, calculate the product of the resource growth ratio and the initial resource limit value to obtain the maximum resource that the resource group can apply for from the resource group resource manager.
[0017] Preferably, before the resource group resource manager allocates expansion resources to the resource group according to the maximum resource that can be applied, the method further includes:
[0018] A resource application request is sent to a resource group resource manager, wherein the resource application request includes a maximum resource that the resource group can apply for.
[0019] Preferably, allocating expansion resources to the resource group according to the maximum resource that can be applied includes:
[0020] All resource groups that have applied for expansion resources are sorted in order of weight from small to large, and the expansion resources in the resource groups with idle resources are recovered in order, and the expansion resources do not exceed the maximum resources that can be applied for by the corresponding resource group;
[0021] After recycling, all resource groups that are applying for capacity expansion are sorted in descending order of weight, and it is determined whether the remaining resources of the resource manager of the resource group are less than the maximum resources that can be applied for by the resource group with the largest weight;
[0022] When the remaining resources are not less than the maximum resources that can be applied for by the resource group with the largest weight, allocating expansion resources to the resource group with the largest weight;
[0023] When the remaining resources are less than the maximum resources that the resource group with the largest weight can apply for, all the remaining resources are allocated to the resource group with the largest weight, and the difference between the remaining resources and the maximum resources that the resource group with the largest weight can apply for is recorded to wait for the next resource allocation.
[0024] Preferably, determining whether to execute the latest query request on the resource group according to the total usage amount of the second resource and the resource limit value after the resource group is expanded includes:
[0025] Comparing the second resource usage total with the resource limit value after the resource group is expanded;
[0026] When the total usage of the second resource is less than the resource limit value of the resource group after the capacity is expanded, the latest query request is executed on the resource group.
[0027] A Trino resource group management device, comprising:
[0028] A configuration module, used to construct a metadata table corresponding to a resource group, and set the maximum available resources and resource growth ratio of the resource group in the metadata table;
[0029] A statistics module, configured to receive a latest query request submitted by a client, and to count a total usage of the first resource of all queries currently running on the resource group before executing the latest query request;
[0030] a calculation module, configured to determine the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource;
[0031] The judgment module is used to count the total second resource usage of all queries currently running on the resource group, and determine whether to execute the latest query request on the resource group according to the total second resource usage and the resource limit value after the resource group is expanded.
[0032] An electronic device comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a Trino resource group management method as described in any one of the above.
[0033] A computer-readable storage medium storing a computer program, wherein the computer program enables a computer to implement a Trino resource group management method as described in any one of the above when executed.
[0034] The present invention has the following beneficial effects:
[0035] In the present invention, the resource group can automatically expand resources when resources are lacking, and can shrink resources when resources are idle, so that the resources of the resource group have elastic characteristics and can effectively meet the requirements of real-time dynamic adjustment of resource group resource limits according to resource usage. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0037] Figure 1 is a first flow chart of a Trino resource group management method provided by an embodiment of the present invention;
[0038] Figure 2 is a second flow chart of a Trino resource group management method provided by an embodiment of the present invention;
[0039] Figure 3 It is a structural diagram of a Trino resource group management device provided by an embodiment of the present invention;
[0040] Figure 4 It is a schematic diagram of an electronic device for implementing a Trino resource group management method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] To make the technical solution of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The terms "first", "second", etc. in the claims and specification of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances. This is only to describe the distinction method adopted when describing objects with the same attributes in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that a process, method, system, product or device containing a series of units is not necessarily limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] Example 1
[0043] like Figure 1 As shown, a Trino resource group management method includes the following steps:
[0044] S110, constructing a metadata table corresponding to a resource group, and setting the maximum available resources and resource growth ratio of the resource group in the metadata table;
[0045] S120, receiving the latest query request submitted by the client, and counting the total usage of the first resource of all queries currently running on the resource group before executing the latest query request;
[0046] S130, determining the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource;
[0047] S140. Count the total second resource usage of all queries currently running on the resource group, and determine whether to execute the latest query request on the resource group according to the total second resource usage and the resource limit value after the resource group is expanded.
[0048] In this embodiment, the metadata table corresponding to the resource group is constructed in the database. There are many data storage systems that Trino can connect to, such as relational database MySQL, NoSQL database, and Hadoop HDFS. The connection database selected here is MySQL database. Specifically, in the MySQL database, ALTER TABLEresource_groups ADD max_memory_limit VARCHAR(128) NULL is used to add a max_memory_limit field for indicating the maximum usable resources of the resource group to the metadata table resource_groups. ALTER TABLEresource_groups ADD resource_weight INT NULL is used to add a resource_weight field for indicating the weight of the resource group to the resource_groups table. The weight can be used for both resource recovery and resource allocation. ALTER TABLE resource_groups ADD growth_fraction DOUBLE NULL is used to add a max_growth_limit field for indicating the resource growth ratio of the resource group when applying for resource expansion to the resource_groups table. This parameter can prevent the resource group from applying for resources in large quantities and quickly, which may cause instability in Trino. ALTERTABLE resource_groups ADD idle_timeout VARCHAR(128) NULL Adds the max_idle_limit field to the resource_groups table to indicate the maximum idle time of resources in the resource group. The maximum idle time of resources is used to indicate how long the expansion resources applied for by the resource group must be idle before they are considered idle resources. It also sets the values corresponding to the maximum available resources, weight, resource growth ratio, and maximum idle time of resources.
[0049] Then, Trino receives the latest query request A from the client, which can be a command line interface TrinoCLI, a JDBC driver, or a Python client, which is not specifically limited here. Before executing the latest query request A, Trino first counts the resources used by all queries currently running on the resource group to obtain the first total resource usage, and then determines the maximum resource that the resource group can apply for from the resource group resource manager ResourceGroupResourceManager in combination with the maximum available resources of the resource group, the resource growth ratio, and the first total resource usage, and sends a resource application request to the resource group resource manager, which includes the maximum resource that the resource group can apply for. The resource group resource manager allocates expansion resources to the resource group based on the maximum resource that the resource group can apply for. The maximum resource that can be applied refers to the maximum expected resource amount declared by the resource group when applying for expansion, and the expansion resource refers to the additional resource actually allocated to the resource group by the resource group resource manager, and its allocation amount is subject to the dual restrictions of the maximum resource amount that the resource group can apply for and the remaining resource amount of the resource group resource manager. Therefore, the expansion resource will not exceed the maximum resource that can be applied.
[0050] Next, the amount of resources used by all queries currently running on the resource group is counted again to obtain the second total resource usage. This is because the time from the resource group issuing a resource application request to the resource group resource manager allocating expansion resources to the resource group is not immediate, but requires some time. During this time, the amount of resources used by all queries currently running on the resource group will change accordingly. Then, based on the second total resource usage and the resource limit value after the resource group is expanded, determine whether to execute the latest query request A on the resource group. The resource limit value refers to the total amount of resources currently available to the resource group. Since the resource group can apply for resources for automatic expansion, if it is not restricted, it may cause a resource group to apply for all Trino's resources.
[0051] Further, the determining whether to execute the latest query request on the resource group according to the second resource usage total amount and the resource limit value after the resource group is expanded includes:
[0052] Comparing the second resource usage total with the resource limit value after the resource group is expanded;
[0053] When the total usage of the second resource is less than the resource limit value of the resource group after the capacity is expanded, the latest query request is executed on the resource group.
[0054] That is, compare the total usage of the second resource with the resource limit value after the resource group is expanded. If the total usage of the second resource is less than the resource limit value after the resource group is expanded, it means that there are unused resources in the resource group. At this time, the latest query request A is executed on the resource group, because the resource group will only run a new query if there are remaining available resources. At the same time, the resources required to run a new query are unknown. Therefore, as long as there are unused resources in the resource group, the new query can be run without considering the size of the unused resources. If there are no unused resources in the resource group, the new query will not be run.
[0055] Furthermore, when any query on the resource group is completed, the latest total resource usage of all queries currently running on the resource group is counted, and the latest total resource usage is compared with the initial resource amount of the resource group. If the time when the latest total resource usage is less than the initial resource amount exceeds the maximum idle time of the resources, the expansion resources allocated to the resource group are reclaimed.
[0056] After each query is run on the resource group, the resources used by all queries currently running on the resource group are counted to obtain the latest total resource usage. If the latest total resource usage is less than the initial resource amount of the resource group, it means that the expanded resource group is idle. At this time, the resource group starts timing and records the current time as T1. The resource group has an initial resource amount, and this initial resource amount is fixed and cannot be recovered by the resource group manager. After that, the latest total resource usage is continuously calculated. If the latest total resource usage calculated is less than the initial resource amount of the resource group within a period of time, the current time is recorded as T2. If T2-T1>max_idle_limit, the resource group is marked as idle and waits for the resource group resource manager to recycle its expanded resources. It should be noted here that during this period of time, if the latest calculated total resource usage is not less than the initial resource amount of the resource group, the previously recorded time T1 will be invalidated, and the next time point when the latest resource usage is less than the initial resource amount of the resource group will be used as the new T1.
[0057] In this embodiment, the resource group can automatically expand resources when resources are lacking, and can shrink resources when resources are idle, so that the resources of the resource group have elastic characteristics and can meet the requirements of real-time dynamic adjustment of resource group resource limits according to resource usage.
[0058] Example 2
[0059] like Figure 2 As shown, a Trino resource group management method includes:
[0060] S210, constructing a metadata table corresponding to a resource group, and setting the maximum available resources and resource growth ratio of the resource group in the metadata table;
[0061] S220, receiving the latest query request submitted by the client, and counting the total usage of the first resource of all queries currently running on the resource group before executing the latest query request;
[0062] S230, comparing the first resource usage total amount with the initial resource limit value of the resource group;
[0063] S240, when the total amount of the first resource usage is greater than the initial resource limit value and the initial resource limit value is less than the maximum available resource, calculating the product of the resource growth ratio and the initial resource limit value to obtain the maximum resource that the resource group can apply for from the resource group resource manager;
[0064] S250, sending a resource application request to the resource group resource manager, wherein the resource application request includes the maximum resource that the resource group can apply for, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum resource that can be applied;
[0065] S260. Count the total second resource usage of all queries currently running on the resource group, and determine whether to execute the latest query request on the resource group according to the second resource usage total and the resource limit value after the resource group is expanded.
[0066] In Example 2, after counting the total first resource usage of all queries currently running on the resource group, the total first resource usage is compared with the initial resource limit value of the resource group. If the total first resource usage is greater than the initial resource limit value and the initial resource limit value is less than the maximum usable resource of the resource group, the product of the resource growth ratio of the resource group and its initial resource limit value is calculated to obtain the maximum resource that the resource group can apply for from the resource group resource manager, and then a resource application request is sent to the resource group resource manager.
[0067] Furthermore, allocating expansion resources to the resource group according to the maximum resource that can be applied includes:
[0068] All resource groups that have applied for expansion resources are sorted in order of weight from small to large, and the expansion resources in the resource groups with idle resources are recovered in order, and the expansion resources do not exceed the maximum resources that can be applied for by the corresponding resource group;
[0069] After recycling, all resource groups that are applying for capacity expansion are sorted in descending order of weight, and it is determined whether the remaining resources of the resource manager of the resource group are less than the maximum resources that can be applied for by the resource group with the largest weight;
[0070] When the remaining resources are not less than the maximum resources that can be applied for by the resource group with the largest weight, allocating expansion resources to the resource group with the largest weight;
[0071] When the remaining resources are less than the maximum resources that the resource group with the largest weight can apply for, all the remaining resources are allocated to the resource group with the largest weight, and the difference between the remaining resources and the maximum resources that the resource group with the largest weight can apply for is recorded to wait for the next resource allocation.
[0072] After receiving the resource application request, the resource group resource manager will first arrange all resource groups that have applied for expansion resources in Trino in order of weight from small to large, and reclaim expansion resources for resource groups with idle resources in this order, that is, the expansion resources are first reclaimed for the resource group with the smallest weight and idle resources, and then the expansion resources are reclaimed for the resource group with the second smallest weight and idle resources, and so on, until the expansion resources in all resource groups with idle resources are reclaimed, and then all resource groups that are applying for expansion resources are arranged in order of weight from large to small, and resource allocation is given priority to the resource group with large weight in combination with the remaining resources of the resource group resource manager. If its remaining resources are not less than the maximum resources that can be applied for by the resource group with the largest weight, the maximum resources applied for are directly allocated to the resource group with the largest weight. If there are still some remaining resources, expansion resources are allocated to the resource group with the second largest weight. If its remaining resources are less than the maximum resources that can be applied for by the resource group with the largest weight, all its remaining resources are allocated to the resource group with the largest weight, and the difference between the remaining resources and the maximum resources that can be applied for by the resource group with the largest weight is recorded to wait for the next resource allocation.
[0073] After the resource group receives the expansion resources allocated by the resource group resource manager, it again counts the resources used by all queries currently running on the resource group to obtain the second total resource usage. The remaining steps are the same as in Example 1 and will not be repeated here.
[0074] In this embodiment, the resource limit of the resource group can be adjusted dynamically in real time through the resource group resource manager to recover and allocate resources of the resource group, thereby improving resource utilization.
[0075] Example 3
[0076] like Figure 3 As shown, a Trino resource group management device includes:
[0077] A configuration module, used to construct a metadata table corresponding to a resource group, and set the maximum available resources and resource growth ratio of the resource group in the metadata table;
[0078] A statistics module, configured to receive a latest query request submitted by a client, and to count a total usage of the first resource of all queries currently running on the resource group before executing the latest query request;
[0079] a calculation module, configured to determine the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource;
[0080] The judgment module is used to count the total second resource usage of all queries currently running on the resource group, and determine whether to execute the latest query request on the resource group according to the total second resource usage and the resource limit value after the resource group is expanded.
[0081] The above-mentioned device can execute the methods provided by all the aforementioned embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above-mentioned methods. For technical details not fully described in this embodiment, please refer to the methods provided by all the aforementioned embodiments of the present invention.
[0082] Example 4
[0083] like Figure 4 As shown, a computer device is provided, including a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the above-mentioned Trino resource group management method.
[0084] The computer device can be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a Trino resource group management method is implemented.
[0085] This embodiment further provides a computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of the Trino resource group management method as described above are implemented.
[0086] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0087] The computer program instructions for performing the operation of the present invention may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.
[0088] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0089] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0090] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A Trino resource group management method, characterized in that: The following steps are involved: Constructing a metadata table corresponding to a resource group, and setting the maximum available resources and resource growth ratio of the resource group in the metadata table; receiving a latest query request submitted by a client, and counting a total usage of the first resource of all queries currently running on the resource group before executing the latest query request; Determine the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource; Counting the total second resource usage of all queries currently running on the resource group, and determining whether to execute the latest query request on the resource group according to the total second resource usage and the resource limit value after the resource group is expanded; The determining, according to the maximum available resource, the resource growth ratio and the total usage of the first resource, of the maximum resource that the resource group can apply for from the resource group resource manager includes: Compare the first total resource usage with the initial resource limit value of the resource group. When the first total resource usage is greater than the initial resource limit value and the initial resource limit value is less than the maximum usable resources, calculate the product of the resource growth ratio and the initial resource limit value to obtain the maximum resource that the resource group can apply for from the resource group resource manager.
2. A Trino resource group management method according to claim 1, characterized in that: The metadata table also includes the weight of the resource group and the maximum idle time of the resource.
3. A Trino resource group management method according to claim 2, characterized in that: The method further comprises: When any query on the resource group is completed, the latest total resource usage of all queries currently running on the resource group is counted, and the latest total resource usage is compared with the initial resource amount of the resource group. If the time when the latest total resource usage is less than the initial resource amount exceeds the maximum idle time of the resources, the expansion resources allocated to the resource group are reclaimed.
4. A Trino resource group management method according to claim 1, characterized in that: Before the resource group resource manager allocates expansion resources to the resource group according to the maximum resource that can be applied, the method further includes: A resource application request is sent to a resource group resource manager, wherein the resource application request includes a maximum resource that the resource group can apply for.
5. A Trino resource group management method according to claim 4, characterized in that: The allocating expansion resources to the resource group according to the maximum resource that can be applied includes: All resource groups that have applied for expansion resources are sorted in order of weight from small to large, and the expansion resources in the resource groups with idle resources are recovered in order, and the expansion resources do not exceed the maximum resources that can be applied for by the corresponding resource group; After recycling, all resource groups that are applying for capacity expansion are sorted in descending order of weight, and it is determined whether the remaining resources of the resource manager of the resource group are less than the maximum resources that can be applied for by the resource group with the largest weight; When the remaining resources are not less than the maximum resources that can be applied for by the resource group with the largest weight, allocating expansion resources to the resource group with the largest weight; When the remaining resources are less than the maximum resources that the resource group with the largest weight can apply for, all the remaining resources are allocated to the resource group with the largest weight, and the difference between the remaining resources and the maximum resources that the resource group with the largest weight can apply for is recorded to wait for the next resource allocation.
6. A Trino resource group management method according to claim 3, characterized in that: The determining whether to execute the latest query request on the resource group according to the second resource usage total amount and the resource limit value after the resource group is expanded includes: Comparing the second resource usage total with the resource limit value after the resource group is expanded; When the total usage of the second resource is less than the resource limit value of the resource group after the capacity is expanded, the latest query request is executed on the resource group.
7. A Trino resource group management device, characterized in that: include: A configuration module, used to construct a metadata table corresponding to a resource group, and set the maximum available resources and resource growth ratio of the resource group in the metadata table; A statistics module, configured to receive a latest query request submitted by a client, and to count a total usage of the first resource of all queries currently running on the resource group before executing the latest query request; a calculation module, configured to determine the maximum resource that the resource group can apply for from the resource group resource manager according to the maximum available resource, the resource growth ratio and the total amount of first resource usage, so that the resource group resource manager allocates expansion resources to the resource group according to the maximum available resource; a judgment module, configured to count the total amount of second resource usage of all queries currently running on the resource group, and determine whether to execute the latest query request on the resource group according to the total amount of second resource usage and the resource limit value after the resource group is expanded; The determining, according to the maximum available resource, the resource growth ratio and the total usage of the first resource, the maximum resource that the resource group can apply for from the resource group resource manager includes: Compare the first total resource usage with the initial resource limit value of the resource group. When the first total resource usage is greater than the initial resource limit value and the initial resource limit value is less than the maximum usable resources, calculate the product of the resource growth ratio and the initial resource limit value to obtain the maximum resource that the resource group can apply for from the resource group resource manager.
8. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a Trino resource group management method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: The computer program enables a computer to implement a Trino resource group management method according to any one of claims 1 to 6 when executed.
