WO2021207926A1 - 确定内存的方法、统计服务器、物理机和存储介质 - Google Patents

确定内存的方法、统计服务器、物理机和存储介质 Download PDF

Info

Publication number
WO2021207926A1
WO2021207926A1 PCT/CN2020/084683 CN2020084683W WO2021207926A1 WO 2021207926 A1 WO2021207926 A1 WO 2021207926A1 CN 2020084683 W CN2020084683 W CN 2020084683W WO 2021207926 A1 WO2021207926 A1 WO 2021207926A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
physical machine
computer
container
preset
Prior art date
Application number
PCT/CN2020/084683
Other languages
English (en)
French (fr)
Inventor
郭子亮
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2020/084683 priority Critical patent/WO2021207926A1/zh
Priority to CN202080099867.0A priority patent/CN115398399A/zh
Publication of WO2021207926A1 publication Critical patent/WO2021207926A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Definitions

  • This application relates to the field of computer technology, and in particular to a method for determining memory, a statistical server, a physical machine, and a storage medium.
  • the physical machine provides memory to the computer container, and the physical machine memory is usually scheduled based on the fixed memory occupied by the computer container that has been set, so as to realize the memory reuse of the physical machine.
  • the fixed memory occupied by the computer container can only be used by the computer.
  • the physical machine memory other than the fixed occupied memory may be scheduled for use by other computer containers.
  • the fixed occupied memory is usually set artificially or directly defaults to the maximum available memory of the computer container.
  • the fixed occupied memory is less than the actual memory used by the computer container, other computer containers may be scheduled with a part of the physical machine memory that does not exist, resulting in exhaustion of the physical machine memory; if the fixed occupied memory is greater than the actual use of the computer container When the memory is reached, the unused fixed memory will be in an idle state, resulting in a waste of memory. Therefore, it is necessary to reasonably configure the fixed memory of the computer container to effectively improve the memory reuse effect of the physical machine.
  • the embodiment of the present application provides a method for determining memory, a statistics server, a physical machine, and a storage medium, which improves the memory reuse effect of the physical machine.
  • the embodiment of the present application provides a method for determining memory, which is applied to a statistics server, and the method includes:
  • the computer container is a container that uses the memory of the physical machine; obtain the preset quantile and the maximum memory corresponding to each physical machine Utilization rate; determine each computer corresponding to each physical machine according to the preset quantile, the memory usage record, the maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine The fixed memory occupied by the container, wherein each physical machine corresponds to at least one computer container.
  • the embodiment of the present application also provides a method for determining memory, which is applied to a physical machine, and the method includes: sending a container memory scheduling request to a statistics server when realizing business operation; receiving the statistics server in response to the container memory scheduling
  • the target fixed occupancy memory includes: the fixed occupancy memory corresponding to at least one computer container, the at least one computer container is all computer containers running in a physical machine; and the total amount of its own memory is obtained ; Based on the total amount of memory and the target fixed occupied memory, determine the amount of remaining memory of the physical machine; the amount of remaining memory of the physical machine is used for common business operation.
  • the embodiment of the present application provides a statistics server, including:
  • the first receiving unit is configured to receive the memory usage record of the computer container corresponding to each physical machine monitored within a preset time period; the computer container is a container that uses the memory of the physical machine;
  • the first obtaining unit is used to obtain the preset quantile and the maximum memory usage rate corresponding to each physical machine
  • the first determining unit is configured to determine the correspondence of each physical machine according to the preset quantile, the memory usage record, the maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine
  • the embodiment of the application provides a physical machine, including:
  • the sending unit is used to send container memory scheduling requests to the statistics server when realizing business operation;
  • the second receiving unit is configured to receive the target fixed occupied memory feedback from the statistics server in response to the container memory scheduling request;
  • the target fixed occupied memory includes: a fixed occupied memory corresponding to at least one computer container, and the at least one computer container All computer containers running in a physical machine;
  • the second obtaining unit is used to obtain the total amount of its own memory
  • the second determining unit is configured to determine the amount of remaining memory of the physical machine based on the total amount of memory and the target fixed occupied memory; the amount of remaining memory of the physical machine is used for common business operation.
  • the embodiment of the present application provides a storage medium that is applied to a statistics server and stores executable instructions.
  • the processors execute the embodiments of the present application.
  • the embodiment of the present application provides a storage medium that stores executable instructions.
  • the processor executes the physical machine side in the embodiments of the present application. Method of determining memory.
  • the statistics server receives the memory usage records of the computer container corresponding to each physical machine monitored within a preset time period; the computer container is a container that uses the memory of the physical machine; Set the quantile and the corresponding maximum memory usage of each physical machine; determine each physical machine according to the preset quantile, memory usage record, maximum memory usage, and the preset maximum available memory of the computer container The fixed memory occupied by each computer container corresponding to each physical machine, where each physical machine corresponds to at least one computer container.
  • the fixed memory usage is determined by the preset quantile, memory usage record, maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine, thereby avoiding manual setting of fixed usage
  • the memory waste or memory exhaustion caused by the memory improves the memory reuse effect of the physical machine.
  • FIG. 1 is a system architecture diagram for determining memory provided by an embodiment of the application
  • FIG. 2 is a first schematic flowchart of a method for determining memory provided by an embodiment of the application
  • FIG. 3 is a second schematic flowchart of a method for determining memory provided by an embodiment of the application
  • FIG. 4 is a third schematic flowchart of a method for determining memory provided by an embodiment of this application.
  • FIG. 5 is a schematic flowchart of a method for determining memory provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of a flow of interaction between a physical machine, a monitoring server, and a statistics server according to an embodiment of the application;
  • FIG. 7 is a first structural diagram of a statistics server provided by an embodiment of this application.
  • FIG. 8 is a first structural diagram of a physical machine provided by an embodiment of this application.
  • FIG. 9 is a second structural diagram of a statistics server provided by an embodiment of this application.
  • FIG. 10 is a second structural diagram of a physical machine provided by an embodiment of this application.
  • the embodiment of the present application provides a system architecture for determining memory, including a statistics server 100, a monitoring server 200, and at least one physical machine 300, where at least one computer container can run on the physical machine.
  • the statistics server 100 They are respectively connected to the monitoring server 200 and the physical machine 300 in communication, the physical machine 300 is in communication connection with the monitoring server 200, and at least one of the physical machines 300 is in communication connection.
  • the monitoring server 200 is used to generate memory usage records of all computer containers and send the memory usage records to the statistics server 100; the statistics server 100 is used to determine the fixed memory usage of all computer containers based on the memory usage records, which will correspond to the physical machine 300
  • the fixed memory occupied by the computer container is sent to the corresponding physical machine 300; the physical machine 300 is used to report the actual memory occupied by the corresponding computer container to the monitoring server 200, and determine the physical machine according to the received fixed memory occupied by the computer container
  • the remaining memory amount of 300, the remaining memory amount of the physical machine 300 can be scheduled for use by the computer container running on the physical machine 300.
  • the computer container is managed by the Kubernetes (K8S) cluster, and the fixed occupied memory takes effect in the scheduling module of the K8S cluster.
  • the scheduling module determines the remaining memory of the physical machine 300 according to the fixed occupied memory of the computer container running on the physical machine 300, thereby The remaining amount of memory of the physical machine 300 is scheduled.
  • the K8S cluster is a mobile communication system used for group dispatch communication.
  • the K8S cluster includes multiple working nodes. Each working node is responsible for running computer containers on each physical machine in the form of POD. POD is the smallest work unit of K8S. A POD contains one or more computer containers.
  • the K8S cluster application program is installed, and based on the communication connection between each physical machine, the K8S cluster realizes the scheduling of physical machine resources. Therefore, each worker node needs to configure the resources required to run the computer container, for example, the maximum occupied memory and fixed occupied memory of the computer container.
  • the K8S cluster also includes a control node, which is responsible for the management of the cluster and provides a management interface for the cluster. Among them, the kube-api server in the control node is the access point for all operation commands, and the kube-sheduler is the scheduling module. It is used to schedule the available resources in each working node according to the resource configuration of each computer container.
  • the statistics server determines the fixed occupied memory of each computer container, and sends the fixed occupied memory of each computer container to the kube-api server. After the kube-api server receives the fixed occupied memory of each container , Validate the fixed memory usage of each computer container in kube-sheduler, so that kube-sheduler can determine the remaining memory of each physical machine according to the fixed memory usage of each computer container, and then schedule the remaining memory of the physical machine to achieve physical Machine memory reuse.
  • the embodiment of the present application provides a method for determining memory. As shown in FIG. 2, it is applied to a statistics server, and the method includes:
  • S201 Receive a memory usage record of a computer container corresponding to each physical machine monitored within a preset time period; the computer container is a container that uses the memory of the physical machine;
  • the statistics server receives the memory usage record of the computer container corresponding to each physical machine monitored by the monitoring server within a preset time period, so as to perform statistics based on the memory usage record to determine the computer container corresponding to each physical machine The fixed memory usage.
  • a computer container is a container that runs on a physical machine in a cluster system.
  • the memory used by the computer container is the memory of the corresponding physical machine.
  • the cluster system can include multiple physical machines, and one physical machine can run multiple Computer containers, the total amount of memory used by all computer containers running on a physical machine should be less than the physical machine memory to avoid exhaustion of the physical machine memory.
  • the computer container may be a docker container.
  • the memory usage record is the memory usage record of the computer container corresponding to each physical machine in the cluster system, and the memory usage record includes the memory actually occupied by each computer container and the time corresponding to the memory occupied.
  • the memory usage record may be a record generated by the monitoring server monitoring the running status of each computer container.
  • each physical machine can obtain real-time real-time information of each computer container running on the physical machine.
  • the real-time occupied memory is reported to the monitoring server, and the monitoring server generates the memory usage record of each computer container according to the real-time memory occupied by each computer container.
  • the memory usage record may be a memory usage record obtained from a time series database (TSDB). It can be understood that obtaining memory usage records through a time series database can achieve efficient storage and rapid processing of massive memory monitoring data.
  • TSDB time series database
  • the preset time period can be set as required, and the specific manner can be set as required, which is not limited in the embodiment of the present application.
  • the preset time period may be a specified time period, such as a specified period between March 20 and March 26, or a preset period of time before the computer container takes effect, or it may be within a month
  • the highest memory usage is 7 consecutive days, etc.
  • the statistics server in order to determine the fixed occupied memory of each computer container, the statistics server needs to obtain the preset quantization in addition to receiving the memory usage record of the computer container corresponding to each physical machine monitored within a preset time period. Number and the maximum memory usage of each physical machine.
  • the preset quantile and the maximum memory usage rate corresponding to each physical machine are preset, and can be adjusted as needed during the operation of the physical machine.
  • the preset quantile is used to count the memory usage records, and represents the size of the memory used by the computer container determined from the memory usage records.
  • the preset quantile is positively correlated with the memory used by the computer container. The larger the preset quantile, the larger the memory used by the determined computer, and the smaller the preset quantile, the smaller the memory used by the determined computer.
  • the maximum memory usage rate of the physical machine is preset, which indicates the degree of idleness that the physical machine is expected to reach. For example, if the physical machine memory is 100G, if the maximum memory usage rate of the physical machine is set to 50%, it means that the physical machine uses 50G of memory while the physical machine is running, and the remaining memory of 50G is in an idle state. In other words, if only 70% of the memory of the physical machine is required, and the remaining 30% remains idle, then the maximum memory usage rate is set to 70%.
  • each physical machine in the cluster system can be set to the same maximum memory usage rate, or can be set to different maximum memory usage rates, which is not limited in the embodiment of the present application.
  • the statistics server can be based on the preset quantile, the memory usage record of the computer container, the maximum available memory of the computer container, and the maximum memory usage of the physical machine corresponding to the computer container. Rate, determine the fixed memory occupied by the computer container, and thus determine the fixed memory occupied by each computer container.
  • each computer container can be flexibly scheduled for memory resources, but there are often more than one computer running on each physical machine. Therefore, it is also necessary to set the maximum available memory of the computer container and the maximum available memory of the computer container.
  • the memory represents the maximum amount of memory that the computer container can use on the corresponding physical machine.
  • the maximum available memory of all computer containers in the cluster system may be the same or different, and the specific maximum available memory may be set as required, which is not limited in the embodiment of the present application.
  • the fixed memory occupied by a computer container represents the fixed memory occupied by the computer container on the corresponding physical machine.
  • the fixed memory occupied by each computer container can only be used by the computer container, even if the fixed memory occupied by a computer container is not fully used , The fixed occupied memory that is free cannot be scheduled to other computer containers.
  • the statistics server takes the percentage of the memory actually occupied by the computer container in the fixed memory usage as the memory usage rate of the computer container, and then sets the memory usage rate of the computer container to the expected value of the maximum memory usage rate of the physical machine. It can be achieved that the memory usage rate of the physical machine does not exceed the maximum memory usage rate, where the memory used by the computer container can be determined according to the memory usage record and the preset quantile value.
  • the embodiment of the present application provides a method for determining memory.
  • the statistics server receives the memory usage records of the computer container corresponding to each physical machine monitored within a preset time period; the computer container is a container that uses the memory of the physical machine; and the preset score is obtained. Digits, and the maximum memory usage of each physical machine; according to the preset quantile, memory usage record, maximum memory usage, and the preset maximum available memory of the computer container corresponding to each physical machine, determine each physical machine The fixed memory occupied by each computer container corresponding to the computer, where each physical machine corresponds to at least one computer container.
  • the fixed memory usage is determined by the preset quantile, memory usage record, maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine, thereby avoiding manual setting of fixed usage
  • the memory waste or memory exhaustion caused by the memory improves the memory reuse effect of the physical machine.
  • the embodiment of the present application provides an implementation of S203 in a method for determining the memory. As shown in FIG. 3, the method includes:
  • S301 According to the memory usage record and preset quantile of the computer container corresponding to each physical machine, count the quantile value of the memory usage of each computer container corresponding to each physical machine within the preset time period; The quantile value of memory usage represents the memory used by each computer container;
  • the statistics server determines the quantile value of the memory usage of each computer container from the memory usage record of the computer container corresponding to each physical machine according to the preset quantile, and calculates the quantile value of the memory usage of each computer container.
  • the quantile value of memory usage is used as the actual memory value occupied by the computer container. In this way, the fixed memory of each computer container can be determined based on the actual memory value of each computer container and the maximum memory usage rate of the corresponding physical machine. .
  • the statistics server can determine the quantile value corresponding to the preset quantile according to the preset quantile. For example, if the preset quantile is 90, the determined quantile value is 90 quantile. If the preset quantile is 75, the determined quantile value is the 75th quantile value.
  • the statistics server calculates the amount of each computer container corresponding to each physical machine in a preset time period according to the memory usage record and preset quantile of the computer container corresponding to each physical machine.
  • the realization of the quantile value of memory usage may include: extracting the memory monitoring value within a preset time period from the memory usage record of each computer container corresponding to each physical machine, and obtaining the to-be-stated memory value of each computer container ; Sort the to-be-stated memory value of each computer container to obtain the sort result of each computer container; determine the memory occupied by each computer container corresponding to each physical machine according to the sort result of each computer container and the preset quantile Quantile of usage.
  • the statistics server needs to extract the memory monitoring value from the memory usage record corresponding to each physical machine, and use the preset quantile to count the extracted memory monitoring value to obtain the quantile value.
  • the server extracts the memory monitoring value from the memory usage record corresponding to each physical machine, and the specific method can be set as required, which is not limited in the embodiment of the present application.
  • the statistics server extracts the memory monitoring value from the memory usage record corresponding to each physical machine, and can use all the memory monitoring values in the memory usage record of each computer container as the to-be-stated memory value of each computer container, or according to For the time in the memory usage record, the memory monitoring value is extracted at a preset time interval as the memory value to be counted.
  • the memory usage record is the one-hour memory record between 10 AM and 11 AM that day.
  • the memory monitoring value in the memory usage record is recorded in seconds.
  • these 3,600 monitoring values can be used as the to-be-stated memory value of the computer container; or, 180 memory monitoring values are extracted according to a preset time interval of 30s as the to-be-stated memory value of the computer container.
  • the statistics server after the statistics server obtains the to-be-stated memory value of each computer container, it needs to sort the to-be-stated memory value to obtain the sorting result. In this way, it can be based on the sorting result and preset score of each computer container.
  • the number of bits is used to determine the quantile value of the memory usage of each computer container.
  • the sorting of the to-be-stated memory values may be sorting in descending order, or sorting in descending order, which is not specifically limited in the embodiment of the present application.
  • the statistics server sorts the 10 memory values to be counted from small to large, and obtains the sorting result, and expresses the i-th memory value to be counted as Qi. If the preset quantile is 90, the 9th memory value is to be counted. The statistical memory value Q 9 is determined as the quantile value; if the preset quantile is 75, the 7.5th memory value to be counted is determined as the quantile value, and the quantile value is the formula (1):
  • the statistics server before determining the quantile value, determines the target interval length according to the sorting result and the preset quantile; the target interval length represents the smallest memory value to be counted among the quantile value and the sorting result The length of the interval between; and then determine the quantile value according to the target interval length and the sorting result.
  • the statistics server may first determine the length of the sorting interval according to the sorting result; the length of the sorting interval indicates the number of intervals between two adjacent memory values to be counted in the sorting result; and then according to the length of the sorting interval and the pre- Set the quantile and determine the target interval.
  • Serial number Memory value Serial number Memory value 1 1.75 7 2.55
  • 11 is the length of the sorting interval. 11 is divided into 100 parts, and the average interval length is 0.11, if the preset quantile is 75, the target interval length is 75 average interval length, that is, 8.25 interval length, that is to say, there are 8.25 intervals between the 75 quantile value and the smallest memory value to be counted, here , The smallest memory value to be counted is the first memory value.
  • S302 Determine the fixed occupied memory of each computer container corresponding to each physical machine according to the quantile value of the memory usage, the respective maximum memory usage rate of each physical machine, and the preset maximum available memory.
  • the statistics server determines the quantile value of the memory usage of the computer container, it can use the quantile value of the memory usage of the computer container, the maximum memory usage rate of the corresponding physical machine, and The preset maximum available memory of the computer container determines the fixed memory occupied by the computer container, thereby determining the fixed memory occupied by each computer container.
  • the statistics server determines the fixed occupied memory of each computer container corresponding to each physical machine according to the quantile value of the memory usage, the maximum memory usage rate corresponding to each physical machine, and the preset maximum available memory.
  • the implementation can include: according to the quantile value of memory usage and the maximum memory usage rate of its corresponding physical machine, obtain the calculation memory occupied by each computer container corresponding to each physical machine; calculate the memory occupied by each physical machine The minimum value of the maximum available memory is used as the fixed occupied memory of each computer container corresponding to each physical machine.
  • the quantile value of the memory usage of the computer container is denoted as Q
  • the maximum memory usage rate of the corresponding physical machine is denoted as P
  • the maximum available memory of the computer container is denoted as L
  • Q/P is the calculation of the memory occupied by the computer container. It can be understood that when the maximum memory usage rate of the physical machine corresponding to the computer container is known, combined with the quantile value of the computer container memory usage, it can be determined , How much memory does each computer container need to calculate to ensure that the memory usage rate of the physical machine does not exceed the maximum memory usage rate.
  • the statistics server needs to calculate The occupied memory is compared with the maximum available memory. If the calculated memory occupied is greater than the maximum available memory, the maximum available memory will be used as the fixed occupied memory.
  • the expected value of the maximum memory usage of a physical machine is 50%, which means that the memory usage of the physical machine does not exceed 50%.
  • the physical machine corresponds to multiple computer containers. If the memory used by each computer container should not exceed Fixed occupancy 50% of the memory, so that the memory used by all computer containers will not exceed 50% of the physical machine memory. If the physical machine memory is 10G, corresponding to 5 computer containers, the quantile value of the memory usage of each computer container is 0.5G, and the fixed occupied memory allocated to each computer container is 1G, then 5 containers are running , The total amount of memory occupied by the physical machine is 2.5G, the memory usage rate of the physical machine is 25%, and the expected value of 50% that does not exceed the maximum memory usage rate of the physical machine.
  • the quantile value is positively correlated with the memory occupied by the calculation.
  • the larger the quantile value the larger the memory occupied by the calculation.
  • the ratio of free memory in the physical machine The higher the value, the lower the possibility of memory exhaustion.
  • the more memory that is fixedly occupied in the physical machine the less memory can be scheduled; similarly, the smaller the quantile value, the smaller the fixed memory occupied.
  • the lower the ratio of free memory in the physical machine the higher the possibility of memory exhaustion, that is, the more likely the physical machine is to be overloaded, but the physical machine is fixedly occupied The smaller the memory, the more memory can be scheduled.
  • the maximum utilization rate is inversely related to the memory occupied by the calculation. The larger the maximum utilization rate, the smaller the fixed memory occupied.
  • the percentage of free memory in the physical machine is lower. The higher the probability of overloading the physical machine, but the less memory that can be scheduled in the physical machine; similarly, the smaller the maximum usage rate, the larger the fixed memory occupied.
  • the actual memory used by the computer container is constant, the physical The higher the percentage of free memory in the machine, the lower the probability of overloading the physical machine, and the more memory that can be scheduled in the physical machine.
  • the fixed memory usage of the computer container can be adjusted, that is, by adjusting the preset quantile and/or the maximum memory usage
  • the rate can control the memory reuse effect of the physical machine and avoid the exhaustion of the physical machine's memory.
  • the statistics server determines each physical machine corresponding to each physical machine according to the preset quantile, memory usage record, maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine. After the fixed memory usage of each computer container, in the case of receiving the updated preset quantile, according to the updated preset quantile, memory usage record, maximum memory usage rate, and the computer corresponding to each physical machine The preset maximum available memory of the container determines the fixed occupied memory of each computer container corresponding to each physical machine; the updated preset quantile is less than the preset quantile; the preset quantile is positively correlated with the fixed occupied memory .
  • a larger preset quantile can be set to make the fixed memory occupation larger, so that the physical machine has more free memory. Avoid the memory overload of the physical machine. Then, during the operation of the physical machine, gradually reduce the quantile value of the memory usage of the computer container by gradually increasing the preset quantile, thereby achieving the goal of gradually reducing the fixed memory usage of the computer container , While avoiding the exhaustion of the physical machine's memory, it continuously improves the efficiency of physical machine's memory reuse.
  • the statistics server determines each physical machine corresponding to each physical machine according to the preset quantile, memory usage record, maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine. After the fixed memory usage of each computer container, in the case of receiving the updated maximum memory usage rate, according to the preset quantile, memory usage record, the updated maximum memory usage rate, and the computer container corresponding to each physical machine The preset maximum available memory for each physical machine determines the fixed memory usage of each computer container corresponding to each physical machine; the updated maximum memory usage rate is higher than the maximum memory usage rate; the maximum memory usage rate is negatively correlated with the fixed memory usage.
  • the statistics server when the statistics server receives the updated preset quantile and the maximum memory usage rate at the same time, the statistics server according to the updated preset quantile, memory usage record, and updated The maximum memory usage rate of each physical machine, and the preset maximum available memory of the computer container corresponding to each physical machine, determine the fixed occupied memory of each computer container corresponding to each physical machine; the updated preset quantile is less than the preset quantile Number; the updated maximum memory usage is higher than the maximum memory usage.
  • the maximum memory usage is increased while gradually reducing the preset quantile, so as to gradually reduce the fixed memory usage of the computer container and avoid the exhaustion of the physical machine memory. , Continuously improve the efficiency of physical machine memory reuse.
  • the embodiment of the present application provides a method for determining the memory. As shown in FIG. 4, the method includes:
  • the target container includes all computer containers running on the first physical machine, and the target fixed occupied memory is the fixed occupied memory of the target container.
  • the container memory scheduling request of the first physical machine is used to request the fixed occupied memory of all computer containers running on the first physical machine.
  • the statistics server confirms the status of each computer container on each physical machine.
  • all the fixed occupied memory of all computer containers corresponding to the first physical machine are sent to the first physical machine. In this way, the first physical machine can determine the amount of memory that can be scheduled on the first physical machine according to the fixed occupied memory of the corresponding computer container.
  • the first physical machine can be any one of the physical machines
  • the target container is all computer containers running on the first physical machine
  • the target fixed occupied memory is the fixed occupied memory of the target container
  • the statistics server can Accept the container memory scheduling request of any physical machine, and according to the container memory scheduling request of the physical machine, send the fixed occupied memory of all computer containers running on the physical machine to the physical machine, thereby making each physical machine have The fixed occupied memory of the corresponding computer container can be obtained, and then the remaining amount of memory of the physical machine itself can be determined.
  • the embodiment of the present application also provides a method for determining memory, as shown in FIG. 5, applied to a physical machine, the method includes:
  • S501 Send a container memory scheduling request to the statistics server when realizing business operation
  • the physical machine when it implements business operation, it needs to send a container memory scheduling request to the statistics server to obtain the fixed occupied memory of all computer containers running on the physical machine.
  • the physical machine is any one of the physical machines, that is, any one of the physical machines needs to send a container memory scheduling request to the statistics server when realizing business operation.
  • the target fixed occupied memory includes: fixed occupied memory corresponding to at least one computer container, and at least one computer container is all computer containers running in a physical machine;
  • the statistics server responds to the request and sends the target fixed memory occupied by the target container to the physical machine, that is, the physical machine receives all computer containers running on the physical machine The fixed memory usage.
  • the container memory scheduling request of each physical machine can include information about all computer containers running on the physical machine. Enable the statistics server to determine which computer containers’ fixed memory usage needs to be sent to the physical machine according to the container memory scheduling request, determine these computer containers as target containers, and determine the fixed memory usage of these settlements and containers as the target fixed used internal memory.
  • S504 Determine the remaining memory amount of the physical machine based on the total amount of memory and the target fixed occupied memory; the remaining memory amount of the physical machine is used for common business operation.
  • the remaining memory amount of the physical machine is determined according to the total amount of memory and the target fixed occupation of the memory.
  • the remaining memory amount of the physical machine can be scheduled to correspond to the physical machine.
  • the amount of memory of the computer container is the amount of memory shared by the computer container corresponding to the physical machine.
  • the method for determining the remaining memory amount of the physical machine based on the total amount of memory and the target fixed occupied memory of the physical machine may include: determining the corresponding fixed occupied memory of at least one computer container based on the target fixed occupied memory Sum; subtract the sum of fixed occupied memory from the total memory to obtain the remaining memory of the physical machine.
  • a physical machine corresponds to at least one computer container, and each computer container has a corresponding fixed occupied memory on the physical machine.
  • the sum of the fixed occupied memory of all computer containers is the total fixed occupied memory on the physical machine.
  • the memory of the scheduled physical machine therefore, the remaining memory of the physical machine is calculated by subtracting the total fixed occupied memory from the physical machine memory.
  • the physical machine obtains the real-time occupied memory of at least one computer container running by itself in real time; reports the real-time occupied memory to the monitoring server, so that the monitoring server provides the statistics server to obtain the corresponding information when monitoring each physical machine.
  • the physical machine monitors the real-time occupied memory of the computer container running by itself, and reports the real-time occupied memory of the monitored computer container to the monitoring server. After that, the monitoring server can report the real-time occupied memory of each computer container, Generate the memory usage record of each computer container.
  • the statistics server needs to determine the fixed memory usage of the computer container, send the memory usage record of the computer container to the statistics server, so that the statistics server can determine the fixed usage based on the memory usage record Memory is out.
  • the embodiment of the present application provides a method for determining memory, as shown in FIG. 6, which is applied to the interaction between a physical machine, a monitoring server, and a statistics server.
  • the method includes:
  • the physical machine obtains real-time memory occupied by all computer containers running by itself in real time;
  • the physical machine reports to the monitoring server the real-time memory occupied by all computer containers running by itself;
  • the monitoring server generates a memory usage record of the corresponding computer container according to the received real-time memory usage of the computer container;
  • the monitoring server sends the memory usage record of each computer container on the physical machine within a preset time period to the statistics server;
  • the statistics server obtains the preset quantile and the maximum memory usage rate of the physical machine
  • the statistics server determines the fixed memory usage of each computer container according to the memory usage record of each computer container on the physical machine, the preset quantile, and the maximum memory usage rate of the physical machine;
  • the statistics server responds to the container memory scheduling request of the physical machine, and sends the fixed occupied memory of all computer containers running on the physical machine to the physical machine;
  • the physical machine determines the remaining memory amount of the physical machine based on the received fixed memory occupied by the computer container and the total amount of memory.
  • the statistics server obtains memory usage records from the monitoring server, and determines the fixed memory usage of each computer container corresponding to each physical machine based on the memory usage record, preset quantiles, and the maximum memory usage rate of each physical machine , Send the fixed occupied memory of each computer container to the corresponding physical machine, so that the physical machine determines the remaining memory amount of the physical machine based on the fixed occupied memory of the computer container running on the physical machine, and then schedules the remaining memory amount , So as to realize the reasonable utilization of the memory of the physical machine and improve the memory reuse effect of the physical machine.
  • the function of the statistical server can be implemented as a statistical module in the physical machine
  • the function of the monitoring server can be implemented as a monitoring module in the physical machine, that is, the physical machine is implemented through its own monitoring module.
  • Monitor all computer containers running on the physical machine, and generate the memory usage record of each computer container.
  • the statistics module will use the memory usage record of each computer container, preset quantiles, the maximum available memory of the corresponding computer container, and The maximum memory usage rate of the physical machine determines the fixed occupied memory of each computer container. Therefore, the physical machine calculates the remaining amount of memory based on the fixed occupied memory of all computer containers.
  • the statistics server 7 includes:
  • the first receiving unit 71 is configured to receive the memory usage record of the computer container corresponding to each physical machine monitored within a preset time period; the computer container is a container that uses the memory of the physical machine;
  • the first obtaining unit 72 is configured to obtain the preset quantile and the maximum memory usage rate corresponding to each physical machine
  • the first determining unit 73 is configured to determine each physical machine according to the preset quantile, the memory usage record, the maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine Corresponding to the fixed occupied memory of each computer container, where each physical machine corresponds to at least one computer container.
  • the first determining unit 73 is further configured to make statistics within the preset time period according to the memory usage record of the computer container corresponding to each physical machine and the preset quantile, The quantile value of the memory usage of each computer container corresponding to each physical machine; the quantile value of the memory usage represents the memory used by each computer container; according to the quantile value of the memory usage, The maximum memory usage rate corresponding to each physical machine and the preset maximum available memory determine the fixed occupied memory of each computer container corresponding to each physical machine.
  • the first determining unit 73 is further configured to obtain each computer corresponding to each physical machine according to the quantile value of the memory usage and the maximum memory usage rate of the corresponding physical machine.
  • the calculation of the container occupies memory; the minimum of the calculated occupancy memory and the maximum available memory corresponding to each physical machine is used as the fixed occupancy memory of each computer container corresponding to each physical machine.
  • the first receiving unit 71 is further configured to receive a container memory scheduling request of the first physical machine; the first determining unit 73 is also configured to respond to the container memory scheduling request, from each Determine the target fixed occupied memory of the requested target container from the fixed occupied memory of each computer container corresponding to the physical machine, and send it to the first physical machine, where the first physical machine is one of the respective physical machines Any physical machine.
  • the first determining unit 73 is further configured to extract the memory monitoring value from the memory usage record of each computer container to obtain the to-be-stated memory value of each computer container; in descending order Sort the to-be-stated memory value of each computer container respectively to obtain the sorting result of each computer container; the sorting result includes the memory value of the computer container and the corresponding serial number; according to the value of each computer container The sorting result and the preset quantile determine the quantile value of the memory usage occupied by each computer container.
  • the first determining unit 73 is further configured to determine a target interval according to the sorting result and a preset quantile; the target interval represents the quantile value and the first quantile in the sorting result. An interval between memory values; the quantile value is determined according to the target interval and the sorting result.
  • the first determining unit 73 is further configured to determine a sorting interval according to the sorting result; the sorting interval represents the interval between two adjacent memory values to be counted in the sorting result Number; the target interval is determined according to the sort interval and the preset quantile.
  • the first determining unit 73 is further configured to, in the case of receiving the updated preset quantile, according to the updated preset quantile, the memory usage record, The maximum memory usage rate and the preset maximum available memory of the computer container corresponding to each physical machine determine the fixed occupied memory of each computer container corresponding to each physical machine; the updated preset quantile is higher than The preset quantile; the preset quantile is positively correlated with the fixed occupied memory.
  • the first determining unit 73 is further configured to, in a case where the updated maximum memory usage rate is received, according to the preset quantile, the memory usage record, and the updated maximum memory usage rate.
  • the maximum memory usage rate of each physical machine and the preset maximum available memory of the computer container corresponding to each physical machine are determined to determine the fixed occupied memory of each computer container corresponding to each physical machine; the updated maximum memory usage rate is lower than the Maximum memory usage rate; the maximum memory usage rate is negatively related to the fixed occupied memory.
  • the first determining unit 73 receives the updated preset quantile value and the updated maximum usage rate according to the updated quantile value and the memory usage Record, the updated maximum usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine, and determine the fixed occupied memory of each computer container corresponding to each physical machine; the updated preset score The digit is higher than the preset quantile; the preset quantile is positively correlated with the fixed occupied memory; the updated maximum memory usage rate is lower than the maximum memory usage rate; the maximum memory The usage rate is negatively correlated with the fixed occupied memory.
  • the physical machine 8 includes:
  • the sending unit 81 is configured to send a container memory scheduling request to the statistics server when realizing service operation;
  • the second receiving unit 82 is configured to receive the target fixed occupied memory feedback from the statistics server in response to the container memory scheduling request;
  • the target fixed occupied memory includes: the fixed occupied memory corresponding to at least one computer container, and the at least one computer Containers are all computer containers running in a physical machine;
  • the second obtaining unit 83 is configured to obtain the total amount of its own memory
  • the second determining unit 84 is configured to determine the amount of remaining memory of the physical machine based on the total amount of memory and the target fixed occupied memory; the remaining amount of memory of the physical machine is used for common business operation.
  • the second determining unit 84 is further configured to determine the sum of the fixed occupied memory corresponding to the at least one computer container based on the target fixed occupied memory; subtract from the total amount of memory The sum of the fixed occupied memory is used to obtain the remaining memory amount of the physical machine.
  • the sending unit 81 is further configured to obtain the real-time occupied memory of at least one computer container running by itself in real time; and report the real-time occupied memory to the monitoring server for the monitoring server to serve as the The statistics server provides access to the memory usage records of the corresponding computer container when monitoring each physical machine.
  • the statistics server 9 includes:
  • the first processor 91 the memory 92 and the communication bus 93.
  • the memory 92 communicates with the first processor 91 through the communication bus 93.
  • the memory 92 stores one or more programs executable by the first processor 91. When the program is executed, the first processor 91 executes any method for determining the memory as in the foregoing embodiments.
  • the physical machine 10 includes:
  • the second processor 101 the memory 102, and the communication bus 103.
  • the memory 102 communicates with the second processor 101 through the communication bus 103.
  • the memory 102 stores one or more programs executable by the second processor 101. When the program is executed, the second processor 101 executes any method for determining memory as in the foregoing embodiments.
  • the embodiment of the present application provides a storage medium, which is applied to a statistics server.
  • the storage medium stores one or more programs, one or more programs can be executed by one or more first processors 91, and the programs are executed by the first processor.
  • the method for determining the memory as in the embodiment of the present application is realized at the time.
  • the embodiment of the present application provides a storage medium, which is applied to a physical machine.
  • the storage medium stores one or more programs, one or more programs can be executed by one or more second processors 101, and the programs are executed by the second processor.
  • the method for determining the memory as in the embodiment of the present application is realized at the time.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • the fixed memory usage is determined by the preset quantile, memory usage record, maximum memory usage rate, and the preset maximum available memory of the computer container corresponding to each physical machine, which avoids manual setting of fixed memory usage
  • the memory waste or memory exhaustion caused by the memory improves the memory reuse effect of the physical machine.

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

