CN114385354A - Weight calculation method, system and medium based on server resource use condition - Google Patents
Weight calculation method, system and medium based on server resource use condition Download PDFInfo
- Publication number
- CN114385354A CN114385354A CN202111617593.2A CN202111617593A CN114385354A CN 114385354 A CN114385354 A CN 114385354A CN 202111617593 A CN202111617593 A CN 202111617593A CN 114385354 A CN114385354 A CN 114385354A
- Authority
- CN
- China
- Prior art keywords
- server
- resources
- resource
- weight
- cpu
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a weight calculation method, a system and a medium based on server resource use condition, wherein the method comprises the following steps of collecting all server resource use conditions; analyzing the collected server resources, and calculating corresponding weight values according to the server resources; modifying each service interface calling weight value, and calling and distributing again; and collecting the service condition of the server resource at regular time and circulating the steps. The weight calculation method based on the service condition of the server resource can prevent the instability of a service interface caused by the abnormal resource of a certain node in the cluster service. According to the invention, after the resource use conditions of each server of the cluster are collected, the resource use conditions are analyzed to obtain the corresponding weight values suitable for the resource conditions of each server, the proportion of each server can be dynamically adjusted and called, and the cluster service can run more stably.
Description
Technical Field
The invention relates to the technical field of data transmission, in particular to a weight calculation method, a weight calculation system and a weight calculation medium based on server resource use conditions.
Background
In the process of mass data transmission, stable operation of cluster services is required. However, due to the complex and uncontrollable use condition of server resources, the memory or CPU of a certain server is often suddenly increased, the service performance running on the server starts to be reduced, and the traditional weight distribution method is a fixed weight and a random weight, and cannot be dynamically adjusted and called according to system resources. The invention can dynamically balance the server pressure in the cluster according to the system resources, and prevent the overall performance of the cluster service from being reduced due to surge of certain server resources.
Disclosure of Invention
The invention provides a weight calculation method and a weight calculation system based on server resource use conditions, which can at least solve one of the technical problems in the background art.
In order to achieve the purpose, the invention adopts the following technical scheme:
a weight calculation method based on server resource use condition comprises the following steps,
collecting the use conditions of all server resources;
analyzing the collected server resources;
calculating a corresponding weight value according to server resources;
modifying each service interface calling weight value, and calling and distributing again;
and collecting the service condition of the server resource at regular time and circulating the steps.
Further, collecting all server resource usage, the steps are as follows,
and acquiring the resource use conditions of all servers in the cluster, including the CPU core number, the CPU use proportion, the memory size, the memory use proportion, the bandwidth size and the bandwidth use proportion of the servers.
Further analysis of the collected server resources is performed, as follows,
calculating the proportion of the total resources occupied by the residual resources of each server;
and calculating the corresponding proportion of each server.
Further, the using condition of the server resource is collected at regular time, and the steps are circulated, including,
and repeating the three steps, namely acquiring the resources of each server at regular time, and when the resource of a certain server is abnormal or the performance of the certain server is reduced, feeding back the resource in the weight result, and correspondingly making weight adjustment to ensure that the operation of the whole cluster is more stable and meets the residual performance requirement of the current machine.
In another aspect, the present invention also discloses a weight calculation system based on server resource usage, which includes the following units,
the data collection unit is used for collecting the use conditions of all server resources;
the resource data analysis unit is used for analyzing the collected server resources and calculating corresponding weight values according to the server resources;
the weight redistribution unit is used for modifying each service interface calling weight value and recalling distribution;
and the circulation collection analysis distribution unit is used for collecting the service condition of the server resource at regular time and circulating the steps.
In yet another aspect, the present invention also discloses a computer readable storage medium storing a computer program, which when executed by a processor causes the processor to perform the steps of the method as described above.
In yet another aspect, the present invention also discloses a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above method.
According to the technical scheme, the weight calculation method based on the service condition of the server resource can prevent the instability of the service interface caused by the abnormal resource of a certain node in the cluster service. According to the invention, after the resource use conditions of each server of the cluster are collected, the resource use conditions are analyzed to obtain the corresponding weight values suitable for the resource conditions of each server, the proportion of each server can be dynamically adjusted and called, and the cluster service can run more stably.
Drawings
Fig. 1 is a flowchart of a method for calculating weights based on server resource usage according to an embodiment of the present invention.
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.
As shown in fig. 1, the method for calculating weight based on server resource usage according to this embodiment includes the following steps,
collecting the use conditions of all server resources;
analyzing the collected server resources;
calculating a corresponding weight value according to server resources;
modifying each service interface calling weight value, and calling and distributing again;
and collecting the service condition of the server resource at regular time and circulating the steps.
The following are specifically described:
1. collecting all server resource usage
And acquiring the resource use conditions of all servers in the cluster, including the CPU core number, the CPU use proportion, the memory size, the memory use proportion, the bandwidth size and the bandwidth use proportion of the servers. For example: server one (CPU 16 core, CPU utilization 50%, memory 128G, utilization 50%, bandwidth 50M, utilization 50%), server two (CPU 16 core, CPU utilization 40%, memory 128G, utilization 40%, bandwidth 50M, utilization 40%), server three (CPU 32 core, CPU utilization 60%, memory 128G, utilization 60%, bandwidth 50M, utilization 60%).
2. Resource data analysis
1) And calculating the proportion of the total resources occupied by the residual resources of each server. The above sample data was analyzed:
the sum of the remaining resources of the server I is as follows: the remaining 50% of the CPU + the remaining 50% of the memory + the remaining 50% of the bandwidth is 150%;
the sum of the remaining resources of the server two is: CPU residual 60% + memory residual 60% + bandwidth residual 60% + 180%
The sum of the remaining resources of the server three is: CPU residual 40% + memory residual 40% + bandwidth residual 40% + 120%
2) The corresponding proportions of the three servers are calculated as: 150:180: 120-5: 6:4
3. Weight reassignment
And (4) taking the result of 5:6:4 calculated in the step (2) as the latest weight to inform the calling application end, and taking the new weight as the basis for accessing each server by the application end.
4. Cyclic collection analysis distribution
And (3) repeating the steps 1 to 3, regularly collecting resources of each server, and when the resource of a certain server is abnormal or the performance of the certain server is reduced, feeding back the resource in the weight result and correspondingly making weight adjustment so that the operation of the whole cluster is more stable and meets the residual performance requirement of the current machine.
In summary, the weight calculation method based on the service condition of the server resource of the present invention can prevent a certain node resource in the cluster service from being abnormal, which results in an unstable service interface. According to the invention, after the resource use conditions of each server of the cluster are collected, the resource use conditions are analyzed to obtain the corresponding weight values suitable for the resource conditions of each server, the proportion of each server can be dynamically adjusted and called, and the cluster service can run more stably.
In another aspect, the present invention also discloses a weight calculation system based on server resource usage, which includes the following units,
the data collection unit is used for collecting the use conditions of all server resources;
the resource data analysis unit is used for analyzing the collected server resources and calculating corresponding weight values according to the server resources;
the weight redistribution unit is used for modifying each service interface calling weight value and recalling distribution;
and the circulation collection analysis distribution unit is used for collecting the service condition of the server resource at regular time and circulating the steps.
In yet another aspect, the present invention also discloses a computer readable storage medium storing a computer program, which when executed by a processor causes the processor to perform the steps of the method as described above.
In yet another aspect, the present invention also discloses a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above method.
It is understood that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, the example and the beneficial effects of the related contents can refer to the corresponding parts in the method.
The embodiment of the application also provides an electronic device, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus,
a memory for storing a computer program;
a processor for implementing the above-mentioned method for calculating weight based on server resource usage when executing a program stored in a memory, the method comprising,
collecting the use conditions of all server resources;
analyzing the collected server resources, and calculating corresponding weight values according to the server resources;
modifying each service interface calling weight value, and calling and distributing again;
and collecting the service condition of the server resource at regular time and circulating the steps.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, or discrete hardware components.
In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above-mentioned server resource usage-based weight calculation methods.
In another embodiment provided by the present application, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to perform any one of the above-mentioned methods for weight calculation based on server resource usage.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (8)
1. A weight calculation method based on server resource use condition is characterized by comprising the following steps,
collecting the use conditions of all server resources;
analyzing the collected server resources, and calculating corresponding weight values according to the server resources;
modifying each service interface calling weight value, and calling and distributing again;
and collecting the service condition of the server resource at regular time and circulating the steps.
2. The method of claim 1, wherein the weight calculation is based on server resource usage, and wherein: all server resource usage is collected, as follows,
and acquiring the resource use conditions of all servers in the cluster, including the CPU core number, the CPU use proportion, the memory size, the memory use proportion, the bandwidth size and the bandwidth use proportion of the servers.
3. The method of claim 2, wherein the weight calculation is based on server resource usage, and wherein: the collected server resources are analyzed, and the steps are as follows,
calculating the proportion of the total resources occupied by the residual resources of each server;
and calculating the corresponding proportion of each server.
4. The method of claim 3, wherein the weight calculation is based on server resource usage, and wherein: collecting the service condition of the server resource at regular time, circulating the steps, including,
and repeating the three steps, namely acquiring the resources of each server at regular time, and when the resource of a certain server is abnormal or the performance of the certain server is reduced, feeding back the resource in the weight result, and correspondingly making weight adjustment to ensure that the operation of the whole cluster is more stable and meets the residual performance requirement of the current machine.
5. The method of claim 3, wherein the weight calculation is based on server resource usage, and wherein: assuming that all server resources include three servers, the usage is as follows,
the first server is a CPU 16 core, the utilization rate of the CPU is 50%, the utilization rate of a memory is 128G, the utilization rate is 50%, the bandwidth is 50M, and the utilization rate is 50%;
the second server is a CPU 16 core, the CPU utilization rate is 40%, the memory is 128G, the utilization rate is 40%, the bandwidth is 50M, and the utilization rate is 40%;
the third server is a CPU 32 core, the CPU utilization rate is 60%, the memory is 128G, the utilization rate is 60%, the bandwidth is 50M, and the utilization rate is 60%;
the above sample data is analyzed:
the sum of the remaining resources of the server I is as follows: the remaining 50% of the CPU + the remaining 50% of the memory + the remaining 50% of the bandwidth is 150%;
the sum of the remaining resources of the server two is: the CPU residual 60% + the memory residual 60% + the bandwidth residual 60% + is 180%;
the sum of the remaining resources of the server three is: the CPU residual 40% + the memory residual 40% + the bandwidth residual 40% + is 120%;
the respective proportions of the three servers are calculated as: 150:180: 120-5: 6: 4;
and (4) notifying the calling application end of the result of calculation of 5:6:4 as the latest weight, and taking the new weight as the basis for accessing each server by the application end.
6. A system for calculating weights based on server resource usage, comprising: comprises the following units of a first unit, a second unit,
the data collection unit is used for collecting the use conditions of all server resources;
the resource data analysis unit is used for analyzing the collected server resources and calculating corresponding weight values according to the server resources;
the weight redistribution unit is used for modifying each service interface calling weight value and recalling distribution;
and the circulation collection analysis distribution unit is used for collecting the service condition of the server resource at regular time and circulating the steps.
7. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 5.
8. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111617593.2A CN114385354A (en) | 2021-12-27 | 2021-12-27 | Weight calculation method, system and medium based on server resource use condition |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111617593.2A CN114385354A (en) | 2021-12-27 | 2021-12-27 | Weight calculation method, system and medium based on server resource use condition |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114385354A true CN114385354A (en) | 2022-04-22 |
Family
ID=81198736
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111617593.2A Pending CN114385354A (en) | 2021-12-27 | 2021-12-27 | Weight calculation method, system and medium based on server resource use condition |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114385354A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116319505A (en) * | 2023-02-10 | 2023-06-23 | 安芯网盾(北京)科技有限公司 | Route distribution method and device |
-
2021
- 2021-12-27 CN CN202111617593.2A patent/CN114385354A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116319505A (en) * | 2023-02-10 | 2023-06-23 | 安芯网盾(北京)科技有限公司 | Route distribution method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11824787B2 (en) | Method and apparatus for node speed limiting, electronic device and storage medium | |
US9703980B2 (en) | Centralized throttling service | |
CN111045782A (en) | Log processing method and device, electronic equipment and computer readable storage medium | |
CN111127181B (en) | Voucher accounting method and device | |
CN114189525B (en) | Service request method and device and electronic equipment | |
CN108156257B (en) | Information pushing method and device | |
CN111309485A (en) | Service calling method and device, electronic equipment and computer readable storage medium | |
CN112866062B (en) | Distributed pressure test system, method, device, equipment and storage medium | |
CN104008016A (en) | Information processing apparatus, resource control method, and program | |
CN114385354A (en) | Weight calculation method, system and medium based on server resource use condition | |
CN110222034A (en) | A kind of database maintenance method and device | |
CN111274012B (en) | Service scheduling method, device, electronic equipment and storage medium | |
CN111831503B (en) | Monitoring method based on monitoring agent and monitoring agent device | |
CN111400045A (en) | Load balancing method and device | |
CN111555918B (en) | Return source optimization method and device and electronic equipment | |
CN111563115B (en) | Statistical method and device for data distribution information in distributed database | |
CN117130979A (en) | Service resource migration method and device and electronic equipment | |
WO2021244441A1 (en) | Service configuration method and apparatus therefor | |
CN111092959B (en) | Request processing method, system and related device for servers in cluster | |
CN115580522A (en) | Method and device for monitoring running state of container cloud platform | |
CN113722113A (en) | Traffic statistic method and device | |
CN111614747B (en) | Information processing method and device | |
CN117319311A (en) | Uploading broadband control method and device, electronic equipment and storage medium | |
CN112148575B (en) | Information processing method, device, electronic equipment and storage medium | |
CN110677463A (en) | Parallel data transmission method, device, medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |