Resource deployment method and device, terminal equipment and storage medium
By obtaining the process number and running status data of the database instance, and using the wolf pack algorithm to optimize resource configuration, it solves the problem of low physical machine resource utilization and virtual machine deployment requiring extensive optimization in MySQL cloud service, and achieves dynamic resource isolation and performance improvement. .
Patent Information
- Application Number
- CN202311246145.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-25
- Publication Date
- 2024-10-18
AI Technical Summary
The existing physical machine exclusive deployment method of MySQL cloud service is not very efficient in terms of resource utilization. Virtual machine deployment requires a lot of optimization and adjustment. It is difficult for container deployment to exert flexibility and automatic drift features. Instead, it increases the number of container management platforms and reduces resource performance.
By obtaining the process number and running status data of the database instance, the resource threshold is determined, the wolf pack algorithm is used to optimize resource configuration, and target scripts are generated for resource deployment control to achieve dynamic physical resource isolation and performance improvement.
It realizes dynamic physical resource isolation, improves physical resource performance, solves the problems of low resource utilization and insufficient performance, and is suitable for application scenarios with high performance and high stability requirements.
Smart Images

Figure CN118796409A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud service technology, and in particular to a resource deployment method, device, terminal equipment and storage medium. Background Art
[0002] In the prior art, the delivery of MySQL cloud services is generally provided by public clouds, and there are three main deployment methods: physical machine exclusive deployment, virtual machine deployment, and container (docker) deployment. Among them, the physical machine exclusive deployment method is guaranteed in terms of performance, but the resource utilization rate is not high. The virtual machine deployment method often requires a lot of early optimization work to ensure it. For example, to meet the performance requirements of the database operating environment, a lot of optimization and adjustment work needs to be invested in the underlying distributed storage, virtualization system, virtualization network, and database software layer. Otherwise, the virtualization deployment method is difficult to guarantee the performance of the database operation. The container deployment method needs to solve the problem of data storage for stateful database processes, and generally requires a fixed running host. It is impossible to give full play to the flexibility and automatic drift characteristics of the container. Instead, it adds a layer of container management platform and reduces resource performance.
[0003] Therefore, it is necessary to propose a solution to achieve dynamic physical resource isolation while improving physical resource performance.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a resource deployment method, apparatus, terminal device and storage medium, aiming to achieve dynamic physical resource isolation while improving physical resource performance.
[0006] To achieve the above object, the present invention provides a resource deployment method, the resource deployment method comprising:
[0007] Get the process number and running status data corresponding to each database instance;
[0008] Determine the resource threshold corresponding to each database instance based on the operating state data;
[0009] Arrange a configuration file according to the process number and resource threshold, and generate a target script corresponding to the configuration file;
[0010] The target script is sent to the server corresponding to each database instance for resource deployment control.
[0011] Optionally, the step of determining the resource threshold corresponding to each database instance based on the operating state data includes:
[0012] Determine resource inflection point values corresponding to multi-dimensional performance indicators according to the operating status data;
[0013] Determine a resource inflection point value set according to the resource inflection point values corresponding to the multi-dimensional performance indicators within a preset time range;
[0014] Based on the resource inflection point value set, the resource threshold corresponding to each database instance is determined by a wolf pack algorithm.
[0015] Optionally, the operating state data includes at least one of a data time series growth rate, a number of concurrent connections, a number of transactions per second, a number of queries per second, and a number of input or output operations per second, the multi-dimensional performance indicator includes a computing capacity indicator, a storage capacity indicator, and a disk input or output capacity indicator, and the step of determining a resource inflection point value corresponding to the multi-dimensional performance indicator according to the operating state data includes:
[0016] Determine the resource inflection point value of the computing capacity indicator based on the number of concurrent connections, number of transactions per second, and number of queries per second;
[0017] Determine the resource inflection point value of the storage capacity indicator based on the data time series growth rate, number of transactions per second, and number of queries per second;
[0018] Determine the resource inflection point value of the disk input or output capacity indicator based on the number of transactions per second, the number of queries per second, and the number of input or output operations per second.
[0019] Optionally, the step of determining the resource threshold corresponding to each database instance by a wolf pack algorithm based on the resource inflection point value set includes:
[0020] Selecting the inflection point combination calculated for the first time in the resource inflection point value set as the initial value of the wolf pack algorithm, and using the initial value as the initial alpha wolf position;
[0021] Iteratively calculating the input resource inflection point value set through the wolf pack algorithm, updating the position of the alpha wolf until the maximum number of iterations is reached, and outputting the position of the alpha wolf as the optimal inflection point;
[0022] An alpha wolf threshold or a fierce wolf threshold is output according to the optimal inflection point, and the alpha wolf threshold or the fierce wolf threshold is used as the resource threshold.
[0023] Optionally, the step of outputting a alpha wolf threshold or a fierce wolf threshold according to the optimal inflection point includes:
[0024] An entropy value is calculated according to the optimal inflection point value and the initial value to obtain an entropy value result, until the entropy value results obtained by two consecutive calculations are constant, and the most recent inflection point value is output as the alpha threshold;
[0025] If the inflection point values converging from the preset time range to the current time do not obtain two consecutive constant entropy value results, the inflection point value corresponding to the initial value is output as the fierce wolf threshold.
[0026] Optionally, the step of arranging a configuration file according to the process number and the resource threshold and generating a target script corresponding to the configuration file includes:
[0027] Determining resource configuration parameters according to the resource threshold through a preset priority rule model;
[0028] Obtain the number of the unused logical core from the memory database system;
[0029] Arrange a corresponding configuration file according to the number of the unused logical core, in combination with the process number and the resource configuration parameter;
[0030] Script arrangement is performed according to the configuration file to obtain the target script.
[0031] Optionally, before the step of acquiring the number of the unused logical core from the memory database system according to the resource configuration parameter, the step further includes:
[0032] Obtain the logical core number corresponding to the central processor through the memory access control hardware;
[0033] The memory database system is used to perform cache management and use status marking on the logical core numbers corresponding to the central processing unit, so as to determine the logical core numbers that are in an unused state.
[0034] In addition, to achieve the above-mentioned purpose, the present invention further provides a resource deployment device, the resource deployment device comprising:
[0035] The acquisition module is used to obtain the process number and running status data corresponding to each database instance;
[0036] A determination module, configured to determine a resource threshold corresponding to each database instance based on the operating state data;
[0037] An orchestration module, used to orchestrate a configuration file according to the process number and the resource threshold, and generate a target script corresponding to the configuration file;
[0038] The deployment module is used to send the target script to the server corresponding to each database instance for resource deployment control.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal device, which includes a memory, a processor, and a resource deployment program stored in the memory and executable on the processor, and the resource deployment program, when executed by the processor, implements the steps of the resource deployment method described above.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a resource deployment program is stored, and when the resource deployment program is executed by a processor, the steps of the resource deployment method described above are implemented.
[0041] A resource deployment method, apparatus, terminal device and storage medium proposed in an embodiment of the present invention obtain the process number and running state data corresponding to each database instance; determine the resource threshold corresponding to each database instance based on the running state data; arrange the configuration file according to the process number and resource threshold, and generate a target script corresponding to the configuration file; send the target script to the server corresponding to each database instance for resource deployment control, determine the resource threshold corresponding to each database instance by obtaining the running state data corresponding to each database instance, and use the process number as the identifier of each database instance, arrange the configuration file according to the resource threshold, generate the corresponding target script and send it to the server corresponding to each database instance for execution, so as to perform resource deployment control, realize dynamic physical resource isolation and improve physical resource performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the resource deployment device of the present invention belongs;
[0043] Figure 2 A schematic diagram of a flow chart of an exemplary embodiment of a resource deployment method of the present invention;
[0044] Figure 3 for Figure 2 A schematic diagram of a specific process of step S20 in the embodiment;
[0045] Figure 4 for Figure 3 A specific flow chart of step S201 in the embodiment;
[0046] Figure 5 A schematic diagram of a computing capability inflection point in an embodiment of the present invention;
[0047] Figure 6 A schematic diagram of storage capacity and disk IO inflection point values in an embodiment of the present invention;
[0048] Figure 7 The figure is a schematic diagram of the resource isolation service architecture flow in an embodiment of the present invention.
[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0051] The main solution of the embodiment of the present invention is: by obtaining the process number and running state data corresponding to each database instance; determining the resource threshold corresponding to each database instance based on the running state data; arranging the configuration file according to the process number and resource threshold, and generating the target script corresponding to the configuration file; sending the target script to the server corresponding to each database instance for resource deployment control, determining the resource threshold corresponding to each database instance by obtaining the running state data corresponding to each database instance, and using the process number as the identifier of each database instance, arranging the configuration file according to the resource threshold, generating the corresponding target script and sending it to the server corresponding to each database instance for execution, so as to perform resource deployment control, realize dynamic physical resource isolation and improve physical resource performance.
[0052] Technical terms involved in the embodiments of the present invention:
[0053] MySQL (Structured Query Language) is a widely used open source relational database management system (RDBMS) that allows users to store, manage and retrieve data. In MySQL, there are multiple different types of processes and threads that work together to provide database services;
[0054] CGroup, also known as control group, is a resource management and isolation technology provided by the Linux kernel, which is used to limit, account and isolate system resources of processes, such as CPU, memory, disk I / O and network bandwidth. CGroup technology allows system administrators or container managers (such as Docker, Kubernetes, etc.) to more accurately control and monitor the resource usage of processes running in the system;
[0055] The CPU (Central Processing Unit) is one of the key components in a computer system, responsible for executing the instructions of computer programs and performing data processing;
[0056] TPS (Transactions Per Second), which is a unit of measurement used to measure the speed or performance of a system, application, or service processing transactions or requests;
[0057] QPS (Queries Per Second) is a unit of measurement used to measure the speed or performance of a system, application, or service in processing query requests;
[0058] IOPS (Input / Output Operations Per Second) is a key indicator used to measure the performance of computer storage devices, especially disks and storage systems;
[0059] Disk I / O (Input / Output) capability refers to the performance and ability of a disk drive (such as a hard disk or solid-state drive) to perform input and output operations. This is a key performance metric in computer systems, especially for storage-intensive applications and workloads.
[0060] In the existing physical deployment method, multiple MySQL processes can be deployed on a physical machine to achieve resource sharing, and resource threshold limits can also be implemented with the help of CGroup technology to achieve a certain resource isolation effect. However, resource thresholds are set in advance according to empirical values. The main problems are: 1. Dynamic resource binding cannot be achieved through the prediction of concurrent traffic. 2. When the database concurrency increases or the amount of data increases sharply, the threshold set in advance is less than the actual operation demand, which is easy to cause slow performance problems and insufficient resource failures.
[0061] The present invention solves the above two problems by means of a method for isolating physical resources through dynamic convergence of resource thresholds: 1. Real-time collection of concurrency and performance-related indicator parameter values, convergence of the optimal threshold through the objective function and the wolf pack algorithm, and solving the threshold acquisition problem of dynamic resource isolation. Problems that may be caused by sudden increases in database concurrency or data volume. 2. Dynamic resource adjustment is performed through repeated optimization through the wolf pack algorithm and priority rule model to solve problems that may be caused by sudden increases in database concurrency or data volume.
[0062] The present invention provides a solution and a multi-instance deployment method, which has the high performance of physical machine deployment and the resource isolation characteristics of virtual machine container deployment, and realizes dynamic isolation of resources. First, the process is directly started on the physical machine, without the need for a special interpretation mechanism, and the kernel is shared with the host, with low performance loss; second, the CGroup technology of the Linux kernel is used to isolate resources, and the resources of the host machine are shared while isolating, so as to achieve the goal of deploying multiple instances on one machine and improve resource utilization. Third, through traffic collection and machine learning, resource usage is predicted, resource thresholds are dynamically set, and resource isolation is dynamically realized according to priority data model rules.
[0063] Although the virtualization and containers of the prior art can achieve resource isolation and improve utilization, they are more suitable for small applications. For applications with large computing, storage and IO resource requirements and high stability requirements, such as MySQL database, Elasticsearch search engine, etc., virtual machines and containers cannot meet the demand for high performance of disk read and write IO. These applications generally use physical machine deployment in production environments. However, the configuration of current physical machines is generally very high. Running only one application process on a machine will cause a large amount of computing and storage resources to be wasted. Although running multiple application processes at the same time can achieve resource sharing, when a process abnormality causes a resource bottleneck, it will simultaneously affect the operation of other applications, causing mutual influence. The present invention not only meets the application scenarios of these applications with high resource requirements, but also realizes resource isolation through dynamic convergence thresholds, which not only ensures the stability of process operation but also improves the utilization of physical machine resources. It has certain promotion and use value for similar applications such as databases and search engines.
[0064] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of a terminal device to which the resource deployment device of the present invention belongs. The resource deployment device may be a device that is independent of the terminal device and capable of performing resource deployment, and may be carried on the terminal device in the form of hardware or software. The terminal device may be an intelligent mobile terminal with data processing functions such as a mobile phone or a tablet computer, or may be a fixed terminal device or server with data processing functions.
[0065] In this embodiment, the terminal device to which the resource deployment apparatus belongs includes at least an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0066] The memory 130 stores an operating system and a resource deployment program. The resource deployment device can store information such as the process number and running state data corresponding to each database instance obtained, the resource threshold corresponding to each database instance determined based on the running state data, the configuration file compiled according to the process number and resource threshold, and the target script corresponding to the configuration file in the memory 130; the output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, a Bluetooth module, etc., and communicates with an external device or server through the communication module 140.
[0067] When the resource deployment program in the memory 130 is executed by the processor, the following steps are implemented:
[0068] Get the process number and running status data corresponding to each database instance;
[0069] Determine the resource threshold corresponding to each database instance based on the operating state data;
[0070] Arrange a configuration file according to the process number and resource threshold, and generate a target script corresponding to the configuration file;
[0071] The target script is sent to the server corresponding to each database instance for resource deployment control.
[0072] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0073] Determine resource inflection point values corresponding to multi-dimensional performance indicators according to the operating status data;
[0074] Determine a resource inflection point value set according to the resource inflection point values corresponding to the multi-dimensional performance indicators within a preset time range;
[0075] Based on the resource inflection point value set, the resource threshold corresponding to each database instance is determined by a wolf pack algorithm.
[0076] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0077] Determine the resource inflection point value of the computing capacity indicator based on the number of concurrent connections, number of transactions per second, and number of queries per second;
[0078] Determine the resource inflection point value of the storage capacity indicator based on the data time series growth rate, number of transactions per second, and number of queries per second;
[0079] Determine the resource inflection point value of the disk input or output capacity indicator based on the number of transactions per second, the number of queries per second, and the number of input or output operations per second.
[0080] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0081] Selecting the inflection point combination calculated for the first time in the resource inflection point value set as the initial value of the wolf pack algorithm, and using the initial value as the initial alpha wolf position;
[0082] Iteratively calculating the input resource inflection point value set through the wolf pack algorithm, updating the position of the alpha wolf until the maximum number of iterations is reached, and outputting the position of the alpha wolf as the optimal inflection point;
[0083] An alpha wolf threshold or a fierce wolf threshold is output according to the optimal inflection point, and the alpha wolf threshold or the fierce wolf threshold is used as the resource threshold.
[0084] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0085] An entropy value is calculated according to the optimal inflection point value and the initial value to obtain an entropy value result, until the entropy value results obtained by two consecutive calculations are constant, and the most recent inflection point value is output as the alpha threshold;
[0086] If the inflection point values converging from the preset time range to the current time do not obtain two consecutive constant entropy value results, the inflection point value corresponding to the initial value is output as the fierce wolf threshold.
[0087] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0088] Determining resource configuration parameters according to the resource threshold through a preset priority rule model;
[0089] Obtain the number of the unused logical core from the memory database system;
[0090] Arrange a corresponding configuration file according to the number of the unused logical core, in combination with the process number and the resource configuration parameter;
[0091] Script arrangement is performed according to the configuration file to obtain the target script.
[0092] Furthermore, when the resource deployment program in the memory 130 is executed by the processor, the following steps are also implemented:
[0093] Obtain the logical core number corresponding to the central processor through the memory access control hardware;
[0094] The memory database system is used to perform cache management and use status marking on the logical core numbers corresponding to the central processing unit, so as to determine the logical core numbers that are in an unused state.
[0095] This embodiment adopts the above scheme, specifically by obtaining the process number and running state data corresponding to each database instance; determining the resource threshold corresponding to each database instance based on the running state data; arranging the configuration file according to the process number and resource threshold, and generating the target script corresponding to the configuration file; sending the target script to the server corresponding to each database instance for resource deployment control, determining the resource threshold corresponding to each database instance by obtaining the running state data corresponding to each database instance, and using the process number as the identifier of each database instance, arranging the configuration file according to the resource threshold, generating the corresponding target script and sending it to the server corresponding to each database instance for execution, so as to perform resource deployment control, realize dynamic physical resource isolation and improve physical resource performance.
[0096] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method of the present invention is proposed.
[0097] The execution subject of the method of this embodiment may be a resource deployment device or a terminal device, etc. This embodiment takes a resource deployment device as an example.
[0098] Reference Figure 2 , Figure 2 The following is a flow chart of an exemplary embodiment of a resource deployment method of the present invention. The resource deployment method comprises:
[0099] Step S10, obtaining the process number and running state data corresponding to each database instance;
[0100] Specifically, in the embodiment of the present invention, the process number corresponding to each installed database instance (i.e., MySQL instance) is obtained from the system layer, which is used to be compiled into the corresponding configuration file and script, which is sent to the corresponding server by the ansible control center and written into the tasks file of the CGroup, and marked as the process object for resource control by the CGroup subsystem. In addition, in the embodiment of the present invention, the database operation status concurrency indicators are extracted in real time, such as the number of concurrent connections, data time series growth rate, number of transactions per second TPS, number of queries per second QPS, number of input / output operations per second IOPS, etc., which are the operation status data of the database process.
[0101] Step S20, determining a resource threshold corresponding to each database instance based on the operating state data;
[0102] Furthermore, after the operating state data corresponding to each database instance is acquired, the resource threshold corresponding to each database instance can be determined based on the operating state data.
[0103] Optionally, based on real-time operating status data, the resource inflection point values corresponding to multi-dimensional performance indicators including computing power indicators, storage capacity indicators, and disk input or output capacity indicators can be determined, and then the resource inflection point value set corresponding to the multi-dimensional performance indicators within a historical period can be determined. The resource threshold is dynamically determined through the wolf pack algorithm, and then the resource threshold is arranged according to the priority rule model.
[0104] Step S30, arranging a configuration file according to the process number and the resource threshold, and generating a target script corresponding to the configuration file;
[0105] Furthermore, after determining the resource threshold corresponding to each database instance according to the running state data, the configuration file can be compiled in combination with the process number, and a target script corresponding to the configuration file can be generated.
[0106] Optionally, the step of arranging a configuration file according to the process number and the resource threshold and generating a target script corresponding to the configuration file includes:
[0107] Determining resource configuration parameters according to the resource threshold through a preset priority rule model;
[0108] Obtain the number of the unused logical core from the memory database system;
[0109] Arrange a corresponding configuration file according to the number of the unused logical core, in combination with the process number and the resource configuration parameter;
[0110] Script arrangement is performed according to the configuration file to obtain the target script.
[0111] In the embodiment of the present invention, dynamic physical resource isolation is achieved by establishing priority data model rules. Specifically, the established priority rule model is used to allocate the alpha wolf threshold parameters in the resource threshold in a 100% ratio manner, and the threshold combination output by the alpha wolf is directly used as the resource configuration parameter; the suboptimal value with a lower priority level, that is, the threshold combination output by the fierce wolf threshold in the resource threshold, is allocated according to a preset ratio (for example, 80%), and used as a resource configuration parameter for resource isolation until it is aggregated to the optimal ratio for dynamic expansion and contraction.
[0112] Optionally, before the step of acquiring the number of the unused logical core from the memory database system according to the resource configuration parameter, the step further includes:
[0113] Obtain the logical core number corresponding to the central processor through the memory access control hardware;
[0114] The memory database system is used to perform cache management and use status marking on the logical core numbers corresponding to the central processing unit, so as to determine the logical core numbers that are in an unused state.
[0115] Specifically, in the embodiment of the present invention, memory access control hardware (numactl-hardware) is used to obtain the logical core number corresponding to the CPU, and redis is used for cache management and usage status marking.
[0116] Optionally, according to the dynamically generated CPU computing resource threshold, the unused logical core numbers are obtained from the cache in order, and the cpu.cfs period us, cpu.cfs quotaus, cpuset.cpus, and cpuset.memes parameters are set in the configuration file to specify the cpu logical cores on which the process runs, where cpu.cfs period us and cpu.cfs quotaus are used to specify the number of cores, and cpuset.cpus and cpuset.mems are used to specify which specific logical cores the process runs on (for example, to limit the CPU resources of the MySQL process to no more than 8 logical cores, cpu.cfs_quota_us = 100000, cpu.cfs_period_us = 800000, cpuset.cpus = "0-7", cpuset.mems = "0"). The storage and IO configurations are also arranged in the same way according to the corresponding parameters configured by the thresholds.
[0117] Step S40: Send the target script to the server corresponding to each database instance for resource deployment control.
[0118] Furthermore, after arranging the configuration file according to the process number and resource threshold and generating the target script corresponding to the configuration file, the arranged target script can be sent to the corresponding server for execution, and the resource control of the process is realized by calling the CGroupfs file system interface to execute the script.
[0119] In this embodiment, by obtaining the process number and running state data corresponding to each database instance; determining the resource threshold corresponding to each database instance based on the running state data; arranging the configuration file according to the process number and resource threshold, and generating the target script corresponding to the configuration file; sending the target script to the server corresponding to each database instance for resource deployment control, by obtaining the running state data corresponding to each database instance, determining the resource threshold corresponding to each database instance, and using the process number as the identifier of each database instance, arranging the configuration file according to the resource threshold, generating the corresponding target script and sending it to the server corresponding to each database instance for execution, so as to perform resource deployment control, realize dynamic physical resource isolation and improve physical resource performance.
[0120] Reference Figure 3 , Figure 3 for Figure 2 The specific flow chart of step S20 in the embodiment. Figure 2 In the embodiment shown, in this embodiment, the above step S20 includes:
[0121] Step S201, determining the resource inflection point value corresponding to the multi-dimensional performance indicator according to the operating state data;
[0122] Optionally, the operating state data includes at least one of a data time series growth rate, a number of concurrent connections, a number of transactions per second, a number of queries per second, and a number of input or output operations per second, and the multi-dimensional performance indicators include a computing power indicator, a storage capacity indicator, and a disk input or output capacity indicator.
[0123] Optionally, the resource inflection points corresponding to the multi-dimensional indicator data are determined based on the real-time indicator data, and then the thresholds are dynamically generated through iterative optimization of the wolf pack algorithm based on the capability inflection point set of the multi-dimensional indicators.
[0124] Optionally, performance monitoring values of multiple dimensions can be obtained based on the real-time collected indicator data, including: storage capacity, computing capacity, and disk IO capacity. Among them, the indicators that can determine storage capacity include data time series growth rate, TPS, and QPS; the indicators that can determine computing capacity include the number of concurrent connections, TPS, and QPS; the indicators that can determine disk IO capacity include IOPS, TPS, and QPS.
[0125] Step S202, determining a resource inflection point value set according to the resource inflection point values corresponding to the multi-dimensional performance indicators within a preset time range;
[0126] Optionally, based on the resource inflection point values corresponding to the multi-dimensional performance indicators within a certain historical period, a resource inflection point value set can be determined, which is then used to determine a set of availability threshold combinations [computing, storage, IO].
[0127] Step S203: Based on the resource inflection point value set, determine the resource threshold corresponding to each database instance through a wolf pack algorithm.
[0128] Optionally, the step of determining the resource threshold corresponding to each database instance by a wolf pack algorithm based on the resource inflection point value set includes:
[0129] Selecting the inflection point combination calculated for the first time in the resource inflection point value set as the initial value of the wolf pack algorithm, and using the initial value as the initial alpha wolf position;
[0130] Iteratively calculating the input resource inflection point value set through the wolf pack algorithm, updating the position of the alpha wolf until the maximum number of iterations is reached, and outputting the position of the alpha wolf as the optimal inflection point;
[0131] An alpha wolf threshold or a fierce wolf threshold is output according to the optimal inflection point, and the alpha wolf threshold or the fierce wolf threshold is used as the resource threshold.
[0132] Specifically, the set of capability inflection point values [computation, storage, IO] corresponding to the start time is used as the initial position of the leader; the set time period is calculated, and the indicator parameters extracted in real time during the time period are continuously and dynamically converged to obtain the set of capability inflection point values corresponding to multiple time periods.
[0133] Optionally, multiple sets of capability inflection point values corresponding to multiple time periods within a period of time are extracted as input parameters of the wolf pack algorithm, the wolf exploration ratio factor and the maximum number of wandering times are set, and the wolf pack algorithm is aggregated multiple times to select the optimal value to update and output the position of the head wolf, and a set of availability threshold combinations [computing, storage, IO] is obtained; the specific implementation method is as follows:
[0134] Optionally, the number of concurrency, TPS, QPS, IOPS, data time series growth rate, etc. in a historical period is used as input parameters to calculate the set of inflection point values within the period; the inflection point value set is calculated using the objective function y=f{(ti,xj)}, where t represents time, x represents the collected indicator value, and y represents the set of indicator values (tm,xk) corresponding to a certain time point when the indicator tends to be flat or decrease.
[0135] Optionally, the inflection point value set calculated by the objective function above is used as the input parameter of the wolf pack algorithm, and the inflection point combination [calculation, storage, IO] calculated for the first time is used as the initial value of the algorithm, and the wolf detection ratio factor and the maximum number of wandering times are set. The input inflection point value set is iteratively calculated by the wolf pack algorithm, and the position of the head wolf is continuously updated until the maximum number of iterations is reached and the position of the head wolf is output as the optimal inflection point. The optimal inflection point value and the initial value are then entropy calculated until the entropy result value of the optimal inflection point calculation for two consecutive times remains constant (that is, the inflection point value of the head wolf output by iterative selection of the inflection point value set of different time periods remains constant with the entropy value of the initial value, which is then recognized as a credible value). At this time, the most recent inflection point value is used as the optimal value output as the head wolf threshold. If a period of history has been converging to the inflection point value of the current time, and the entropy value calculation process with the initial value has not obtained two consecutive constant values, at this time, the initial inflection point value is used as the suboptimal value output as the fierce wolf threshold.
[0136] It should be noted that the wolf pack algorithm used in the embodiment of the present invention can be replaced by other similar optimization algorithms, such as particle swarm optimization (PSO), genetic algorithm (GA) and simulated annealing (SA), to solve complex optimization problems.
[0137] This embodiment adopts the above scheme, specifically by determining the resource inflection point values corresponding to the multi-dimensional performance indicators according to the operating status data; determining a resource inflection point value set according to the resource inflection point values corresponding to the multi-dimensional performance indicators within a preset time range; based on the resource inflection point value set, determining the resource threshold value corresponding to each database instance through a wolf pack algorithm, by determining the resource inflection point value set, and then dynamically determining the resource threshold value using the wolf pack algorithm, the optimal threshold value can be converged through the objective function and the wolf pack algorithm, thereby solving the threshold acquisition problem of dynamic resource isolation, and at the same time avoiding problems that may be caused by database concurrency or sudden increase in data volume.
[0138] Reference Figure 4 , Figure 4 for Figure 3 The specific flow chart of step S201 in the embodiment. Figure 3 In the embodiment shown, in this embodiment, the above step S201 includes:
[0139] Step S2011, determining the resource inflection point value of the computing capacity indicator according to the number of concurrent connections, the number of transactions per second, and the number of queries per second;
[0140] Step S2012, determining the resource inflection point value of the storage capacity indicator according to the data time series growth rate, the number of transactions per second, and the number of queries per second;
[0141] Step S2013, determining a resource inflection point value of the disk input or output capacity indicator according to the number of transactions per second, the number of queries per second, and the number of input or output operations per second.
[0142] Specifically, based on the real-time collected indicator data, performance monitoring values in multiple dimensions can be obtained, including storage capacity, computing capacity, and disk IO capacity. Among them, the indicators that can determine storage capacity include data time series growth rate, TPS, and QPS; the indicators that can determine computing capacity include concurrent connections, TPS, and QPS; the indicators that can determine disk IO capacity include IOPS, TPS, and QPS.
[0143] Optionally, the parameters representing the processing performance of the database are TPS and QPS. The computing power inflection point is determined based on the number of concurrent connections, TPS, and QPS. Figure 5 , Figure 5 Schematic diagram of the computing power inflection point in the embodiment of the present invention. Figure 5 As shown in the figure, the inflection point is the minimum value of the intersection of the number of concurrent connections, TPS, and QPS.
[0144] Reference Figure 6 , Figure 6 Schematic diagram of storage capacity and disk IO inflection point value in an embodiment of the present invention, as shown in FIG. Figure 6As shown in the figure, the storage space inflection point is determined based on the data time series growth rate, TPS, and QPS. The inflection point is the minimum value of the intersection of the data growth rate, TPS, and QPS. Figure 6 As shown, the disk IO inflection point is determined according to IOPS, TPS, and QPS, and the IOPS value corresponding to the determined minimum storage space inflection point value is used as the disk IO inflection point.
[0145] It should be noted that the embodiment of the present invention does not specifically limit the order of implementing the above-mentioned steps S2011, S2012 and S2013, that is, in other embodiments, step S2012 or step S2013 may be executed first, and then step S2011.
[0146] This embodiment adopts the above scheme, specifically by determining the resource inflection point value of the computing capacity indicator according to the number of concurrent connections, the number of transactions per second, and the number of queries per second; determining the resource inflection point value of the storage capacity indicator according to the data time series growth rate, the number of transactions per second, and the number of queries per second; determining the resource inflection point value of the disk input or output capacity indicator according to the number of transactions per second, the number of queries per second, and the number of input or output operations per second. Through the collected multiple indicator data of the database process running state, including the data time series growth rate, the number of concurrent connections, TPS, QPS, IOPS, etc., the change trend of each indicator is converged. When the indicator tends to be flat or decreases, it is a performance inflection point. At this time, continuing to increase resources cannot improve the running performance. Therefore, the resource value corresponding to the indicator can be used as the resource threshold.
[0147] In addition, an embodiment of the present invention further provides a resource deployment device, the resource deployment device comprising:
[0148] The acquisition module is used to obtain the process number and running status data corresponding to each database instance;
[0149] A determination module, configured to determine a resource threshold corresponding to each database instance based on the operating state data;
[0150] An orchestration module, used to orchestrate a configuration file according to the process number and the resource threshold, and generate a target script corresponding to the configuration file;
[0151] The deployment module is used to send the target script to the server corresponding to each database instance for resource deployment control.
[0152] Reference Figure 7 , Figure 7 FIG. 1 is a schematic diagram of a resource isolation service architecture flow in an embodiment of the present invention. Figure 7As shown, in the embodiment of the present invention, the sharing of the underlying resources is realized by starting multiple MySQL processes on the server at the same time, using the process number as the instance identifier, establishing an independent protocol stack and a root directory mount point and saving them in a separate configuration file. The multiple instance processes control the size of memory allocation through parameter configuration, and encapsulate resource isolation services at the same time. The computing resources are mainly restricted by CGroup technology, and the concurrent pressure index is cleaned by the wolf pack algorithm to dynamically generate threshold parameters. The isolation configuration file is arranged according to the priority rule model, which avoids the contention of computing resources of multiple database instances, thereby improving the utilization rate of physical resources. The specific process includes:
[0153] (1) Use numactl-hardware to obtain the logical core number corresponding to the CPU, use redis for cache management, and mark the usage status;
[0154] (2) Real-time extraction of concurrent status indicators of the database operation status, such as the number of concurrent connections, data time series growth rate, TPS, QPS, IOPS, etc., and retention of database process operation status data;
[0155] (3) Obtain the process number corresponding to the installed MySQL instance from the system layer, compile it into the corresponding configuration file and script, send it to the corresponding server by the Ansible control center and write it into the tasks file of the CGroup, marking it as the process object for resource control of the CGroup subsystem;
[0156] (4) Based on the real-time indicator data, the capability inflection points corresponding to the multi-dimensional indicator data are determined, and then based on the capability inflection point set of the multi-dimensional indicators, the thresholds are dynamically generated through iterative optimization of the wolf pack algorithm.
[0157] (4-1), based on the real-time collected indicator data, we can get performance monitoring values in multiple dimensions, including storage capacity, computing capacity, and disk IO capacity. Among them, the indicators that can determine storage capacity include data time series growth rate, TPS, and QPS; the indicators that can determine computing capacity include concurrent connections, TPS, and QPS; the indicators that can determine disk IO capacity include IOPS, TPS, and QPS.
[0158] (4-2) Calculate the capability inflection point values of multi-dimensional performance indicators as follows:
[0159] First, collect multiple indicator data of the database process running state (including data time series growth rate, number of concurrent connections, TPS, QPS, IOPS, etc.);
[0160] Then, converge the changing trends of various indicators. When the indicators tend to be flat or decrease, it is the performance inflection point. At this time, further increasing resources cannot improve the operating performance. The resource value corresponding to the indicator can be used as the threshold reference value;
[0161] The parameters that represent the processing performance of the database are TPS and QPS. The computing power inflection point is determined based on the number of concurrent connections, TPS, and QPS. The storage space inflection point is determined based on the data time series growth rate, TPS, and QPS. The disk IO inflection point is determined based on IOPS, TPS, and QPS.
[0162] (4-3) Based on a set of capacity inflection point values within a certain historical period, determine a set of availability threshold combinations [computing, storage, IO].
[0163] Specifically, the set of capability inflection point values corresponding to the start time [computing, storage, IO] is used as the initial position of the alpha wolf;
[0164] Calculate according to the set time period, and continuously and dynamically converge the indicator parameters extracted in real time during the time period to obtain the set of capability inflection point values corresponding to multiple time periods;
[0165] Extract multiple sets of capability inflection point values corresponding to multiple time periods within a period as input parameters of the wolf pack algorithm, set the wolf exploration ratio factor and the maximum number of wandering times, perform multiple aggregations through the wolf pack algorithm to select the optimal value to update the position of the head wolf and output a set of availability threshold combinations [computing, storage, IO]; the specific implementation method is as follows:
[0166] 1) Using the number of concurrent connections, TPS, QPS, IOPS, data time series growth rate, etc. over a period of history as input parameters, calculate the set of inflection point values within that period of time; the inflection point value set calculation uses the objective function y=f{(ti,xj)}, where t represents time, x represents the collected indicator value, and y represents the set of indicator values (tm,xk) corresponding to a certain time point when the indicator tends to be flat or decrease.
[0167] 2) The inflection point value set calculated by the objective function above is used as the input parameter of the wolf pack algorithm. The inflection point combination [calculation, storage, IO] calculated for the first time is used as the initial value of the algorithm. The wolf exploration ratio factor and the maximum number of wandering times are set. The input inflection point value set is iteratively calculated by the wolf pack algorithm, and the position of the head wolf is continuously updated until the maximum number of iterations is reached and the head wolf position is output as the optimal inflection point. The optimal inflection point value and the initial value are then used for entropy calculation until the entropy value result of two consecutive optimal inflection point calculations remains constant (that is, the head wolf inflection point value output by iterative selection of inflection point value sets in different time periods remains constant with the entropy value of the initial value, which is considered to be a credible value). At this time, the most recent inflection point value is used as the optimal value output as the head wolf threshold. If a period of history has been converging to the inflection point value of the current time, and the entropy value calculation process with the initial value has not obtained two consecutive constant values, at this time, the initial inflection point value is used as the suboptimal value output as the fierce wolf threshold.
[0168] (5) Priority rule model: The threshold parameters of the alpha wolf are allocated in a 100% ratio, and the threshold combination output by the alpha wolf is directly used as the resource configuration parameter; the threshold combination of the suboptimal value with a lower priority level, i.e., the threshold output by the fierce wolf, is allocated at a ratio of 80%, and used as a resource configuration parameter for resource isolation until the optimal ratio is aggregated for dynamic expansion and contraction;
[0169] (6) According to the dynamically generated CPU computing resource threshold, obtain the "unused" logical core numbers from the cache in order, and set the cpu.cfs period us, cpu.cfs quota us, cpuset.cpus, and cpuset.memes parameters in the configuration file to specify the cpu logical cores on which the process runs. cpu.cfs period us and cpu.cfs quotaus are used to specify the number of cores, and cpuset.cpus and cpuset.mems are used to specify which specific logical cores the process runs on (for example, limit the CPU resources of the MySQL process to no more than 8 logical cores cpu.cfs_quota_us = 100000, cpu.cfs_period_us = 800000, cpuset.cpus = "0-7", cpuset.mems = "0"). Storage and IO configurations are also arranged in the same way according to the corresponding parameters configured according to the thresholds;
[0170] (7) Script arrangement: Script arrangement is performed according to the configuration file;
[0171] (8) Ansible control center: sends the compiled script to the corresponding server for execution;
[0172] (9) Call the CGroupfs file system interface to execute the script and implement process resource control.
[0173] In this embodiment, the underlying resources are shared by starting multiple MySQL processes, the process number is used as the instance identifier, an independent protocol stack and root directory mount point are established and saved in a separate configuration file, and the resource isolation service is encapsulated; by real-time collection of concurrency and performance-related indicator parameter values, the indicator values are used as the input of the objective function, and the resource usage and performance trends are predicted in real time according to the indicator values, and a set of resource inflection point values are converged through the objective function calculation; the resource inflection point value set is used as the input of the wolf pack algorithm, and the optimal inflection point value is dynamically obtained through the wolf pack algorithm, and the entropy value is calculated with the initial value to converge to a constant threshold as the configuration parameter of the resource isolation service; at the same time, dynamic physical resource isolation is achieved by establishing priority data model rules.
[0174] For the principle and implementation process of implementing resource deployment in this embodiment, please refer to the above embodiments and will not be repeated here.
[0175] In addition, an embodiment of the present invention also proposes a terminal device, which includes a memory, a processor, and a resource deployment program stored in the memory and executable on the processor, and the resource deployment program implements the steps of the resource deployment method described above when executed by the processor.
[0176] Since all the technical solutions of all the aforementioned embodiments are adopted when the resource deployment program is executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0177] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a resource deployment program is stored. When the resource deployment program is executed by a processor, the steps of the resource deployment method described above are implemented.
[0178] Since all the technical solutions of all the aforementioned embodiments are adopted when the resource deployment program is executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0179] Compared with the prior art, the resource deployment method, apparatus, terminal device and storage medium proposed in the embodiments of the present invention obtain the process number and running state data corresponding to each database instance; determine the resource threshold corresponding to each database instance based on the running state data; arrange the configuration file according to the process number and resource threshold, and generate the target script corresponding to the configuration file; send the target script to the server corresponding to each database instance for resource deployment control, determine the resource threshold corresponding to each database instance by obtaining the running state data corresponding to each database instance, and use the process number as the identifier of each database instance, arrange the configuration file according to the resource threshold, generate the corresponding target script and send it to the server corresponding to each database instance for execution, so as to perform resource deployment control, realize dynamic physical resource isolation and improve physical resource performance.
[0180] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0181] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0182] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.
[0183] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A resource deployment method, characterized in that: The resource deployment method comprises the following steps: Get the process number and running status data corresponding to each database instance; Determine the resource threshold corresponding to each database instance based on the operating state data; Arrange a configuration file according to the process number and resource threshold, and generate a target script corresponding to the configuration file; The target script is sent to the server corresponding to each database instance for resource deployment control.
2. The resource deployment method according to claim 1, characterized in that: The step of determining the resource threshold corresponding to each database instance based on the operating state data comprises: Determine resource inflection point values corresponding to multi-dimensional performance indicators according to the operating status data; Determine a resource inflection point value set according to the resource inflection point values corresponding to the multi-dimensional performance indicators within a preset time range; Based on the resource inflection point value set, the resource threshold corresponding to each database instance is determined by a wolf pack algorithm.
3. The resource deployment method according to claim 2, characterized in that: The operating state data includes at least one of a data time series growth rate, a number of concurrent connections, a number of transactions per second, a number of queries per second, and a number of input or output operations per second; the multi-dimensional performance indicators include a computing capacity indicator, a storage capacity indicator, and a disk input or output capacity indicator; and the step of determining a resource inflection point value corresponding to the multi-dimensional performance indicator according to the operating state data includes: Determine a resource inflection point value for calculating the capability indicator according to the number of concurrent connections, the number of transactions per second, and the number of queries per second; Determine the resource inflection point value of the storage capacity indicator according to the data time series growth rate, the number of transactions per second, and the number of queries per second; The resource inflection point value of the disk input or output capacity indicator is determined according to the number of transactions per second, the number of queries per second, and the number of input or output operations per second.
4. The resource deployment method according to claim 2, characterized in that: The step of determining the resource threshold corresponding to each database instance by a wolf pack algorithm based on the resource inflection point value set includes: Selecting the inflection point combination calculated for the first time in the resource inflection point value set as the initial value of the wolf pack algorithm, and using the initial value as the initial alpha wolf position; Iteratively calculating the input resource inflection point value set through the wolf pack algorithm, updating the position of the alpha wolf until the maximum number of iterations is reached, and outputting the position of the alpha wolf as the optimal inflection point; An alpha wolf threshold or a fierce wolf threshold is output according to the optimal inflection point, and the alpha wolf threshold or the fierce wolf threshold is used as the resource threshold.
5. The resource deployment method according to claim 4, characterized in that: The step of outputting the alpha wolf threshold or the fierce wolf threshold according to the optimal inflection point comprises: An entropy value is calculated according to the optimal inflection point value and the initial value to obtain an entropy value result, until the entropy value results obtained by two consecutive calculations are constant, and the most recent inflection point value is output as the alpha threshold; If the inflection point values converging from the preset time range to the current time do not obtain two consecutive constant entropy value results, the inflection point value corresponding to the initial value is output as the fierce wolf threshold.
6. The resource deployment method according to claim 1, characterized in that: The step of arranging the configuration file according to the process number and the resource threshold and generating the target script corresponding to the configuration file includes: Determining resource configuration parameters according to the resource threshold through a preset priority rule model; Obtain the number of the unused logical core from the memory database system; Arrange a corresponding configuration file according to the number of the unused logical core, in combination with the process number and the resource configuration parameter; Script arrangement is performed according to the configuration file to obtain the target script.
7. The resource deployment method according to claim 6, characterized in that: Before the step of obtaining the number of the unused logical core from the memory database system according to the resource configuration parameter, the step further includes: Obtain the logical core number corresponding to the central processor through the memory access control hardware; The memory database system is used to perform cache management and use status marking on the logical core numbers corresponding to the central processing unit, so as to determine the logical core numbers that are in an unused state.
8. A resource deployment device, characterized in that: The resource deployment device comprises: The acquisition module is used to obtain the process number and running status data corresponding to each database instance; A determination module, configured to determine a resource threshold corresponding to each database instance based on the operating state data; An orchestration module, used to orchestrate a configuration file according to the process number and the resource threshold, and generate a target script corresponding to the configuration file; The deployment module is used to send the target script to the server corresponding to each database instance for resource deployment control.
9. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a resource deployment program stored in the memory and executable on the processor. When the resource deployment program is executed by the processor, the steps of the resource deployment method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a resource deployment program, and when the resource deployment program is executed by a processor, the steps of the resource deployment method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
IO control optimization method based on cgroup
CN119690347A
Server installation method, device, equipment, medium and product
CN120743312A
Server installation method, device, equipment, medium and product
CN120743312B