一种确定内存的方法、统计服务器(100)、物理机(300)和存储介质,所述方法包括:接收在预设时间段内监控到的各个物理机(300)对应的计算机容器的内存使用记录;计算机容器为使用物理机(300)内存的容器(S201);获取预设分位数,以及各个物理机(300)各自对应的最大内存使用率(S202);根据预设分位数、内存使用记录、最大内存使用率、以及各物理机(300)对应的计算机容器的预设最大可用内存,确定每个物理机(300)对应的每个计算机容器的固定占用内存,其中,每个物理机(300)对应至少一个计算机容器(S203)。

Description

确定内存的方法、统计服务器、物理机和存储介质 技术领域
本申请涉及计算机技术领域,尤其涉及一种确定内存的方法、统计服务器、物理机和存储介质。
背景技术
目前,物理机向计算机容器提供内存,通常是基于设置好的计算机容器的固定占用内存来调度物理机内存,从而实现物理机的内存复用,其中,计算机容器的固定占用内存只能由该计算机容器使用,固定占用内存之外的物理机内存才可能被调度给其他计算机容器使用,而固定占用内存通常是人为设置的,或者直接默认为计算机容器的最大可用内存。在实际应用中,如果固定占用内存小于计算机容器实际使用到的内存,其他计算机容器将可能被调度了一部分不存在的物理机内存,导致物理机内存耗尽;如果固定占用内存大于计算机容器实际使用到的内存,则未使用到的固定占用内存将处于空闲状态,导致内存浪费,因此,需要合理配置计算机容器的固定占用内存,才能有效提高物理机的内存复用效果。
发明内容
本申请实施例提供一种确定内存的方法、统计服务器、物理机和存储介质,提高了物理机的内存复用效果。
本申请实施例的技术方案可以如下实现:
本申请实施例提供了一种确定内存的方法,应用于统计服务器,所述方法包括:
接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;所述计算机容器为使用物理机内存的容器;获取预设分位数,以及各个物理机各自对应的最大内存使用率;根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,所述每个物理机对应至少一个计算机容器。
本申请实施例还提供了一种确定内存的方法,应用于物理机,所述方法包括:在实现业务运行时,发送容器内存调度请求给统计服务器;接收所述统计服务器响应所述容器内存调度请求反馈的目标固定占用内存;所述目标固定占用内存包括:至少一个计算 机容器对应的固定占用内存,所述至少一个计算机容器为一个物理机中正在运行的全部计算机容器;获取自身的内存总量;基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量;所述物理机剩余内存量用于共业务运行时使用。
本申请实施例提供了一种统计服务器,包括:
第一接收单元,用于接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;所述计算机容器为使用物理机内存的容器;
第一获取单元,用于获取预设分位数,以及各个物理机各自对应的最大内存使用率;
第一确定单元,用于根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,所述每个物理机对应至少一个计算机容器。
本申请实施例提供了一种物理机,包括:
发送单元,用于在实现业务运行时,发送容器内存调度请求给统计服务器;
第二接收单元,用于接收所述统计服务器响应所述容器内存调度请求反馈的目标固定占用内存;所述目标固定占用内存包括:至少一个计算机容器对应的固定占用内存,所述至少一个计算机容器为一个物理机中正在运行的全部计算机容器;
第二获取单元,用于获取自身的内存总量;
第二确定单元,用于基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量;所述物理机剩余内存量用于共业务运行时使用。
本申请实施例提供了一种存储介质,应用于统计服务器,存储有可执行指令,当所述可执行指令被一个或多个第一处理器执行的时候,所述处理器执行本申请实施例中统计服务器侧的确定内存的方法。
本申请实施例提供了一种存储介质,存储有可执行指令,当所述可执行指令被一个或多个第二处理器执行的时候,所述处理器执行本申请实施例中物理机侧的确定内存的方法。
本申请实施例所提供的一种确定内存的方法,统计服务器接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;计算机容器为使用物理机内存的容器;获取预设分位数,以及各个物理机各自对应的最大内存使用率;根据预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,每个物理机对应至少一个计算机容器。也就是说,固定占用内存是通过预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存共同确定出的,从而避免了人工设置固定占用内存导致的内存浪费或内存耗尽,提高物理机的内存复用效果。
附图说明
图1为本申请实施例提供的一种确定内存的系统架构图;
图2为本申请实施例提供的一种确定内存的方法流程示意图一;
图3为本申请实施例提供的一种确定内存的方法流程示意图二;
图4为本申请实施例提供的一种确定内存的方法流程示意图三;
图5为本申请实施例还提供的一种确定内存的方法流程示意图;
图6为本申请实施例提供的一种物理机、监控服务器和统计服务器之间交互的流程示意图;
图7为本申请实施例提供的一种统计服务器的结构示意图一;
图8为本申请实施例提供的一种物理机的结构示意图一;
图9为本申请实施例提供的一种统计服务器的结构示意图二;
图10为本申请实施例提供的一种物理机的结构示意图二。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
本申请实施例提供一种确定内存的系统架构,包括一个统计服务器100、一个监控服务器200和至少一个物理机300,其中,物理机上可运行至少一个计算机容器,如图1所示,统计服务器100分别与监控服务器200、物理机300通信连接,物理机300与监控服务器200通信连接,至少一个物理机300之间通信连接。
监控服务器200,用于生成所有计算机容器的内存使用记录,将内存使用记录发送给统计服务器100;统计服务器100,用于基于内存使用记录,确定所有计算机容器固定占用内存,将与物理机300对应的计算机容器的固定占用内存发送给对应的物理机300;物理机300,用于向监控服务器200上报对应的计算机容器的实际占用内存,并根据接收到的计算机容器的固定占用内存确定该物理机300的剩余内存量,物理机300的剩余内存量可以被调度给该物理机300上运行的计算机容器使用。
其中,计算机容器通过Kubernetes(K8S)集群管理,固定占用内存在K8S集群的调度模块中生效,由调度模块根据物理机300上运行的计算机容器的固定占用内存确定物理机300的内存剩余量,从而对物理机300内存剩余量进行调度。
需要说明的是,集群是一种用于集团调度通信的移动通信系统。K8S集群包括多个 工作节点,各个工作节点负责以POD的形式在各个物理机上运行计算机容器,POD是K8S的最小工作单元,一个POD包含一个或者多个计算机容器,具体来说,每个物理机上安装有K8S集群的应用程序,基于各个物理机之间的通信连接,实现K8S集群对物理机资源的调度。因此,各个工作节点需要配置运行计算机容器需要的资源,例如,计算机容器的最大占用内存和固定占用内存。此外,K8S集群还包括一个控制节点,控制节点负责集群的管理,为集群提供管理接口,其中,控制节点中的kube-api server是所有操作命令的接入点,而kube-sheduler为调度模块,用于根据对各个计算机容器的资源配置,对各个工作节点内的可用资源进行调度。
在本申请的一个实施例中,统计服务器确定出每个计算机容器的固定占用内存,将每个计算机容器的固定占用内存发送给kube-api server,kube-api server接收各个容器的固定占用内存后,在kube-sheduler中生效各计算机容器的固定占用内存,这样,kube-sheduler就可以根据各个计算机容器的固定占用内存来确定各个物理机的内存剩余量,进而调度物理机内存剩余量,实现物理机内存复用。
本申请实施例提供一种确定内存的方法,如图2所示,应用于统计服务器,该方法包括:
S201、接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;计算机容器为使用物理机内存的容器;
在本申请实施例中,统计服务器接收由监控服务器监控到的各个物理机对应的计算机容器在预设时间段内的内存使用记录,以便根据内存使用记录进行统计,确定各个物理机对应的计算机容器的固定占用内存。
需要说明的是,计算机容器是在集群系统中运行于物理机上的容器,计算机容器所使用的内存为对应物理机的内存,这里,集群系统可以包括多个物理机,一个物理机上可以运行多个计算机容器,在一个物理机上运行的所有计算机容器所使用的内存的总量应小于物理机内存,避免物理机内存耗尽。
在一些实施例中,计算机容器可以是docker容器。
其中,内存使用记录为集群系统中各个物理机对应的计算机容器的内存使用记录,内存使用记录包括各个计算机容器实际占用的内存及占用该内存对应的时间。
在一些实施例中,内存使用记录可以是,由监控服务器对各个计算机容器的运行状态进行监控而生成的记录,具体来说,每个物理机可以实时获取在该物理机上运行的各个计算机容器实时占用的内存,将实时占用的内存上报给监控服务器,由监控服务器根据各个计算机容器实时占用的内存生成各个计算机容器的内存使用记录。
在一些实施例中,内存使用记录可以是从时序数据库(Time Series Database,TSDB)中获取的内存使用记录。可以理解,通过时序数据库来获取内存使用记录,可以实现对海量内存监控数据的高效存储和快速处理。
在本申请实施例中,预设时间段可以根据需要设置,具体方式可以根据需要设置, 本申请实施例不作限定。
示例性的,预设时间段可以是指定的时间段,如指定3月20日至3月26日之间,也可以是计算机容器生效之前的一段预设时间段,还可以是近一个月内内存使用量最高的连续7天等。
S202、获取预设分位数,以及各个物理机各自对应的最大内存使用率;
在本申请实施例中,统计服务器为了确定每个计算机容器的固定占用内存,除了需要接收预设时间段内监控的各个物理机对应的计算机容器的内存使用记录以外,还需要获取预设分位数和各个物理机各自对应的最大内存使用率。这里,预设分位数和各个物理机各自对应的最大内存使用率是预先设置好的,在物理机运行过程中,可以根据需要调整的。
其中,预设分位数是用来对内存使用记录进行统计的,表示从内存使用记录中确定的计算机容器使用的内存的大小。预设分位数与计算机容器使用的内存正相关,预设分位数越大,确定出的计算机使用的内存越大,预设分位数越小,确定出的计算机使用的内存越小。
这里,物理机最大内存使用率是预先设置好的,表示期望该物理机所达到的空闲程度。举例来说,物理机内存为100G,如果设定物理机最大内存使用率为50%,表示物理机在运行过程中,使用的内存为50G,剩余内存50G则处于空闲状态。也就是说,若需要物理机的内存只会被使用70%,剩余30%保持空闲状态,则将最大内存使用率设置为70%。
需要说明的是,集群系统中的各个物理机可以设置同样的最大内存使用率,也可以设置不同的最大内存使用率,对此,本申请实施例不作限定。
S203、根据预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,每个物理机对应至少一个计算机容器。
在本申请实施例中,对于一个计算机容器,统计服务器可以根据预设分位数、该计算机容器的内存使用记录、该计算机容器的最大可用内存、以及该计算机容器对应的物理机的最大内存使用率,确定该计算机容器的固定占用内存,由此,确定出每个计算机容器的固定占用内存。
需要说明的是,在集群系统中,各个计算机容器可以灵活的被调度内存资源,但每个物理机上运行的计算机常常不止一个,因此,还需要设置计算机容器的最大可用内存,计算机容器的最大可用内存表示该计算机容器在对应物理机上能够使用的内存的最大值。
这里,集群系统中所有计算机容器的最大可用内存可以相同,也可以不同,具体最大可用内存可以根据需要设置,对此,本申请实施例不作限定。
其中,计算机容器的固定占用内存表示该计算机容器在对应的物理机上占用的固定 内存,每个计算机容器的固定占用内存只能为该计算机容器使用,即使一个计算机容器的固定占用内存未被完全使用,空闲出来的固定占用内存也不能被调度给其他计算机容器。
可以理解的是,统计服务器将计算机容器实际占用的内存在固定占用内存中所占的比例作为计算机容器的内存使用率,再设置计算机容器的内存使用率为物理机最大内存使用率的使用期望值,则能够实现物理机的内存使用率不超过最大内存使用率,其中,计算机容器使用的内存可以根据内存使用记录和预设分位值确定。
本申请实施例提供一种确定内存的方法,统计服务器接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;计算机容器为使用物理机内存的容器;获取预设分位数,以及各个物理机各自对应的最大内存使用率;根据预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,每个物理机对应至少一个计算机容器。也就是说,固定占用内存是通过预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存共同确定出的,从而避免了人工设置固定占用内存导致的内存浪费或内存耗尽,提高物理机的内存复用效果。
在本申请的一个实施例中,本申请实施例提供了一种确定该内存的方法中的S203的实现,如图3所示,该方法包括:
S301、根据各个物理机对应的计算机容器的内存使用记录和预设分位数,统计在预设时间段内,每个物理机对应的每个计算机容器所占的内存使用量的分位值;内存使用量的分位值表示每个计算机容器使用的内存;
在本申请实施例中,统计服务器根据预设分位数从各个物理机对应的计算机容器的内存使用记录中确定每个计算机容器所占内存使用量的分位值,将每个计算机容器所占内存使用量的分位值作为该计算机容器实际占用的内存值,这样,就可以基于每个计算机容器实际占用的内存值和对应的物理机的最大内存使用率来确定每个计算机容器的固定内存。
需要说明的是,统计服务器根据预设分位数可以确定与预设分位数对应的分位值,例如,预设分位数为90,则确定出的分位值为90分位值,若预设分位数为75,则确定出的分位值为75分位值。
在本申请的一些实施例中,统计服务器根据各个物理机对应的计算机容器的内存使用记录和预设分位数,统计在预设时间段内,每个物理机对应的每个计算机容器所占的内存使用量的分位值的实现可以包括:从各个物理机对应的每个计算机容器的内存使用记录中提取在预设时间段内的内存监控值,得到每个计算机容器的待统计内存值;对每个计算机容器的待统计内存值排序,得到每个计算机容器的排序结果;根据每个计算机容器排序结果和预设分位数,确定各个物理机对应的每个计算机容器所占的内存使用量的分位值。
在本申请实施例中,统计服务器需要从各个物理机对应的内存使用记录中提取内存监控值,采用预设分位数对提取出的内存监控值进行统计,从而得到分位值,其中,统计服务器从各个物理机对应的内存使用记录中提取内存监控值,具体方式可以根据需要设置,本申请实施例不作限定。
示例性的,统计服务器从各个物理机对应的内存使用记录中提取内存监控值,可以将每个计算机容器的内存使用记录中的所有内存监控值作为各计算机容器的待统计内存值,也可以根据内存使用记录中的时间,按照预设的时间间隔提取内存监控值作为待统计内存值。
举例来说,内存使用记录是当天上午10点到11点之间一个小时的内存记录,内存使用记录中的内存监控值以秒为单位的记录,则一个计算机容器的内存使用记录中共有3600个内存监控值,可以将这3600个监控值作为该计算机容器的待统计内存值;或者,按照预设时间间隔30s提取出180个内存监控值作为该计算机容器的待统计内存值。
在本申请实施例中,统计服务器在得到每个计算机容器的待统计内存值后,需要对待统计内存值进行排序,得到排序结果,这样,就可以根据每个计算机容器的排序结果和预设分位数来确定每个计算机容器所占内存使用量的分位值。
这里,对待统计内存值进行排序可以是按照从大到小的顺序进行排序,也可以是按照从小到大的顺序进行排序,对此,本申请实施例不作具体限定。
举例来说,统计服务器对10个待统计内存值按照从小到大排序,得到排序结果,将第i个待统计内存值表示为Qi,若预设分位数为90,则将第9个待统计内存值Q 9确定为分位值;若预设分位数为75,则将第7.5个待统计内存值确定为分位值,则分位值为公式(1):
Q=Q 7.5=Q 7+(Q 8-Q 7)×(7.5-7)         (1)
在本申请的一个实施例中,在确定分位值之前,统计服务器根据排序结果和预设分位数,确定目标间隔长度;目标间隔长度表示分位值与排序结果中最小的待统计内存值之间的间隔长度;再根据目标间隔长度和排序结果确定分位值。
在本申请的一个实施例中,统计服务器可以先根据排序结果确定排序间隔长度;排序间隔长度表示排序结果中相邻两个待统计内存值之间的间隔的数目;再根据排序间隔长度和预设分位数,确定目标间隔。
举例来说,12个待统计内存值按照从小到大的顺序进行排序后,得到如表1所示的待统计内存值的排序结果表,每个待统计内存值有一个对应的序号数:
表1
序号数 内存值 序号数 内存值
1 1.75 7 2.55
2 1.98 8 2.78
3 2.23 9 2.84
4 2.33 10 2.88
5 2.48 11 2.91
6 2.49 12 2.92
其中,排序结果表中共计12个待统计内存值,相邻两个待统计内存值之间的间隔共有11个,11即为排序间隔长度,将11均分为100份,得到平均间隔长度为0.11,若预设分位数为75,则目标间隔长度为75份平均间隔长度,即8.25个间隔长度,也就是说75分位值和最小的待统计内存值之间有8.25个间隔,这里,最小的待统计内存值为第一个内存值。
在本申请的一个实施例中,统计服务器在确定目标间隔长度后,将目标间隔长度8.25拆分为整数间隔长度8和小数间隔长度0.25,由此得到第一分位值的序号数是8+1=9,则第一分位值为排序结果中的第9个内存值2.84,第二分位值为第9个内存值和第10个内存值之间的差值乘以0.25,即(2.88-2.84)*0.25=0.02,进一步地,75分位值为第一分位值和第二分位值的和,即2.84+0.02=2.86。
S302、根据内存使用量的分位值、各个物理机各自对应的最大内存使用率、和预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存。
在本申请实施例中,统计服务器在确定出计算机容器的内存使用量的分位值后,就可以根据该计算机容器的内存使用量的分位值、对应的物理机的最大内存使用率、和该计算机容器的预设最大可用内存,确定该计算机容器的固定占用内存,由此,确定出每个计算机容器的固定占用内存。
在一些实施例中,统计服务器根据内存使用量的分位值、各个物理机各自对应的最大内存使用率、和预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存的实现可以包括:根据内存使用量的分位值与其对应的物理机的最大内存使用率,得到每个物理机对应的每个计算机容器的计算占用内存;将计算占用内存和每个物理机对应的最大可用内存中的最小值,作为每个物理机对应的每个计算机容器的固定占用内存。
在本申请实施例中,将计算机容器的内存使用量的分位值记为Q,对应的物理机的最大内存使用率记为P,该计算机容器的最大可用内存记为L,则该计算机的固定占用内存R可以表示为公式(2):
Figure PCTCN2020084683-appb-000001
其中,Q/P为计算机容器计算占用内存,可以理解的是,在已知与计算机容器对应的物理机的最大内存使用率的情况下,结合计算机容器内存使用量的分位值,可以确定 出,每个计算机容器需要占用多少计算占用内存,才能够保证物理机的内存使用率不超过最大内存使用率。
进一步地,计算占用内存如果大于最大可用内存,则超出最大可用内存的那部分内存将永久空闲,不利于物理机内存的合理利用,因此,在确定出计算占用内存后,统计服务器还需将计算占用内存和最大可用内存比较,如果计算占用内存大于最大可用内存,则将最大可用内存作为固定占用内存。
举例来说,物理机的最大内存使用率的使用期望值为50%,表示物理机的内存使用率不超过50%,考虑物理机对应多个计算机容器,如果每个计算机容器使用的内存应不超过固定占用内存的50%,这样,所有计算机容器使用的内存将不超过物理机内存的50%。假如,物理机内存10G,对应5个计算机容器,每个计算机容器的内存使用量的分位值均为0.5G,给每个计算机容器分配的固定占用内存均为1G,则5个容器运行时,占用物理机内存的总量为2.5G,物理机的内存使用率为25%,没有超过物理机最大内存使用率的使用期望值50%。
需要说明的是,分位值与计算占用内存正相关,分位值越大,得到的计算占用内存越大,在计算机容器实际使用的内存一定的情况下,物理机中空闲的内存所占比率越高,内存耗尽的可能性越低,但是,物理机中被固定占用的内存越多,则可被调度的内存越少;同理,分位值越小,得到的固定占用内存越小,在计算机容器实际使用的内存一定的情况下,物理机中空闲的内存比率越低,内存耗尽的可能性越高,也就是说,物理机越容易超载,但是,物理机中被固定占用的内存越小,则可被调度的内存越多。
另外,最大使用率与计算占用内存反相关,最大使用率越大,得到的固定占用内存越小,在计算机容器实际使用的内存一定的情况下,物理机中空闲的内存所占比率越低,则物理机超载概率越高,但物理机内可被调度的内存越少;同理,最大使用率越小,得到的固定占用内存越大,在计算机容器实际使用的内存一定的情况下,物理机中空闲的内存所占比率越高,则物理机超载概率越低,而物理机内可被调度的内存越多。
可以理解的是,通过调整预设分位数和物理机的最大内存使用率,可以实现对计算机容器的固定占用内存的调整,也就是说,通过调整预设分位数和/或最大内存使用率可以控制物理机的内存复用效果,避免物理机内存耗尽。
在本申请的一个实施例中,统计服务器根据预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存之后,在接收到更新后的预设分位数的情况下,根据更新后的预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;更新后的预设分位数小于预设分位数;预设分位数与固定占用内存正相关。
可以理解的是,在物理机开始运行时,在不确定物理机内存使用量的情况下,可以设置较大的预设分位数使固定占用内存大一些,从而使物理机空闲内存多一些,避免物 理机内存超载,然后,在物理机运行过程中,通过逐步增加预设分位数来逐步降低计算机容器的内存使用量的分位值,进而实现逐步减小计算机容器的固定占用内存的目的,避免物理机内存耗尽的同时,不断提高物理机内存复用效率。
在本申请的一个实施例中,统计服务器根据预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存之后,在接收到更新后的最大内存使用率的情况下,根据预设分位数、内存使用记录、更新后的最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;更新后的最大内存使用率高于最大内存使用率;最大内存使用率与固定占用内存负相关。
可以理解的是,在物理机开始运行时,在不确定物理机内存使用量的情况下,可以设置较低的最大内存使用率使物理机空闲内存多一些,避免物理机内存超载,然后,在物理机运行过程中,通过逐步提高最大内存使用率来逐步减小计算机容器的固定占用内存,避免物理机内存耗尽的同时,不断提高物理机内存复用效率。
在本申请的一些实施例中,在统计服务器同时接收到更新后的预设分位数和最大内存使用率的情况下,统计服务器根据更新后的预设分位数、内存使用记录、更新后的最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;更新后的预设分位数小于预设分位数;更新后的最大内存使用率高于最大内存使用率。
可以理解的是,在物理机运行过程中,通过逐步减小预设分位数的同时,提高最大内存使用率,从而实现逐步减小计算机容器的固定占用内存,避免物理机内存耗尽的同时,不断提高物理机内存复用效率。
在本申请的一个实施例中,在S203之后,本申请实施例提供了一种确定该内存的方法,如图4所示,该方法包括:
S401、接收第一物理机的容器内存调度请求;
S402、响应容器内存调度请求,从每个物理机对应的每个计算机容器的固定占用内存中确定所请求的目标容器的目标固定占用内存,并发送给第一物理机,第一物理机为各个物理机中的任意物理机。
这里,目标容器包括第一物理机上运行的所有计算机容器,目标固定占用内存为目标容器的固定占用内存。
在本申请实施例中,第一物理机的容器内存调度请求,是用来请求第一物理机上运行的所有计算机容器的固定占用内存的,统计服务器在确认出各个物理机上的每个计算机容器的固定占用内存之后,如果接收到第一物理机的容器内存调度请求,则将与第一物理机对应的所有计算机容器的固定占用内存全部发送给第一物理机。这样,第一物理机才能根据对应的计算机容器的固定占用内存来确定,第一物理机上可被调度的内存量。
其中,第一物理机可以是各个物理机中的任意一个物理机,目标容器是第一物理机上运行的所有计算机容器,目标固定占用内存为目标容器的固定占用内存,也就是说,统计服务器可以接受任意一个物理机的容器内存调度请求,并根据该物理机的容器内存调度请求,将该物理机上运行的所有计算机容器的固定占用内存发送给该物理机,由此,使每个物理机都可以获取对应的计算机容器的固定占用内存,进而确定该物理机自身的内存剩余量。
本申请实施例还提供了一种确定内存的方法,如图5所示,应用于物理机,该方法包括:
S501、在实现业务运行时,发送容器内存调度请求给统计服务器;
在本申请实施例中,物理机在实现业务运行时,需要向统计服务器发送容器内存调度请求,以获取该物理机上运行的所有计算机容器的固定占用内存。
这里,物理机为各个物理机中的任意一个物理机,也就是说,各个物理机中的任意一个物理机,在实现业务运行时,都需要向统计服务器发送容器内存调度请求。
S502、接收统计服务器响应容器内存调度请求反馈的目标固定占用内存;目标固定占用内存包括:至少一个计算机容器对应的固定占用内存,至少一个计算机容器为一个物理机中正在运行的全部计算机容器;
在本申请实施例中,物理机向统计服务器发送容器内存调度请求后,统计服务器响应该请求,将目标容器的目标固定占用内存发送给该物理机,即物理机接收物理机上运行的所有计算机容器的固定占用内存。
需要说明的是,由于各个物理机上的所有计算机容器的固定占用内存都是由统计服务器确定的,因此,每个物理机的容器内存调度请求中可以包括该物理机上运行的所有计算机容器的信息,使统计服务器能够根据容器内存调度请求来确定哪些计算机容器的固定占用内存是需要发送给该物理机的,将这些计算机容器确定为目标容器,将这些结算及容器的固定占用内存确定为的目标固定占用内存。
S503、获取自身的内存总量;
S504、基于内存总量和目标固定占用内存,确定物理机剩余内存量;物理机剩余内存量用于共业务运行时使用。
在本申请实施例中,物理机获取自身的内存总量后,根据内存总量和目标固定占用该内存来确定物理机剩余内存量,物理机剩余内存量是可以被调度给与该物理机对应的计算机容器的内存量,是与该物理机对应的计算机容器共用的内存量。
在本申请的一个实施例中,物理机基于内存总量和目标固定占用内存,确定物理机剩余内存量的实现方法可以包括:基于目标固定占用内存,确定至少一个计算机容器的对应的固定占用内存之和;从内存总量中减去固定占用内存之和,得到物理机剩余内存量。
可以理解的是,一个物理机对应至少一个计算机容器,每个计算机容器在物理机上 有对应的固定占用内存,所有计算机容器的固定占用内存之和是物理机上的固定占用内存总量,是不可以被调度的物理机内存,因此,用物理机内存减去固定占用内存总量即为物理机剩余内存量。
在本申请的一个实施例中,物理机实时获取自身的运行的至少一个计算机容器的实时占用内存;将实时占用内存上报给监控服务器,以供监控服务器为统计服务器提供监控各个物理机时获取对应的计算机容器的内存使用记录。
可以理解的是,物理机监控自身运行的计算机容器的实时占用内存,将监控到的计算机容器的实时占用内存上报给监控服务器,之后,监控服务器可以根据上报的每个计算机容器的实时占用内存,生成每个计算机容器的内存使用记录,在统计服务器需要确定计算机容器的固定占用内存时,将该计算机容器的内存使用记录发送给统计服务器,这样,统计服务器就可以根据内存使用记录来确定固定占用内存了。
本申请实施例提供了一种确定内存的方法,如图6所示,应用于物理机、监控服务器和统计服务器之间的交互,该方法包括:
S601、物理机实时获取自身运行的全部计算机容器的实时占用内存;
S602、物理机向监控服务器上报自身运行的全部计算机容器的实时占用内存;
S603、监控服务器根据接收到的计算机容器的实时占用内存生成对应的计算机容器的内存使用记录;
S604、监控服务器向统计服务器发送预设时间段内的物理机上的每个计算机容器的内存使用记录;
S605、统计服务器获取预设分位数,以及物理机的最大内存使用率;
S606、统计服务器根据物理机上的每个计算机容器的内存使用记录、预设分位数和物理机最大的内存使用率,确定每个计算机容器的固定占用内存;
S607、物理机向统计服务器发送容器内存调度请求;
S608、统计服务器响应物理机的容器内存调度请求,向物理机发送运行在物理机上的所有计算机容器的固定占用内存;
S609、物理机获取自身内存总量;
S610、物理机基于接收到的计算机容器的固定占用内存和内存总量确定物理机剩余内存量。
需要说明的是,在实际应用中,常常涉及多个物理机以与统计服务器以及监控服务器的交互,其中,每一个物理机与统计服务器以及监控服务器之间的交互,均执行图6所示的方法。
可以理解的是,统计服务器从监控服务器获取内存使用记录,根据内存使用记录、预设分位数和各个物理机最大的内存使用率,确定每个物理机对应的每个计算机容器的固定占用内存,将各个计算机容器的固定占用内存发送给对应的物理机,使物理机基于运行在该物理机上的计算机容器的固定占用内存,确定出该物理机的剩余内存量,进而 对剩余内存量进行调度,从而实现对物理机内存的合理利用,提高物理机的内存复用效果。
在一些实施例中,统计服务器的功能可以作为物理机中的一个统计模块来实现,监控服务器的功能可以作为物理机中的一个监控模块来实现,也就是说,物理机通过自身的监控模块来监控运行在该物理机上的所有计算机容器,并生成每个计算机容器的内存使用记录,统计模块根据每个计算机容器的内存使用记录、预设分位数、对应的计算机容器的最大可用内存、以及物理机的最大内存使用率,确定每个计算机容器的固定占用内存,由此,物理机根据所有计算机容器的固定占用内存计算内存剩余量。
本申请实施例提供一种统计服务器,如图7所示,该统计服务器7包括:
第一接收单元71,用于接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;所述计算机容器为使用物理机内存的容器;
第一获取单元72,用于获取预设分位数,以及各个物理机各自对应的最大内存使用率;
第一确定单元73,用于根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,所述每个物理机对应至少一个计算机容器。
在一些实施例中,所述第一确定单元73,还用于根据所述各个物理机对应的计算机容器的内存使用记录和所述预设分位数,统计在所述预设时间段内,每个物理机对应的每个计算机容器所占的内存使用量的分位值;所述内存使用量的分位值表示每个计算机容器使用的内存;根据所述内存使用量的分位值、各个物理机各自对应的最大内存使用率、和所述预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存。
在一些实施例中,所述第一确定单元73,还用于根据所述内存使用量的分位值与其对应的物理机的最大内存使用率,得到所述每个物理机对应的每个计算机容器的计算占用内存;将所述计算占用内存和每个物理机对应的所述最大可用内存中的最小值,作为每个物理机对应的每个计算机容器的所述固定占用内存。
在一些实施例中,所述第一接收单元71,还用于接收第一物理机的容器内存调度请求;所述第一确定单元73,还用于响应所述容器内存调度请求,从每个物理机对应的每个计算机容器的所述固定占用内存中确定所请求的目标容器的目标固定占用内存,并发送给所述第一物理机,所述第一物理机为所述各个物理机中的任意物理机。
在一些实施例中,所述第一确定单元73,还用于从所述每个计算机容器的内存使用记录中提取内存监控值,得到每个计算机容器的待统计内存值;从小到大的顺序分别对所述每个计算机容器的待统计内存值排序,得到每个计算机容器的排序结果;所述排序结果包括所述计算机容器的内存值和对应的序号数;根据所述每个计算机容器的排序结果和所述预设分位数,确定每个计算机容器所占的内存使用量的分位值。
在一些实施例中,所述第一确定单元73,还用于根据所述排序结果和预设分位数, 确定目标间隔;所述目标间隔表示所述分位值与所述排序结果中第一个内存值之间的间隔;据所述目标间隔和所述排序结果,确定所述分位值。
在一些实施例中,所述第一确定单元73,还用于根据所述排序结果,确定排序间隔;所述排序间隔表示所述排序结果中相邻两个待统计内存值之间的间隔的数目;根据所述排序间隔和所述预设分位数,确定所述目标间隔。
在一些实施例中,所述第一确定单元73,还用于在接收到更新后的预设分位数的情况下,根据所述更新后的预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;所述更新后的预设分位数高于所述预设分位数;所述预设分位数与所述固定占用内存正相关。
在一些实施例中,所述第一确定单元73,还用于在接收到更新后的最大内存使用率的情况下,根据所述预设分位数、所述内存使用记录、所述更新后的最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;所述更新后的最大内存使用率低于所述最大内存使用率;所述最大内存使用率与所述固定占用内存负相关。
在一些实施例中,所述第一确定单元73,在接收到更新后的预设分位值和更新后的最大使用率的情况下,根据所述更新后的分位值、所述内存使用记录、所述更新后的最大使用率,以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;所述更新后的预设分位数高于所述预设分位数;所述预设分位数与所述固定占用内存正相关;所述更新后的最大内存使用率低于所述最大内存使用率;所述最大内存使用率与所述固定占用内存负相关。
本申请实施例提供一种物理机,如图8所示,该物理机8包括:
发送单元81,用于在实现业务运行时,发送容器内存调度请求给统计服务器;
第二接收单元82,用于接收所述统计服务器响应所述容器内存调度请求反馈的目标固定占用内存;所述目标固定占用内存包括:至少一个计算机容器对应的固定占用内存,所述至少一个计算机容器为一个物理机中正在运行的全部计算机容器;
第二获取单元83,用于获取自身的内存总量;
第二确定单元84,用于基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量;所述物理机剩余内存量用于共业务运行时使用。
在一些实施例中,所述第二确定单元84,还用于基于所述目标固定占用内存中,确定所述至少一个计算机容器对应的固定占用内存之和;从所述内存总量中减去所述固定占用内存之和,得到所述物理机剩余内存量。
在一些实施例中,所述发送单元81,还用于实时获取自身的运行的至少一个计算机容器的实时占用内存;将所述实时占用内存上报给监控服务器,以供所述监控服务器为所述统计服务器提供监控各个物理机时获取对应的计算机容器的内存使用记录。
本申请实施例提供一种统计服务器,如图9所示,该统计服务器9包括:
第一处理器91、存储器92和通信总线93,存储器92通过通信总线93与第一处理器91进行通信,存储器92存储第一处理器91可执行的一个或者多个程序,当一个或者多个程序被执行时,通过第一处理器91执行如前述实施例的任意一种确定内存的方法。
本申请实施例提供一种物理机,如图10所示,该物理机10包括:
第二处理器101、存储器102和通信总线103,存储器102通过通信总线103与第二处理器101进行通信,存储器102存储第二处理器101可执行的一个或者多个程序,当一个或者多个程序被执行时,通过第二处理器101执行如前述实施例的任意一种确定内存的方法。
本申请实施例提供一种存储介质,应用于统计服务器,存储介质存储有一个或者多个程序,一个或者多个程序可被一个或者多个第一处理器91执行,程序被第一处理器执行时实现如本申请实施例的确定内存的方法。
本申请实施例提供一种存储介质,应用于物理机,存储介质存储有一个或者多个程序,一个或者多个程序可被一个或者多个第二处理器101执行,程序被第二处理器执行时实现如本申请实施例的确定内存的方法。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图 一个方框或多个方框中指定的功能的步骤。
以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。
工业实用性
本申请实施例中,固定占用内存是由预设分位数、内存使用记录、最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存确定出来的,避免了人工设置固定占用内存导致的内存浪费或内存耗尽,提高了物理机的内存复用效果。

