System resource adaptation method and device and storage medium
By obtaining and analyzing the initial resource configuration and historical resource usage information of the target system, dividing time windows and adjusting resource modules, the problem that system resource configuration in the existing technology cannot adapt to performance bottleneck transfers is solved, and resource utilization and user experience are improved.
Patent Information
- Application Number
- CN202510216075.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-02-26
AI Technical Summary
The existing system resource configuration method cannot meet the user needs after the performance bottleneck is transferred, resulting in poor user experience.
By obtaining the initial resource configuration of the target system and resource usage information for historical time periods, dividing periodic time windows, determining the resource modules to be expanded and reduced, and adjusting resources based on the actual throughput and maximum throughput ratio.
It realizes flexible adjustment of resource configuration based on user historical resource usage information, avoids the limitations of fixed configuration mode, and improves resource utilization and user experience.
Smart Images

Figure CN120144291A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and in particular, to a method, device, and storage medium for adapting system resources. Background Art
[0002] With the change of user service requirements, the performance bottleneck points of system resources will shift. For example, in the initial stage, it may be limited by the storage capacity. As data grows later, throughput or access latency may become the main bottlenecks. Currently, the configuration of system resources is still in a fixed mode, that is, providing services to users according to the initial configuration provided to users, which cannot meet the user requirements after the performance bottleneck points shift, resulting in a poor user experience. Summary of the Invention
[0003] To solve the above technical problems, the present application provides a method, device, and storage medium for adapting system resources, which can solve the problem that the current system resource configuration method cannot meet the user requirements after the performance bottleneck points shift, resulting in a poor user experience.
[0004] In a first aspect, the present application provides a method for adapting system resources, including: obtaining the initial resource configuration of a target system; the initial resource configuration at least includes the type and maximum throughput of each resource module; dividing a historical time period into multiple time windows that appear periodically, and statistically analyzing the resource usage information of the target system by the target user in each time window; the resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount; determining a resource module to be expanded, the target time window corresponding to the resource module to be expanded, and a resource module to be reduced according to the initial resource configuration and the resource usage information; the actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to a first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced corresponding to the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio; determining an adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced; when the current time is in the target time window, increasing the actual system resource amount of the resource module to be expanded by the adjustment amount, and reducing the system resource amount of the resource module to be reduced by the adjustment amount.
[0005] In some embodiments, determining the resource module to be expanded and the corresponding target time window according to the initial resource configuration and resource usage information includes: when the actual throughput of a resource module in a time window is greater than or equal to a first preset ratio of the maximum throughput, determining the resource module as a candidate resource module and the time window as a candidate time window; when the number of occurrences of the candidate time window corresponding to the candidate resource module in a historical time period is greater than a quantity threshold, determining the candidate resource module as the resource module to be expanded and the candidate time window as the target time window.
[0006] In some embodiments, determining the adjustment amount according to the actual throughput, maximum throughput, actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, actual system resource amount of the resource module to be reduced includes: determining a first preset ratio of the maximum throughput of the resource module to be expanded as a first true value, and a second preset ratio of the maximum throughput of the resource module to be reduced as a second true value; determining the difference between the actual throughput of the resource module to be expanded and the first true value as a first difference, and the difference between the actual throughput of the resource module to be reduced and the second true value as a second difference; determining the product of the first difference and the actual system resource amount of the resource module to be expanded as a first product, and the product of the second difference and the actual system resource amount of the resource module to be reduced as a second product; determining the quotient of the first product and the maximum throughput of the resource module to be expanded as a first threshold, and the quotient of the second product and the maximum throughput of the resource module to be reduced as a second threshold; determining any value between the first threshold and the second threshold as the adjustment amount.
[0007] In some embodiments, increasing the actual system resource amount of the resource module to be expanded by the adjustment amount includes: when the type of the resource module is a CPU, increasing the number of threads scheduling the CPU in the resource module to be expanded according to the adjustment amount; or modifying the execution efficiency of a single thread in the resource module to be expanded according to the adjustment amount.
[0008] In some embodiments, the initial resource configuration further includes the initial system resource amount of each resource module; after the end of the target time window, adjusting the system resource amounts of the resource module to be expanded and the resource module to be reduced to the initial system resource amounts according to the initial resource configuration.
[0009] In some embodiments, the maximum throughput and the actual throughput are the input / output IO throughput of the resource module; in addition to supporting the IO service, the resource module to be reduced also supports at least one other service.
[0010] Second aspect, the present application provides an adaptation device for system resources, including: an acquisition module, configured to acquire an initial resource configuration of a target system; the initial resource configuration at least includes the type and maximum throughput of each resource module; a processing module, configured to divide a historical time period into a plurality of time windows that appear periodically, and count the resource usage information of the target system by the target user in each time window; the resource usage information includes the type, actual throughput, and actual system resource amount of each resource module; a determination module, configured to determine a resource module to be expanded, a target time window corresponding to the resource module to be expanded, and a resource module to be reduced according to the initial resource configuration and the resource usage information; the actual throughput of the resource module to be expanded in the target time window is greater than or equal to a first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced in the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio; the determination module is further configured to determine an adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced; an adjustment module, configured to increase the actual system resource amount of the resource module to be expanded by the adjustment amount and decrease the system resource amount of the resource module to be reduced by the adjustment amount when the current time is in the target time window.
[0011] In some embodiments, the determination module is specifically configured to: when the actual throughput of a resource module in a time window is greater than or equal to a first preset ratio of the maximum throughput, determine the resource module as a candidate resource module and the time window as a candidate time window; when the number of times the candidate time window corresponding to the candidate resource module appears in the historical time period is greater than a quantity threshold, determine the candidate resource module as the resource module to be expanded and the candidate time window as the target time window.
[0012] In some embodiments, the determination module is specifically configured to: determine a first preset ratio of the maximum throughput of the resource module to be expanded as a first true value, and a second preset ratio of the maximum throughput of the resource module to be reduced as a second true value; determine a first difference as the difference between the actual throughput of the resource module to be expanded and the first true value, and a second difference as the difference between the actual throughput of the resource module to be reduced and the second true value; determine a first product as the product of the first difference and the actual system resource amount of the resource module to be expanded, and a second product as the product of the second difference and the actual system resource amount of the resource module to be reduced; determine a first threshold as the quotient of the first product and the maximum throughput of the resource module to be expanded, and a second threshold as the quotient of the second product and the maximum throughput of the resource module to be reduced; determine any value between the first threshold and the second threshold as the adjustment amount.
[0013] In some embodiments, the adjustment module is specifically configured to, when the type of the resource module is a CPU, increase the number of threads scheduling the CPU in the resource module to be expanded according to the adjustment amount; or modify the execution efficiency of a single thread in the resource module to be expanded according to the adjustment amount.
[0014] In some embodiments, the initial resource configuration further includes the initial system resource amount of each resource module; the adjustment module is further configured to, after the end of the target time window, adjust the system resource amounts of the resource module to be expanded and the resource module to be reduced to the initial system resource amount according to the initial resource configuration.
[0015] In some embodiments, the maximum throughput and the actual throughput are the input / output IO throughput of the resource module; in addition to supporting the IO service, the resource module to be reduced further supports at least one other service.
[0016] In a third aspect, the present application provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, it implements the method for adapting system resources in any one of the embodiments of the first aspect.
[0017] In a fourth aspect, the present application provides a computer-readable storage medium, including: a computer program stored on the computer-readable storage medium, where when the computer program is executed by the processor, it implements the method for adapting system resources in any one of the embodiments of the first aspect.
[0018] In a fifth aspect, the present application provides a computer program product, including: when the computer program product runs on a computer, it causes the computer to implement the method for adapting system resources in any one of the embodiments of the first aspect.
[0019] The technical solution provided by this application has the following advantages compared with the prior art: First, obtain the initial resource configuration of the target system. Among them, the initial resource configuration includes at least the type and maximum throughput of each resource module. After that, divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target user for the target system in each time window. Among them, the resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount. After that, according to the initial resource configuration and the resource usage information, determine the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced. Among them, the actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to the first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced corresponding to the target time window is less than the second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio. Finally, according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced, determine the adjustment amount, and when the current time is in the target time window, increase the actual system resource amount of the resource module to be expanded by the adjustment amount, and reduce the system resource amount of the resource module to be reduced by the adjustment amount. In this way, it is possible to flexibly adjust the resource configuration situation in the corresponding time period according to the resource usage information of the target user in the historical time period, avoiding the problem that the system resources cannot meet the user needs after the performance bottleneck point has shifted when using a fixed configuration mode for all users, thereby improving the resource utilization rate and at the same time improving the user experience. Brief Description of the Drawings
[0020] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.
[0021] In order to more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0022] Figure 1 It is one of the flowcharts of the method for adapting system resources provided by the embodiments of this application;
[0023] Figure 2 It is another flowchart of the method for adapting system resources provided by the embodiments of this application;
[0024] Figure 3The third flowchart of the system resource adaptation method provided by the embodiments of the present application;
[0025] Figure 4 The structural schematic diagram of an adaptation device for system resources provided by the embodiments of the present application;
[0026] Figure 5 The structural schematic diagram of an electronic device provided by the embodiments of the present application. Detailed implementation manners
[0027] In order to more clearly understand the above objects, features and advantages of the present application, the solutions of the present application will be further described below. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.
[0028] When the storage system is delivered, a reasonable software and hardware configuration plan will be formulated according to the performance requirements of the user, that is, a fixed system resource configuration plan will be configured at the initial delivery. However, for the same storage cluster of the same user, the business models and pressures borne by the cluster are different every day or every week, and show a certain regularity. In this way, as the business changes, such as changes in bandwidth, computing power or throughput, the performance bottleneck points of the storage will shift. This fixed configuration strategy cannot fully meet the optimal performance ratio requirements for the entire time period.
[0029] An embodiment of the present application provides a method for adapting system resources to address the above problems, including: obtaining the initial resource configuration of the target system; the initial resource configuration includes at least the type and maximum throughput of each resource module; dividing the historical time period into multiple time windows that appear periodically, and statistically analyzing the resource usage information of the target user for the target system in each time window; the resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount; determining the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced according to the initial resource configuration and the resource usage information; the actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to a first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced corresponding to the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio; determining the adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced; when the current time is in the target time window, increasing the actual system resource amount of the resource module to be expanded by the adjustment amount, and reducing the system resource amount of the resource module to be reduced by the adjustment amount. In this way, it is possible to flexibly adjust the resource configuration in the corresponding time period according to the resource usage information of the target user in the historical time period, avoiding the problem that the fixed configuration mode is used for all users to configure system resources and cannot meet the user needs after the performance bottleneck point shifts, thereby improving the resource utilization rate and at the same time improving the user experience.
[0030] The method for adapting system resources provided by the embodiments of the present application can be executed by a system resource adaptation device. The system resource adaptation device can be hardware or software. When the system resource adaptation device is hardware, it can be various electronic devices with the function of running system resource adaptation, including but not limited to mobile phones, computers, laptops, tablets, etc. When the system resource adaptation device is software, it can be installed in the above-listed electronic devices. It can be implemented as multiple software or software modules, or can be implemented as a single software or software module. No specific limitation is made here.
[0031] Many specific details are set forth in the following description to facilitate a thorough understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present application, rather than all of the embodiments.
[0032] Figure 1 For the flowchart of the method for adapting system resources provided by the embodiments of the present application, as Figure 1 shown, the method for adapting system resources may include the following steps:
[0033] S11. Obtain the initial resource configuration of the target system.
[0034] Among them, the initial resource configuration includes at least the type and maximum throughput of each resource module. The type of system resources refers to the classification of various hardware and software resources available for users in the target system. For example, memory, network bandwidth, central processing unit (CPU), etc.; the target system can be a centralized storage system, a distributed storage system, various computer systems, etc. The maximum throughput can be the maximum input / output (IO) throughput of the resource module.
[0035] In some embodiments, the initial resource configuration may further include the capacity type, identification, and initial system resource amount of each resource module. Among them, the capacity type can be the read / write capacity corresponding to the IO of the resource module, and the identification of the resource module can be the name corresponding to the resource module. Exemplarily, when the type of system resource is CPU, the initial resource configuration is shown in Table 1 below, including the capacity type, maximum throughput, identification, type, and initial system resource amount of each resource module.
[0036] Table 1
[0037] Capacity type Maximum throughput Identification Type Initial system resource quantity Small I / O read 80,000 Gateway CPU 8 Small I / O read and write 60,000 Storage index pool CPU 24 Small I / O write 40,000 Storage index pool CPU 24 Large I / O read 1GB Storage data pool CPU 8 Large I / O read and write 500MB Storage data pool CPU 8 Large I / O write 300MB Storage data pool CPU 8
[0038] Specifically, the method for obtaining the initial resource configuration of the target system can be to obtain it from a pre-stored database; it can also be configured according to the actual performance results before release based on the hardware configuration and software version of the target system. This application does not limit this.
[0039] S12. Divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target user for the target system in each time window.
[0040] Among them, the resource usage information includes the type, actual throughput, and actual system resource amount of each resource module. The historical time period is long enough and can be divided into multiple time windows that appear periodically. For example, when the time window is calculated in minutes, the historical time period is calculated in hours, days, weeks, months, years, etc.; when the time window is calculated in hours, the historical time period is calculated in days, weeks, months, years, etc.; and so on. When the time window is calculated in months, the historical time period is calculated in years, decades, etc. The actual throughput can be the actual IO throughput of the resource module.
[0041] Specifically, when the target system runs in the production environment corresponding to the target user for a long time, record the historical resource usage information of the target system by the target user within the historical time period, divide the historical time period into multiple time windows according to a preset granularity (such as seconds, minutes, hours, days, etc.), and determine the historical resource usage information corresponding to each time window as the resource usage information of the time window for the target system.
[0042] In some embodiments, the granularity of the time window can be 10 minutes. In some embodiments, the resource usage information may further include the capacity type and identifier of each resource module.
[0043] Exemplarily, when the type of the system resource is CPU and the granularity of the time window is 10 minutes, the resource usage information of the target system by the target user in the following time window is as shown in Table 2 below.
[0044] Table 2
[0045]
[0046] In some embodiments, after the resource usage information of the target system for each time window is counted, the system resource adaptation method further includes removing the outlier points (such as data that is too large or too small) in the resource usage information to ensure the accuracy of the data.
[0047] S13. Determine the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced according to the initial resource configuration and the resource usage information.
[0048] Among them, the actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to the first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced corresponding to the target time window is less than the second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio. The first preset ratio and the second preset ratio are preset. For example, they are default values, or values set by relevant personnel according to the actual situation. For another example, the first preset ratio is 80%, and the second preset ratio is 50%.
[0049] Specifically, the method for determining the resource module to be expanded and the target time window corresponding to the resource module to be expanded according to the initial resource configuration and the resource usage information may be that when the actual throughput of a certain resource module is greater than or equal to the first preset ratio of the maximum throughput, the time window corresponding to the actual throughput is determined as the target time window, and the resource module is determined as the resource module to be expanded.
[0050] For example, when the first preset ratio is 75%, and the resource usage information of the target system by the target user in each time window of the historical time period is as shown in Table 2 above, it can be obtained that the storage data pool is a resource module to be expanded during the period from 00:30 to 01:10. Among them, when the storage data pool is from 00:30 to 00:40, the ratio of the actual throughput to the maximum throughput is 800÷1024 = 0.78 > 75%; when the storage data pool is from 00:40 to 00:50, the ratio of the actual throughput to the maximum throughput is 860÷1024 = 0.84 > 75%; when the storage data pool is from 00:50 to 01:00, the ratio of the actual throughput to the maximum throughput is 460÷500 = 0.92 > 75%; when the storage data pool is from 01:00 to 01:10, the ratio of the actual throughput to the maximum throughput is 300÷300 = 1 > 75%.
[0051] After that, determine the resource module to be reduced according to the resource usage information of other resource modules corresponding to the target time window. Specifically, a resource module whose actual throughput corresponding to the target time window is less than the second preset ratio of the maximum throughput and whose type is the same as that of the resource module to be expanded can be determined as the resource module to be reduced.
[0052] Exemplarily, when the second preset ratio is 50%, the storage data pool is a resource module to be expanded during the period from 00:30 to 01:10, and when the ratio of the actual throughput to the maximum throughput of the gateway during the period from 00:30 to 01:10 is 800÷80000 = 0.01, since 0.01 < 50%, the gateway can be determined as the resource module to be reduced.
[0053] In some embodiments, the maximum throughput and the actual throughput are the input / output IO throughput of the resource module; the resource module to be reduced supports at least one other service in addition to the IO service. Among them, the other service is a service that does not require occupying the resources of the type corresponding to the resource module to be expanded. For example, when the type corresponding to the resource module to be expanded is the CPU, the other service can be the broadband service. In this way, when adjusting the system resources, the impact of the adjustment process on the IO service can be avoided to the greatest extent, ensuring the normal operation of the service.
[0054] S14. Determine the adjustment amount according to the actual throughput, maximum throughput, actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, actual system resource amount of the resource module to be reduced.
[0055] Specifically, first, the minimum value of the adjustment amount can be calculated according to the formula where x is used to represent the minimum value of the adjustment amount, X is used to represent the actual system resource amount of the resource module to be expanded, a is used to represent the actual throughput of the resource module to be expanded, w1 The first preset ratio for representing the maximum throughput of the resource module to be expanded, and A is used to represent the maximum throughput of the resource module to be expanded.
[0056] Then, according to the formula Calculate the maximum value of the adjustment amount for a single resource module to be reduced. Wherein, y is used to represent the maximum value of the adjustment amount for a single resource module to be reduced, Y is used to represent the actual system resources of the resource module to be reduced, b is used to represent the actual throughput of the resource module to be reduced, and w 1 The second preset ratio for representing the maximum throughput of the resource module to be reduced, and B is used to represent the maximum throughput of the resource module to be reduced.
[0057] Finally, if y > x, then one resource module to be reduced can be used to determine the adjustment amount, that is, the adjustment amount takes any value between x and y; if y < x, then at least two resource modules to be reduced can be used to determine the adjustment amount, that is, the adjustment amount takes any value between x and the sum of the maximum values of the adjustment amounts of a single resource module calculated by the at least two resource modules to be reduced; if y = x, then the adjustment amount can be directly made y or x, and the one resource module to be reduced is used to adjust the resource module to be expanded.
[0058] S15. When the current time is within the target time window, increase the actual system resources of the resource module to be expanded by the adjustment amount, and reduce the system resources of the resource module to be reduced by the adjustment amount.
[0059] First, increase the actual system resources of the resource module to be expanded by the adjustment amount. Specifically, the way to increase the actual system resources of the resource module to be expanded by the adjustment amount can be, when the type of the resource module is CPU, increase the number of threads scheduling the CPU in the resource module to be expanded according to the adjustment amount; or modify the execution efficiency of a single thread in the resource module to be expanded according to the adjustment amount. For example, change the mapping relationship between the original thread and the CPU from 2 threads mapping to 1 CPU to 1 thread mapping to 1 CPU.
[0060] After that, reduce the system resources of the resource module to be reduced by the adjustment amount.
[0061] Specifically, first, when there is one resource module to be reduced, directly reduce the system resources of the one resource module to be reduced by the adjustment amount; when there are multiple resource modules to be reduced, according to the actual situation of the multiple resource modules (the ratio of the actual throughput to the maximum throughput), reduce the system resources of the multiple resource modules by the adjustment amount in total.
[0062] Secondly, the method of reducing the system resource amount of the resource module to be reduced by the adjustment amount can be, when the type of the resource module is CPU, reducing the CPU ratio of the resource module to be reduced, that is, reducing the number of CPUs used by a single resource module to be reduced. For example, it can be dynamically reducing or restarting the resource module to be reduced in sequence after configuration modification.
[0063] Exemplarily, when the type of the system resource is CPU, the resource module to be expanded is a storage data pool, the target time window includes 00:30 to 01:10, the resource module to be reduced is a gateway, and the adjustment amount is 4, Table 2 is adjusted to Table 3 as follows.
[0064] Table 3
[0065]
[0066] In some embodiments, the initial resource configuration further includes the initial system resource amount of each resource module; the system resource adaptation method further includes: after the target time window ends, adjusting the system resource amounts of the resource module to be expanded and the resource module to be reduced to the initial system resource amounts according to the initial resource configuration. In this way, after the target time window ends, the system resource amounts of the resource module to be expanded and the resource module to be reduced can be adjusted to the initial state, ensuring that outside the target time window, the system resources can still be configured in the most appropriate way initially selected, ensuring the stability of the system.
[0067] In the above solution, first, obtain the initial resource configuration of the target system. The initial resource configuration includes at least the type and maximum throughput of each resource module. Then, divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target user for the target system in each time window. The resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount. Then, based on the initial resource configuration and the resource usage information, determine the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced. The actual throughput of the resource module to be expanded in the target time window is greater than or equal to the first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced in the target time window is less than the second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio. Finally, based on the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced, determine the adjustment amount, and when the current time is in the target time window, increase the actual system resource amount of the resource module to be expanded by the adjustment amount, and reduce the system resource amount of the resource module to be reduced by the adjustment amount. In this way, it is possible to flexibly adjust the resource configuration in the corresponding time period according to the resource usage information of the target user in the historical time period, avoiding the problem that the system resources cannot meet the user requirements after the performance bottleneck point has shifted when using a fixed configuration mode for all users, thereby improving the resource utilization rate and at the same time improving the user experience.
[0068] In some embodiments, as Figure 2 shown, the method for determining the resource module to be expanded and the target time window corresponding to the resource module to be expanded according to the initial resource configuration and the resource usage information may include the following steps:
[0069] S131. When the actual throughput of a resource module in a time window is greater than or equal to the first preset ratio of the maximum throughput, determine the resource module as a candidate resource module and the time window as a candidate time window.
[0070] S132. When the number of occurrences of the candidate time window corresponding to the candidate resource module in the historical time period is greater than the quantity threshold, determine the candidate resource module as the resource module to be expanded and the candidate time window as the target time window.
[0071] The quantity threshold is a preset value, which can be a default value, or a value set by relevant personnel according to the actual situation, or a value set according to the number of time window cycles included in the historical time period.
[0072] In the above solution, it is possible to screen out the target time window corresponding to the resource module to be expanded that reaches the performance bottleneck according to the throughput of the resource module, so as to facilitate subsequent adjustment and adaptation of system resources in this target time window, improving the flexibility of the system resource adaptation method and indirectly improving the user experience.
[0073] In some embodiments, as Figure 3 shown, the method for determining the adjustment amount according to the actual throughput, maximum throughput, actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, actual system resource amount of the resource module to be reduced may include the following steps:
[0074] S141. Determine the first preset ratio of the maximum throughput of the resource module to be expanded as the first true value, and the second preset ratio of the maximum throughput of the resource module to be reduced as the second true value.
[0075] Specifically, the first true value can be calculated according to the formula w 1 =A×n, and the second true value can be calculated according to the formula w 2 =B×m. Wherein, w 1 is used to represent the first true value, that is, the first preset ratio of the maximum throughput of the resource module to be expanded; A is used to represent the maximum throughput of the resource module to be expanded; n is used to represent the first preset ratio; B is used to represent the maximum throughput of the resource module to be reduced; w 2 is used to represent the second true value, that is, the second preset ratio of the maximum throughput of the resource module to be reduced; m is used to represent the second preset ratio.
[0076] S142. Determine the difference between the actual throughput of the resource module to be expanded and the first true value as the first difference, and the difference between the actual throughput of the resource module to be reduced and the second true value as the second difference.
[0077] Specifically, the first difference can be calculated according to the formula c 1 =a - w 1 , and the second difference can be calculated according to the formula c 2 =b - w 2 . Wherein, c 1 is used to represent the first difference, c 2 is used to represent the second difference; a is used to represent the actual throughput of the resource module to be expanded, b is used to represent the actual throughput of the resource module to be reduced; w 1 is used to represent the first true value, w 2 is used to represent the second true value.
[0078] S143. Determine the product of the first difference and the actual system resource amount of the resource module to be expanded as the first product, and the product of the second difference and the actual system resource amount of the resource module to be reduced as the second product.
[0079] Specifically, the first product can be calculated according to the formula d 1 = c 1 × X, and the second product can be calculated according to the formula d 2 = c 2 × Y. Among them, d 1 is used to represent the first product, and d 2 is used to represent the second product; c 1 is used to represent the first difference, and c 2 is used to represent the second difference; X is used to represent the actual system resource amount of the resource module to be expanded, and Y is used to represent the actual system resource amount of the resource module to be reduced.
[0080] S144. Determine the first threshold as the quotient of the first product and the maximum throughput of the resource module to be expanded, and determine the second threshold as the quotient of the second product and the maximum throughput of the resource module to be reduced.
[0081] Specifically, the first threshold can be calculated according to the formula e 1 = d 1 ÷ A, and the second threshold can be calculated according to the formula e 2 = d 2 ÷ B. Among them, e 1 is used to represent the first threshold, and e 2 is used to represent the second threshold; d 1 is used to represent the first product, and d 2 is used to represent the second product; A is used to represent the maximum throughput of the resource module to be expanded, and B is used to represent the maximum throughput of the resource module to be reduced.
[0082] S145. Determine any value between the first threshold and the second threshold as the adjustment amount.
[0083] Specifically, if the first threshold is less than the second threshold, any value between the first threshold and the second threshold is determined as the adjustment amount; if the first threshold is equal to the second threshold, the first threshold or the second threshold is determined as the adjustment amount; if within the target time window, the first threshold of the resource module to be expanded is greater than the second thresholds of all resource modules to be reduced, it is determined that there are no resource modules to be reduced that can be reduced within the target time window, and the adjustment amount cannot be determined, that is, the resource adjustment cannot be completed. When it is determined that the resource adjustment cannot be completed, a non-adjustable indication can be sent.
[0084] In the above solution, the selectable range of the adjustment amount can be jointly determined according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded and the resource module to be reduced, avoiding the problem of resource tension of the resource module to be reduced after adjusting the resource module to be expanded, ensuring the stability of the system, and indirectly improving the user experience.
[0085] In the embodiments of the present application, the adaptation device for system resources can be divided into functional modules according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0086] As Figure 4 shown, it is a schematic structural diagram of the adaptation device for system resources provided by the embodiments of the present application. The adaptation device for system resources includes an acquisition module 51, a processing module 52, a determination module 53, and an adjustment module 54.
[0087] The acquisition module 51 is configured to acquire the initial resource configuration of the target system; the initial resource configuration includes at least the type and maximum throughput of each resource module; the processing module 52 is configured to divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target user for the target system in each time window; the resource usage information includes the type, actual throughput, and actual system resource amount of each resource module; the determination module 53 is configured to determine the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced according to the initial resource configuration and the resource usage information; the actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to a first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced corresponding to the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio; the determination module 53 is further configured to determine the adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced; the adjustment module 54 is configured to increase the actual system resource amount of the resource module to be expanded by the adjustment amount and reduce the system resource amount of the resource module to be reduced by the adjustment amount when the current time is in the target time window.
[0088] In the above solution, first, obtain the initial resource configuration of the target system. The initial resource configuration includes at least the type and maximum throughput of each resource module. Then, divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target user for the target system in each time window. The resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount. Then, based on the initial resource configuration and the resource usage information, determine the resource module to be expanded, the target time window corresponding to the resource module to be expanded, and the resource module to be reduced. The actual throughput of the resource module to be expanded in the target time window is greater than or equal to the first preset ratio of the maximum throughput; the actual throughput of the resource module to be reduced in the target time window is less than the second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; the second preset ratio is less than the first preset ratio. Finally, based on the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded corresponding to the target time window, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced, determine the adjustment amount, and when the current time is in the target time window, increase the actual system resource amount of the resource module to be expanded by the adjustment amount, and decrease the system resource amount of the resource module to be reduced by the adjustment amount. In this way, it is possible to flexibly adjust the resource configuration in the corresponding time period according to the resource usage information of the target user in the historical time period, avoiding the problem that the system resources cannot meet the user requirements after the performance bottleneck point has shifted when using a fixed configuration mode for all users, thereby improving the resource utilization rate and the user experience at the same time.
[0089] In some embodiments, the determining module 53 is specifically configured to: when the actual throughput of a resource module in a time window is greater than or equal to the first preset ratio of the maximum throughput, determine the resource module as a candidate resource module and the time window as a candidate time window; when the number of occurrences of the candidate time window corresponding to the candidate resource module in the historical time period is greater than the quantity threshold, determine the candidate resource module as the resource module to be expanded and the candidate time window as the target time window.
[0090] In some embodiments, the determination module 53 is specifically configured to: determine a first preset ratio of the maximum throughput of the resource module to be expanded as the first true value, and a second preset ratio of the maximum throughput of the resource module to be reduced as the second true value; determine the difference between the actual throughput of the resource module to be expanded and the first true value as the first difference, and the difference between the actual throughput of the resource module to be reduced and the second true value as the second difference; determine the product of the first difference and the actual system resource amount of the resource module to be expanded as the first product, and the product of the second difference and the actual system resource amount of the resource module to be reduced as the second product; determine the quotient of the first product and the maximum throughput of the resource module to be expanded as the first threshold, and the quotient of the second product and the maximum throughput of the resource module to be reduced as the second threshold; determine any value between the first threshold and the second threshold as the adjustment amount.
[0091] In some embodiments, the adjustment module 54 is specifically configured to, when the type of the resource module is a CPU, increase the number of threads scheduling the CPU in the resource module to be expanded according to the adjustment amount; or modify the execution efficiency of a single thread in the resource module to be expanded according to the adjustment amount.
[0092] In some embodiments, the initial resource configuration further includes the initial system resource amount of each resource module; the adjustment module 54 is further configured to, after the end of the target time window, adjust the system resource amounts of the resource module to be expanded and the resource module to be reduced to the initial system resource amounts according to the initial resource configuration.
[0093] In some embodiments, the maximum throughput and the actual throughput are the input / output IO throughput of the resource module; in addition to supporting the IO service, the resource module to be reduced further supports at least one other service.
[0094] The system resource adaptation device provided in this embodiment can execute the system resource adaptation method provided in the above method embodiment. The implementation principle and technical effects are similar to those of the above method, and will not be elaborated here.
[0095] Figure 5 An electronic device is shown according to an exemplary embodiment. The electronic device may include a processor 802, and the processor 802 is configured to execute application program code to implement the system resource adaptation method in the present application.
[0096] The processor 802 may be a central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the solution of the present application.
[0097] Such as Figure 5As shown, the electronic device may further include a memory 803. The memory 803 is used to store the application program code for executing the solution of this application, and is controlled by the processor 802 for execution.
[0098] The memory 803 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or may also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 803 may exist independently and be connected to the processor 802 through the bus 804. The memory 803 may also be integrated with the processor 802.
[0099] As Figure 5 shown, the electronic device may further include a communication interface 801. Among them, the communication interface 801, the processor 802, and the memory 803 may be coupled to each other. For example, they are coupled to each other through the bus 804. The communication interface 801 is used for information interaction with other devices. For example, it supports information interaction between the electronic device and other devices.
[0100] It should be noted that Figure 5 the device structure shown in Figure 5 does not constitute a limitation on the electronic device. Except for
[0101] the components shown, the electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. And the electronic device provided in this embodiment may execute the system resource adaptation method provided in the above method embodiment. The implementation principle and technical effect are similar to those of the above method, and will not be elaborated here.
[0102] Among them, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk, or the like.
[0103] An embodiment of the present application provides a computer program product. The computer program product stores a computer program. When the computer program is executed by a processor, it implements each process of the method for adapting system resources in the above method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0104] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0105] In the present application, the processor can be a central processing unit (CPU), or can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor can also be any conventional processor, etc.
[0106] In the present application, the memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0107] In this application, computer-readable media include both permanent and non-permanent, removable and non-removable storage media. The storage media can implement information storage by any method or technology, and the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transitory media such as modulated data and carrier waves.
[0108] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the said element.
[0109] The above description is only a specific implementation manner of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to the embodiments described herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for adapting system resources, characterized in that: include: Get the initial resource configuration of the target system; The initial resource configuration includes at least the type and maximum throughput of each resource module; Divide the historical time period into multiple time windows that appear periodically, and count the resource usage information of the target system by the target user in each time window; the resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount; Determine, according to the initial resource configuration and resource usage information, resource modules to be expanded, target time windows corresponding to the resource modules to be expanded, and resource modules to be reduced; The actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to a first preset ratio of the maximum throughput; The actual throughput of the resource module to be reduced corresponding to the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; The second preset ratio is smaller than the first preset ratio; Determine an adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced corresponding to the target time window; When the current time is within the target time window, the actual system resource amount of the resource module to be expanded is increased by the adjustment amount, and the system resource amount of the resource module to be reduced is reduced by the adjustment amount.
2. The adaptation method according to claim 1, characterized in that: The determining, according to the initial resource configuration and resource usage information, a resource module to be expanded and a target time window corresponding to the resource module to be expanded includes: When the actual throughput of the resource module in the time window is greater than or equal to a first preset ratio of the maximum throughput, the resource module is determined as a candidate resource module, and the time window is determined as a candidate time window; When the number of times the candidate time window corresponding to the candidate resource module appears in the historical time period is greater than the quantity threshold, the candidate resource module is determined as the resource module to be expanded, and the candidate time window is determined as the target time window.
3. The adaptation method according to claim 1, characterized in that: The step of determining the adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced corresponding to the target time window includes: Determine a first preset ratio of the maximum throughput of the resource module to be expanded as a first true value, and determine a second preset ratio of the maximum throughput of the resource module to be reduced as a second true value; Determine the difference between the actual throughput of the resource module to be expanded and the first true value as a first difference, and determine the difference between the actual throughput of the resource module to be reduced and the second true value as a second difference; Determine the product of the first difference and the actual system resource amount of the resource module to be expanded as a first product, and determine the product of the second difference and the actual system resource amount of the resource module to be reduced as a second product; The quotient of the first product and the maximum throughput of the resource module to be expanded is determined as a first threshold, and the quotient of the second product and the maximum throughput of the resource module to be reduced is determined as a second threshold; Any value between the first threshold and the second threshold is determined as the adjustment amount.
4. The adaptation method according to claim 1, characterized in that: The step of increasing the actual system resource amount of the resource module to be expanded by the adjustment amount includes: When the type of the resource module is CPU, the number of threads scheduling the CPU in the resource module to be expanded is increased according to the adjustment amount; or the execution efficiency of a single thread in the resource module to be expanded is modified according to the adjustment amount.
5. The adaptation method according to claim 1, characterized in that: The initial resource configuration also includes an initial system resource amount for each resource module; After the target time window ends, the system resource amounts of the resource modules to be expanded and the resource modules to be reduced are adjusted to the initial system resource amounts according to the initial resource configuration.
6. The adaptation method according to claim 1, characterized in that: The maximum throughput and the actual throughput are the input and output IO throughputs of the resource module; the resource module to be reduced supports at least one other service in addition to the IO service.
7. A system resource adaptation device, characterized in that: include: An acquisition module is used to obtain the initial resource configuration of the target system; The initial resource configuration includes at least the type and maximum throughput of each resource module; A processing module, used to divide the historical time period into a plurality of time windows that appear periodically, and to count the resource usage information of the target user on the target system in each time window; The resource usage information includes the type of each resource module, the actual throughput, and the actual system resource amount; A determination module, configured to determine, according to the initial resource configuration and resource usage information, a resource module to be expanded, a target time window corresponding to the resource module to be expanded, and a resource module to be reduced; The actual throughput of the resource module to be expanded corresponding to the target time window is greater than or equal to a first preset ratio of the maximum throughput; The actual throughput of the resource module to be reduced corresponding to the target time window is less than a second preset ratio of the maximum throughput, and the type of the resource module to be reduced is the same as the type of the resource module to be expanded; The second preset ratio is smaller than the first preset ratio; The determination module is further configured to determine the adjustment amount according to the actual throughput, maximum throughput, and actual system resource amount of the resource module to be expanded, and the actual throughput, maximum throughput, and actual system resource amount of the resource module to be reduced, corresponding to the target time window; The adjustment module is used to increase the actual system resource amount of the resource module to be expanded by the adjustment amount, and reduce the system resource amount of the resource module to be reduced by the adjustment amount when the current time is in the target time window.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the system resource adaptation method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the system resource adaptation method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that When the computer program product is executed on a computer, the computer is enabled to implement the system resource adaptation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Parameter configuration method, device and system and computer readable storage medium
CN111356232A
Virtual machine resource extension method and device and related equipment
CN112463297A
End-side collaborative multi-unmanned aerial vehicle autonomous navigation method
CN114061589A
Container application capacity expanding and shrinking method and device, computer equipment and storage medium
CN115174406A
Server resource control method and device, electronic equipment and storage medium
CN117349015A