Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the convenience of understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Fig. 1 is an application scenario diagram of a control method for a server according to an embodiment of the present invention, and as shown in fig. 1, the application scenario specifically includes: the system comprises at least one client, at least one server and a monitoring system. The client sends a (HyperText Transfer Protocol, HTTP) request to the server, and the server returns a processing result of the request to the client; the monitoring system prestores the capacity expansion/reduction rules of the server, is responsible for monitoring the running state of the server, acquiring the average resource utilization rate and the average garbage recovery frequency of the server, and judging whether the server needs to expand/reduce the capacity according to the average resource utilization rate and the average garbage recovery frequency of the server so as to meet the requirement for processing the client request.
Further, the average resource usage of the server may include:
average Central Processing Unit (CPU) utilization, average memory utilization, and average Input/Output (I/O) utilization.
The following describes a control method of a server in detail with a monitoring system as an execution subject of the present solution.
Fig. 2 is a schematic flowchart of a control method of a server according to an embodiment of the present invention, and as shown in fig. 2, the method specifically includes:
and S21, acquiring the average resource utilization rate and the average garbage collection frequency corresponding to one or more servers.
In the embodiment of the invention, the monitoring system sends a data acquisition request to the server, and the server responds to the data acquisition request and returns the average resource utilization rate and the average garbage collection frequency information of the server to the monitoring system.
The average resource usage of the server may include: average CPU utilization, average memory utilization, and average I/O utilization.
And S22, determining the capacity expansion/reduction strategy corresponding to the server based on the average resource utilization rate, the average garbage collection frequency and a preset capacity expansion/reduction rule.
In the embodiment of the invention, a capacity expansion rule and a capacity reduction rule are preset, and the number of the servers is controlled according to the rules.
Further, judging whether the current server meets an expansion/contraction rule or not according to the obtained average resource utilization rate and the average garbage recycling frequency of the server, and if the current server meets the expansion rule, determining an expansion strategy (increasing the number of servers) corresponding to the server; and if the current server meets the capacity reduction rule, determining a capacity reduction strategy corresponding to the server (reducing the number of the servers).
In an alternative of the embodiment of the present invention, different conditions are correspondingly set for the capacity expansion rule and the capacity reduction rule, and the conditions may be determined according to the average resource utilization rate and the average garbage collection frequency of the server.
For example, when the average resource usage includes resource usage information (CPU average usage, memory average usage, or I/O average usage), a first threshold corresponding to CPU average usage (e.g., 80%) is set, a second threshold corresponding to memory average usage (e.g., 80%) is set, and a third threshold corresponding to I/O average usage (e.g., 80%) is set; a fourth threshold (e.g., 80/s) corresponding to the average garbage collection frequency is set.
Determining conditions corresponding to the conditions meeting the capacity expansion rule based on the above steps includes: the average CPU utilization rate is greater than or equal to a first threshold, the average memory utilization rate is greater than or equal to a second threshold, the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage recycling frequency is greater than or equal to a fourth threshold;
further, determining that the condition corresponding to the contraction and capacity rule is met includes: the average utilization rate of the CPU is smaller than a first threshold value, the average utilization rate of the memory is smaller than a second threshold value, the average utilization rate of the I/O is smaller than a third threshold value, and the average garbage recycling frequency is smaller than a fourth threshold value.
And S23, controlling the number of the servers based on the capacity expansion/reduction strategy.
In the embodiment of the invention, if the capacity expansion strategy corresponding to the server is determined, the number of the servers is increased so as to meet the requirement of processing the client request and improve the service efficiency; and if the capacity reduction strategy corresponding to the server is determined, reducing the number of the servers so as to avoid resource waste.
According to the control method of the server, provided by the embodiment of the invention, the average resource utilization rate and the average garbage recovery frequency of the server are monitored, the capacity expansion/reduction strategy met by the server is judged according to the average resource utilization rate and the average garbage recovery frequency, and the number of the servers is controlled according to the capacity expansion/reduction strategy, so that the dynamic adjustment of the number of the servers is realized, the server can efficiently process the data request of the client under the condition of not overload, and the service efficiency is improved; and the resource waste caused by too many idle servers can be avoided.
Fig. 3 is a schematic flowchart of another method for controlling a server according to an embodiment of the present invention, and as shown in fig. 3, the method specifically includes:
and S31, acquiring the average resource utilization rate and the average garbage collection frequency corresponding to one or more servers.
In the embodiment of the invention, a server receives and processes HTTP requests of a client, in the processing process, the number of the HTTP requests can occupy different average resource utilization rates and average garbage recovery frequencies of the server, an agent is deployed on each server in advance, the average resource utilization rate and the average garbage recovery frequency information of the server are collected in real time/at regular time through the agent, and a monitoring system sends the requests to the agent to obtain the average resource utilization rate and the average garbage recovery frequency information corresponding to the server.
For example, a timer is set in the monitoring system, and a request is sent to the agent at intervals of a set time, so as to obtain the average resource utilization rate and the average garbage collection frequency corresponding to the server.
Further, the average resource usage rate and the average garbage collection frequency obtained from the agent may be stored in the local memory of the monitoring system.
The average resource usage by the server includes: average CPU utilization, average memory utilization, and average I/O utilization.
For example, the average resource usage rate and the average garbage collection frequency acquired at different times may be:
9:00 the average utilization rate of CPU of the server is 10%, the average utilization rate of memory is 30%, the average utilization rate of I/O is 30% and the average garbage collection frequency is 20/s; 9:10, the average utilization rate of the CPU of the server is 30%, the average utilization rate of the memory is 30%, the average utilization rate of the I/O is 50% and the average garbage collection frequency is 50/s; the average CPU utilization rate of the 10:00 server is 60%, the average memory utilization rate is 60%, the average I/O utilization rate is 70% or the average garbage collection frequency is 100/s.
S32, if the ratio of the average CPU utilization rate to the average resource utilization rate of the server to the average memory utilization rate is greater than or equal to a first threshold, the average I/O utilization rate to the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage collection frequency is greater than or equal to a fourth threshold is greater than or equal to a fifth threshold, determining to expand the capacity of the server.
In the embodiment of the present invention, the average resource utilization includes resource utilization information (CPU average utilization, memory average utilization, and I/O average utilization), and a first threshold (e.g., 60%) corresponding to the CPU average utilization, a second threshold (e.g., 60%) corresponding to the memory average utilization, and a third threshold (e.g., 70%) corresponding to the I/O average utilization are set; setting a fourth threshold (for example, 100/s) corresponding to the average garbage recycling frequency; the four parameters are at the fifth threshold (e.g., 75%) corresponding to the percentage of the normal range.
Determining conditions corresponding to the conditions meeting the capacity expansion rule based on the above steps includes:
the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage collection frequency meet the condition that the occupation ratio of the average CPU utilization rate is greater than or equal to a first threshold value, the average memory utilization rate is greater than or equal to a second threshold value, the average I/O utilization rate is greater than or equal to a third threshold value and the average garbage collection frequency is greater than or equal to a fourth threshold value is greater than or equal to a fifth threshold value;
for example, if the average CPU utilization is greater than or equal to 60%, the average memory utilization is greater than or equal to 60%, the average I/O utilization is greater than or equal to 70%, and the average garbage collection frequency is less than 100/s, the percentage of the average CPU utilization greater than or equal to the first threshold, the average memory utilization greater than or equal to the second threshold, the average I/O utilization greater than or equal to the third threshold, and the average garbage collection frequency greater than or equal to the fourth threshold is 75%, and the server meets the conditions corresponding to the capacity expansion rule.
For another example, if the average CPU utilization is less than 60%, the average memory utilization is less than 60%, the average I/O utilization is greater than or equal to 70%, and the average garbage collection frequency is greater than or equal to 100/s, the occupation ratio that the average CPU utilization is greater than or equal to the first threshold, the average memory utilization is greater than or equal to the second threshold, the average I/O utilization is greater than or equal to the third threshold, and the average garbage collection frequency is greater than or equal to the fourth threshold is 50%, then the server does not meet the condition corresponding to the capacity expansion rule.
Or,
the average CPU utilization rate is greater than or equal to a first threshold value.
For example, if the average CPU utilization is greater than or equal to 60%, the server meets the condition corresponding to the capacity expansion rule.
Further, determining that the condition corresponding to the contraction and capacity rule is met includes:
the average utilization rate of the CPU is smaller than a first threshold value, the average utilization rate of the memory is smaller than a second threshold value, the average utilization rate of the I/O is smaller than a third threshold value, and the average garbage recycling frequency is smaller than a fourth threshold value.
And S33, if the capacity of the server is determined to be expanded, determining the configuration information corresponding to any one of the servers from one or more servers.
In this embodiment of the present invention, a server is randomly selected from one or more servers, and hardware configuration information of the server is obtained, where the hardware configuration information is used to configure a server with the same configuration as the selected server, and the configuration information may include: the size or bandwidth of the CPU core, memory, etc.
In an alternative of the embodiment of the present invention, when the server expands the capacity, the HTTP requests of the client are subjected to the current limiting processing, specifically including limiting the number of the HTTP requests of the client, and returning a specific current limiting error code to the rejected requests.
And S34, according to the configuration information, gradually adding one server to one or more servers, so that the occupation ratio of the average CPU utilization rate in the average resource utilization rates of the servers is greater than or equal to a first threshold, the average memory utilization rate is greater than or equal to a second threshold, the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage collection frequency is greater than or equal to a fourth threshold is less than a fifth threshold, and the average CPU utilization rate is less than the first threshold. In the embodiment of the invention, one server is reconfigured according to the configuration information, and the configured server is added to one or more existing servers.
The specific addition mode can be as follows: and gradually adding one server to one or more servers, and judging whether the average resource utilization rate and the average garbage collection frequency meet the condition of continuous capacity expansion once every time until parameters in the average resource utilization rate and the average garbage collection frequency of the servers meet the conditions that the average CPU utilization rate is greater than or equal to a first threshold value, the average memory utilization rate is greater than or equal to a second threshold value, the occupation ratio of the average I/O utilization rate is greater than or equal to a third threshold value and the average garbage collection frequency is greater than or equal to a fourth threshold value is less than a fifth threshold value, and the average CPU utilization rate is less than the first threshold value.
For example, after determining that the number of servers needs to be increased, the existing server a1 and server a2 first add a server A3 with the same configuration information according to the configuration information of the server a1 or the server a2, add the server A3 to the server a1 and the server a2, and then the monitoring system determines whether the number of servers needs to be increased according to the latest collected average resource utilization rate and average garbage collection frequency of all servers including the server A3, and if so, add a server a4 with the same configuration information according to the configuration information of the server a1, the server a2, or the server A3 until the ratio of the average resource utilization rate of the servers and the average garbage collection frequency satisfies that the average utilization rate of the CPU is greater than or equal to a first threshold, the average memory utilization rate is greater than or equal to a second threshold, the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage collection frequency is greater than or equal to a fourth threshold and is less than a fifth threshold, and the ratio is The average CPU utilization rate is less than a first threshold.
In an alternative of the embodiment of the present invention, a plurality of servers may be added to one or more of the servers simultaneously according to the average resource usage rate and the average garbage collection frequency of the servers, and the number of the servers added simultaneously may be determined according to the average resource usage rate and the average garbage collection frequency of the servers.
For example, the first threshold value is set in advance to 60% and it is set in advance to increase one server for every 10% exceeding the first threshold value, simply by the CPU average usage judgment. When the average resource utilization rate of the servers and the average CPU utilization rate in the average garbage collection frequency collected by the monitoring system are 90%, the first threshold value is exceeded by 30%, and 3 servers are required to be added at one time.
In an alternative of the embodiment of the present invention, if it is determined to expand the servers, one or more servers are configured to a server cluster formed by one or more current servers according to mirror image information configuring the current server to form a new server cluster, so that an occupation ratio of an average CPU utilization rate in the average resource utilization rates in the new server cluster, which is greater than or equal to a first threshold, an average memory utilization rate, which is greater than or equal to a second threshold, an average I/O utilization rate, which is greater than or equal to a third threshold, and an average garbage collection frequency, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, and the average CPU utilization rate is smaller than the first threshold.
For example, the memory of the preconfigured server is 5G, the average memory usage rate is increased due to the increase of data requests of the clients, the server needs to be expanded, and in order to avoid the instability of the system caused by multiple expansion of the server, 3 servers with 5G memories can be configured in a mirror image manner to be added to one or more current servers to form a new server cluster, so as to optimize the existing server.
S35, in a set time, if the average CPU utilization rate is smaller than a first threshold, the average memory utilization rate is smaller than a second threshold, the average I/O utilization rate is smaller than a third threshold and the average garbage collection frequency is smaller than a fourth threshold in the average resource utilization rates of the servers, determining to perform capacity reduction on the servers.
In an alternative of the embodiment of the present invention, if the server has already been capacity-expanded, after the server runs for a set time, it is determined whether the server needs to perform capacity reduction.
For example, the existing server cluster has already been expanded and stably operates for a set time period, and the monitoring system collects the average resource utilization rate and the average garbage collection frequency of the latest server, and according to the conditions corresponding to the contraction and expansion rule: the average CPU utilization rate is smaller than a first threshold, the average memory utilization rate is smaller than a second threshold, the average I/O utilization rate is smaller than a third threshold, and the average garbage collection frequency is smaller than a fourth threshold, whether the collected average resource utilization rate and the average garbage collection frequency of the latest server meet the capacity reduction condition is judged, and if yes, the number of the servers needs to be reduced.
S36, if it is determined to perform capacity reduction on the servers, successively reducing one server from the plurality of servers, so that an occupation ratio of the average CPU utilization rate of the average resource utilization rates of the servers, which is greater than or equal to a first threshold, the average memory utilization rate of the servers, which is greater than or equal to a second threshold, the average I/O utilization rate of the servers, which is greater than or equal to a third threshold, and the average garbage collection frequency of the servers, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, and the average CPU utilization rate is smaller than the first threshold, the average memory utilization rate of the servers is smaller than the second threshold, the average I/O utilization rate of the servers is smaller than the third threshold, and the occupation ratio of the average garbage collection frequency of the servers, which is smaller than the fourth.
In this embodiment, the presetting of the capacity reduction condition may specifically include:
the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage collection frequency meet the conditions that the average CPU utilization rate is greater than or equal to a first threshold value, the average memory utilization rate is greater than or equal to a second threshold value, the average I/O utilization rate is greater than or equal to a third threshold value and the average garbage collection frequency is greater than or equal to a fourth threshold value, wherein the proportion of the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage.
The specific reduction method may be: and successively reducing one server, and after the server continues to stably run for a preset time period every time, judging whether the average resource utilization rate and the average garbage recovery frequency of the latest server meet the condition of continuing capacity reduction again until the parameters in the average resource utilization rate and the average garbage recovery frequency of the server meet the condition of capacity reduction.
For example, there are four preconfigured servers including: a1, A2, A3 and A4, the server needs to be expanded by judging the average resource utilization rate and the average garbage collection frequency of the server, and the number of the expanded servers is 6, which comprises: a1, A2, A3, A4, A5 (newly added) and A6 (newly added), after the server stably runs for a period of time, the capacity reduction is needed by judging the average resource utilization rate and the average garbage recovery frequency of the server, and 5 servers after the capacity reduction comprise: a1, a2, A3, a4 and a5 (new); or, there are 5 servers after the capacity reduction, including: a2, A3, a4, a5 (new) and a6 (new).
In an alternative of the embodiment of the present invention, if it is determined to perform capacity reduction on the servers, controlling the number of the servers after capacity reduction to be greater than or equal to the initial number of the servers; the initial number is the number of the server before capacity expansion is performed.
According to the control method of the server, provided by the embodiment of the invention, the average resource utilization rate and the average garbage recovery frequency of the server are monitored, the capacity expansion/reduction strategy met by the server is judged according to the average resource utilization rate and the average garbage recovery frequency, the number of the servers is controlled according to the capacity expansion/reduction strategy, the dynamic adjustment of the number of the servers is realized, when the number of the servers is increased, the server can efficiently process the data request of the client under the condition of no overload, and the service efficiency is improved; when the number of the servers is reduced, the resource waste caused by excessive idle servers can be avoided.
Fig. 4 is a schematic structural diagram of a control device of a server according to an embodiment of the present invention, which specifically includes:
an obtaining module 401, configured to obtain an average resource utilization rate and an average garbage collection frequency corresponding to one or more servers;
a determining module 402, configured to determine, based on the average resource usage rate, the average garbage collection frequency, and a preset capacity expansion/reduction rule, a capacity expansion/reduction policy corresponding to the server;
a control module 403, configured to control the number of servers based on the capacity expansion/reduction policy.
In a possible implementation manner, the determining module is specifically configured to determine the average resource usage rate includes a Central Processing Unit (CPU) average usage rate, a memory average usage rate, and an Input/Output (I/O) average usage rate; if the proportion of the average CPU utilization rate to the average resource utilization rate of the server is greater than or equal to a first threshold value, the average memory utilization rate to the average memory utilization rate is greater than or equal to a second threshold value, the average I/O utilization rate to the average I/O utilization rate is greater than or equal to a third threshold value, and the average garbage collection frequency is greater than or equal to a fourth threshold value is greater than or equal to a fifth threshold value, determining to expand the capacity of the server; and in a set time, if the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage collection frequency in the average resource utilization rates of the server are smaller than a first threshold, a second threshold and a fourth threshold, determining to reduce the capacity of the server.
In a possible implementation manner, the determining module is further configured to determine to expand the server if the average CPU utilization rate in the average resource utilization rates of the server is greater than or equal to a first threshold.
In a possible implementation manner, the determining module is further configured to determine, if it is determined to expand the servers, configuration information corresponding to any one of the servers from one or more of the servers.
In a possible implementation manner, the control module is specifically configured to gradually add one server to one or more servers according to the configuration information, so that an occupation ratio of the average CPU utilization rate of the average resource utilization rates of the servers, which is greater than or equal to a first threshold, the average memory utilization rate, which is greater than or equal to a second threshold, the average I/O utilization rate, which is greater than or equal to a third threshold, and the average garbage collection frequency, which is greater than or equal to a fourth threshold, is less than a fifth threshold, and the average CPU utilization rate is less than the first threshold.
In a possible implementation manner, the control module is further configured to successively reduce one server from the plurality of servers if it is determined to scale down the server, so that an occupation ratio of the average CPU utilization rate of the average resource utilization rates of the servers, which is greater than or equal to a first threshold, the average memory utilization rate of the servers, which is greater than or equal to a second threshold, the average I/O utilization rate of the servers, which is greater than or equal to a third threshold, and the average garbage collection frequency of the servers, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, the average CPU utilization rate of the servers is smaller than the first threshold, the average memory utilization rate of the servers is smaller than the second threshold, the average I/O utilization rate of the servers is smaller than the third threshold, and the occupation ratio of the average garbage collection frequency of the servers, which is smaller than the fourth threshold.
In a possible embodiment, the control module is further configured to control the number of the servers after the capacity reduction to be greater than or equal to the initial number of the servers if it is determined that the capacity reduction is performed on the servers; the initial number is the number of the server before capacity expansion is performed.
In a possible implementation manner, the control module is further configured to configure one or more servers to a server cluster formed by one or more current servers according to mirror image information configuring the current server to form a new server cluster if it is determined to expand the servers, so that an occupation ratio of an average CPU utilization rate in the average resource utilization rates of the new server cluster, which is greater than or equal to a first threshold, an average memory utilization rate, which is greater than or equal to a second threshold, an average I/O utilization rate, which is greater than or equal to a third threshold, and an average garbage collection frequency, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, and the average CPU utilization rate is smaller than the first threshold.
The control device of the server provided in this embodiment may be the control device of the server shown in fig. 4, and may perform all the steps of the control method of the server shown in fig. 2 to 3, so as to achieve the technical effect of the control method of the server shown in fig. 2 to 3, and please refer to the description related to fig. 2 to 3 for brevity, which is not described herein again.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention, where thecomputer device 500 shown in fig. 5 includes: at least oneprocessor 501,memory 502, at least onenetwork interface 504, andother user interfaces 503. The various components in thecomputer device 500 are coupled together by abus system 505. It is understood that thebus system 505 is used to enable connection communications between these components. Thebus system 505 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled asbus system 505 in FIG. 5.
Theuser interface 503 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It is to be understood that thememory 502 in embodiments of the present invention may be either volatile memory or non-volatile memory, or may include both volatile and non-volatile memory, wherein non-volatile memory may be Read-only memory (ROM), programmable Read-only memory (programmable ROM), erasable programmable Read-only memory (EPROM ), electrically erasable programmable Read-only memory (EEPROM), or flash memory volatile memory may be Random Access Memory (RAM), which serves as external cache memory, by way of example and not limitation, many forms of RAM are available, such as static random access memory (staticiram, SRAM), dynamic random access memory (dynamicdram, SDRAM), synchronous dynamic random access memory (syncronous, SDRAM), double data rate synchronous dynamic random access memory (doubtatatare SDRAM, ddrsrssram), Enhanced synchronous dynamic random access memory (Enhanced DRAM, Enhanced SDRAM), synchronous DRAM, or SDRAM 3535L, which are intended to include, but not be limited to, and any other types of RAM suitable for direct access.
In some embodiments,memory 502 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof as follows: anoperating system 5021 andapplication programs 5022.
Theoperating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. Theapplication 5022 includes various applications, such as a media player (MediaPlayer), a Browser (Browser), and the like, for implementing various application services. The program for implementing the method according to the embodiment of the present invention may be included in theapplication program 5022.
In the embodiment of the present invention, by calling a program or an instruction stored in thememory 502, specifically, a program or an instruction stored in theapplication 5022, theprocessor 501 is configured to execute the method steps provided by the method embodiments, for example, including:
acquiring average resource utilization rate and average garbage recovery frequency corresponding to one or more servers; determining an expansion/contraction strategy corresponding to the server based on the average resource utilization rate, the average garbage recovery frequency and a preset expansion/contraction rule; and controlling the number of the servers based on the capacity expansion/reduction strategy.
In one possible embodiment, the average resource usage includes a Central Processing Unit (CPU) average usage, a memory average usage, and an Input/Output (I/O) average usage; if the proportion of the average CPU utilization rate to the average resource utilization rate of the server is greater than or equal to a first threshold value, the average memory utilization rate to the average memory utilization rate is greater than or equal to a second threshold value, the average I/O utilization rate to the average I/O utilization rate is greater than or equal to a third threshold value, and the average garbage collection frequency is greater than or equal to a fourth threshold value is greater than or equal to a fifth threshold value, determining to expand the capacity of the server; and in a set time, if the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage collection frequency in the average resource utilization rates of the server are smaller than a first threshold, a second threshold and a fourth threshold, determining to reduce the capacity of the server.
In a possible implementation manner, if the average CPU utilization in the average resource utilization of the server is greater than or equal to a first threshold, it is determined to expand the server.
In a possible embodiment, if it is determined that the capacity of the server is expanded, configuration information corresponding to any one of the servers is determined from one or more of the servers; according to the configuration information, one server is gradually added to one or more servers, so that the occupation ratio of the average CPU utilization rate in the average resource utilization rates of the servers to be greater than or equal to a first threshold value, the average memory utilization rate to be greater than or equal to a second threshold value, the average I/O utilization rate to be greater than or equal to a third threshold value and the average garbage collection frequency to be greater than or equal to a fourth threshold value is smaller than a fifth threshold value, and the average CPU utilization rate to be smaller than the first threshold value.
In a possible embodiment, if it is determined to scale down the servers, one server is successively reduced from the plurality of servers, so that an occupation ratio of the average CPU utilization rate of the average resource utilization rates of the servers, which is greater than or equal to a first threshold, the average memory utilization rate of the servers, which is greater than or equal to a second threshold, the average I/O utilization rate of the servers, which is greater than or equal to a third threshold, and the average garbage collection frequency of the servers, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, and the occupation ratio of the average CPU utilization rate of the servers, which is smaller than the first threshold, the average memory utilization rate of the servers, which is smaller than the second threshold, the average I/O utilization rate of the servers, which is smaller than the third threshold, and the average garbage collection frequency of the servers.
In a possible implementation manner, if the server is determined to be subjected to capacity reduction, controlling the number of the servers subjected to capacity reduction to be larger than or equal to the initial number of the servers; the initial number is the number of the server before capacity expansion is performed.
In a possible implementation manner, if it is determined to expand the servers, one or more servers are configured to a server cluster formed by one or more current servers according to mirror image information configuring the current servers to form a new server cluster, so that an occupation ratio of the average CPU utilization rate in the average resource utilization rates in the new server cluster is greater than or equal to a first threshold, the average memory utilization rate is greater than or equal to a second threshold, the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage collection frequency is greater than or equal to a fourth threshold is less than a fifth threshold, and the average CPU utilization rate is less than the first threshold.
The method disclosed by the above-mentioned embodiments of the present invention may be applied to theprocessor 501, or implemented by theprocessor 501. Theprocessor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in theprocessor 501. Theprocessor 501 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in thememory 502, and theprocessor 501 reads the information in thememory 502 and completes the steps of the method in combination with the hardware.
For a hardware implementation, the processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), digital signal processing devices (DSPDevices), Programmable logic devices (P L D), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The computer device provided in this embodiment may be the computer device shown in fig. 5, and may perform all the steps of the control method of the server shown in fig. 2 to 3, so as to achieve the technical effect of the control method of the server shown in fig. 2 to 3, and please refer to the related description of fig. 2 to 3 for brevity, which is not described herein again.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the control method of the server executed on the computer device side as described above is realized.
The processor is configured to execute a computer program stored in the memory to implement the following steps of a control method of a server executed on the computer device side:
acquiring average resource utilization rate and average garbage recovery frequency corresponding to one or more servers; determining an expansion/contraction strategy corresponding to the server based on the average resource utilization rate, the average garbage recovery frequency and a preset expansion/contraction rule; and controlling the number of the servers based on the capacity expansion/reduction strategy.
In one possible embodiment, the average resource usage includes a Central Processing Unit (CPU) average usage, a memory average usage, and an Input/Output (I/O) average usage; if the proportion of the average CPU utilization rate to the average resource utilization rate of the server is greater than or equal to a first threshold value, the average memory utilization rate to the average memory utilization rate is greater than or equal to a second threshold value, the average I/O utilization rate to the average I/O utilization rate is greater than or equal to a third threshold value, and the average garbage collection frequency is greater than or equal to a fourth threshold value is greater than or equal to a fifth threshold value, determining to expand the capacity of the server; and in a set time, if the average CPU utilization rate, the average memory utilization rate, the average I/O utilization rate and the average garbage collection frequency in the average resource utilization rates of the server are smaller than a first threshold, a second threshold and a fourth threshold, determining to reduce the capacity of the server.
In a possible implementation manner, if the average CPU utilization in the average resource utilization of the server is greater than or equal to a first threshold, it is determined to expand the server.
In a possible embodiment, if it is determined that the capacity of the server is expanded, configuration information corresponding to any one of the servers is determined from one or more of the servers; according to the configuration information, one server is gradually added to one or more servers, so that the occupation ratio of the average CPU utilization rate in the average resource utilization rates of the servers to be greater than or equal to a first threshold value, the average memory utilization rate to be greater than or equal to a second threshold value, the average I/O utilization rate to be greater than or equal to a third threshold value and the average garbage collection frequency to be greater than or equal to a fourth threshold value is smaller than a fifth threshold value, and the average CPU utilization rate to be smaller than the first threshold value.
In a possible embodiment, if it is determined to scale down the servers, one server is successively reduced from the plurality of servers, so that an occupation ratio of the average CPU utilization rate of the average resource utilization rates of the servers, which is greater than or equal to a first threshold, the average memory utilization rate of the servers, which is greater than or equal to a second threshold, the average I/O utilization rate of the servers, which is greater than or equal to a third threshold, and the average garbage collection frequency of the servers, which is greater than or equal to a fourth threshold, is smaller than a fifth threshold, and the occupation ratio of the average CPU utilization rate of the servers, which is smaller than the first threshold, the average memory utilization rate of the servers, which is smaller than the second threshold, the average I/O utilization rate of the servers, which is smaller than the third threshold, and the average garbage collection frequency of the servers.
In a possible implementation manner, if the server is determined to be subjected to capacity reduction, controlling the number of the servers subjected to capacity reduction to be larger than or equal to the initial number of the servers; the initial number is the number of the server before capacity expansion is performed.
In a possible implementation manner, if it is determined to expand the servers, one or more servers are configured to a server cluster formed by one or more current servers according to mirror image information configuring the current servers to form a new server cluster, so that an occupation ratio of the average CPU utilization rate in the average resource utilization rates in the new server cluster is greater than or equal to a first threshold, the average memory utilization rate is greater than or equal to a second threshold, the average I/O utilization rate is greater than or equal to a third threshold, and the average garbage collection frequency is greater than or equal to a fourth threshold is less than a fifth threshold, and the average CPU utilization rate is less than the first threshold.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.