Claims (16)

  1. 一种确定内存的方法,其特征在于,应用于统计服务器,包括:
    接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;所述计算机容器为使用物理机内存的容器;
    获取预设分位数,以及各个物理机各自对应的最大内存使用率;
    根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,所述每个物理机对应至少一个计算机容器。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,包括:
    根据所述各个物理机对应的计算机容器的内存使用记录和所述预设分位数,统计在所述预设时间段内,每个物理机对应的每个计算机容器所占的内存使用量的分位值;所述内存使用量的分位值表示每个计算机容器使用的内存;
    根据所述内存使用量的分位值、各个物理机各自对应的最大内存使用率、和所述预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述内存使用量的分位值、各个物理机各自对应的最大内存使用率、和所述预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,包括:
    根据所述内存使用量的分位值与其对应的物理机的最大内存使用率,得到所述每个物理机对应的每个计算机容器的计算占用内存;
    将所述计算占用内存和每个物理机对应的所述最大可用内存中的最小值,作为每个物理机对应的每个计算机容器的所述固定占用内存。
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存之后,所述方法还包括:
    接收第一物理机的容器内存调度请求;
    响应所述容器内存调度请求,从每个物理机对应的每个计算机容器的所述固定占用内存中确定所请求的目标容器的目标固定占用内存,并发送给所述第一物理机,所述第一物理机为所述各个物理机中的任意物理机。
  5. 根据权利要求2所述的方法,其特征在于,所述根据所述各个物理机对应的计算机容器的内存使用记录和所述预设分位数,统计在所述预设时间段内,每个物理机对 应的每个计算机容器所占的内存使用量的分位值,包括:
    从所述各个物理机对应的所述每个计算机容器的内存使用记录中提取在所述预设时间段内的内存监控值,得到每个计算机容器的待统计内存值;
    对所述每个计算机容器的待统计内存值进行排序,得到每个计算机容器的排序结果;
    根据所述每个计算机容器的排序结果和所述预设分位数,确定所述各个物理机对应的每个计算机容器所占的所述内存使用量的分位值。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述每个计算机容器的排序结果和所述预设分位数,确定所述各个物理机对应的每个计算机容器所占的所述内存使用量的分位值,包括:
    根据所述排序结果和预设分位数,确定目标间隔长度;所述目标间隔长度表示所述分位值与所述排序结果中最小的待统计内存值之间的间隔长度;
    根据所述目标间隔长度和所述排序结果,确定每个计算机容器对应的所述分位值。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述排序结果和预设分位数,确定目标间隔长度,包括:
    根据所述排序结果,确定排序间隔长度;所述排序间隔长度表示所述排序结果中相邻两个待统计内存值之间的间隔的数目;
    根据所述排序间隔长度和所述预设分位数,确定所述目标间隔长度。
  8. 根据权利要求1至3、或5至7任一项所述的方法,其特征在于,所述根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存之后,所述方法还包括:
    在接收到更新后的预设分位数的情况下,根据所述更新后的预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;所述更新后的预设分位数小于所述预设分位数;所述预设分位数与所述固定占用内存正相关。
  9. 根据权利要求1至3、或5至8任一项所述的方法,其特征在于,所述根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存之后,所述方法还包括:
    在接收到更新后的最大内存使用率的情况下,根据所述预设分位数、所述内存使用记录、所述更新后最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存;所述更新后的最大内存使用率高于所述最大内存使用率;所述最大内存使用率与所述固定占用内存负相关。
  10. 一种确定内存的方法,其特征在于,应用于物理机,包括:
    在实现业务运行时,发送容器内存调度请求给统计服务器;
    接收所述统计服务器响应所述容器内存调度请求反馈的目标固定占用内存;所述目标固定占用内存包括:至少一个计算机容器对应的固定占用内存,所述至少一个计算机容器为一个物理机中正在运行的全部计算机容器;
    获取自身的内存总量;
    基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量;所述物理机剩余内存量用于共业务运行时使用。
  11. 根据权利要求10所述的方法,其特征在于,所述基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量,包括:
    基于所述目标固定占用内存中,确定所述至少一个计算机容器对应的固定占用内存之和;
    从所述内存总量中减去所述固定占用内存之和,得到所述物理机剩余内存量。
  12. 根据权利要求10或11所述的方法,其特征在于,所述方法还包括:
    实时获取自身的运行的至少一个计算机容器的实时占用内存;
    将所述实时占用内存上报给监控服务器,以供所述监控服务器为所述统计服务器提供监控各个物理机时获取对应的计算机容器的内存使用记录。
  13. 一种统计服务器,其特征在于,包括:
    第一接收单元,用于接收在预设时间段内监控到的各个物理机对应的计算机容器的内存使用记录;所述计算机容器为使用物理机内存的容器;
    第一获取单元,用于获取预设分位数,以及各个物理机各自对应的最大内存使用率;
    第一确定单元,用于根据所述预设分位数、所述内存使用记录、所述最大内存使用率、以及各物理机对应的计算机容器的预设最大可用内存,确定每个物理机对应的每个计算机容器的固定占用内存,其中,所述每个物理机对应至少一个计算机容器。
  14. 一种物理机,其特征在于,包括:
    发送单元,用于在实现业务运行时,发送容器内存调度请求给统计服务器;
    第二接收单元,用于接收所述统计服务器响应所述容器内存调度请求反馈的目标固定占用内存;所述目标固定占用内存包括:至少一个计算机容器对应的固定占用内存,所述至少一个计算机容器为一个物理机中正在运行的全部计算机容器;
    第二获取单元,用于获取自身的内存总量;
    第二确定单元,用于基于所述内存总量和所述目标固定占用内存,确定物理机剩余内存量;所述物理机剩余内存量用于共业务运行时使用。
  15. 一种存储介质,应用于统计服务器,其特征在于,存储有可执行指令,当所述可执行指令被一个或多个第一处理器执行的时候,所述第一处理器执行所述的权利要求1至9任一项所述的确定内存的方法。
  16. 一种存储介质,应用于物理机,其特征在于,存储有可执行指令,当所述可执 行指令被一个或多个第二处理器执行的时候,所述第二处理器执行所述的权利要求10至12任一项所述的确定内存的方法。
