CN107360006B - Resource charging method and device - Google Patents

Resource charging method and device Download PDF

Info

Publication number
CN107360006B
CN107360006B CN201710439373.2A CN201710439373A CN107360006B CN 107360006 B CN107360006 B CN 107360006B CN 201710439373 A CN201710439373 A CN 201710439373A CN 107360006 B CN107360006 B CN 107360006B
Authority
CN
China
Prior art keywords
resource
charging
time
log
preset
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.)
Active
Application number
CN201710439373.2A
Other languages
Chinese (zh)
Other versions
CN107360006A (en
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 Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online 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 Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201710439373.2A priority Critical patent/CN107360006B/en
Publication of CN107360006A publication Critical patent/CN107360006A/en
Application granted granted Critical
Publication of CN107360006B publication Critical patent/CN107360006B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/14Charging, metering or billing arrangements for data wireline or wireless communications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/14Charging, metering or billing arrangements for data wireline or wireless communications
    • H04L12/1403Architecture for metering, charging or billing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/14Charging, metering or billing arrangements for data wireline or wireless communications
    • H04L12/141Indication of costs
    • H04L12/1414Indication of costs in real-time
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/14Charging, metering or billing arrangements for data wireline or wireless communications
    • H04L12/1432Metric aspects

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides a resource charging method and a device, wherein the method comprises the following steps: if the fact that the user uses various resources of the cloud platform is detected, determining the charging modes of the various resources, if the charging mode of the resources in the plurality of resources is charging on time, acquiring a resource change log of the cloud platform and generating metering information of each resource charged on time according to the resource change log, the metering information comprises the use duration of each resource, the use duration of each resource according to the time charging and the preset charging strategy, charging each resource charged on time, generating a sub bill corresponding to each resource charged on time, determining the total bill of the user according to all the sub bills, applying the embodiment of the invention, generating the service duration of the resource according to the resource change log, because the log time recorded by the resource change log is accurate to second, compared with the prior method for generating the resource metering information according to the monitoring data, the method has the advantage that the resource charging accuracy is improved.

Description

Resource charging method and device
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a resource charging method and a resource charging apparatus.
Background
Cloud computing is an increase, use and delivery mode of related services based on the internet, provides available, convenient and on-demand network access, enters a computing resource sharing pool which can rapidly provide resources including networks, servers, storage, application software, services and the like, is typically used on demand, and charging for the resources is the basis of commercialization of a cloud platform.
The existing cloud computing resource charging is to calculate the usage amount of resources by monitoring the resources by a monitoring system, so as to perform charging. Because the monitoring system usually monitors the resources in a periodic detection mode, the time precision of cloud computing resource charging depends on the detection period of the monitoring system, and the timeliness depends on the data pulling period of the charging system and the monitoring system, but the monitoring system cannot accurately feed back the resource change to the charging system in real time, so that the existing method for cloud computing resource charging through the monitoring system has the problems of insufficient charging precision and effectiveness.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are proposed to provide a resource charging method and a resource charging apparatus that overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present invention discloses a resource charging method, including:
if detecting that the user uses various resources of the cloud platform, determining the charging modes of the various resources;
if the charging mode of the resources in the multiple resources is determined to be on-time charging, acquiring a resource change log of the cloud platform;
generating the metering information of each resource charged on time according to the resource change log, wherein the metering information comprises the service life of each resource;
charging each resource charged according to the time length of use of each resource charged according to time and a preset charging strategy, and generating a sub-bill corresponding to each resource charged according to time;
and determining the total bill of the user according to all the sub-bills.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
acquiring account information of the user, wherein the account information comprises prestored fees;
determining a preset period corresponding to the pre-stored expense according to the pre-stored expense;
and acquiring a resource change log of the cloud platform according to the preset period.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
receiving a change message for a resource change used by a user;
and acquiring a changed resource change log corresponding to the change message.
Preferably, the step of obtaining the changed resource change log corresponding to the change message includes:
acquiring a message source of the change message;
and acquiring a resource change log after the change of the message source according to the message source.
Preferably, the step of generating the metering information of each resource charged on time according to the resource change log includes:
extracting log records related to the metering information from the resource change log;
obtaining user information and the resource type, resource configuration, use start time and use end time of each resource used by the user by using the associated log record;
and calculating the use duration of each resource according to the use starting time and the use ending time of each resource.
Preferably, the step of extracting a log record associated with the metering information from the resource change log includes:
acquiring action behavior information recorded by each log in the resource change log;
judging whether the action behavior information influences the metering information;
if so, extracting a log record corresponding to the action behavior information;
and if not, discarding the log record corresponding to the action behavior information.
Preferably, before the charging each resource charged according to the time length of use of each resource charged according to time and a preset charging policy, and generating a sub-bill corresponding to each resource charged according to time, the method further includes:
determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use start time and the use end time of each resource used by a user;
and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service life of the preset resource sharing combination.
Preferably, the step of charging each resource according to the time length of use of each resource charged according to time and the preset charging policy, and generating the sub-bill corresponding to each resource charged according to time includes:
acquiring the resource rate of each resource according to the resource type and the resource allocation of each resource;
acquiring marketing factors corresponding to the user information;
and charging each resource according to the using time length of each resource, the resource rate and marketing factors to generate a sub bill corresponding to each resource.
Preferably, before the determining the total bill of the user according to all the sub-bills, the method further comprises:
acquiring a preset charging strategy of the preset resource sharing combination, wherein the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination;
and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
In order to solve the above problem, an embodiment of the present invention discloses a resource charging apparatus, including:
the charging mode determining module is used for determining the charging modes of various resources if detecting that the user uses the various resources of the cloud platform;
the resource change log obtaining module is used for obtaining the resource change log of the cloud platform if the charging mode of the resources in the plurality of resources is on-time charging;
the metering information generating module is used for generating the metering information of each resource charged on time according to the resource change log, and the metering information comprises the service duration of each resource;
the sub-bill generation module is used for charging each resource charged on time according to the service life of each resource charged on time and a preset charging strategy and generating a sub-bill corresponding to each resource charged on time;
and the total bill determining module is used for determining the total bill of the user according to all the sub-bills.
Optionally, the resource change log obtaining module includes:
the account information acquisition submodule is used for acquiring the account information of the user, and the account information comprises prestored fees;
the preset period acquisition submodule is used for determining a preset period corresponding to the pre-storage cost according to the pre-storage cost;
and the first resource change log obtaining submodule is used for obtaining the resource change log of the cloud platform according to the preset period.
Optionally, the resource change log obtaining module includes:
a change message receiving submodule for receiving a change message for a resource change used by a user;
and the second resource change log obtaining submodule is used for obtaining the changed resource change log corresponding to the change message.
Optionally, the second resource change log obtaining sub-module includes:
a message source obtaining unit, configured to obtain a message source of the change message;
and the resource change log acquiring unit is used for acquiring the resource change log of the message source according to the message source.
Optionally, the metering information generating module includes:
a log record extraction submodule, configured to extract a log record associated with the metering information from the resource change log;
the metering information acquisition submodule is used for acquiring user information by utilizing the associated log record, and the resource type, the resource configuration, the use start time and the use end time of each resource used by the user;
and the resource use duration calculation submodule is used for calculating the resource use duration of each resource according to the use start time and the use end time of each resource.
Optionally, the log record extracting sub-module includes:
a behavior information obtaining unit, configured to obtain action behavior information recorded in each log in the resource change log;
the judging unit is used for judging whether the action behavior information influences the metering information;
the extraction unit is used for extracting the log record corresponding to the action behavior information;
and the discarding unit is used for discarding the log record corresponding to the action behavior information.
Optionally, the apparatus further comprises:
the resource sharing combination metering information generating module is used for determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use starting time and the use ending time of each resource used by a user; and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service duration of the preset resource sharing combination.
Optionally, the preset charging policy for each resource includes a resource rate and a marketing factor for each resource, and the sub-bill generating module includes:
a resource rate obtaining submodule, configured to obtain a resource rate of each resource according to the resource type and the resource configuration of each resource;
the marketing factor acquisition submodule is used for acquiring marketing factors corresponding to the user information;
and the sub-bill generation submodule is used for charging each resource according to the resource use time length, the resource rate and the marketing factor of each resource and generating a sub-bill corresponding to each resource.
Optionally, the sub-bill generation module further includes:
the resource sharing combination sub-bill generation sub-module is used for acquiring a preset charging strategy of the preset resource sharing combination, and the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination; and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
In order to solve the above problem, an embodiment of the present invention discloses an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the steps of any one of the above methods.
In order to solve the above problem, an embodiment of the present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program is configured to implement the steps of any one of the methods described above when executed by a processor.
The embodiment of the invention has the following advantages:
the embodiment of the invention determines the charging modes of various resources if detecting that a user uses various resources of a cloud platform, acquires a resource change log of the cloud platform and generates the metering information of each resource charged on time according to the resource change log if the charging mode of the resources in the various resources is charged on time, wherein the metering information comprises the use duration of each resource, charges each resource charged on time according to the use duration of each resource charged on time and a preset charging strategy, generates a sub-bill corresponding to each resource charged on time, and determines the total bill of the user according to all the sub-bills. The accuracy of resource charging is improved.
In the embodiment of the invention, if the resource is changed, after the change message sent by the message system of the cloud platform is received, the changed resource change log corresponding to the change message can be immediately obtained, and the metering information is generated according to the changed resource change log, so that the resource change can be synchronized into the charging in real time, the real-time charging can be carried out, and the real-time charging bill can be generated.
In the embodiment of the invention, each subsystem of the cloud platform only maintains the resource change log without carrying out charging related processing, and the cloud platform and the charging system are mutually decoupled, so that the overall reliability of the cloud platform system is improved.
In the embodiment of the invention, if the preset resource sharing combination exists in the multiple resources used by the user, the shared resources are charged according to the charging strategy of the preset resource sharing combination, so that the flexibility of resource charging is improved.
Drawings
FIG. 1 is a flowchart illustrating steps of a resource charging method according to an embodiment of the present invention;
fig. 2 is a block diagram of a resource charging apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a resource charging method according to the present invention is shown, which may specifically include the following steps:
step 101, if detecting that a user uses multiple resources of a cloud platform, determining a charging mode of the multiple resources.
In the embodiment of the present invention, the resource may refer to a resource of a resource sharing pool in cloud computing. Cloud computing is a product of development and fusion of traditional computer and network technologies, such as distributed computing, parallel computing, utility computing, network storage, virtualization, load balancing, hot backup redundancy and the like. Resources of a resource sharing pool in cloud computing may include networks, servers, storage, application software, services, and the like. The resources of the cloud computing are used as required, and the charging mode of the resources can include on-time charging, wherein the on-time charging refers to calculating service cost of the service according to the time length of the resources used by the user at a certain resource rate and is unrelated to the traffic, such as services of a cloud host, a cloud hard disk, a cloud database, object storage and the like.
The cloud platform may include a plurality of subsystems, resources of the plurality of subsystems may be different, and a user may use resources of one or more subsystems of the cloud platform.
The embodiment of the invention can be used for charging by taking a user as a unit, for example, when the user logs in the cloud platform through an account, the resource used by the account is charged, and the used resource can be various resources, so that the charging mode of the various resources used by the user needs to be determined.
The charging mode for determining the resource may be determined according to the resource type, for example, the charging mode is preset for different resource types, or may be determined according to the service type requested by the user, for example, the cloud host service adopts a time charging mode, and when the user uses the resource, the charging mode of the resource can be known.
And step 102, if the charging mode of the resources in the plurality of resources is on-time charging, acquiring a resource change log of the cloud platform.
If the charging mode of the resources in the multiple resources used by the user is on-time charging, the resource change log of the cloud platform can be acquired. In practical applications, each subsystem of the cloud platform has its own resource change log, and the resource change log records the change actions of the resource, such as starting, powering on, powering off, deleting, changing configuration, etc., unique identifier of the resource, operator ID, operation time, and resource information (configuration, specification, etc.). The charging system may obtain resource change logs of each subsystem of the cloud platform according to a preset period, and the resource change logs of each subsystem of the cloud platform may be stored in each subsystem or in a database server designated by the cloud platform, so that the resource change logs may be obtained from each subsystem of the cloud platform or from a database server designated by the cloud platform.
In an embodiment of the present invention, the resource change log of the cloud platform may be obtained according to a preset period, and then step 102 may include the following sub-steps:
substep S11, obtaining account information of the user, wherein the account information comprises pre-stored fees;
a substep S12, determining a preset period corresponding to the pre-stored expense according to the pre-stored expense;
and a substep S13, acquiring the resource change log of the cloud platform according to the preset period.
In practical application, the charging system may set a period for obtaining the cloud platform resource change log, specifically, different preset periods may be obtained according to the pre-stored cost of the user, for example, the preset period is also correspondingly shortened along with the reduction of the pre-stored cost of the user, so that the situation that the pre-stored cost of the user is insufficient to cause arrearage is avoided, which is described in an example below:
for example, when the user a logs in the cloud platform through the account, the charging system may obtain the pre-stored cost of the account of the user a, if the pre-stored cost is greater than 1000 yuan, the period for obtaining the resource change log may be 1 hour, if the pre-stored cost is greater than 500 yuan and less than 1000 yuan, the period for obtaining the resource change log may be 0.5 hour, and when the pre-stored cost is less than 500 yuan, the period for obtaining the resource change log may be 0.3 hour, so that the user may be notified of insufficient pre-stored cost in advance, and user arrearage is avoided.
In another preferred embodiment of the present invention, since periodically obtaining the resource change log cannot ensure that the usage status of the resource can be fed back to the charging system in real time, and cannot generate the charging bill of the user in real time, each subsystem of the cloud platform may perform an analysis once while recording the resource log, if the log relates to the usage amount, configuration, status, and the like of the resource used by the user and affects the metering information, a change message may be transmitted to the charging system through the message system, and the charging system may obtain the corresponding changed resource change log in real time according to the source of the change message, then step 102 may include the following sub-steps:
in sub-step S21, a change message for a change in the resource used by the user is received.
In practical application, the charging system periodically obtains resource change logs of subsystems of the cloud platform, for example, the resource change logs of the subsystems are obtained every 1 hour, but there is a possibility that resource configuration is changed during the period of obtaining the resource change logs, for example, a user updates the cloud host configuration on line, and upgrades a cloud host using a single-core CPU to a dual-core CPU cloud host, obviously, the used resource configuration is different, and the resource rate is also different, in this case, the user needs to obtain the resource change logs in the next period, and thus, the charging real-time performance is insufficient.
In order to avoid the above situation, when each subsystem of the cloud platform records the resource change log, if the change of the resource change log affects the resource usage, configuration, state change and the like, which may affect resource charging, a change message is transmitted to the charging system through the message system, and the charging system may receive the change message.
And a substep S22, obtaining a changed resource change log corresponding to the change message.
In the embodiment of the present invention, step S22 may include the following sub-steps:
substep S221, obtaining the message source of the change message;
and a substep S222, obtaining a resource change log of the message source according to the message source.
After receiving a change message of changing resources used by a user, a charging system acquires resource change logs corresponding to the change message in real time, specifically, message queues sent by different subsystems of a cloud platform are different, the change message can be distinguished from the specific subsystem of the cloud platform through the message queues, and then the changed resource change logs of the subsystem are acquired in real time, for example, the resource change logs after the time point of generating the change message can be acquired, so that the real-time resource change logs can be acquired, and the real-time performance of resource charging is improved.
According to the embodiment of the invention, the resource change data is not directly transmitted to the charging system through the message system, but only the change message is transmitted, so that the coupling and reliability of the cloud platform system are ensured, the resource change data cannot be lost under the condition that the message system is broken down, and the service of each subsystem of the cloud platform and the service of the charging system cannot be influenced.
103, generating the metering information of each resource charged on time according to the resource change log, wherein the metering information comprises the service life of each resource.
In a preferred embodiment of the present invention, step 103 may comprise the following sub-steps:
in substep S31, a log record associated with the measurement information is extracted from the resource change log.
The resource change log may be configured to record a change operation of the resource, and extract a log record associated with the metering information from the resource change log according to a meaning of the change operation, and specifically may include the following sub-steps:
substep S311, obtaining the action behavior information recorded by each log in the resource change log;
a substep S312, determining whether the motion behavior information affects the metering information; if yes, go to step S313, otherwise go to step S314.
A substep S313, extracting a log record corresponding to the action behavior information;
and a substep S314 of discarding the log record corresponding to the action behavior information.
In practical application, the resource change log comprises a resource change log acquired according to a preset period and a resource change log acquired after a change message is received, log records in the resource change log can be analyzed one by one, action behavior information of each log record is acquired, whether the log records influence metering information or not is judged by understanding the meaning of the action behavior information in the log records, for example, whether the action behavior information influences use duration, configuration and the like, if so, the log records are extracted, otherwise, the log records are discarded, and therefore the log records irrelevant to the metering information are filtered. For example, if the time of a certain log record in the resource starting process does not change the use time of the resource, the log is discarded, if the log record records the resource change name and does not influence the metering information, the log can be directly discarded, and if the log record records the second configuration of the resource, for example, the cloud host single-core CPU 1G memory is changed to the dual-core CPU 2G memory, because the configuration is different and the resource rate is different, the metering information is influenced, and the log record is extracted.
In the preferred embodiment, whether the metering information is affected or not is judged through the action behavior information in the log record, if not, the log record is abandoned, the log record irrelevant to the metering information is filtered, and finally the log record relevant to the metering information is obtained.
And a substep S32 of obtaining user information using the associated log record, and a resource type, a resource configuration, a usage start time, and a usage end time of each resource used by the user.
And after the associated log records are extracted, analyzing the log records, understanding the meaning of action behaviors in the log records, and obtaining the metering information from the action behaviors. The metering information may include user information for using the resource, a resource type for each resource used by the user, a resource configuration, a start usage time and an end time, and the like.
For example, after a subsystem of the cloud platform is powered on, a resource change log is generated, where the resource change log includes a user using the subsystem, resource types of various resources used by the user using the subsystem, resource configuration, a start time of use, and an end time of use, and for resource a, the resource change log may record a log record of a time duration of use of the subsystem resource a by the user, where the start time is an operation time of the log record, and the end time is null, and when a log records that the user finishes using the resource a in the future, the previous time duration of use is updated, and the end time is recorded as an operation time of the log.
The user information may be a unique identification ID of the user, and in a multi-tenant environment, may also be a tenant ID of the user, for example, an account of the user, or the like.
The resource types may include cloud computing service resources such as virtual machines, disks, CPUs, memory, IPs, object storage, databases, caches, and so on.
The resource configuration may be a specification of resources, such as a single-core CPU 1G memory or a dual-core CPU 2G memory of the cloud host, a disk 100G, a disk 200G, IP bandwidth 1Mbps, 5Mbps, and the like.
In the embodiment of the invention, because the change log usually records the change condition of the resource in real time, and the time can be accurate to seconds, the accuracy of the resource metering information is improved compared with the prior art that the resource metering information is obtained by monitoring data according to the metering information generated by the log record associated with the metering information in the resource change log.
And a substep S33, calculating the resource usage duration of each resource according to the usage start time and the usage end time of each resource.
In the embodiment of the invention, the charging mode of the resources is charging on time, the charge of the resources is related to the use duration, and the duration between the use start time and the use end time is the use duration after the use start time and the use end time are obtained from the log record. Since the use start time and the use end time are recorded in real time by the change log, the calculation accuracy of the resource use time is high.
In an optional embodiment of the present invention, there may also be multiple resource common charging modes, and then the metering information may also be generated by:
determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use start time and the use end time of each resource used by a user;
and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service duration of the preset resource sharing combination.
In practical applications, a preset resource sharing combination may be set, and when it is detected that a user uses resources in the preset resource sharing combination at the same time, a usage duration of the preset resource sharing combination may be calculated, which is described as follows by way of example:
for example, the use start time of the user using the resource a is 08:00:00, and the use end time is 12:00: 00;
the use start time of the use resource B is 09:00:00, and the use end time is 11:00: 00;
the use start time of the use resource C is 07:00:00, and the use end time is 12:00: 00;
assuming that the resource A, B, C is 1.0 yuan/hour in common and 1.5 yuan/hour in single use, it may be determined whether the resource A, B, C exists according to the resource type and resource configuration of each of the multiple resources used by the user, and if so, the time duration in common for the resource A, B, C is calculated according to the use start time and the use end time of the resource A, B, C, as in the above example, the time duration in common for the resource source A, B, C is 09:00:00 to 11:00:00, that is, the time duration in common is 2 hours, the rate for the predetermined combination in common for the resource A, B, C is 3.0 yuan/hour in the time duration in common for 2 hours, and the resource A, B, C is charged according to the rate for single use outside the time duration in common for 2 hours.
Of course, the above multiple resource sharing combinations are only examples, and when implementing the embodiment of the present invention, other multiple resource sharing combinations may be set according to practical situations, which is not limited in this embodiment of the present invention. In addition, besides the above multiple resource sharing combinations, those skilled in the art may also adopt other multiple resource sharing combinations according to actual needs, and the embodiment of the present invention is not limited thereto.
And 104, charging each resource charged according to time according to the service life of each resource charged according to time and a preset charging strategy, and generating a sub bill corresponding to each resource charged according to time.
In the embodiment of the present invention, the preset charging policy includes a resource rate and a marketing factor of each resource, and step 104 may include the following sub-steps:
and a substep S41, obtaining the resource rate of each resource according to the resource type and resource configuration of each resource.
In practical application, different types of resources or different resource configurations of the same type of resources have different hardware costs and maintenance costs and different resource rates, for example, the resource rate of a single-core CPU 1G memory of a cloud host is 0.01 yuan/hour, and the resource rate of a 2G memory of a dual-core CPU is 0.02 yuan/hour. Therefore, when the resources need to be charged, the resource type and the resource rate of the resource configuration of each resource need to be acquired. Specifically, the resource rates corresponding to the resource types and the resource configurations may be preset and stored in the charging system, and when the resources need to be charged, the resource types and the resource rates corresponding to the resource configurations of each resource may be directly obtained in the storage medium.
And a substep S42, obtaining a marketing factor corresponding to the user information.
In practical applications, some resources may have marketing activities, such as discount activities for some users, for example, a certain resource user C may discount by 5 (for example, user C is a VIP user), and if the rate of the resource is 0.02 yuan/hour, then marketing factors are superimposed, and the discount rate is 0.01 yuan/hour.
Certainly, the marketing campaign may also be directed to some resources, for example, a certain resource may be folded by 5 from time a to time B (for example, when the business is idle), and at this time, the marketing factor corresponding to the resource may be acquired.
Of course, the above-mentioned discount activities are only examples, and those skilled in the art may also conceive other marketing factors, such as credit deduction, according to practical situations, and the embodiment of the present invention is not limited thereto.
And a substep S43, charging each resource according to the resource usage duration, the resource rate and the marketing factor of each resource, and generating a sub bill corresponding to each resource.
After the resource use duration, the resource rate and the marketing factor of each resource are obtained, the resource cost can be calculated according to a preset rule, and a sub bill corresponding to each resource is generated.
For better illustration of the embodiments of the present invention, the following description is given with reference to examples:
the measurement information of the resource a obtained from the resource change log is:
the start time of use: 2016-12-0100: 00: 00;
end of use time: 2016-12-0101: 00: 00;
resource: a (A is type);
configuration: a dual-core CPU and a memory 2G;
the user: x;
resource rate: a dual-core CPU, wherein the resource rate of the memory 2G is 0.2 yuan/hour;
marketing factors: user X has a discount from 2016-12-0100: 30:00 to 2016-12-3123: 59:59, with a discount rate of 0.5.
The final resource cost details generated are:
2016-12-0100: 00:00 to 2016-12-0100: 30:00A resource dual-core CPU memory 2G resource use time length 0.5 hours, deduction fee 0.5 x 0.2 ═ 0.1 yuan;
2016-12-0100: 30:00 to 2016-12-0101: 00:00A resource dual-core CPU, the use time of the memory 2G resource is 0.5 hour, and the fee deduction is 0.5 multiplied by 0.2 multiplied by 0.5 to 0.05 yuan.
The sub-bill for user X to use resource a is: resource A is 0.15 yuan.
It should be noted that the above examples are only for convenience of understanding, and the embodiments of the present invention are not limited to the above manner of charging the resource according to the usage duration, the resource rate and the marketing factor.
In an optional embodiment of the present invention, the sub-bill of the preset resource sharing combination may be further calculated according to the preset resource sharing combination, and the method specifically includes the following steps:
acquiring a preset charging strategy of the preset resource sharing combination, wherein the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination;
and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
In the embodiment of the invention, the charging strategy of the preset resource sharing combination comprises the resource rate of the preset resource sharing combination and the marketing factor, so that the sub-bill corresponding to the preset resource sharing combination can be obtained by considering the marketing factor after calculating the product of the service duration of the preset resource sharing combination and the resource rate of the preset resource sharing combination.
For better illustration of the embodiments of the present invention, the following description is given with reference to examples:
from the resource change log, the time period for which resource A, B, C was used is:
the use start time of the use resource A is 08:00:00, and the use end time is 12:00: 00;
the use start time of the use resource B is 09:00:00, and the use end time is 11:00: 00;
the use start time of the use resource C is 07:00:00, and the use end time is 12:00: 00;
resource rate:
resource a rate: 1.5 yuan/hr; resource B rate: 1.5 yuan/hr; resource C rate: 1.5 yuan/hr;
resource A, B, C shares a combined rate: 3 yuan/hour;
the user: x;
marketing factors: user X has a discount with a discount rate of 0.85.
The sub-bill shared by the resource A, B, C is generated as:
the sub-bill for user X using resource A, B, C at the same time, 09:00:00-11:00:00, is: 3 × 2 × 0.85 ═ 5.1 yuan.
For portions that do not belong to the simultaneous use of resource A, B, C, billing may be performed at the resource rate for individual use, for example:
the generation of the sub-bill for the individual use of resource a is:
the sub-bill for user X to use resource A, 08:00:00-09:00:00, is: 1 × 1.5 × 0.85 ═ 1.275 membered;
the sub-bill for user X to use resource A from 11:00:00 to 12:00:00 is: 1 × 1.5 × 0.85 ═ 1.275 membered;
the generation of the sub-bill for the individual use of resource C is:
the sub-bill for user X to use resource C, 07:00:00-09:00:00, is: 2 × 1.5 × 0.85 ═ 2.55 yuan;
the sub-bill for user X to use resource C from 11:00:00 to 12:00:00 is: 1 × 1.5 × 0.85 ═ 1.275 elements.
In another example, a sub-bill for resource a may also be generated for resource a as follows:
the sub-bill for user X to use resource A, 08:00:00-09:00:00, is: 1 × 1.5 × 0.85 ═ 1.275 membered;
the sub-bill for user X using resource A from 09:00:00-11:00:00 is: 2 × 1 × 0.85 ═ 1.7 membered;
the sub-bill for user X to use resource A from 11:00:00 to 12:00:00 is: 1 × 1.5 × 0.85 ═ 1.275 elements.
Of course, the above-mentioned multiple resource sharing combinations and charging manners are only examples, and when implementing the embodiment of the present invention, other multiple resource sharing combinations and charging manners may be set according to actual situations, which is not limited in this embodiment of the present invention. In addition, besides the above-mentioned multiple resource sharing combinations and charging manners, those skilled in the art may also adopt other multiple resource sharing combinations and charging manners according to actual needs, and the embodiment of the present invention is not limited thereto.
And step 105, determining a total bill of the user according to all the sub-bills.
In practical applications, after the sub-bill for each resource or the sub-bill shared by multiple resources is generated, all the sub-bills of the user may be merged to generate a total bill of the user, and the total bill is notified to the user or deducted according to the total bill.
The embodiment of the invention determines the charging mode of various resources if detecting that the user uses various resources of the cloud platform, if the charging mode of the resources in the plurality of resources is on-time charging, acquiring a resource change log of the cloud platform, generating the metering information of each resource on-time charging according to the resource change log, and according to the metering information of each resource on-time charging and a preset charging strategy, charging each resource charged on time, generating a sub bill corresponding to each resource charged on time, determining the total bill of the user according to all the sub bills, applying the embodiment of the invention, generating resource metering information according to the resource change log, because the resource change log is generated in real time, the recorded log time is accurate to second, and compared with the existing method for generating the resource metering information according to the monitoring data, the method is accurate to minute, and the accuracy of resource charging is improved.
In the embodiment of the invention, if the resource is changed, after the change message sent by the message system is received, the changed resource change log corresponding to the change message can be immediately obtained, and the metering information is generated according to the changed resource change log, so that the resource change can be synchronized to the charging in real time, and the real-time performance of the charging is ensured.
According to the resource charging method provided by the embodiment of the invention, the cloud platform only needs to maintain the resource change log without carrying out charging related processing, and the cloud platform and the charging system are mutually decoupled, so that the overall reliability of the cloud platform system is improved.
In the embodiment of the invention, if the preset resource sharing combination exists in the multiple resources used by the user, the shared resources are charged according to the charging strategy of the preset resource sharing combination, so that the flexibility of resource charging is improved.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 2, a block diagram of a structure of an embodiment of a resource charging apparatus of the present invention is shown, which may specifically include the following modules:
a charging mode determining module 201, configured to determine a charging mode for multiple resources if it is detected that the user uses the multiple resources of the cloud platform;
a resource change log obtaining module 202, configured to obtain a resource change log of the cloud platform if a charging manner of a resource in the multiple resources is on-time charging;
a metering information generating module 203, configured to generate the metering information of each resource charged on time according to the resource change log, where the metering information includes a usage duration of each resource;
the sub-bill generating module 204 is configured to charge each resource charged on time according to the usage duration of each resource charged on time and a preset charging policy, and generate a sub-bill corresponding to each resource charged on time;
and the total bill determining module 205 is used for determining the total bill of the user according to all the sub-bills.
Optionally, the resource change log obtaining module 202 includes:
the account information acquisition submodule is used for acquiring the account information of the user, and the account information comprises prestored fees;
the preset period acquisition submodule is used for determining a preset period corresponding to the pre-storage cost according to the pre-storage cost;
and the first resource change log obtaining submodule is used for obtaining the resource change log of the cloud platform according to the preset period.
Optionally, the resource change log obtaining module 202 includes:
a change message receiving submodule for receiving a change message for a resource change used by a user;
and the second resource change log obtaining submodule is used for obtaining the changed resource change log corresponding to the change message.
Optionally, the second resource change log obtaining sub-module includes:
a message source obtaining unit, configured to obtain a message source of the change message;
and the resource change log acquiring unit is used for acquiring the resource change log of the message source according to the message source.
Optionally, the metering information generating module 203 includes:
a log record extraction submodule, configured to extract a log record associated with the metering information from the resource change log;
the metering information acquisition submodule is used for acquiring user information by utilizing the associated log record, and the resource type, the resource configuration, the use start time and the use end time of each resource used by the user;
and the resource use duration calculation submodule is used for calculating the resource use duration of each resource according to the use start time and the use end time of each resource.
Optionally, the log record extracting sub-module includes:
a behavior information obtaining unit, configured to obtain action behavior information recorded in each log in the resource change log;
the judging unit is used for judging whether the action behavior information influences the metering information;
the extraction unit is used for extracting the log record corresponding to the action behavior information;
and the discarding unit is used for discarding the log record corresponding to the action behavior information.
Optionally, the apparatus further comprises:
the resource sharing combination metering information generating module is used for determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use starting time and the use ending time of each resource used by a user; and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service duration of the preset resource sharing combination.
Optionally, the preset charging policy for each resource includes a resource rate and a marketing factor for each resource, and the sub-bill generating module 204 includes:
a resource rate obtaining submodule, configured to obtain a resource rate of each resource according to the resource type and the resource configuration of each resource;
the marketing factor acquisition submodule is used for acquiring marketing factors corresponding to the user information;
and the sub-bill generation submodule is used for charging each resource according to the resource use time length, the resource rate and the marketing factor of each resource and generating a sub-bill corresponding to each resource.
Optionally, the sub-bill generating module 204 further includes:
the resource sharing combination sub-bill generation sub-module is used for acquiring a preset charging strategy of the preset resource sharing combination, and the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination; and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
The embodiment of the invention determines the charging modes of various resources when detecting that the user uses various resources of the cloud platform, when the charging mode of the resources in the plurality of resources is time-based, acquiring a resource change log of the cloud platform, generating the metering information of each resource charged on time according to the resource change log, and according to the metering information of each resource charged on time and a preset charging strategy, charging each resource charged on time, generating a sub bill corresponding to each resource charged on time, determining the total bill of the user according to all the sub bills, applying the embodiment of the invention, generating resource metering information according to the resource change log, because the resource change log is generated in real time, the recorded log time is accurate to second, and compared with the existing method for generating the resource metering information according to the monitoring data, the method is accurate to minute, and the accuracy of resource charging is improved.
An embodiment of the present invention provides an electronic device and a computer-readable storage medium, where the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
if detecting that the user uses various resources of the cloud platform, determining the charging modes of the various resources;
if the charging mode of the resources in the plurality of resources is on-time charging, acquiring a resource change log of the cloud platform;
generating the metering information of each resource charged on time according to the resource change log, wherein the metering information comprises the service life of each resource;
charging each resource charged according to the time length of use of each resource charged according to time and a preset charging strategy, and generating a sub-bill corresponding to each resource charged according to time;
and determining the total bill of the user according to all the sub-bills.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
acquiring account information of the user, wherein the account information comprises prestored fees;
determining a preset period corresponding to the pre-storing expense according to the pre-storing expense;
and acquiring a resource change log of the cloud platform according to the preset period.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
receiving a change message for a resource change used by a user;
and acquiring a changed resource change log corresponding to the change message.
Preferably, the step of obtaining the changed resource change log corresponding to the change message includes:
acquiring a message source of the change message;
and acquiring a resource change log of the message source according to the message source.
Preferably, the step of generating the metering information of each resource charged on time according to the resource change log includes:
extracting log records related to the metering information from the resource change log;
obtaining user information by using the associated log records, and resource types, resource configurations, use start time and use end time of each resource used by the user;
and calculating the resource use duration of each resource according to the use starting time and the use ending time of each resource.
Preferably, the step of extracting a log record associated with the metering information from the resource change log includes:
acquiring action behavior information recorded by each log in the resource change log;
judging whether the action behavior information influences the metering information;
if so, extracting a log record corresponding to the action behavior information;
and if not, discarding the log record corresponding to the action behavior information.
Preferably, before the charging each resource charged according to the time length of use of each resource charged according to time and a preset charging policy, and generating a sub-bill corresponding to each resource charged according to time, the method further includes:
determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use start time and the use end time of each resource used by a user;
and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service life of the preset resource sharing combination.
Preferably, the preset charging policy for each resource includes a resource rate and a marketing factor of each resource, and the step of charging each resource charged on time according to the metering information and the preset charging policy for each resource charged on time and generating the sub-bill corresponding to each resource charged on time includes:
acquiring the resource rate of each resource according to the resource type and the resource allocation of each resource;
acquiring marketing factors corresponding to the user information;
and charging each resource according to the resource use duration, the resource rate and the marketing factor of each resource to generate a sub bill corresponding to each resource.
Preferably, before the determining the total bill of the user according to all the sub-bills, the method further comprises:
acquiring a preset charging strategy of the preset resource sharing combination, wherein the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination;
and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
The computer-readable storage medium stores a computer program that when executed by a processor, performs the steps of:
if detecting that the user uses various resources of the cloud platform, determining the charging modes of the various resources;
if the charging mode of the resources in the plurality of resources is on-time charging, acquiring a resource change log of the cloud platform;
generating the metering information of each resource charged on time according to the resource change log, wherein the metering information comprises the service life of each resource;
charging each resource charged according to the time length of use of each resource charged according to time and a preset charging strategy, and generating a sub-bill corresponding to each resource charged according to time;
and determining the total bill of the user according to all the sub-bills.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
acquiring account information of the user, wherein the account information comprises prestored fees;
determining a preset period corresponding to the pre-storing expense according to the pre-storing expense;
and acquiring a resource change log of the cloud platform according to the preset period.
Preferably, the step of obtaining the resource change log of the cloud platform includes:
receiving a change message for a resource change used by a user;
and acquiring a changed resource change log corresponding to the change message.
Preferably, the step of obtaining the changed resource change log corresponding to the change message includes:
acquiring a message source of the change message;
and acquiring a resource change log of the message source according to the message source.
Preferably, the step of generating the metering information of each resource charged on time according to the resource change log includes:
extracting log records related to the metering information from the resource change log;
obtaining user information by using the associated log records, and resource types, resource configurations, use start time and use end time of each resource used by the user;
and calculating the resource use duration of each resource according to the use starting time and the use ending time of each resource.
Preferably, the step of extracting a log record associated with the metering information from the resource change log includes:
acquiring action behavior information recorded by each log in the resource change log;
judging whether the action behavior information influences the metering information;
if so, extracting a log record corresponding to the action behavior information;
and if not, discarding the log record corresponding to the action behavior information.
Preferably, before the charging each resource charged according to the time length of use of each resource charged according to time and a preset charging policy, and generating a sub-bill corresponding to each resource charged according to time, the method further includes:
determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use start time and the use end time of each resource used by a user;
and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service life of the preset resource sharing combination.
Preferably, the preset charging policy for each resource includes a resource rate and a marketing factor of each resource, and the step of charging each resource charged on time according to the metering information and the preset charging policy for each resource charged on time and generating the sub-bill corresponding to each resource charged on time includes:
acquiring the resource rate of each resource according to the resource type and the resource allocation of each resource;
acquiring marketing factors corresponding to the user information;
and charging each resource according to the resource use duration, the resource rate and the marketing factor of each resource to generate a sub bill corresponding to each resource.
Preferably, before the determining the total bill of the user according to all the sub-bills, the method further comprises:
acquiring a preset charging strategy of the preset resource sharing combination, wherein the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination;
and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method and the device for charging resources provided by the present invention are introduced in detail, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (9)

1. A resource charging method is applied to a charging system and comprises the following steps:
if detecting that the user uses various resources of the cloud platform, determining the charging modes of the various resources;
if the charging mode of the resources in the multiple resources is determined to be on-time charging, acquiring a resource change log of the cloud platform;
generating the metering information of each resource charged on time according to the resource change log, wherein the metering information comprises the service life of each resource;
charging each resource charged according to the time length of use of each resource charged according to time and a preset charging strategy, and generating a sub-bill corresponding to each resource charged according to time;
determining a total bill of the user according to all the sub bills;
wherein the step of obtaining the resource change log of the cloud platform comprises:
receiving a change message aiming at resource change used by a user, wherein the change message is generated by analyzing a log which influences the metering information while recording a resource log of each subsystem of the cloud platform;
acquiring a changed resource change log corresponding to the change message;
wherein, generating the metering information of each resource charged by time according to the resource change log comprises:
extracting log records related to the metering information from the resource change log;
obtaining user information and the resource type, resource configuration, use start time and use end time of each resource used by the user by using the associated log record;
calculating the use duration of each resource according to the use start time and the use end time of each resource;
wherein extracting log records associated with the metering information from the resource change log comprises:
acquiring action behavior information recorded by each log in the resource change log;
judging whether the action behavior information influences the metering information;
and if so, extracting the log record corresponding to the action behavior information.
2. The method of claim 1, wherein the step of obtaining a resource change log for the cloud platform comprises:
acquiring account information of the user, wherein the account information comprises prestored fees;
determining a preset period corresponding to the pre-stored expense according to the pre-stored expense;
and acquiring a resource change log of the cloud platform according to the preset period.
3. The method according to claim 2, wherein the step of obtaining the changed resource change log corresponding to the change message comprises:
acquiring a message source of the change message;
and acquiring a resource change log after the change of the message source according to the message source.
4. The method according to claim 1, wherein before the charging each resource charged according to the time duration of use of each resource charged according to time and a preset charging policy, and generating a sub-bill corresponding to each resource charged according to time, the method further comprises:
determining whether a preset resource sharing combination exists according to the resource type, the resource configuration, the use start time and the use end time of each resource used by a user;
and if the preset resource sharing combination exists, generating metering information of the preset resource sharing combination, wherein the metering information of the preset resource sharing combination comprises the service life of the preset resource sharing combination.
5. The method according to claim 1, wherein the preset charging policy for each resource includes a resource rate and a marketing factor for each resource, and the step of charging each resource charged on time according to the usage duration of each resource charged on time and the preset charging policy to generate the sub-bill corresponding to each resource charged on time comprises:
acquiring the resource rate of each resource according to the resource type and the resource allocation of each resource;
acquiring marketing factors corresponding to the user information;
and charging each resource according to the using time length of each resource, the resource rate and marketing factors to generate a sub bill corresponding to each resource.
6. The method of claim 4, further comprising, prior to said determining a total bill of said user from all sub-bills:
acquiring a preset charging strategy of the preset resource sharing combination, wherein the preset charging strategy comprises a resource rate and a marketing factor of the preset resource sharing combination;
and charging the preset resource sharing combination according to the service life of the preset resource sharing combination, the resource rate of the preset resource sharing combination and marketing factors, and generating a sub bill corresponding to the preset resource sharing combination.
7. A resource charging device is applied to a charging system and comprises:
the charging mode determining module is used for determining the charging modes of various resources if detecting that the user uses the various resources of the cloud platform;
the resource change log obtaining module is used for obtaining the resource change log of the cloud platform if the charging mode of the resources in the plurality of resources is on-time charging;
the metering information generating module is used for generating the metering information of each resource charged on time according to the resource change log, and the metering information comprises the service duration of each resource;
the sub-bill generation module is used for charging each resource charged on time according to the service life of each resource charged on time and a preset charging strategy and generating a sub-bill corresponding to each resource charged on time;
the total bill determining module is used for determining the total bill of the user according to all the sub bills;
the resource change log obtaining module includes:
the change message receiving submodule is used for receiving change messages aiming at resource change used by a user, and the change messages are generated by analyzing logs influencing the metering information while recording own resource logs by each subsystem of the cloud platform;
a second resource change log obtaining sub-module, configured to obtain a changed resource change log corresponding to the change message;
wherein the metering information generating module comprises:
a log record extraction submodule, configured to extract a log record associated with the metering information from the resource change log;
the metering information acquisition submodule is used for acquiring user information by utilizing the associated log record, and the resource type, the resource configuration, the use start time and the use end time of each resource used by the user;
the resource use duration calculation submodule is used for calculating the resource use duration of each resource according to the use start time and the use end time of each resource;
the log record extraction sub-module comprises:
a behavior information obtaining unit, configured to obtain action behavior information recorded in each log in the resource change log;
the judging unit is used for judging whether the action behavior information influences the metering information;
the extraction unit is used for extracting the log record corresponding to the action behavior information;
and the discarding unit is used for discarding the log record corresponding to the action behavior information.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of claims 1-6 are implemented when the program is executed by the processor.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN201710439373.2A 2017-06-12 2017-06-12 Resource charging method and device Active CN107360006B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710439373.2A CN107360006B (en) 2017-06-12 2017-06-12 Resource charging method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710439373.2A CN107360006B (en) 2017-06-12 2017-06-12 Resource charging method and device

Publications (2)

Publication Number Publication Date
CN107360006A CN107360006A (en) 2017-11-17
CN107360006B true CN107360006B (en) 2021-01-22

Family

ID=60272801

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710439373.2A Active CN107360006B (en) 2017-06-12 2017-06-12 Resource charging method and device

Country Status (1)

Country Link
CN (1) CN107360006B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108171540A (en) * 2017-12-26 2018-06-15 北京星河星云信息技术有限公司 For the method and apparatus of resource metering and billing
CN110197368B (en) * 2018-03-21 2024-02-13 腾讯科技(深圳)有限公司 Cloud resource processing method, device and storage medium
CN109063074A (en) * 2018-07-24 2018-12-21 浪潮(北京)电子信息产业有限公司 Data processing method, device, equipment and medium based on Hadoop
CN108900361B (en) * 2018-08-10 2021-05-25 北京金山云网络技术有限公司 Cloud resource configuration determining method and device and electronic equipment
CN110929121B (en) * 2018-09-20 2023-07-04 中国石油化工股份有限公司 Log analysis-based seismic data processor time refinement calculation method and system
CN109255602A (en) * 2018-09-26 2019-01-22 广东浪潮大数据研究有限公司 A kind of resource uses charging method, device and equipment
CN109783312B (en) * 2018-12-18 2022-04-22 华为云计算技术有限公司 Resource usage metering method, device and system
CN109801135B (en) * 2019-01-16 2021-04-13 金蝶软件(中国)有限公司 Bill generation method and device, computer equipment and storage medium
CN112990952A (en) * 2019-12-12 2021-06-18 北京金山云网络技术有限公司 Cloud computing metering charging method and device, electronic equipment and storage medium
CN111224791B (en) * 2020-01-10 2020-12-08 上海云海万邦数据科技有限公司 Cloud resource charging method and device, electronic equipment and storage medium
CN111651345A (en) * 2020-04-13 2020-09-11 优刻得科技股份有限公司 System testing method and device and electronic equipment
CN111628906B (en) * 2020-05-11 2023-05-09 紫光云技术有限公司 Method for carrying out flow statistics and monitoring on elastic public network IP
CN111754270A (en) * 2020-07-01 2020-10-09 浪潮云信息技术股份公司 Charging management system of cloud computing product general product model
CN114629732A (en) * 2020-12-11 2022-06-14 北京金山云网络技术有限公司 Charging method and device for cloud resources, electronic equipment and medium
CN113516507B (en) * 2021-06-16 2024-02-13 国云科技股份有限公司 Multi-cloud management platform resource charging method and device
CN113553303A (en) * 2021-06-24 2021-10-26 南方科技大学 Resource management method, device, medium and electronic equipment of super computer
CN113556394B (en) 2021-07-20 2022-12-06 北京百度网讯科技有限公司 Cloud product network usage processing method, device, equipment, storage medium and product
CN113517989B (en) * 2021-09-14 2021-12-17 浙江九州云信息科技有限公司 Resource charging method and device for IaaS cloud platform
CN113934543A (en) * 2021-10-21 2022-01-14 江苏安超云软件有限公司 Universal charging method and device for cloud resources, electronic equipment and storage medium
CN117742975B (en) * 2024-02-20 2024-06-04 北京搜狐新媒体信息技术有限公司 Resource data processing method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521662A (en) * 2011-11-29 2012-06-27 曙光信息产业(北京)有限公司 Consumption charging method in cloud computing environment
CN104333456A (en) * 2014-10-22 2015-02-04 浪潮(北京)电子信息产业有限公司 Service charging method and system under cloud computing environment
CN104574051A (en) * 2015-01-12 2015-04-29 浪潮(北京)电子信息产业有限公司 Charging method and device
CN105245351A (en) * 2015-08-28 2016-01-13 浪潮集团有限公司 Charging method and device
CN105447046A (en) * 2014-09-02 2016-03-30 阿里巴巴集团控股有限公司 Distributed system data consistency processing method, device and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521662A (en) * 2011-11-29 2012-06-27 曙光信息产业(北京)有限公司 Consumption charging method in cloud computing environment
CN105447046A (en) * 2014-09-02 2016-03-30 阿里巴巴集团控股有限公司 Distributed system data consistency processing method, device and system
CN104333456A (en) * 2014-10-22 2015-02-04 浪潮(北京)电子信息产业有限公司 Service charging method and system under cloud computing environment
CN104574051A (en) * 2015-01-12 2015-04-29 浪潮(北京)电子信息产业有限公司 Charging method and device
CN105245351A (en) * 2015-08-28 2016-01-13 浪潮集团有限公司 Charging method and device

Also Published As

Publication number Publication date
CN107360006A (en) 2017-11-17

Similar Documents

Publication Publication Date Title
CN107360006B (en) Resource charging method and device
US11307770B2 (en) Capacity forecasting based on capacity policies and transactions
US9311664B2 (en) Systems and methods for automatically collection of performance data in a multi-tenant database system environment
CN108090225B (en) Database instance running method, device and system and computer readable storage medium
US9037483B1 (en) Multi-touch attribution model for valuing impressions and other online activities
US10411969B2 (en) Backend resource costs for online service offerings
CN106815254B (en) Data processing method and device
KR20190055264A (en) Providing per-application resource usage information
CN108880934B (en) Data flow statistical method and device based on block chain
WO2015127864A1 (en) Method and apparatus for controlling media data to be placed at constant speed
CN110233741B (en) Service charging method, device, equipment and storage medium
CN108322350B (en) Service monitoring method and device and electronic equipment
US11570078B2 (en) Collecting route-based traffic metrics in a service-oriented system
CN112085535A (en) Resource metering charging method, device, cluster and storage medium
CN106096926B (en) Event processing method, device, electronic device and storage medium
CN105426284A (en) Monitoring Device, Server, Monitoring System, Monitoring Method And Program Recording Medium
WO2019086522A1 (en) A COMPUTER IMPLEMENTED METHOD, A SYSTEM AND A COMPUTER PROGRAM FOR OPTIMIZING THE OPERATION OF A CLOUD HOSTED SOFTWARE AS A SERVICE (SaaS) SYSTEM
CN111260399A (en) Advertisement data processing method and device based on block chain network and electronic equipment
CN107886424B (en) Settlement data processing method and device, computer equipment and storage medium
CN111192123A (en) Account checking system based on hybrid cloud computing platform and account checking method thereof
US8924343B2 (en) Method and system for using confidence factors in forming a system
CN108234622A (en) Charging method and charge system
CN111144987A (en) Abnormal shopping behavior limiting method, limiting assembly and shopping system
CN111198986B (en) Information transmission method, device, electronic equipment and storage medium
CN109922123B (en) Display method and display device for call relation between servers

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
GR01 Patent grant
GR01 Patent grant