Resource adjustment methods, apparatus, equipment, storage media, and computer program products
Patent Information
- Application Number
- CN202411077854.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2044-08-07
Smart Images

Figure CN119046261B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a resource adjustment method, apparatus, device, storage medium, and computer program product. Background Technology
[0002] Because the application and deployment process for test environment databases is relatively simple, and resource requirements fluctuate significantly and rapidly due to the test project cycle and project impact, resource shortages and waste are very likely to occur. Current database resource management methods primarily rely on monitoring various database system metrics (such as CPU utilization, memory usage, and connection utilization) and then scaling the database up or down based on these metrics. This approach is inflexible, performance data collection is intermittent, consumes significant system resources, and makes it difficult to collect continuous database performance data. Furthermore, it fails to consider the relationship between the database and the application, as well as the need for unified management between the test and production environments. The metrics are somewhat one-sided, easily leading to delayed, missed, or frequent resource adjustments, resulting in resource supply failing to keep pace with project needs or significant resource waste.
[0003] Therefore, the current methods for adjusting database resources in the test environment suffer from problems such as single indicators, delayed and ineffective adjustment actions, frequent actions, or inability to correlate the test environment with the production environment, or the inability to correlate the database with the application. As a result, the database resources in the development and test environment cannot be maximized according to the actual situation.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this application is to provide a resource adjustment method, apparatus, device, storage medium, and computer program product, which aims to solve the technical problem that the database resources in the development and testing environment cannot be maximized according to the actual situation.
[0006] To achieve the above objectives, this application proposes a resource adjustment method, the method comprising:
[0007] Obtain test environment database information and corresponding production environment database status data;
[0008] Based on the test environment database information and the corresponding production environment database status data, the resource usage status of the corresponding test environment database is identified, and the resource usage status identification result is obtained.
[0009] Based on the resource usage identification results, resource adjustments are made to the test environment database to obtain resource adjustment results.
[0010] In one embodiment, the step of obtaining test environment database information and corresponding production environment database status data includes:
[0011] Based on the pre-obtained test environment database configuration data, perform unified performance collection on the test environment database to obtain the test environment database information;
[0012] Based on the test environment database configuration data, determine the production environment database corresponding to the test environment database;
[0013] Information is retrieved from the production environment database to obtain the status data of the production environment database.
[0014] In one embodiment, the test environment database is managed by a preset test environment database information management system. Before the step of performing unified performance data collection on the test environment database based on pre-obtained test environment database configuration data to acquire the test environment database information, the method further includes:
[0015] Data asset information is collected from several of the aforementioned test environment databases to obtain full asset information data for the test environment databases.
[0016] The test environment database information management system is updated based on the full asset information data of the test environment database to generate the test environment database configuration data.
[0017] In one embodiment, the step of identifying the resource usage status of the corresponding test environment database based on the test environment database information and the corresponding production environment database status data, and obtaining the resource usage status identification result, includes:
[0018] Based on the test environment database information, determine whether the test environment database is in a suspected idle state, and obtain a first judgment result;
[0019] Based on the status data of the production environment database, determine whether the production environment database corresponding to the test environment database is offline, and obtain a second determination result.
[0020] Based on the first and second judgment results, the resource usage status identification result is generated.
[0021] In one embodiment, the resource adjustment result is a first resource adjustment result, and the step of adjusting the resources of the test environment database based on the resource usage identification result to obtain the resource adjustment result includes:
[0022] When the resource usage status identification result indicates that the test environment database is in a suspected idle state or the production environment database corresponding to the test environment database is offline, the test environment database user data is obtained.
[0023] The user data in the test environment database is filtered to obtain application user data and development user data, and the users corresponding to the application user data and development users are taken as target users.
[0024] The number of times the target user connects to the test environment database within a preset time period is counted to obtain the target user's login count;
[0025] Determine whether the number of login attempts of the target user is less than a preset login threshold.
[0026] If so, back up the test environment database and take the test environment database offline to obtain the first resource adjustment result.
[0027] In one embodiment, the resource adjustment result is a second resource adjustment result, and the step of adjusting the resources of the test environment database based on the resource usage identification result to obtain the resource adjustment result further includes:
[0028] When the resource usage status identification result indicates that the test environment database is not in a suspected idle state and the production environment database corresponding to the test environment database is not offline, the structured query statement review platform associated with the test environment database is accessed.
[0029] The structured query statement review platform filters out structured query statements whose execution time exceeds a preset time threshold to obtain target statements.
[0030] Determine whether the execution path of the target statement is the optimal path;
[0031] If so, the test environment database is expanded to generate the second resource adjustment result.
[0032] Furthermore, to achieve the above objectives, this application also proposes a resource adjustment device, which includes:
[0033] The acquisition module is used to acquire test environment database information and corresponding production environment database status data;
[0034] The identification module is used to identify the resource usage status of the corresponding test environment database based on the test environment database information and the corresponding production environment database status data, and to obtain the resource usage status identification result.
[0035] The adjustment module is used to adjust the resources in the test environment database based on the resource usage status identification results, and obtain the resource adjustment results.
[0036] In addition, to achieve the above objectives, this application also proposes a resource adjustment device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the resource adjustment method as described above.
[0037] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the resource adjustment method described above.
[0038] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the resource adjustment method described above.
[0039] This application provides a resource adjustment method. By acquiring test environment database information and corresponding production environment database status data, the test environment database is associated with the production environment database. This method can more accurately identify the resource usage of the test environment database, and then adjust the resources of the test environment database based on the resource usage identification results. This solves the technical problem that the resources of the development test environment database cannot be maximized according to the actual situation, and improves the resource utilization efficiency of the test environment database. Attached Figure Description
[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0041] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a flowchart illustrating an embodiment of the resource adjustment method of this application.
[0043] Figure 2 This is a flowchart illustrating Embodiment 2 of the resource adjustment method of this application;
[0044] Figure 3A simplified flowchart illustrating the resource adjustment method provided in Embodiment 2 of this application;
[0045] Figure 4 This is a schematic diagram of the module structure of the resource adjustment device according to an embodiment of this application;
[0046] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the resource adjustment method in this application embodiment.
[0047] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0048] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0049] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0050] The main solution in this application embodiment is:
[0051] Obtain test environment database information and corresponding production environment database status data;
[0052] Based on the test environment database information and the corresponding production environment database status data, the resource usage status of the corresponding test environment database is identified, and the resource usage status identification result is obtained.
[0053] Based on the resource usage identification results, resource adjustments are made to the test environment database to obtain resource adjustment results.
[0054] Because existing methods for adjusting database resources in the test environment suffer from problems such as single indicators, delayed and ineffective adjustment actions, frequent actions, or inability to correlate the test environment with the production environment, or the inability to correlate the database with the application, the database resources in the development and test environment cannot be maximized according to the actual situation.
[0055] This application provides a solution that, by acquiring test environment database information and corresponding production environment database status data, associates the test environment database with the production environment database. This allows for a more accurate identification of the resource usage of the test environment database, and then resource adjustments are made to the test environment database based on the resource usage identification results. This solves the technical problem that the resources of the development test environment database cannot be maximized according to the actual situation, and improves the resource utilization efficiency of the test environment database.
[0056] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or resource adjustment system capable of performing the above functions. The following description uses a resource adjustment system as an example to illustrate this embodiment and the subsequent embodiments.
[0057] Based on this, embodiments of this application provide a resource adjustment method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the resource adjustment method of this application.
[0058] In this embodiment, the resource adjustment method includes steps S10 to S30:
[0059] Step S10: Obtain the test environment database information and the corresponding production environment database status data;
[0060] It should be noted that the test environment database information may include CPU usage, memory usage, number of user connections, connection usage, disk usage, etc.
[0061] In one feasible implementation, step S10 may include steps S101 to S103:
[0062] Step S101: Based on the pre-obtained test environment database configuration data, perform unified performance collection on the test environment database to obtain the test environment database information;
[0063] Step S102: Determine the production environment database corresponding to the test environment database based on the test environment database configuration data;
[0064] Step S103: Retrieve information from the production environment database to obtain the status data of the production environment database.
[0065] The resource adjustment system initiates performance data collection tools or runs custom scripts to gather performance data from the test environment database and obtain test environment database information. This process may involve various database operations, such as executing queries to measure response time and monitoring system resource usage. Then, based on the test environment database configuration data, the system compares the configuration parameters of the test environment database with those of a potential production environment database. These parameters include database engine version, configuration file settings, memory allocation, and disk layout. This comparison allows for a preliminary assessment of similarities and differences, verification of the test environment database instance name or identifier, and identification of the corresponding production environment database. Finally, information is retrieved from the production environment database to obtain its status data.
[0066] In this embodiment, based on the pre-obtained test environment database configuration data, test environment database information and corresponding production environment database status data are obtained. This provides necessary basic data and environmental comparison for subsequent performance evaluation and optimization, helping to ensure the consistency of the test environment and production environment in terms of database configuration and performance, thereby enabling more effective performance analysis and optimization.
[0067] In another feasible implementation, steps S401 to S402 may be included before step S10:
[0068] Step S401: Collect data asset information from several test environment databases to obtain full asset information data of the test environment databases;
[0069] Step S402: Update the test environment database information management system based on the full asset information data of the test environment database to generate the test environment database configuration data.
[0070] The resource adjustment system performs a full collection of data asset information for all test environment databases, including detailed information on all databases in the test environment. This information may include database type, version, instance name, main table structure, stored procedures, triggers, etc. The collected data is cleaned and verified to ensure its integrity and accuracy. This includes removing unnecessary or duplicate data, fixing potential errors or inconsistencies, and obtaining full asset information for the test environment databases. Then, the test environment database information management system is updated based on the full asset information data of the test environment databases to generate test environment database configuration data.
[0071] In this embodiment, by collecting data asset information from several test environment databases, full asset information data of the test environment database is obtained; the test environment database information management system is updated based on the full asset information data of the test environment database to generate the test environment database configuration data. This allows the establishment and maintenance of an accurate and complete test environment database asset information and configuration data management system, laying the foundation for subsequent database management, performance optimization, and troubleshooting, and ensuring the consistency and manageability of the environment.
[0072] Step S20: Based on the test environment database information and the corresponding production environment database status data, identify the resource usage status of the corresponding test environment database and obtain the resource usage status identification result.
[0073] The resource adjustment system determines whether the test environment database is in a suspected idle state based on the test environment database information, and determines whether the corresponding production environment database is offline based on the production environment database status data, thus obtaining the resource usage status identification result.
[0074] In one feasible implementation, the test environment database is managed through a preset test environment database information management system, and step S20 may include steps S201 to S203:
[0075] Step S201: Based on the test environment database information, determine whether the test environment database is in a suspected idle state, and obtain a first determination result;
[0076] Step S202: Based on the production environment database status data, determine whether the production environment database corresponding to the test environment database is offline, and obtain a second determination result;
[0077] Step S203: Generate the resource usage status identification result based on the first judgment result and the second judgment result.
[0078] The resource adjustment system determines whether the test environment database is in a suspected idle state based on the test environment database information, and obtains a first judgment result. Then, based on the production environment database status data, it determines whether the corresponding production environment database is offline, and obtains a second judgment result. Finally, based on the first and second judgment results, a resource usage status identification result is generated.
[0079] For example, the database in the test environment can be preliminarily judged as potentially idle by the utilization of memory and CPU and the number of user connections. Specifically, if the peak CPU utilization is less than 10% and the maximum number of user connections is less than 10, the database in the test environment is judged to be potentially idle.
[0080] In this embodiment, the test environment database and the production environment database are associated based on the first and second judgment results, and the online / offline status of the test environment database is linked to avoid the test environment database continuing to run idle even when the production application and the production environment database are offline, thus avoiding resource waste.
[0081] Step S30: Based on the resource usage identification results, adjust the resources in the test environment database to obtain resource adjustment results.
[0082] Based on the resource usage status identification results, the resource adjustment system adjusts the resources of the test environment database and obtains the resource adjustment results. The resource adjustment methods include expanding the test environment database and backing up the test environment database and then taking it offline.
[0083] This embodiment provides a resource adjustment method. By acquiring test environment database information and corresponding production environment database status data, the test environment database is associated with the production environment database. This allows for a more accurate identification of the resource usage of the test environment database. Based on the resource usage identification results, the resources of the test environment database are adjusted. This solves the technical problem that the resources of the development test environment database cannot be maximized according to the actual situation, and improves the resource utilization efficiency of the test environment database.
[0084] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 The resource adjustment result is the first resource adjustment result, and step S30 includes steps S301 to S304:
[0085] Step S301: When the resource usage status identification result indicates that the test environment database is in a suspected idle state or the production environment database corresponding to the test environment database is offline, obtain the user data of the test environment database.
[0086] Step S302: Filter the user data in the test environment database to obtain application user data and development user data, and use the users corresponding to the application user data and development users as target users;
[0087] Step S303: Within a preset time period, count the number of times the target user connects to the test environment database to obtain the number of times the target user logs in;
[0088] Step S304: Determine whether the number of login attempts of the target user is less than a preset login threshold.
[0089] Step S305: If yes, back up the test environment database and take the test environment database offline to obtain the first resource adjustment result.
[0090] When the resource usage status identification result indicates that the test environment database is in a suspected idle state or the corresponding production environment database is offline, the resource adjustment system obtains user data from the test environment database. Test environment database users include four categories: application users, development users, operations and maintenance users, and internal system users. Application users are typically end-users who access the test environment database through applications to perform specific operations or queries. Development users are personnel who directly use the test environment database during development, testing, or maintenance; they may perform higher-level database operations, debugging, or performance analysis. The system then filters the test environment database user data to obtain application user data and development user data, and identifies the users corresponding to these user data and development users as target users. Within a preset time period, the system counts the number of times target users connect to the test environment database to obtain the target user login count. It then determines whether the target user login count is less than a preset login threshold. If the target user login count is less than the preset login threshold, the system backs up the test environment database, preserving the current database state and data integrity, and then takes the test environment database offline, obtaining the first resource adjustment result.
[0091] In one feasible implementation, the resource adjustment result is a second resource adjustment result, and step S30 may further include steps S306 to S309:
[0092] Step S306: When the resource usage status identification result indicates that the test environment database is not in a suspected idle state and the production environment database corresponding to the test environment database is not offline, the structured query statement review platform associated with the test environment database is accessed.
[0093] Step S307: Through the structured query statement review platform, the structured query statements whose execution time is greater than a preset time threshold are filtered to obtain the target statement;
[0094] Step S308: Determine whether the execution path of the target statement is the optimal path;
[0095] Step S309: If yes, then expand the test environment database to generate the second resource adjustment result.
[0096] When the resource usage status identification result indicates that the test environment database is not in a suspected idle state and the corresponding production environment database is not offline, the resource adjustment system accesses the structured query statement review platform associated with the test environment database. Then, through the structured query statement review platform, it filters structured query statements whose execution time exceeds a preset time threshold to obtain the target statement. It then determines whether the execution path of the target statement is the optimal path. If the execution path of the target statement is the optimal path, the test environment database is expanded. This means that the system increases the database resources, such as increasing memory, adding more processor cores, or increasing storage capacity, to meet the performance requirements of the current query and generate a second resource adjustment result.
[0097] The following are ways to determine whether the execution path of a structured query statement (SQL) is the optimal path:
[0098] 1. Execution Plan Analysis:
[0099] Use the tools provided by the database to obtain the execution plan of the query.
[0100] Analyze each step in the execution plan to understand the specific execution path and operation sequence selected by the database system.
[0101] Confirm that the database has selected the most suitable indexes, join order, and filtering conditions.
[0102] 2. Index optimization:
[0103] Ensure that the tables involved in the query have appropriate indexes. Use database management tools or commands to check index usage.
[0104] Avoid full table scans and optimize queries to utilize indexes, reducing the cost and time of data retrieval.
[0105] 3. Optimizer selection:
[0106] The SQL query optimizer is responsible for generating execution plans, and typically considers multiple possible execution paths.
[0107] Verify whether the execution plan chosen by the optimizer is reasonable and optimal, especially for complex queries or queries involving multiple tables.
[0108] 4. Performance Evaluation:
[0109] Use database performance monitoring tools (such as the performance monitoring tools that come with the database management system or third-party tools) to evaluate the performance of different execution paths.
[0110] By comparing metrics such as execution time, CPU utilization, memory consumption, and I / O operations, the optimal execution path can be determined to improve overall performance.
[0111] 5. Real-time monitoring and feedback:
[0112] In a production environment, monitor the execution and performance of SQL queries in real time.
[0113] Adjust and optimize strategies based on monitoring data to ensure the database maintains high efficiency under constantly changing workloads.
[0114] In this implementation, the structured query statement review platform associated with the test environment database is used to analyze the specific situation of slow structured query statements and determine whether the slow response of the test environment database is caused by improper writing of the user's structured query statement. This avoids simply expanding the capacity of the test environment database based on CPU and memory indicators, which would result in wasted resources.
[0115] In this embodiment, the performance metrics of the test environment database, such as CPU, memory, and data rate, are enhanced based on the number of logins by the target user. This reduces the reliance on such metrics and allows for more accurate assessment of user connections and database usage. It solves the problems of discontinuous performance data collection, high resource consumption, and inaccurate assessment, and can accurately determine the idle status of the test environment database, thus avoiding resource waste.
[0116] For example, to help understand the implementation flow of the resource adjustment method obtained by combining Embodiment 1 and Embodiment 2 above, please refer to... Figure 3 , Figure 3 A simplified flowchart of a resource adjustment method is provided. Specifically, the simplified flowchart of this embodiment is as follows:
[0117] (1) Collect data asset information from all databases in the test environment, including Oracle, MySQL, TDSQL, GaussDB, etc. The full database of the test environment is all databases in the test environment.
[0118] (2) Update the data in the test environment database information management system, and put all kinds of assets into the database for unified management.
[0119] (3) Collect unified performance data of the test environment database of the test environment information management system. The data collected includes CPU usage, memory usage, number of user connections, number of connections usage, and disk usage.
[0120] (4) Using the indicators collected in step 3, a preliminary judgment is made as to whether the test environment database is suspected of being idle by measuring memory and CPU usage and the number of user connections. Specifically, if the peak CPU usage is less than 10% and the maximum number of user connections is less than 10, then the test environment database is suspected of being idle.
[0121] (5) Pull the production environment database information to determine whether the production environment database corresponding to the test environment is offline.
[0122] (6) If step 4 determines that the test environment database is a suspected idle database, or if the production environment database corresponding to the test environment database obtained in step 5 has been taken offline, then auditing of the test environment database will be enabled. The specific auditing strategy is to first classify the database users into four categories: application users, development users, operation and maintenance users, and internal system users. Only application users and development users will be audited. When these two types of users connect to the data, login auditing will be triggered, and triggers will be designed to record the client IP or hostname, database username, and client version information of the connection. At the same time, the test environment database will be marked and enter the observation period.
[0123] If step 4 determines that the test environment database is not idle and step 5 indicates that the corresponding production environment database is in a normal online state, then the SQL audit platform information of the test environment database is linked to check for any recent slow SQL queries and whether the execution path of the slow SQL queries is already the optimal path. If the SQL execution path is already the optimal path, then it is determined that the database has a performance bottleneck, and the test environment database is scaled up; otherwise, the SQL query is reported back to the relevant development team for optimization. After resource scaling, the relevant information in the test environment database information management system is updated, and routine performance data collection is performed to form a closed loop.
[0124] (7) Determine whether the database that has entered the observation period after enabling the audit strategy in step 5 has reached the minimum login threshold during the observation period. The observation period is 30 days, and the minimum number of logins is 10 or more application user or developer user login operations within 30 days.
[0125] (8) If step 7 determines that the minimum login requirement has not been met during the observation period, a database backup will be automatically initiated. After the backup, the test environment database will be taken offline, and the relevant status of the test environment database information management system will be updated to form a closed loop. If the minimum login requirement has been met during the observation period, the offline action will not be triggered, and data performance data collection will continue, entering the next judgment cycle to form a closed loop.
[0126] Compared with the prior art, the resource adjustment method described in this embodiment has the following advantages:
[0127] (1) By adding auditing strategies, login auditing and triggers have been designed to enhance database performance indicators such as CPU, memory and data rate. This can reduce the dependence on such indicators and accurately determine user connections and database usage. It solves the problems of discontinuous performance data collection, high resource consumption and inaccurate judgment. It can accurately determine the idle status of the database in the test environment and avoid resource waste.
[0128] (2) By linking the performance indicators of the test environment database such as CPU and memory to the SQL auditing platform, we can determine whether the slow database response is caused by improper SQL writing by the user by analyzing the specific situation of slow SQL, thus avoiding the waste of resources caused by simply expanding the capacity based on the CPU and memory indicators of the test environment database.
[0129] (3) The test environment database is linked to the production environment database status, and the online and offline status of the test environment database is linked to avoid the test environment database still running idle when the production application and production environment database are offline, resulting in a waste of resources.
[0130] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the resource adjustment method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0131] This application also provides a resource adjustment device, please refer to... Figure 4 The resource adjustment device includes:
[0132] Module 10 is used to acquire test environment database information and corresponding production environment database status data;
[0133] The identification module 20 is used to identify the resource usage status of the corresponding test environment database based on the test environment database information and the corresponding production environment database status data, and obtain the resource usage status identification result.
[0134] The adjustment module 30 is used to adjust the resources in the test environment database based on the resource usage status identification results, and obtain the resource adjustment results.
[0135] Optionally, the acquisition module 10 is further configured to:
[0136] Based on the pre-obtained test environment database configuration data, perform unified performance collection on the test environment database to obtain the test environment database information;
[0137] Based on the test environment database configuration data, determine the production environment database corresponding to the test environment database;
[0138] Information is retrieved from the production environment database to obtain the status data of the production environment database.
[0139] Optionally, the test environment database is managed through a preset test environment database information management system. Before the step of uniformly collecting performance data from the test environment database based on pre-obtained test environment database configuration data to acquire the test environment database information, the system further includes:
[0140] Data asset information is collected from several of the aforementioned test environment databases to obtain full asset information data for the test environment databases.
[0141] The test environment database information management system is updated based on the full asset information data of the test environment database to generate the test environment database configuration data.
[0142] Optionally, the identification module 20 is further configured to:
[0143] Based on the test environment database information, determine whether the test environment database is in a suspected idle state, and obtain a first judgment result;
[0144] Based on the status data of the production environment database, determine whether the production environment database corresponding to the test environment database is offline, and obtain a second determination result.
[0145] Based on the first and second judgment results, the resource usage status identification result is generated.
[0146] Optionally, the resource adjustment result is a first resource adjustment result, and the adjustment module 30 is further configured to:
[0147] When the resource usage status identification result indicates that the test environment database is in a suspected idle state or the production environment database corresponding to the test environment database is offline, the test environment database user data is obtained.
[0148] The user data in the test environment database is filtered to obtain application user data and development user data, and the users corresponding to the application user data and development users are taken as target users.
[0149] The number of times the target user connects to the test environment database within a preset time period is counted to obtain the target user's login count;
[0150] Determine whether the number of login attempts of the target user is less than a preset login threshold.
[0151] If so, back up the test environment database and take the test environment database offline to obtain the first resource adjustment result.
[0152] Optionally, the resource adjustment result is a second resource adjustment result, and the adjustment module 30 is further configured to:
[0153] When the resource usage status identification result indicates that the test environment database is not in a suspected idle state and the production environment database corresponding to the test environment database is not offline, the structured query statement review platform associated with the test environment database is accessed.
[0154] The structured query statement review platform filters out structured query statements whose execution time exceeds a preset time threshold to obtain target statements.
[0155] Determine whether the execution path of the target statement is the optimal path;
[0156] If so, the test environment database is expanded to generate the second resource adjustment result.
[0157] The resource adjustment device provided in this application, employing the resource adjustment method in the above embodiments, can solve the technical problem that the database resources in the development and testing environment cannot be maximized according to the actual situation. Compared with the prior art, the beneficial effects of the resource adjustment device provided in this application are the same as those of the resource adjustment method provided in the above embodiments, and other technical features in the resource adjustment device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0158] This application provides a resource adjustment device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the resource adjustment method in Embodiment 1 above.
[0159] The following is for reference. Figure 5 The diagram illustrates a structural schematic of a resource adjustment device suitable for implementing embodiments of this application. The resource adjustment device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The resource adjustment device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0160] like Figure 5 As shown, the resource adjustment device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the resource adjustment device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the resource adjustment device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows resource adjustment devices with various systems, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.
[0161] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0162] The resource adjustment device provided in this application, employing the resource adjustment method described in the above embodiments, can solve the technical problem that the database resources in the development and testing environment cannot be maximized according to the actual situation. Compared with the prior art, the beneficial effects of the resource adjustment device provided in this application are the same as those of the resource adjustment method provided in the above embodiments, and other technical features of this resource adjustment device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0163] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0164] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0165] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the resource adjustment method in the above embodiments.
[0166] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0167] The aforementioned computer-readable storage medium may be included in the resource adjustment device; or it may exist independently and not assembled into the resource adjustment device.
[0168] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the resource adjustment device, cause the resource adjustment device to:
[0169] Obtain test environment database information and corresponding production environment database status data;
[0170] Based on the test environment database information and the corresponding production environment database status data, the resource usage status of the corresponding test environment database is identified, and the resource usage status identification result is obtained.
[0171] Based on the resource usage identification results, resource adjustments are made to the test environment database to obtain resource adjustment results.
[0172] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0173] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0174] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0175] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described resource adjustment method, thereby solving the technical problem that the database resources in the development and testing environment cannot be maximized according to the actual situation. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the resource adjustment method provided in the above embodiments, and will not be repeated here.
[0176] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the resource adjustment method described above.
[0177] The computer program product provided in this application can solve the technical problem that the database resources in the development and testing environment cannot be maximized according to the actual situation. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the resource adjustment method provided in the above embodiments, and will not be repeated here.
[0178] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A resource adjustment method, characterized in that, The method includes: Obtain test environment database information and corresponding production environment database status data; Based on the test environment database information and the corresponding production environment database status data, the resource usage status of the corresponding test environment database is identified, and the resource usage status identification result is obtained. Based on the resource usage identification results, resource adjustments are made to the test environment database to obtain resource adjustment results.
2. The method as described in claim 1, characterized in that, The steps for obtaining test environment database information and corresponding production environment database status data include: Based on the pre-obtained test environment database configuration data, perform unified performance collection on the test environment database to obtain the test environment database information; Based on the test environment database configuration data, determine the production environment database corresponding to the test environment database; Information is retrieved from the production environment database to obtain the status data of the production environment database.
3. The method as described in claim 2, characterized in that, The test environment database is managed through a preset test environment database information management system. Before the step of uniformly collecting performance data from the test environment database based on pre-obtained test environment database configuration data, the method further includes: Data asset information is collected from several of the aforementioned test environment databases to obtain full asset information data for the test environment databases. The test environment database information management system is updated based on the full asset information data of the test environment database to generate the test environment database configuration data.
4. The method as described in claim 1, characterized in that, The step of identifying the resource usage status of the corresponding test environment database based on the test environment database information and the corresponding production environment database status data, and obtaining the resource usage status identification result, includes: Based on the test environment database information, determine whether the test environment database is in a suspected idle state, and obtain a first judgment result; Based on the status data of the production environment database, determine whether the production environment database corresponding to the test environment database is offline, and obtain a second determination result. Based on the first and second judgment results, the resource usage status identification result is generated.
5. The method as described in claim 1, characterized in that, The resource adjustment result is the first resource adjustment result. The step of adjusting the resources in the test environment database based on the resource usage identification result to obtain the resource adjustment result includes: When the resource usage status identification result indicates that the test environment database is in a suspected idle state or the production environment database corresponding to the test environment database is offline, the test environment database user data is obtained. The user data in the test environment database is filtered to obtain application user data and development user data, and the users corresponding to the application user data and development users are taken as target users. The number of times the target user connects to the test environment database within a preset time period is counted to obtain the target user's login count; Determine whether the number of login attempts of the target user is less than a preset login threshold. If so, back up the test environment database and take the test environment database offline to obtain the first resource adjustment result.
6. The method as described in claim 1, characterized in that, The resource adjustment result is the second resource adjustment result. The step of adjusting the resources in the test environment database based on the resource usage identification result to obtain the resource adjustment result further includes: When the resource usage status identification result indicates that the test environment database is not in a suspected idle state and the production environment database corresponding to the test environment database is not offline, the structured query statement review platform associated with the test environment database is accessed. The structured query statement review platform filters structured query statements whose execution time exceeds a preset time threshold to obtain target statements. Determine whether the execution path of the target statement is the optimal path; If so, the test environment database is expanded to generate the second resource adjustment result.
7. A resource adjustment device, characterized in that, The device includes: The acquisition module is used to acquire test environment database information and corresponding production environment database status data; The identification module is used to identify the resource usage status of the corresponding test environment database based on the test environment database information and the corresponding production environment database status data, and to obtain the resource usage status identification result. The adjustment module is used to adjust the resources in the test environment database based on the resource usage status identification results, and obtain the resource adjustment results.
8. A resource adjustment device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the resource adjustment method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the resource adjustment method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the resource adjustment method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Production environment performance evaluation method, device and equipment and storage medium
CN110188027A
Method and device for processing disaster recovery resources in cloud platform and electronic equipment
CN118152195A