PCT/CN2020/084683 2020-04-14 2020-04-14 确定内存的方法、统计服务器、物理机和存储介质 WO2021207926A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/084683 WO2021207926A1 (zh) 2020-04-14 2020-04-14 确定内存的方法、统计服务器、物理机和存储介质
CN202080099867.0A CN115398399A (zh) 2020-04-14 2020-04-14 确定内存的方法、统计服务器、物理机和存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/084683 WO2021207926A1 (zh) 2020-04-14 2020-04-14 确定内存的方法、统计服务器、物理机和存储介质

Publications (1)

Publication Number Publication Date
WO2021207926A1 true WO2021207926A1 (zh) 2021-10-21

Family

ID=78083549

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/084683 WO2021207926A1 (zh) 2020-04-14 2020-04-14 确定内存的方法、统计服务器、物理机和存储介质

Country Status (2)

Country Link
CN (1) CN115398399A (zh)
WO (1) WO2021207926A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968840A (zh) * 2022-07-29 2022-08-30 北京永洪商智科技有限公司 一种内存使用量控制方法及系统
CN115604668A (zh) * 2022-12-09 2023-01-13 融合通信技术(天津)有限公司(Cn) 短信发送和推送监控方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232282A (zh) * 2010-10-29 2011-11-02 华为技术有限公司 一种实现数据中心资源负载均衡的方法及装置
CN103810109A (zh) * 2012-11-15 2014-05-21 华为技术有限公司 内存分配方法、装置及系统
CN105204948A (zh) * 2015-10-29 2015-12-30 广州云宏信息科技股份有限公司 虚拟机物理内存配置方法及装置
US20170090962A1 (en) * 2014-06-12 2017-03-30 Huawei Technologies Co., Ltd. Method for Mapping Between Virtual CPU and Physical CPU and Electronic Device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232282A (zh) * 2010-10-29 2011-11-02 华为技术有限公司 一种实现数据中心资源负载均衡的方法及装置
CN103810109A (zh) * 2012-11-15 2014-05-21 华为技术有限公司 内存分配方法、装置及系统
US20170090962A1 (en) * 2014-06-12 2017-03-30 Huawei Technologies Co., Ltd. Method for Mapping Between Virtual CPU and Physical CPU and Electronic Device
CN105204948A (zh) * 2015-10-29 2015-12-30 广州云宏信息科技股份有限公司 虚拟机物理内存配置方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968840A (zh) * 2022-07-29 2022-08-30 北京永洪商智科技有限公司 一种内存使用量控制方法及系统
CN114968840B (zh) * 2022-07-29 2022-11-01 北京永洪商智科技有限公司 一种内存使用量控制方法及系统
CN115604668A (zh) * 2022-12-09 2023-01-13 融合通信技术(天津)有限公司(Cn) 短信发送和推送监控方法、装置、设备及存储介质
CN115604668B (zh) * 2022-12-09 2023-05-09 融合通信技术(天津)有限公司 短信发送和推送监控方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN115398399A (zh) 2022-11-25

