CN112085535A - Resource metering charging method, device, cluster and storage medium - Google Patents

Resource metering charging method, device, cluster and storage medium Download PDF

Info

Publication number
CN112085535A
CN112085535A CN202010967790.6A CN202010967790A CN112085535A CN 112085535 A CN112085535 A CN 112085535A CN 202010967790 A CN202010967790 A CN 202010967790A CN 112085535 A CN112085535 A CN 112085535A
Authority
CN
China
Prior art keywords
metering
charging
resource
metadata
resources
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
Application number
CN202010967790.6A
Other languages
Chinese (zh)
Inventor
史建华
张晓东
连建永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Ling Skylark Technology Co ltd
Original Assignee
Beijing Ling Skylark Technology Co ltd
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 Beijing Ling Skylark Technology Co ltd filed Critical Beijing Ling Skylark Technology Co ltd
Priority to CN202010967790.6A priority Critical patent/CN112085535A/en
Publication of CN112085535A publication Critical patent/CN112085535A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0283Price estimation or determination

Landscapes

  • Business, Economics & Management (AREA)
  • Development Economics (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a resource metering charging method, a device, a cluster and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining metadata of resources of various types of a service cluster in a container system, wherein the metadata is used for indicating quota amount of the resources of various types, and executing metering charging service according to the metadata of the resources of various types and a preset metering charging strategy. Compared with the prior art, the method solves the problem of low metering and charging efficiency, and makes the metering and charging operation almost have no perception to the service cluster by controlling the mode of separating the cluster from the service cluster, thereby reducing the intrusion and interference of the metering and charging service to the service of the user and ensuring the stability of the whole system.

Description

Resource metering charging method, device, cluster and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a resource metering charging method, device, cluster, and storage medium.
Background
With the development of public cloud technology, public clouds are widely applied in medical treatment, education, technical research and development and the like. The metering and charging of the resources are the key of the public cloud landing.
Currently, the usage of resources is counted by each host, and a bill corresponding to the usage of resources is generated according to a predefined charging policy, where the metering charging refers to counting the usage of resources by using a set of predefined metering policies. However, with the change of metering units, it is inefficient to employ the conventional metering charging mode.
Disclosure of Invention
An object of the present application is to provide a method, an apparatus, a cluster and a storage medium for metering and charging a container, so as to solve the problem of low metering and charging efficiency in the prior art.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides a resource metering and charging method, where the method includes:
acquiring metadata of each type of resource in a container system of a service cluster, wherein the metadata is used for indicating quota amount of each type of resource;
and executing the metering charging service according to the metadata of the resources of each type and a preset metering charging strategy.
Optionally, the performing a metering charging service according to the metadata of the resources of the respective types and a preset metering charging policy includes:
acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster;
and executing the metering charging service according to the metadata of the resources of all types, the resource usage amount and the metering charging strategy.
Optionally, after the performing a metering charging service according to the metadata of the resources of the respective types and a preset metering charging policy, the method further includes:
and acquiring the metering charging summary data within a first preset time according to the metering charging detail data obtained by the metering charging service.
Optionally, after acquiring the metering charging summary data within the first preset time according to the metering charging detail data obtained by the metering charging service, the method further includes:
and acquiring the metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is greater than the first preset time length.
Optionally, the acquiring metadata of each type of resource in the container system of the service cluster includes:
acquiring quota quantities of a plurality of containers corresponding to a target container group from the container system;
taking a sum of the quota amounts of the plurality of containers as metadata of the target container group resource, the metadata of the target container group resource including the quota amount of the target container group resource.
Optionally, the obtaining the resource usage amount of each type of resource from the monitoring system of the service cluster includes:
acquiring resource usage amounts of a plurality of containers corresponding to the target container group resource from the monitoring system;
and adding the resource usage amounts of the plurality of containers to obtain the resource usage amount of the container group resource.
Optionally, the method further includes:
and storing the metering charging summary data of the first preset time length to a preset storage system, and updating the metering charging summary data of the first preset time length stored in the preset storage system with the updated metering charging summary data of the first preset time length when the updated data exists.
In a second aspect, another embodiment of the present application provides an apparatus for metering and charging resources, where the apparatus includes:
an obtaining module, configured to obtain metadata of resources of each type in a container system of a service cluster, where the metadata is used to indicate a quota amount of the resources of each type;
and the processing module is used for executing the metering charging service according to the metadata of the resources of all types and a preset metering charging strategy.
Optionally, the processing module is specifically configured to:
acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster;
and executing the metering charging service according to the metadata of the resources of all types, the resource usage amount and the metering charging strategy.
Optionally, the obtaining module is further configured to:
and acquiring the metering charging summary data within a first preset time according to the metering charging detail data obtained by the metering charging service.
Optionally, the obtaining module is further configured to:
and acquiring the metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is greater than the first preset time length.
Optionally, the resources of each type include container group resources, and the obtaining module is specifically configured to:
acquiring quota quantities of a plurality of containers corresponding to a target container group from the container system;
taking a sum of the quota amounts of the plurality of containers as metadata of the target container group resource, the metadata of the target container group resource including the quota amount of the target container group resource.
Optionally, the resources of each type include container group resources, and the obtaining module is specifically configured to:
acquiring resource usage amounts of a plurality of containers corresponding to the target container group resource from the monitoring system;
and adding the resource usage amounts of the plurality of containers to obtain the resource usage amount of the container group resource.
Optionally, the method further comprises:
and the storage module is used for storing the metering charging summary data of the first preset time length to a preset storage system, and updating the metering charging summary data of the first preset time length stored in the preset storage system with the updated metering charging summary data of the first preset time length when the updated data exists.
In a third aspect, another embodiment of the present application provides a control cluster, including: a processor, a memory and a bus, the memory storing a computer program executable by the processor, the processor and the memory communicating via the bus when the control cluster is running, the processor executing the computer program to perform the method of any of the first aspect.
In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the method of any one of the first aspect.
The application provides a resource metering charging method, a device, a cluster and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining metadata of resources of various types of a service cluster in a container system, wherein the metadata is used for indicating quota amount of the resources of various types, and executing metering charging service according to the metadata of the resources of various types and a preset metering charging strategy. Compared with the prior art, the method solves the problem of low metering and charging efficiency, and makes the metering and charging operation almost have no perception to the service cluster by controlling the mode of separating the cluster from the service cluster, thereby reducing the intrusion and interference of the metering and charging service to the service of the user and ensuring the stability of the whole system.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 shows an architecture diagram of a resource metering and charging system provided by an embodiment of the present application;
fig. 2 is a first flowchart illustrating a resource metering and charging method provided in an embodiment of the present application;
fig. 3 shows a second flowchart of a resource metering and charging method provided in the embodiment of the present application;
fig. 4 shows a third flowchart of a resource metering and charging method provided in the embodiment of the present application;
fig. 5 shows a schematic structural diagram of a resource metering and charging apparatus provided in an embodiment of the present application;
fig. 6 shows a schematic structural diagram of a control cluster provided in an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for illustrative and descriptive purposes only and are not used to limit the scope of protection of the present application. Additionally, it should be understood that the schematic drawings are not necessarily drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
In addition, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that in the embodiments of the present application, the term "comprising" is used to indicate the presence of the features stated hereinafter, but does not exclude the addition of further features.
As kubernets stands out from the battle of container arrangement tools, it is increasingly referred to as a de facto standard for container management. The container technology is also mature and strong, the commercial landing of a multi-cloud mixed cloud is continuously accelerated, containerization becomes a future development trend of internet technology, container appearance causes the change of a metering unit, and the change is transited from an original host node to a container example, wherein the containerization causes the metering and charging unit to become smaller and more, the starting and stopping frequency and the number of the container example far exceed those of the former host node due to the fact that the container is an ultra-light virtual machine in nature, and therefore, along with the change of the metering unit, a performance bottleneck of a traditional metering and charging scheme on a performance container can be caused, and the efficiency is low.
In order to solve the above problems, the present application provides a resource metering and charging method, which includes obtaining metadata of each type of resource of a service cluster in a container system, where the metadata is used to indicate quota amount of each type of resource, and executing a metering and charging service according to the metadata of each type of resource and a preset metering and charging policy.
Fig. 1 shows a schematic structural diagram of a resource metering and charging system provided in an embodiment of the present application, and as shown in fig. 1, the resource metering and charging system includes a control cluster 100 and a service cluster 200, where the control cluster 100 and the service cluster 200 are respectively composed of a plurality of service hosts.
The control cluster 100 is configured to manage the service cluster 200, for example, when a website is deployed, the service of the website is deployed to a corresponding service host in the service cluster 200, so that a user actually accesses the corresponding service host in the service cluster 200 when accessing the website; the service cluster 200 is used to run specific user services. Therefore, on one hand, the management service and the user service are separated, the interference of the two services is reduced as much as possible, on the other hand, the relative stability of the control cluster 100 can be ensured, and the whole system cannot be crashed when any one service cluster 200 fails.
In this embodiment, the control cluster 100 is provided with a metering and charging component 101 and a storage system 102, where the metering and charging component 101 is a core of the whole system for executing a metering and charging algorithm, and is configured to obtain metadata of some resources from the container system 201 and obtain monitoring indexes from the monitoring system 202 to generate metering and charging data. The metering and charging data is divided into two types, one type is detail data, and the other type is summarized data. For example, a certain time is set between every two days, and the measurement detail data of the current day is continuously refreshed according to the monitoring index and the metadata by a timing task; the method comprises the steps that a timing task is carried out once every day, summarized data of the previous day are generated according to detail data of the previous day, the data are permanently stored in an external storage system in a document mode, after the metering data exist, a metering and charging report can be generated according to a monthly or annual mode, and meanwhile metering and charging details of any container resource in a certain time period can be inquired.
The storage system 102 is used to store the metering billing data. Because of the huge number of containers and frequent start and stop, a large amount of metering and billing data is generated every day, and because of the requirements of some enterprises, the metering and billing data may be stored for a long time, and therefore a database which can store a large amount of data and can be stored for a long time and can provide a quick retrieval capability is required, and therefore, the ElasticSearch can be used as the storage system 102, and the storage system in the embodiment includes but is not limited to ElasticSearch.
The service cluster 200 is provided with a container system 201 (i.e., a kubernets container arrangement system) and a monitoring system 202, wherein the container system 201 is a bottom carrier of the whole cluster, and can manage all resources on a service host in the service cluster 200 for the containers running thereon to use. Kubernets as a control center of the whole cluster can allocate and recycle resources required by containers, various user services can run on the Kubernets in a container mode, and dynamic migration, horizontal expansion, health check and smooth upgrading of the containers are guaranteed by a Kubernets orchestration system.
The monitoring system 202 is a monitoring center of the whole service cluster and is responsible for collecting relevant monitoring indexes, such as resource usage, from service hosts and containers in the service cluster. The monitoring system 202 may be a Prometheus monitoring system, which is a high-performance time sequence database integrating collection, storage, and query, and can actively capture monitoring indexes of hosts and containers in a cluster, and provide a plurality of data storage modes and a complete set of PSQLs for users to query. In the present embodiment, the container is the minimum unit for metering and charging, and the resource information consumed by the container is stored in the promemeus in the form of Metrics, which is the main data source of the metering and charging system. Of course, the monitoring system 202 may also be other monitoring index collection systems, which is not limited in this embodiment.
In an actual Application process, after the service cluster 200 is deployed, a Kubernetes container arrangement system and a promemeus monitoring system need to be installed on the service cluster 200, and the service cluster 200 is accessed into the control cluster 100 to be managed, the metering and charging component 101 in the control cluster 100 may obtain a system configuration of the newly accessed service cluster 200 through a preset Application Programming Interface (API), where the system configuration includes, but is not limited to, an access manner of Kubernetes, an access manner of promemeus, and the like, so that the control cluster 100 can access the service cluster 200 to obtain required data, before obtaining the required data, the metering and charging component 101 may determine whether the service cluster 200 is installed with promemeus, and if not, skip the service cluster 200, that is, it is a condition that the installation of the promemeus monitoring system is a resource metering and charging system.
The resource metering and charging method of the present application is described in detail below with reference to several specific embodiments.
Fig. 2 is a flowchart illustrating a first flowchart of a resource metering and charging method provided in an embodiment of the present application, where the scheme may be executed by the control cluster illustrated in fig. 1. As shown in fig. 2, the method comprises the steps of:
s301, obtaining metadata of each type of resource in a container system of the service cluster, wherein the metadata is used for indicating the quota amount of each type of resource.
S302, executing metering charging service according to the metadata of each type of resource and a preset metering charging strategy.
Wherein the container system may be a kubernets container orchestration system as shown in the embodiment of fig. 1.
Specifically, the control cluster may obtain, through the metering and charging component, metadata of each type of resource based on a preset application program interface API, where the metadata is used to indicate a quota amount of each type of resource, where the quota amount is allocated resource information, and then execute the metering and charging service according to the metadata of each type of resource and a preset metering and charging policy. The metering and charging policy includes a metering policy and a charging policy, the metering policy may be, for example, a total quota obtained by adding quotas of a certain type of resources, and the charging policy may be, for example, a total cost obtained by multiplying the total quota by a quota unit price.
Optionally, the metadata includes at least one of:
CPU quota, memory quota, bandwidth quota, hard disk quota.
The CPU quota is a CPU resource allocated to a certain type of resource, for example, may be a 4-core CPU and an 8-core CPU, the memory quota is a memory resource allocated to a certain type of resource, for example, may be an 8G memory and a 16G memory, the bandwidth quota is a bandwidth resource allocated to a certain type of resource, and the hard disk resource is a hard disk resource allocated to a certain type of resource.
For example, if the metadata includes a CPU quota, a memory quota, a bandwidth quota, and a hard disk quota, the preset metering and charging policy includes a metering policy and a charging policy, and the charging policy may include a charging policy of the CPU, a charging policy of the memory, a charging policy of the bandwidth, and a charging policy of the hard disk, and similarly, the metering policy may include a metering policy of the CPU, a metering policy of the memory, a metering policy of the bandwidth, and a metering policy of the hard disk.
Taking the CPU quota as an example, the CPU quota may be measured according to a measurement policy of the CPU, and the CPU cost may be obtained by combining a charging policy of the CPU, where the charging policy of the CPU may be, for example, the CPU cost obtained by multiplying the CPU unit price by the CPU quota, and then the CPU cost, the memory cost, the bandwidth cost, and the hard disk cost are added to obtain the cost of the total resource.
Of course, the preset metering and charging policy and the CPU unit price may be determined according to actual situations, which is not particularly limited in this embodiment.
Optionally, the respective types of resources include at least one of the following resources:
container group resources, business resources, namespace resources.
The container group resource is a Pod resource, the container group includes multiple containers, and the quota of the container group may be obtained by adding quotas of the multiple containers in the container group, for example, the CPU quota of the container group is obtained by adding the CPU quotas of the multiple containers in the container group.
The service resources are project resources, the resources allocated to different projects are different, the control cluster can acquire metadata of the service resources from the container system through the metering and charging component, the projects can be website projects for example, and the service resources are resources allocated to websites.
The namespaces may be operational environments of the services, that is, a service may be operated in different namespaces, for example, for a website project, a first namespace is used for a first test, a second namespace is used for a second test, a third namespace is used for a user to access, and different resources may be allocated for different namespaces.
Optionally, if the resources of each type include a container group resource, the obtaining metadata of the resources of each type in the container system of the service cluster includes:
acquiring quota quantities of a plurality of containers corresponding to a target container group from a container system;
and taking the sum of the quota amounts of the plurality of containers as metadata of the target container group resource, wherein the metadata of the target container group resource comprises the quota amount of the target container group resource.
Specifically, since the container group includes a plurality of containers, and a container is a minimum unit of the container group, quota amounts of the plurality of containers corresponding to the target container group may be obtained from the container system, and then a sum of the quota amounts of the plurality of containers is used as a quota amount of the target container group. The target container group is any container group which needs to execute metering and charging service, and the quota amount of each container is stored in the container system.
It should be noted that the control cluster may obtain the metadata of each type of resource from the monitoring system at regular time or in real time, for example, the metadata is executed once every two hours, which is not particularly limited in this embodiment.
The resource metering and charging method provided by the embodiment comprises the following steps: the method comprises the steps of obtaining metadata of resources of various types of a service cluster in a container system, wherein the metadata is used for indicating quota amount of the resources of various types, and executing metering charging service according to the metadata of the resources of various types and a preset metering charging strategy. The problem of low metering and charging efficiency is solved, and the metering and charging operation is almost unaware to the service cluster by controlling the mode of separating the cluster from the service cluster, so that the invasion and interference of the metering and charging service to the service of the user are reduced, and the integral stability of the system is ensured.
On the basis of the embodiment of fig. 2, executing a metering charging service according to metadata of each type of resource and a preset metering charging policy specifically includes the steps shown in the embodiment of fig. 3. Fig. 3 shows a second flowchart of the resource metering and charging method provided in the embodiment of the present application, and as shown in fig. 3, the performing of the metering and charging service according to the metadata of each type of resource and the preset metering and charging policy specifically includes:
s401, acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster.
S402, executing metering charging service according to the metadata of the resources of the types, the resource usage amount and the metering charging strategy.
The resource usage may include at least one of an actual usage of the CPU, an actual usage of the memory, an actual usage of the bandwidth, and an actual usage of the hard disk.
Specifically, the control cluster may obtain the resource usage amounts of each type from the monitoring system of the service cluster through the metering and charging component based on a preset API, and then execute the metering and charging service according to the metadata of the resources of each type, the resource usage amounts, and a preset metering and charging policy.
The metering and charging policy comprises a metering policy and a charging policy, the metering policy can comprise a metering policy of a CPU, a metering policy of a memory, a metering policy of a bandwidth and a metering policy of a hard disk, and the charging policy can comprise a charging policy of the CPU, a charging policy of the memory, a charging policy of the bandwidth and a charging policy of the hard disk.
In an optional embodiment, the total amount of the CPU is obtained according to a CPU quota of a certain type of resource, an actual usage amount of the CPU, and a metering policy of the CPU, where the metering policy of the CPU may be, for example, an average value of the CPU quota and the actual usage amount of the CPU, and the CPU cost is obtained according to a charging policy of the CPU, and the charging policy of the CPU may be, for example, a unit CPU unit price multiplied by the CPU quota to obtain the CPU cost.
Similarly, the memory cost, the bandwidth cost, and the hard disk cost may be obtained separately with reference to the calculation method of the CPU cost, and then the CPU cost, the memory cost, the bandwidth cost, and the hard disk cost are added to obtain the total resource cost.
It should be noted that the control cluster may obtain the resource usage amount of each type of resource from the monitoring system at regular time or in real time, for example, the resource usage amount may be obtained every two hours, so that the metering and charging data of each type of resource in each day, each week, and each month may be obtained.
Optionally, the obtaining the resource usage amount of each type of resource from the monitoring system of the service cluster includes:
acquiring resource usage amounts of a plurality of containers corresponding to the target container group resource from a monitoring system;
and adding the resource usage amounts of the containers to obtain the resource usage amount of the container group resource.
Specifically, since the container group includes a plurality of containers, and a container is a minimum unit of the container group, the resource usage amounts of the plurality of containers corresponding to the target container group may be obtained from the monitoring system, and then a sum of the resource usage amounts of the plurality of containers is used as the resource usage amount of the target container group. The monitoring system is used for collecting the resource usage amount of each container.
The resource metering and charging method provided by the embodiment comprises the following steps: and acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster, and executing the metering and charging service according to the metadata, the resource usage amount and the metering and charging strategy of each type of resource. In this embodiment, the data source of the metering charging is the monitoring index of the monitoring system, and due to the time sequence continuity of the monitoring index of the monitoring system, the sampling interval of the metering data is usually very small, so that the accuracy of the resource usage amount obtained by the control cluster is ensured, and the problem of low metering charging efficiency is solved.
On the basis of the foregoing embodiment, fig. 4 shows a third flowchart of a resource metering and charging method provided in the embodiment of the present application, and as shown in fig. 4, after performing a metering and charging service according to metadata of each type of resource and a preset metering and charging policy, the method further includes:
s501, acquiring the summarized data of the metering charging within the first preset time according to the detailed metering charging data obtained by the metering charging service.
The metering charging detail data obtained by executing the metering charging service in steps S401 to S402 include the metering charging detail data and the charging detail data, and then the metering charging component may collect the metering charging detail data within a first preset time in a timing manner to obtain the metering charging summary data within the first preset time, including the metering summary data and the charging summary data.
The first preset duration can be one day, and the metering and charging component can collect the metering and charging detail data of each day at regular time to generate daily metering and charging summary data.
Optionally, the metering and charging detail data of the first day is summarized by default on the second day, so that the accuracy of the metering and charging summarized data of the first day can be ensured.
Optionally, the metering charging summary data of the first preset time duration may also be stored in the preset storage system, and when the updated data exists, the metering charging summary data of the first preset time duration stored in the preset storage system is updated with the updated metering charging summary data of the first preset time duration.
Specifically, the preset storage system may be an elastic search shown in the embodiment of fig. 1, and if the metadata and the resource usage amount are continuously obtained by a timing task, when updated data exists, the summarized metering and charging detail data is executed again, and the updated metering and charging summary data with the first preset time duration updates the metering and charging summary data with the first preset time duration stored in the preset storage system, so as to ensure accuracy of the data. The updated data comprises updated metadata and updated resource usage, wherein the metering charging summary data of the first preset time period can be stored in a preset storage system in a document form, so that a user can conveniently inquire the metering charging summary data of the first preset time period.
Of course, the metering and charging detail data may also be stored in the preset storage system, and the specific execution process is similar to the process of the metering and charging summary data of the first preset duration, and is not described herein again.
Optionally, after acquiring the metering charging summary data within the first preset time period according to the metering charging detail data obtained by the metering charging service, the method further includes:
s502, acquiring the metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is larger than the first preset time length.
Through the steps, the metering charging summary data in the first preset time length can be obtained, the metering charging assembly can summarize the metering charging summary data in the first preset time length in a timing mode to obtain the metering charging summary data in the second preset time length, and the second preset time length is larger than the first preset time length.
And if the second preset time can be one month, and the first preset time can be one day, summarizing the daily metering charging summary data to obtain monthly metering charging summary data.
Optionally, the summary is performed on the first day of the month to obtain the previous month measurement and charging summary data, so that the accuracy of the previous month measurement and charging summary data can be ensured.
Optionally, the metering charging summary data of the second preset time duration may also be stored in the preset storage system, and when the updated data exists, the metering charging summary data of the second preset time duration stored in the preset storage system is updated with the updated metering charging summary data of the second preset time duration.
The execution process of the metering charging summary data of the second preset time duration is similar to the process of the metering charging summary data of the first preset time duration, and is not described herein again.
The resource metering and charging method provided by the embodiment comprises the following steps: the method comprises the steps of obtaining metering charging summary data in a first preset time length according to metering charging detail data obtained by metering charging service, and obtaining metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is larger than the first preset time length. Because the algorithm timing task of the metering and charging has longer execution interval and less execution times, the existing monitoring index is only converted into the metering and charging list during each execution, and then the metering and charging summary list is generated according to the metering and charging list, the metering algorithm has low complexity, and is quick, simple and efficient.
Fig. 5 shows a schematic structural diagram of a resource metering and charging apparatus provided in an embodiment of the present application, where the resource metering and charging apparatus 600 may be integrated in a control cluster. As shown in fig. 5, the resource metering and charging apparatus 600 includes:
an obtaining module 601, configured to obtain metadata of each type of resource in a container system of a service cluster, where the metadata is used to indicate a quota amount of each type of resource;
a processing module 602, configured to execute a metering and charging service according to the metadata of the resources of the various types and a preset metering and charging policy.
Optionally, the processing module 602 is specifically configured to:
acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster;
and executing the metering charging service according to the metadata of the resources of all types, the resource usage amount and the metering charging strategy.
Optionally, the obtaining module 601 is further configured to:
and acquiring the metering charging summary data within a first preset time according to the metering charging detail data obtained by the metering charging service.
Optionally, the obtaining module 601 is further configured to:
and acquiring the metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is greater than the first preset time length.
Optionally, the resources of each type include container group resources, and the obtaining module is specifically configured to:
acquiring quota quantities of a plurality of containers corresponding to a target container group from the container system;
taking a sum of the quota amounts of the plurality of containers as metadata of the target container group resource, the metadata of the target container group resource including the quota amount of the target container group resource.
Optionally, the resources of each type include container group resources, and the obtaining module 601 is specifically configured to:
acquiring resource usage amounts of a plurality of containers corresponding to the target container group resource from the monitoring system;
and adding the resource usage amounts of the plurality of containers to obtain the resource usage amount of the container group resource.
Optionally, the method further comprises:
the storage module 603 is configured to store the metering charging summary data of the first preset time duration to a preset storage system, and when there is update data, update the metering charging summary data of the first preset time duration stored in the preset storage system with the updated metering charging summary data of the first preset time duration.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Fig. 6 shows a schematic structural diagram of a control cluster provided in an embodiment of the present application, and as shown in fig. 6, a control cluster 700 includes: the system comprises a processor 701, a memory 702 and a bus 703, wherein the memory 702 stores a computer program executable by the processor 701, when the control cluster 700 runs, the processor 701 communicates with the memory 702 through the bus 703, and the processor 701 executes the computer program to execute the resource metering and charging method.
The embodiment of the application also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the resource metering and charging method is executed.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to corresponding processes in the method embodiments, and are not described in detail in this application. In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and there may be other divisions in actual implementation, and for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or modules through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a service host, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.

Claims (10)

1. A resource metering charging method is characterized by comprising the following steps:
acquiring metadata of each type of resource in a container system of a service cluster, wherein the metadata is used for indicating quota amount of each type of resource;
and executing the metering charging service according to the metadata of the resources of each type and a preset metering charging strategy.
2. The method according to claim 1, wherein the performing a metered charging service according to the metadata of the respective types of resources and a preset metered charging policy comprises:
acquiring the resource usage amount of each type of resource from the monitoring system of the service cluster;
and executing the metering charging service according to the metadata of the resources of all types, the resource usage amount and the metering charging strategy.
3. The method according to claim 1 or 2, wherein after the performing the metering charging service according to the metadata of the respective types of resources and the preset metering charging policy, the method further comprises:
and acquiring the metering charging summary data within a first preset time according to the metering charging detail data obtained by the metering charging service.
4. The method according to claim 3, wherein after acquiring the summarized data of the metering charging within a first preset time period according to the detailed metering charging data obtained by the metering charging service, the method further comprises:
and acquiring the metering charging summary data in a second preset time length according to the metering charging summary data in the first preset time length, wherein the second preset time length is greater than the first preset time length.
5. The method of claim 1, wherein the respective types of resources comprise container group resources, and wherein the obtaining metadata of the respective types of resources in a container system of the service cluster comprises:
acquiring quota quantities of a plurality of containers corresponding to a target container group from the container system;
taking a sum of the quota amounts of the plurality of containers as metadata of a target container group resource, the metadata of the target container group resource including the quota amount of the target container group resource.
6. The method of claim 2, wherein the obtaining the resource usage amount of each type of resource from the monitoring system of the service cluster comprises:
acquiring resource usage amounts of a plurality of containers corresponding to the target container group resource from the monitoring system;
and adding the resource usage amounts of the plurality of containers to obtain the resource usage amount of the container group resource.
7. The method of claim 3, further comprising:
and storing the metering charging summary data of the first preset time length to a preset storage system, and updating the metering charging summary data of the first preset time length stored in the preset storage system with the updated metering charging summary data of the first preset time length when the updated data exists.
8. A resource metering and charging apparatus, comprising:
an obtaining module, configured to obtain metadata of resources of each type in a container system of a service cluster, where the metadata is used to indicate a quota amount of the resources of each type;
and the processing module is used for executing the metering charging service according to the metadata of the resources of all types and a preset metering charging strategy.
9. A control cluster, comprising: a processor, a memory and a bus, the memory storing a computer program executable by the processor, the processor and the memory communicating via the bus when the control cluster is running, the processor executing the computer program to perform the method of any of claims 1-7.
10. A storage medium, comprising: the storage medium has stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1-7.
CN202010967790.6A 2020-09-15 2020-09-15 Resource metering charging method, device, cluster and storage medium Pending CN112085535A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010967790.6A CN112085535A (en) 2020-09-15 2020-09-15 Resource metering charging method, device, cluster and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010967790.6A CN112085535A (en) 2020-09-15 2020-09-15 Resource metering charging method, device, cluster and storage medium

Publications (1)

Publication Number Publication Date
CN112085535A true CN112085535A (en) 2020-12-15

Family

ID=73737886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010967790.6A Pending CN112085535A (en) 2020-09-15 2020-09-15 Resource metering charging method, device, cluster and storage medium

Country Status (1)

Country Link
CN (1) CN112085535A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112669025A (en) * 2020-12-24 2021-04-16 广西中科曙光云计算有限公司 Data resource supply charging method, device, medium and terminal equipment
CN112751726A (en) * 2020-12-17 2021-05-04 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN113191758A (en) * 2021-05-19 2021-07-30 新天科技股份有限公司 Metering point-based charging method, revenue system, electronic device and storage medium
CN117742975A (en) * 2024-02-20 2024-03-22 北京搜狐新媒体信息技术有限公司 Resource data processing method and device, storage medium and electronic equipment
CN117742975B (en) * 2024-02-20 2024-06-04 北京搜狐新媒体信息技术有限公司 Resource data processing method and device, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120173513A1 (en) * 2010-12-31 2012-07-05 Microsoft Corporation Allocation of tenants to database services
CN105049218A (en) * 2015-06-24 2015-11-11 上海斐讯数据通信技术有限公司 PhiCloud cloud charging method and system
CN107516199A (en) * 2017-08-01 2017-12-26 携程旅游信息技术(上海)有限公司 Container charging method, apparatus and system, equipment, the storage medium of cloud platform
CN110597623A (en) * 2019-08-13 2019-12-20 平安普惠企业管理有限公司 Container resource allocation method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120173513A1 (en) * 2010-12-31 2012-07-05 Microsoft Corporation Allocation of tenants to database services
CN105049218A (en) * 2015-06-24 2015-11-11 上海斐讯数据通信技术有限公司 PhiCloud cloud charging method and system
CN107516199A (en) * 2017-08-01 2017-12-26 携程旅游信息技术(上海)有限公司 Container charging method, apparatus and system, equipment, the storage medium of cloud platform
CN110597623A (en) * 2019-08-13 2019-12-20 平安普惠企业管理有限公司 Container resource allocation method and device, computer equipment and storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112751726A (en) * 2020-12-17 2021-05-04 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN112669025A (en) * 2020-12-24 2021-04-16 广西中科曙光云计算有限公司 Data resource supply charging method, device, medium and terminal equipment
CN112669025B (en) * 2020-12-24 2021-07-16 广西中科曙光云计算有限公司 Data resource supply charging method, device, medium and terminal equipment
CN113191758A (en) * 2021-05-19 2021-07-30 新天科技股份有限公司 Metering point-based charging method, revenue system, electronic device and storage medium
US12008402B2 (en) 2021-08-27 2024-06-11 Red Hat, Inc. Determining computer resource usage at multiple levels of a container orchestration system hierarchy
CN117742975A (en) * 2024-02-20 2024-03-22 北京搜狐新媒体信息技术有限公司 Resource data processing method and device, storage medium and electronic equipment
CN117742975B (en) * 2024-02-20 2024-06-04 北京搜狐新媒体信息技术有限公司 Resource data processing method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US10877987B2 (en) Correlating log data with performance measurements using a threshold value
US10592522B2 (en) Correlating performance data and log data using diverse data stores
US10877986B2 (en) Obtaining performance data via an application programming interface (API) for correlation with log data
US10614132B2 (en) GUI-triggered processing of performance data and log data from an information technology environment
US11119982B2 (en) Correlation of performance data and structure data from an information technology environment
CN106489251B (en) The methods, devices and systems of applied topology relationship discovery
US10353957B2 (en) Processing of performance data and raw log data from an information technology environment
CN112085535A (en) Resource metering charging method, device, cluster and storage medium
US10564870B1 (en) Placing data storage volumes
US20170286499A1 (en) Query-Triggered Processing of Performance Data and Log Data from an Information Technology Environment
US20140324862A1 (en) Correlation for user-selected time ranges of values for performance metrics of components in an information-technology environment with log data from that information-technology environment
US10158743B2 (en) Compute node cluster management
CN110515539A (en) Cloud disk hanging method, device, equipment and storage medium based on cloud storage
US10419305B2 (en) Visualization of workload distribution on server resources
US20150280981A1 (en) Apparatus and system for configuration management
CN112667405B (en) Information processing method, device, equipment and storage medium
US11228490B1 (en) Storage management for configuration discovery data
CN111177201A (en) Data stream processing method and related device
CN109586970B (en) Resource allocation method, device and system
CN115883407A (en) Data acquisition method, system, equipment and storage medium
CN109947730A (en) Metadata restoration methods, device, distributed file system and readable storage medium storing program for executing
US10067849B2 (en) Determining dynamic statistics based on key value patterns
US9507492B2 (en) Search engine optimization utilizing scrolling fixation
US20160110117A1 (en) Computer system and method for controlling hierarchical storage therefor
US10585620B2 (en) Storage monitoring system for monitoring components in a storage system in a distributed manner

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20201215

RJ01 Rejection of invention patent application after publication