Cluster server resource allocation method, device, storage medium and program product
By regularly calculating the loss value and health of the server and distributing resources, the problem of not considering server losses in the existing technology is solved, reasonable resource allocation and loss balance are achieved, and the performance and reliability of the cluster server are improved.
Patent Information
- Application Number
- CN202411932258.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the prior art, the server resource allocation strategy does not fully consider the loss situation of each server in the cluster, resulting in a decrease in the overall performance and reliability of the server cluster.
By regularly obtaining the load data of each server in the server cluster, calculating the loss value, and regularly calculate the health of each server based on the loss value and the server usage time, rank the health degree, and finally selecting the most suitable server resource for allocation based on the user's resource application request.
It realizes reasonable allocation of resources and balanced overall loss, improves load balancing and efficient operation of cluster servers, and adapts to dynamic changes in cluster operation status.
Smart Images

Figure CN119356893B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cluster server resource allocation method, device, storage medium and program product. Background Art
[0002] With the continuous development of cloud computing and big data technology, cluster servers have become the core equipment supporting high-performance computing and massive data storage. Server clusters provide users with efficient and stable services by integrating a large amount of computing resources and storage resources.
[0003] In the prior art, most server resource allocation strategies use random allocation or sequential allocation. This allocation strategy often ignores the impact of server wear and tear, causing some servers to wear out too quickly due to long-term high-load operation, while other servers are relatively idle, resulting in uneven resource utilization, which reduces the overall performance and reliability of the cluster server.
[0004] Therefore, there is an urgent need for an allocation method that can comprehensively consider server performance, current load and loss conditions to achieve reasonable resource allocation and overall loss balance. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a cluster server resource allocation method, device, storage medium and program product, aiming to solve the problem that the prior art does not fully consider the loss of each server in the cluster, thereby causing the overall performance and reliability of the server cluster to decline.
[0006] In order to achieve the above purpose and other advantages, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a cluster server resource allocation method, comprising:
[0008] Regularly obtain the load data of each server in the server cluster and calculate the loss value;
[0009] Based on the loss value and the usage time of the server, regularly calculate the health of each server and sort the health;
[0010] Based on the user's resource application request and the server health ranking results, the most appropriate server resources are selected and allocated.
[0011] According to a cluster server resource allocation method provided by the present invention, the load data includes: CPU usage and hard disk read and write volume;
[0012] The step of regularly acquiring the load data of each server in the server cluster and calculating the loss value comprises:
[0013] At every preset first time interval, regularly collect the CPU usage rate and hard disk read and write volume of each server;
[0014] Allocating corresponding first weight coefficient and second weight coefficient to the CPU usage rate and the hard disk read / write volume, and calculating the loss value;
[0015] The collection time point of the load data, the UUID of the server, the CPU usage rate, the hard disk read and write volume, and the loss value are stored in a preset first data table.
[0016] According to a cluster server resource allocation method provided by the present invention, the steps of allocating corresponding first weight coefficients and second weight coefficients to the CPU usage rate and the hard disk read / write volume, and calculating the loss value include:
[0017] Multiplying the first weight coefficient by the CPU usage rate to obtain a CPU loss component;
[0018] Multiplying the second weight coefficient by the hard disk read / write volume to obtain a hard disk loss component;
[0019] The CPU loss component and the hard disk loss component are added together to obtain the loss value.
[0020] According to a cluster server resource allocation method provided by the present invention, the step of regularly calculating the health of each server and sorting the health based on the loss value and the usage time of the server includes:
[0021] At every preset second time interval, based on the CPU usage, the hard disk read / write volume and the loss value, respectively calculate the total value of the CPU average usage, the total value of the hard disk read / write volume and the total loss value;
[0022] Allocating corresponding third and fourth weight coefficients to the total loss value and the usage time of the server, and calculating the health degree based on a preset health degree initial value;
[0023] The health update time point, the UUID of the server, the total value of the average CPU usage, the total value of the hard disk read and write volume, the total loss value and the health are stored in a preset second data table;
[0024] The second data table is sorted according to health level.
[0025] According to a cluster server resource allocation method provided by the present invention, the steps of respectively calculating the total value of the average CPU usage, the total value of the hard disk read / write volume and the total value of the loss at every preset second time interval based on the CPU usage, the hard disk read / write volume and the loss value include:
[0026] At every preset second time interval, regularly calculate the average value of the CPU usage obtained in the second time interval to obtain the average CPU usage, and add it to the average CPU usage of the last second time interval to obtain the total value of the average CPU usage;
[0027] At every second time interval, the accumulated value of the hard disk read / write volume obtained in the second time interval is calculated at the same time, and added to the accumulated value of the hard disk read / write volume in the last second time interval to obtain the total value of the hard disk read / write volume;
[0028] At every preset second time interval, the multiple loss values calculated within the second time interval are accumulated to obtain an accumulated value, and the accumulated value is added to the accumulated value of the loss value of the last second time interval to obtain the total loss value.
[0029] According to a cluster server resource allocation method provided by the present invention, the steps of allocating corresponding third weight coefficients and fourth weight coefficients to the total loss value and the usage time of the server, and calculating the health degree based on a preset health degree initial value include:
[0030] Multiplying the third weight coefficient by the total loss value to obtain a loss component;
[0031] Multiplying the fourth weight coefficient by the usage time of the server to obtain a time component;
[0032] The health degree is obtained by subtracting the loss component and the time component from the initial health degree value in sequence.
[0033] According to a cluster server resource allocation method provided by the present invention, the step of selecting the most suitable server resources and allocating resources based on the user's resource application request and the server health ranking result includes:
[0034] Receive resource allocation application requests and determine the request type;
[0035] Based on the request type, determining a health threshold range;
[0036] Based on the health threshold range, corresponding server resources are selected from the health ranking results and resources are allocated.
[0037] In a second aspect, the present invention provides an electronic device, the electronic device comprising:
[0038] One or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processors execute the steps of any of the above-mentioned cluster server resource allocation methods.
[0039] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction, when executed by a processor, implements the steps of any of the above-described cluster server resource allocation methods.
[0040] In a fourth aspect, the present invention provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of any of the above-described cluster server resource allocation methods.
[0041] The present invention provides a cluster server resource allocation method, device, storage medium and program product, which periodically obtains the load data of each server in the server cluster and calculates the loss value; based on the loss value and the use time of the server, regularly calculates the health of each server and sorts the health; based on the user's resource application request and the health ranking result of the server, selects the most suitable server resource and allocates the resource. The present invention comprehensively considers the server's load data, such as CPU usage and hard disk read and write volume, and regularly calculates the server's loss situation, and then further derives the server's health index, and sorts the server according to the health index, so that different allocation strategies are adopted according to the user's application request when allocating resources to reduce the weight of high-loss servers. Therefore, reasonable resource allocation and overall loss balance are achieved, ensuring load balancing and efficient operation of cluster servers. Moreover, by regularly updating the health and sorting results, it can adapt to the dynamic changes in the cluster's operating status and ensure the effectiveness of the resource allocation strategy. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other implementation methods can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 It is a flow chart of a cluster server resource allocation method provided by an embodiment of the present invention;
[0044] Figure 2 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0045] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings as follows.
[0046] It should be noted that it is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in the present invention can be combined with other embodiments without conflict. Unless otherwise defined, the technical terms or scientific terms involved in the present invention should be the usual meanings understood by people with ordinary skills in the technical field to which the present invention belongs. The words "one", "a", "a", "the" and the like involved in the present invention do not indicate a quantitative limitation and may represent the singular or plural. The terms "including", "comprising", "having" and any of their variations involved in the present invention are intended to cover non-exclusive inclusions; the terms "first", "second", "third", etc. involved in the present invention are merely to distinguish similar objects and do not represent a specific ordering of objects.
[0047] The loss assessment of hardware server performance indicators usually involves comprehensive consideration of factors such as the usage, wear and aging of server hardware components (such as CPU, hard disk, service time, etc.). The following is an introduction to the relevant performance indicators:
[0048] CPU usage: A CPU that runs continuously at high load may accelerate its aging process. You can evaluate the CPU's wear and tear by monitoring its average usage, peak usage, and running time.
[0049] Disk read / write volume: The hard disk read / write volume (especially write volume) will affect its lifespan. You can evaluate the hard disk's wear and tear by monitoring indicators such as the hard disk read / write times, read / write speed, and number of bad sectors.
[0050] Hardware life aging: The wear and tear of a server can be assessed based on how long it has been running. A fixed time threshold is set, and servers that exceed this threshold are considered to have a higher stability risk.
[0051] The applicant has found that the server resource allocation strategy in the prior art usually focuses more on meeting current service requests and resource requirements, but takes less consideration of the long-term operation loss of the server, resulting in some servers being worn out too quickly due to long-term high-load operation, while other servers may be in a relatively idle state, reducing the overall performance and reliability of the cluster server. Therefore, the present invention provides a cluster server resource allocation method, device, storage medium and program product, designing a more scientific and reasonable resource allocation strategy, comprehensively considering the loss of the server, so as to achieve balanced allocation and efficient utilization of resources.
[0052] Reference Figure 1 As shown, an embodiment of the present invention provides a cluster server resource allocation method, comprising:
[0053] Step S1: Regularly obtain the load data of each server in the server cluster and calculate the loss value.
[0054] In this embodiment, the load data includes: CPU usage and hard disk read and write volume. Step S1 specifically includes:
[0055] Step S101: regularly collecting the CPU usage rate and hard disk read / write volume of each server at every preset first time interval.
[0056] Specifically, the resource allocation method is applied to a cluster server resource allocation strategy system based on loss assessment. The system is adapted with a load collection module, a loss statistics module, a resource allocation module, etc. The load collection module traverses each server in the server cluster at fixed intervals (such as 1 minute, 2 minutes, 5 minutes, etc., the specific time can be adjusted according to actual needs) by setting a timer or scheduling a task, and automatically collects the CPU usage and hard disk read and write volume of each server in the server cluster. The collection process can be implemented by calling a remote monitoring tool or a monitoring interface provided by the server. Preferably, the first time interval of this embodiment is set to 1 minute.
[0057] It should be noted that the collected server information is identified by the server's UUID (Universally Unique Identifier). The IP address of the server may change with changes in the network environment, migration or restart of the server. This dynamic nature brings great inconvenience to the long-term tracking and management of the server. Once the UUID is generated, it will not change. No matter how the server's network environment changes, the UUID will remain unchanged, and the server can be tracked and managed through the UUID. This stability makes UUID an ideal choice for long-term tracking and management of server clusters.
[0058] Step S102: assigning corresponding first weight coefficients and second weight coefficients to the CPU usage rate and the hard disk read / write volume, and calculating the loss value.
[0059] In this embodiment, step S102 specifically includes:
[0060] Step S1021: multiplying the first weight coefficient by the CPU usage rate to obtain a CPU loss component;
[0061] Step S1022: multiplying the second weight coefficient by the hard disk read / write volume to obtain a hard disk wear component;
[0062] Step S1023: Add the CPU loss component and the hard disk loss component to obtain a loss value.
[0063] In the cluster server resource allocation strategy method based on loss evaluation, the loss value comprehensively considers the CPU usage and hard disk read and write volume of the server, and is an important indicator for evaluating server performance loss. Therefore, its calculation and implementation process is crucial. Since the server cluster carries various types of applications and services, these applications and services have different requirements for the use of CPU and hard disk. For example, some computing-intensive applications may rely more on CPU performance, while other data-intensive applications may pay more attention to the read and write speed of the hard disk. Therefore, as the application scenarios and requirements change, the values of α and β need to be adjusted to better adapt to these changes. According to factors such as the server's hardware specifications, application scenarios, and historical operating data, reasonable weight coefficients α and β are assigned to the CPU usage and hard disk read and write volume respectively. Then, based on these weight coefficients and the collected load data, the loss value of each server is calculated using the loss calculation formula, such as: loss value = α × CPU usage + β × Disk read and write volume, where α and β are weight coefficients and can be adjusted according to actual conditions.
[0064] Each calculated loss value will be stored as a new record in the database table for subsequent accumulation and query. Since the loss value is a quantitative indicator that comprehensively reflects the loss of the server CPU and hard disk, by calculating the loss value, the system can accurately evaluate the health status and performance stability of the server in the future.
[0065] Step S103: storing the load data collection time point, the UUID of the server, the CPU usage rate, the hard disk read and write volume, and the loss value in a preset first data table.
[0066] In order to ensure the reliability and persistence of data, a first data table is created in the database (MySQL, Oracle, etc.), and the load collection module will store the collected information in the database system. The fields created in this data table include: collection time point, UUID, CPU usage, hard disk read and write volume, and loss value, etc. Select appropriate data types, design reasonable constraints, and appropriate indexes for the created fields. After each load data collection, the loss value is automatically calculated, and the data such as the collection time point, the server's unique identifier (UUID), CPU usage, hard disk read and write volume, and loss value are stored in the data table. Therefore, by regularly collecting the server's load data and calculating the loss value, and storing the data at the same time, real-time monitoring and evaluation of the server's loss situation can be achieved, and data support is also provided for subsequent resource allocation strategy adjustments.
[0067] Step S2: Based on the loss value and the usage time of the server, the health of each server is calculated regularly and the health ranking is performed.
[0068] In this embodiment, step S2 specifically includes:
[0069] Step S201: at every preset second time interval, based on the CPU usage, hard disk read / write volume and loss value, respectively calculate the total CPU average usage, the total hard disk read / write volume and the total loss value.
[0070] In this embodiment, step S201 specifically includes:
[0071] Step S2011: at every preset second time interval, regularly calculating the average value of the CPU usage obtained in the second time interval to obtain the average CPU usage, and adding it to the average CPU usage of the last second time interval to obtain a total value of the average CPU usage;
[0072] Step S2012: at every second time interval, the accumulated value of the hard disk read / write volume acquired in the second time interval is calculated at a regular interval, and added to the accumulated value of the hard disk read / write volume in the previous second time interval to obtain a total value of the hard disk read / write volume;
[0073] Step S2013: at every preset second time interval, a plurality of loss values calculated in the second time interval are accumulated to obtain an accumulated value, and the accumulated value is added to the accumulated value of the loss value in the previous second time interval to obtain a total loss value.
[0074] The loss statistics module sets a timed task to count the total average CPU usage, total hard disk read / write volume, and total loss of each server at a preset second time interval (such as 1 hour, 2 hours, etc.) Preferably, the second time interval of this embodiment is set to 1 hour.
[0075] The CPU usage rate obtained by the load collection module is automatically triggered by the set scheduled task to calculate the average value, and the average CPU usage rate of the server in the time interval is calculated regularly (for example, the second time interval is set to 1 hour, the load collection module collects the CPU usage rate every 1 minute, and the loss statistics module reads the CPU usage rate that has not been calculated after the last scheduled task is started from the first data table of the database, and calculates the average value of the multiple CPU usage rate data collected in this time period to obtain the average CPU usage rate of this time period). Then, by accumulating the average CPU usage rate of each time interval, that is, regularly calculating the average value of the CPU usage rate obtained within this hour, the average CPU usage rate is obtained, and added to the average CPU usage rate of the previous hour stored in the database table, the total value of the average CPU usage rate of the server from the first time it went online to the present can be obtained, thereby reflecting the long-term load situation of the server.
[0076] For the total hard disk read and write volume, the system also calculates the hard disk read and write volume data of each server within the preset second time interval at regular intervals. That is to say, after the scheduled task is started, the system will read the hard disk read and write volume that has not been calculated since the last scheduled task was started from the first data table. For example, if the second time interval is set to 1 hour, the load collection module will store the hard disk read and write volume collected every 1 minute in the database table, and the loss statistics module will read multiple hard disk read and write volume data that have not been calculated (that is, within the hour) since the last scheduled task was started from the first data table of the database for cumulative calculation to obtain the cumulative value of the hard disk read and write volume in this time period. Then, by accumulating the hard disk read and write volume of each time interval, the total hard disk read and write volume of the server from the first time it went online to the present can be obtained, thereby reflecting the overall hard disk usage of the server.
[0077] For the total loss value, the system also regularly calculates the loss value of each server within the preset second time interval. Since the loss value has been calculated and stored in the first data table, after the scheduled task is started, the system will read the loss value that has not been calculated after the last scheduled task was started from the first data table and perform cumulative calculations to obtain the cumulative value of the loss value for this time period. Then, by accumulating the loss value of each time interval, the total loss value of the server from the first time it went online to the present can be obtained, thereby reflecting the overall performance loss of the server.
[0078] Therefore, the calculation of these three values is performed as a scheduled task every second preset time interval, reading all the loss values that have not been calculated since the last scheduled task, and accumulating them according to the server UUID and the previous calculation results to obtain the total value of the server from the first time it went online to the present. The total loss value is used to calculate the health of the server and sort the health. It should be noted that the average CPU usage is in the database table, and its value is cumulative, so when using the average CPU usage for calculation, it needs to be divided by the server usage time.
[0079] Step S202: assign corresponding third and fourth weight coefficients to the total loss value and the usage time of the server, and calculate the health degree based on a preset health degree initial value.
[0080] In this embodiment, step S202 specifically includes:
[0081] Step S2021: multiplying the third weight coefficient by the total loss value to obtain a loss component;
[0082] Step S2022: multiplying the fourth weight coefficient by the usage time of the server to obtain a time component;
[0083] Step S2023: Subtract the loss component and the time component from the initial health value in sequence to obtain the health.
[0084] The third weight coefficient is used to adjust the influence of the total loss value when calculating health. The fourth weight coefficient is similar to the third weight coefficient. It is also a preset coefficient used to adjust the influence of server usage time when calculating health. With the expansion of cluster scale, the upgrade of server hardware and the change of business needs, the weight coefficient can be adjusted regularly or irregularly. When adjusting the weight coefficient, it is necessary to comprehensively consider factors such as the server's hardware configuration, operating environment, and business needs. After adjusting the weight coefficient, it is necessary to verify its effect through experiments to ensure the rationality and effectiveness of the resource allocation strategy.
[0085] It should be noted that the initial health value is the default value when the server is first put online. It can be adjusted according to factors such as the server's hardware configuration, expected service life, and business needs. For example, if the expected service life of the server is 10 years, its initial health value is set to 10000. The initial value is set high so that it will gradually decrease in subsequent use, reflecting the aging process of the server. When the health of the server drops to a negative value, it means that the server is in a serious aging or failure state and needs to be dealt with as soon as possible. Therefore, an alarm mechanism is implemented to notify the operation and maintenance personnel in time when the health drops to a negative value. You can also set an alarm threshold. Once the server's health drops below the threshold, the alarm mechanism is triggered. The alarm information can be sent in a variety of ways, such as email, SMS, or instant messaging tools. After receiving the alarm information, the operation and maintenance personnel should immediately inspect and repair the server. For example, take hardware replacement, upgrade the system, or other necessary operation and maintenance measures.
[0086] The server usage time reflects the length of time the server has been in use since it was first enabled. This indicator is crucial for evaluating the stability and reliability of the server, because during the use of the hardware server, its electronic components will gradually age over time, thus affecting the overall performance and stability of the server.
[0087] The health score is a relative value that reflects the current health status of the server. The health score calculation formula for a server is: Health = (Health Initial Value - ( x × total loss)-( y × server usage time))*100%. Among them, x and y is the weight coefficient, which can be adjusted according to actual conditions.
[0088] For performance indicator data such as the total value of CPU average usage, total value of hard disk read and write volume, health, total value of loss, etc., corresponding charts or text display areas can be added on the system page for display. Among them, due to the different launch time and usage time of the server, the total value of CPU average usage needs to be divided by the server usage time when displayed on the page.
[0089] Step S203: storing the health update time point, the UUID of the server, the total value of the average CPU usage, the total value of the hard disk read and write volume, the total value of the loss and the health in a preset second data table;
[0090] Step S204: sort the second data table according to health level.
[0091] Create a second data table in the database. The fields created in the data table include: update time point, UUID, total CPU usage, total hard disk read and write volume, and total loss, etc. Select appropriate data types, design reasonable constraints, and appropriate indexes for the created fields. For example, the UUIDs of the first data table and the second data table are set as primary keys respectively. When establishing the relationship between tables, a foreign key relationship is established through UUID, and the UUID field of one data table is associated with the UUID field in another data table.
[0092] The system stores information such as the update time of health, the UUID (unique identifier) of the server, the total value of the average CPU usage, the total value of the hard disk read and write volume, the total value of the loss, and the health in the preset second data table. Storing health information helps the system track the health of the server in real time and provide accurate decision-making basis for the resource allocation module. The health information in the second data table is sorted and arranged from high to low or from low to high according to the health. The sorting result reflects the health status and performance stability of each server in the server cluster. Therefore, by regularly updating the health and sorting results, the effectiveness of the resource allocation strategy is guaranteed to adapt to the dynamic changes in the cluster operation status.
[0093] Step S3: Based on the user's resource application request and the server health ranking results, the most suitable server resources are selected and resource allocation is performed.
[0094] In this embodiment, step S3 specifically includes:
[0095] Step S301: receiving a resource allocation application request and determining the request type;
[0096] Step S302: Determine a health threshold range based on the request type;
[0097] Step S303: Based on the health threshold range, select corresponding server resources from the health ranking results and allocate resources.
[0098] Specifically, the resource allocation module first receives resource allocation application requests from users or applications. These requests may include adding computing resources, storage resources or network resources. After receiving the application, the resource allocation module analyzes the type of request. The request type may include test environment request, production environment request, development environment request, etc.
[0099] Depending on the request type, the resource allocation module will look up the corresponding health threshold range from a preset health threshold table. This table may contain health ranges corresponding to different types of requests. For example, for production environment requests, the module may look for a higher health threshold range to ensure that the allocated server has higher stability and performance; while for test environment requests, the module may look for a lower health threshold range to make full use of the server resources with lower health in the cluster.
[0100] The resource allocation module selects qualified server resources from the health ranking results according to the health threshold range determined in step S302. For example, for production environment requests, the module will select servers with higher health rankings; and for test environment requests, the module may select servers with lower health rankings. Because the test environment has lower requirements for stability, even if the server fails or performance degrades during the test process, it will not have any impact on the production environment. For applications in the production environment, the resource allocation module will give priority to servers with high health to ensure the stability and reliability of the service. Therefore, different resource allocation strategies are adopted for different application requests to achieve reasonable resource allocation and overall loss balance, thereby improving the operating efficiency and reliability of the server cluster.
[0101] In summary, the present invention provides a cluster server resource allocation method, which periodically obtains the load data of each server in the server cluster and calculates the loss value; based on the loss value and the usage time of the server, the health of each server is periodically calculated and the health is sorted; based on the user's resource application request and the health ranking result of the server, the most suitable server resource is selected and the resource is allocated. The present invention comprehensively considers the server's load data, such as CPU usage and hard disk read and write volume, and periodically calculates the server's loss, and then further derives the server's health index, and sorts the server according to the health index, so that different allocation strategies are adopted according to the user's application request when allocating resources to reduce the weight of high-loss servers. Therefore, reasonable resource allocation and overall loss balance are achieved, ensuring load balancing and efficient operation of cluster servers. Moreover, by regularly updating the health and sorting results, it can adapt to the dynamic changes in the cluster's operating status and ensure the effectiveness of the resource allocation strategy.
[0102] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0103] In addition, some embodiments of the present application also provide an electronic device. The electronic device may be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, etc. The electronic device may also be a mobile device in various forms, such as a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices.
[0104] The electronic device comprises: one or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the cluster server resource allocation method provided in any one or more of the above embodiments. Figure 2 An exemplary structural diagram of the electronic device is disclosed. Figure 2 As shown, the electronic device includes: one or more processors 1101, a memory 1102, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Among them, the components shown in this article, their connections and relationships, and their functions are only examples, and are not intended to limit the implementation of the present application described and / or required herein.
[0105] The electronic device may further include: an input device 1103 and an output device 1104. The processor 1101, the memory 1102, the input device 1103 and the output device 1104 may be connected via a bus or other means. Figure 2 The example of connecting through bus is taken in the following.
[0106] The input device 1103 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 1104 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0107] To provide interaction with a user, the electronic device may be a computer. The computer has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0108] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium, and when the computer program / instruction is executed by a processor, the steps of the cluster server resource allocation method provided in any one or more of the above embodiments are implemented. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more computer-readable instructions.
[0109] The memory 1102 can be used as a non-transient computer-readable storage medium, which can be used to store non-transient software programs, non-transient computer executable programs and modules. The processor 1101 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1102, so as to implement the program instructions / modules corresponding to the method provided by any one or more embodiments in the embodiments of the present application.
[0110] The memory 1102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1102 may optionally include a memory remotely arranged relative to the processor 1101, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0111] It should be noted that more specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0112] Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0113] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0114] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. For example, an application-specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware device may be used for implementation. In some embodiments, the software program of the present application may be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) may be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive or a floppy disk and the like. In addition, some steps or functions of the present application may be implemented by hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.
[0115] The computer program product provided in the embodiment of the present application includes one or more computer programs / instructions, which, when executed by the processor, generate in whole or in part the process or function described in the embodiment of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL, Digital Subscriber Line)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive, solid state disk, SSD), etc.
[0116] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0117] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.
Claims
1. A cluster server resource allocation method, characterized in that: include: Regularly obtain the load data of each server in the server cluster and calculate the loss value, wherein the load data includes: CPU usage and hard disk read and write volume; The step of regularly acquiring the load data of each server in the server cluster and calculating the loss value comprises: At every preset first time interval, regularly collect the CPU usage rate and hard disk read and write volume of each server; Allocating corresponding first weight coefficient and second weight coefficient to the CPU usage rate and the hard disk read / write volume, and calculating the loss value; The load data collection time point, the UUID of the server, the CPU usage rate, the hard disk read / write volume, and the loss value are stored in a preset first data table; Based on the loss value and the usage time of the server, the health of each server is regularly calculated and ranked, including: At every preset second time interval, based on the CPU usage, the hard disk read / write volume and the loss value, respectively calculate the total value of the CPU average usage, the total value of the hard disk read / write volume and the total loss value; Allocating corresponding third and fourth weight coefficients to the total loss value and the usage time of the server, and calculating the health degree based on a preset health degree initial value; The health update time point, the UUID of the server, the total value of the average CPU usage, the total value of the hard disk read and write volume, the total loss value and the health are stored in a preset second data table; sorting the second data table according to health level; After the scheduled task is started, the system will read the loss values that have not been calculated after the last scheduled task was started from the first data table and perform cumulative calculations to obtain the cumulative value of the loss value for this time period, and then accumulate the loss values of each of the second time intervals to obtain the total loss value of the server from the first time it went online to the present; The step of allocating corresponding third weight coefficients and fourth weight coefficients to the total loss value and the usage time of the server, and calculating the health degree based on a preset health degree initial value, comprises: Multiplying the third weight coefficient by the total loss value to obtain a loss component; Multiplying the fourth weight coefficient by the usage time of the server to obtain a time component; Subtract the loss component and the time component from the initial health value in sequence to obtain the health, wherein the initial health value is set according to the expected service life of the server; Based on the user's resource application request and the server health ranking results, the most appropriate server resources are selected and allocated.
2. The cluster server resource allocation method according to claim 1, characterized in that: The step of allocating the first weight coefficient and the second weight coefficient corresponding to the CPU usage rate and the hard disk read / write volume, and calculating the loss value comprises: Multiplying the first weight coefficient by the CPU usage rate to obtain a CPU loss component; Multiplying the second weight coefficient by the hard disk read / write volume to obtain a hard disk loss component; The CPU loss component and the hard disk loss component are added together to obtain the loss value.
3. The cluster server resource allocation method according to claim 1, characterized in that: The step of calculating the total value of the average CPU usage, the total value of the hard disk read / write volume, and the total value of the loss at every preset second time interval based on the CPU usage, the hard disk read / write volume, and the loss value, respectively, comprises: At every preset second time interval, regularly calculate the average value of the CPU usage obtained in the second time interval to obtain the average CPU usage, and add it to the average CPU usage of the last second time interval to obtain the total value of the average CPU usage; At every second time interval, the accumulated value of the hard disk read / write volume obtained in the second time interval is calculated at the same time, and added to the accumulated value of the hard disk read / write volume in the last second time interval to obtain the total value of the hard disk read / write volume; At every preset second time interval, a plurality of loss values calculated within the second time interval are accumulated to obtain an accumulated value, and the accumulated value is added to the accumulated value of the loss value of the last second time interval to obtain the total loss value.
4. The cluster server resource allocation method according to claim 1, characterized in that: The step of selecting the most suitable server resources and allocating resources based on the user's resource application request and the server health ranking result includes: Receive resource allocation application requests and determine the request type; Based on the request type, determining a health threshold range; Based on the health threshold range, corresponding server resources are selected from the health ranking results and resources are allocated.
5. An electronic device, characterized in that: The electronic device comprises: One or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the cluster server resource allocation method according to any one of claims 1 to 4.
6. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the cluster server resource allocation method according to any one of claims 1 to 4 are implemented.
7. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the cluster server resource allocation method as described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Message-in-message station resource scheduling method, device thereof, equipment and medium
CN119172384A
Methods and systems for prioritizing nameservers
US20150319097A1