Similar Documents

Publication Publication Date Title
CN107426274B (zh) 基于时序的业务应用及监控分析调度的方法和系统
WO2021207926A1 (zh) 确定内存的方法、统计服务器、物理机和存储介质
CN108845878A (zh) 基于无服务器计算的大数据处理方法及装置
CN108270805B (zh) 用于数据处理的资源分配方法及装置
US11496413B2 (en) Allocating cloud computing resources in a cloud computing environment based on user predictability
CN110716808B (zh) 业务处理方法、装置、计算机设备和存储介质
CN110990138A (zh) 资源调度方法、装置、服务器及存储介质
CN113568756B (zh) 一种密码资源协同动态调度方法和系统
CN111600967A (zh) 一种基于访问压力的区块链节点间负载均衡系统
CN104572302B (zh) 一种实现资源分配的方法及装置
US20190138354A1 (en) Method for scheduling jobs with idle resources
CN112261120A (zh) 一种配电物联网云边协同任务卸载方法及装置
CN106982441A (zh) 一种小区扩容的确定方法及装置
US9621438B2 (en) Network traffic management
CN106933673A (zh) 调整组件逻辑线程数量的方法及装置
CN109347982A (zh) 一种数据中心的调度方法及装置
US20210004675A1 (en) Predictive apparatus and method for predicting workload group metrics of a workload management system of a database system
CN115941622A (zh) 一种带宽调节方法、系统、设备及存储介质
CN115168042A (zh) 监控集群的管理方法及装置、计算机存储介质、电子设备
TWI584667B (zh) 多請求的排程方法及排程裝置
CN112667392A (zh) 云计算资源分配方法、装置、计算机设备和存储介质
CN102567024A (zh) 脚本执行系统和脚本执行方法
CN113822485A (zh) 一种配电网调度任务优化方法及系统
CN107479977B (zh) 一种确定设备性能的方法和设备
Skulysh et al. Development of the concept for the computational resources management software in the customer service systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20931403

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 15/03/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20931403

Country of ref document: EP

Kind code of ref document: A1