Billing control method, device, electronic device, server and storage medium
By using the client virtual machine to trigger charging indication information in a low power consumption state, the server releases resources and stops charging, which solves the problem in the existing technology that users are difficult to flexibly respond to changes in resource demand, and achieves cost reduction and avoidance of resource waste. effect.
Patent Information
- Application Number
- CN202010699620.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-20
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-07-20
AI Technical Summary
In the existing technology, it is difficult for users to flexibly respond to different demands for server resources at different times due to business changes, resulting in high user costs, inconvenience in starting resources and using virtual machines at any time, and the problem of wastage of server resources.
When the client virtual machine enters a low-power state (such as shutting down or suspending), the accounting instruction information is triggered, and the server releases relevant resources and stops accounting, so that the virtual machine does not need to use resources in a low-power state, thereby eliminating the need for Re-create virtual machines to flexibly respond to changes in resource requirements.
It reduces user costs, facilitates users to start resources and use virtual machines at any time, and avoids waste of server-side resources.
Smart Images

Figure CN111861446B
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of resource billing, and in particular, relates to a billing control method, device, electronic device, server and storage medium. Background Art
[0002] At present, users such as enterprises or individuals often rely on their business by purchasing billing resources from the service end. Typically, the service end can be a cloud service, where cloud service is an increase, use and interaction model of related services based on the Internet. It provides dynamic, scalable and often virtualized resources to users such as enterprises or individuals through the Internet. In essence, it circulates cloud computing, storage, orchestration and other resources as a service commodity through the Internet, so that users such as enterprises can obtain the required services through the network in an on-demand and scalable manner.
[0003] The server generally charges users based on the service resources purchased and the length of time the resources are occupied. When users want to stop being charged for certain resources, this is usually achieved by deleting the client virtual machine (such as a cloud host created on the client physical machine based on cloud resources). When users need server service resources again, they need to reapply for resources and use the virtual machine image to recreate the virtual machine on the client, which is time-consuming and labor-intensive. It is difficult to flexibly respond to different demands for resource billing caused by different demands for server resources at different times. This also leads to high user costs, inconvenience for users to start resources and use virtual machines at any time, and waste of service resources. Summary of the invention
[0004] In view of this, the present application provides a billing control method, device, electronic device, server and storage medium, which achieves the purpose of saving user costs, facilitating users to start server resources and use virtual machines at any time, and not causing waste of server resources by providing a function of stopping billing for corresponding resources when the client virtual machine is in low power consumption (such as shutdown or suspension).
[0005] The specific technical solutions are as follows:
[0006] A charging control method is applied to a server at a service end, the method comprising:
[0007] Acquire first charging indication information of the client, where the first charging indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0008] Determine, from the first resources of the server on which the creation and operation of the first virtual machine depend, a second resource that is not needed by the first virtual machine in the first state;
[0009] Releasing the second resource of the server, and controlling the second resource to be in a reallocatable state;
[0010] Stop charging the first virtual machine for usage of the second resource.
[0011] Optionally, the obtaining first charging indication information of the client includes:
[0012] Receiving first charging indication information triggered and sent by the first virtual machine during the process of entering a first low power consumption state or entering a second low power consumption state;
[0013] Wherein, the first state includes the first low power consumption state and the second low power consumption state;
[0014] In the first low power consumption state, the business process and the system process of the first virtual machine stop running; in the second low power consumption state, the business process of the first virtual machine stops running and the system process keeps running.
[0015] Optionally, the first resource of the server on which the creation and operation of the first virtual machine depends includes computing resources and storage resources;
[0016] In the first low power consumption state, the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on;
[0017] In the second low power consumption state, the second resources that the first virtual machine does not need to use include some computing resources in the first resources that the first virtual machine depends on.
[0018] Optionally, after stopping charging of the first virtual machine for usage of the second resource, the method further includes:
[0019] Obtaining second charging indication information of the client;
[0020] Determine whether a first physical machine has enough of the second resource; the first physical machine is a host machine where the second resource is located before the second resource is released;
[0021] If it is determined that the second resource is available, allocating the second resource from the first physical machine to the first virtual machine, and locking the second resource;
[0022] If it is determined that the resource is not available, allocating the second resource from the second physical machine to the first virtual machine, and locking the second resource;
[0023] charging the first virtual machine for use of the second resource;
[0024] The second charging indication information is information triggered by the client based on an event that the first virtual machine enters a second state; in the second state, the first virtual machine runs a system process and a business process.
[0025] Optionally, after releasing the second resource of the server, the method further includes:
[0026] Allocating the released second resource to a second virtual machine based on a resource allocation policy;
[0027] The second virtual machine and the first virtual machine are virtual machines created on the same client or different clients.
[0028] Optionally, it also includes:
[0029] Obtaining configuration change indication information sent by the client when the first virtual machine is in a first state;
[0030] Recording the configuration change indication information;
[0031] Based on an event that the first virtual machine enters the second state, the first resource that the first virtual machine depends on on the server is adjusted to a third resource.
[0032] A charging control method, applied to a client, comprising:
[0033] Acquire the status of a first virtual machine created on the client;
[0034] Based on an event that the first virtual machine enters a first state, triggering first charging indication information; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0035] Sending the first billing indication information to a server at the service end to instruct the server to release the second resource at the service end and stop charging the first virtual machine for the use of the second resource; wherein the second resource after release is in a reallocatable state;
[0036] The second resource is a resource that is determined by the server from the server-side first resource on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state.
[0037] Optionally, the triggering of the first charging indication information based on the event that the first virtual machine enters the first state includes:
[0038] The first virtual machine triggers the first charging indication information during a process of entering a first low power consumption state or a second low power consumption state;
[0039] The sending the first charging indication information to the server at the service end includes:
[0040] The first virtual machine sends the first billing indication information to the server;
[0041] Wherein, the first state includes the first low power consumption state and the second low power consumption state;
[0042] In the first low power consumption state, the business process and the system process of the first virtual machine stop running; in the second low power consumption state, the business process of the first virtual machine stops running and the system process keeps running.
[0043] Optionally, after sending the first charging indication information to the server of the service end, the method further includes:
[0044] The first virtual machine triggers second charging indication information during or after entering the second state;
[0045] Sending the second charging indication information to the server to instruct the server to allocate the second resource to the first virtual machine from the service end;
[0046] Wherein, in the second state, the first virtual machine runs a system process and a business process.
[0047] Optionally, it also includes:
[0048] When the first virtual machine is in the first state, configuration change indication information is sent to the server to instruct the server to record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server side to a third resource.
[0049] A charging control device is applied to a server at a service end, and the method comprises:
[0050] A first acquisition unit is used to acquire first charging indication information of a client, where the first charging indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0051] a determining unit, configured to determine, from the first resources of the server on which the creation and operation of the first virtual machine depend, a second resource that is not needed to be used by the first virtual machine in the first state;
[0052] A releasing unit, used for releasing the second resource of the server and controlling the second resource to be in a reallocatable state;
[0053] A billing control unit is used to stop the first virtual machine from charging for the use of the second resource.
[0054] A charging control device, applied to a client, comprising:
[0055] A second acquisition unit, configured to acquire a state of a first virtual machine created on the client;
[0056] a triggering unit, configured to trigger first charging indication information based on an event that the first virtual machine enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0057] A sending unit, configured to send the first charging indication information to a server at a service end, so as to instruct the server to release the second resource at the service end and stop charging the first virtual machine for the use of the second resource; wherein the second resource after release is in a reallocatable state;
[0058] The second resource is a resource that is determined by the server from the first resource of the server on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state.
[0059] A server, comprising:
[0060] A first memory, used for storing a first computer instruction set;
[0061] The first processor is used to implement the billing control method applied to the server as described in any one of the above items by executing the instruction set stored in the first memory.
[0062] An electronic device, comprising:
[0063] A second memory, used for storing a second computer instruction set;
[0064] The second processor is used to implement the billing control method applied to the client as described in any one of the above items by executing the instruction set stored in the second memory.
[0065] A computer-readable storage medium stores a first computer instruction set, wherein the first computer instruction set, when executed by a processor, implements the billing control method applied to a server as described in any one of the above items.
[0066] A computer-readable storage medium stores a second computer instruction set, wherein the second computer instruction set, when executed by a processor, implements the billing control method applied to a client as described in any one of the above items.
[0067] The billing control method, device, electronic device, server and storage medium provided in the embodiments of the present application release relevant resources on the server side and stop the virtual machine from charging for the use of the resources according to the billing indication information triggered by the client based on the first state of its virtual machine. Since the power consumption of the virtual machine in the first state is lower than that in the second state, the release of relevant resources on the server side and the stopping of charging are achieved when the client virtual machine is in a low power consumption state (such as shutdown, suspension), without relying on the deletion of the client virtual machine. In this way, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (switching to a high power consumption state) without having to re-create the virtual machine, thereby flexibly responding to the different resource billing requirements of the client at different times, reducing user costs, and facilitating users to start the resource-using virtual machine at any time, while avoiding waste of server-side resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0069] Figure 1 It is a flow chart of a billing control method applied to a server provided in an embodiment of the present application;
[0070] Figure 2 This is a diagram of the cloud resource service architecture provided by the embodiment of the present application;
[0071] Figure 3 It is another flow chart of a billing control method applied to a server provided in an embodiment of the present application;
[0072] Figure 4 This is another flow chart of a charging control method applied to a server provided in an embodiment of the present application;
[0073] Figure 5 It is another flow chart of a billing control method applied to a server provided in an embodiment of the present application;
[0074] Figure 6 This is a flow chart of a charging control method applied to a client provided in an embodiment of the present application;
[0075] Figure 7 It is another flow chart of a charging control method applied to a client provided in an embodiment of the present application;
[0076] Figure 8This is another flow chart of a charging control method applied to a client provided in an embodiment of the present application;
[0077] Fig. 9 It is a structural diagram of a billing control device applied to a server provided in an embodiment of the present application;
[0078] Fig.10 It is another structural schematic diagram of a billing control device applied to a server provided in an embodiment of the present application;
[0079] Fig.11 It is another structural diagram of a billing control device applied to a server provided in an embodiment of the present application;
[0080] Fig.12 It is a structural diagram of a charging control device applied to a client provided in an embodiment of the present application;
[0081] Fig.13 It is a schematic diagram of the structure of the server provided in the embodiment of the present application;
[0082] Fig.14 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0083] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0084] At present, for a large number of users of server resources such as cloud service resources, their business will periodically have high and low peaks in a day, which correspondingly leads to different usage requirements for server resources at different times. Users usually hope to stop billing the backend service resources of at least some virtual machines on the client when the business is off-peak, and to easily start resources to cope with the business when the business is peak. However, if you want to stop server resource billing, you can only do it by deleting the client virtual machine (such as the client cloud host). After deletion, once the user's business encounters a traffic peak, the user can only recreate the virtual machine using the virtual machine image, which is time-consuming and labor-intensive. It is difficult to flexibly respond to different resource billing requirements caused by different demands for server resources at different times due to changes in user business. At the same time, it is easy to cause problems such as high user costs, inconvenience for users to start resources and use virtual machines at any time, and waste of service resources.
[0085] To solve this problem, the present application provides a billing control method, device, electronic device, server and storage medium. A typical application scenario is the billing control of cloud service resources in the cloud. The following will mainly be based on this application scenario and will explain in detail the billing control method, device, electronic device, server and storage medium of the present application through multiple embodiments.
[0086] First, the charging control method provided by the embodiment of the present application is introduced. Figure 1 , shows a flow chart of a charging control method applied to a server, which may include the following steps:
[0087] Step 101: Obtain first billing indication information of the client, where the first billing indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than that in the second state.
[0088] In actual applications, a client physical machine (such as a laptop, desktop, etc.) can create and run one or more virtual machines based on service resources purchased from the server, such as creating one or more cloud hosts based on cloud service resources purchased from the cloud. The first virtual machine of the client is a general virtual machine and is not used to represent a specific virtual machine. It is only used to distinguish it from other virtual machines on the same client or different clients that have not entered the first state.
[0089] The above-mentioned first state is a low power consumption state of the client virtual machine, including but not limited to a first low power consumption state and a second low power consumption state. In the first low power consumption state, both the business process and the system process of the virtual machine stop running, and this state is also the shutdown state of the virtual machine; in the second low power consumption state, the business process of the virtual machine stops running and is suspended, and the system process (the most basic system process that can maintain the operation of the system) remains running, and this state is also the suspended state of the virtual machine.
[0090] The second state mentioned above is a high power consumption state of the virtual machine. In this state, both the system process and the business process of the virtual machine are running normally. Therefore, this state can also be understood as a normal running state of the virtual machine.
[0091] The client can monitor the status of its virtual machine and, based on the monitored event of the first virtual machine entering the first state, trigger the first billing indication information corresponding to the first virtual machine, and send the first billing indication information to a server on the service side, such as sending the first billing indication information to a server in the cloud service resource management platform.
[0092] The first charging indication information is used to inform the server that the first virtual machine is currently entering the first state, and to instruct the server to release server-side related resources and stop charging for the event that the first virtual machine enters the first state.
[0093] During implementation, the server may specifically receive first billing indication information triggered and sent by the first virtual machine when entering a first low power consumption state or entering a second low power consumption state; more specifically, the server may receive the first billing indication information triggered and sent by the first virtual machine when the first virtual machine is shutting down or suspending.
[0094] Optionally, this embodiment adds a metadata tag enable_track_resource to the virtual machine, and uses different values of the metadata tag to indicate different states of the virtual machine, different billing requirements and other information. Exemplarily, for example, the value of the metadata tag is 0, that is, enable_track_resource = 00 (assuming it occupies 2 bits), indicating that the virtual machine enters the shutdown state and requires no charge for shutdown (no charge for resources that are not needed in the shutdown state); the value of the metadata tag is 1, that is, enable_track_resource = 01, indicating that the virtual machine enters the power-on state and requires normal billing; the value of the metadata tag is 2, that is, enable_track_resource = 10, indicating that the virtual machine enters the suspended state and requires no charge for suspension (no charge for resources that are not needed in the suspended state). In this example, the first billing indication information mentioned above is the tag value of enable_track_resource being "0" or "2". The metadata tag and its value logic for different states are added to the processing code of the virtual machine's shutdown processing flow or suspension processing flow to support automatic assignment of corresponding values to the metadata tag corresponding to the current state during the virtual machine shutdown or suspension process, and generate first billing indication information that carries at least the value information of the metadata tag, which is then sent to the server.
[0095] After receiving the first charging indication information of the client virtual machine, the server extracts the corresponding value of the metadata tag and performs a matching operation based on the value, such as releasing the relevant resources occupied by the virtual machine on the server side and stopping the virtual machine from charging for the released resources based on the received metadata tag value of 0 or 2. The following is a detailed description of the processing process.
[0096] Step 102: Determine, from among first resources of a server on which creation and operation of the first virtual machine depend, a second resource that is not required to be used by the first virtual machine in the first state.
[0097] In this step, the first resource on the server side on which the creation and operation of the first virtual machine depends is essentially the resource on which the first virtual machine of the client relies on the server side. The creation and operation of a virtual machine usually requires at least two types of resources: storage and computing. Therefore, the first resource may include storage resources such as disks and computing resources such as CPU (central processing unit) and memory.
[0098] In the first low power consumption state in the first state, that is, the shutdown state, the business processes and system processes of the first virtual machine stop running, and no CPU, memory and other computing resources are needed. The server determines all computing resources such as CPU and memory from all resources that the first virtual machine relies on on the server side based on the fact that the first virtual machine is in the first low power consumption state, and uses all computing resources as the second resources to be released and stopped charging.
[0099] Similarly, in the second low power consumption state in the first state, that is, the suspended state, the business process of the first virtual machine is stopped and the system process remains running, and there is no need to use some computing resources such as CPU and memory. Based on the situation that the first virtual machine is in the second low power consumption state, the server determines the unused computing resources from all computing resources such as CPU and memory that the first virtual machine relies on on the server side, and uses this part of the computing resources as the second resources to be released and stopped charging.
[0100] In implementation, the computing resources actually consumed by the system process running to maintain the first virtual machine in the suspended state can be detected to further determine the unused computing resources (i.e., the second resources) in the first resources occupied by the first virtual machine on the server side.
[0101] Take the billing control of cloud service resources as an example. Figure 2As shown, optionally, the cloud maintains a computing resource cluster, a storage resource cluster and a cloud management platform, the computing resource cluster includes multiple computing nodes, each computing node is composed of one or more physical machines (such as servers) for providing computing resources such as CPU and memory, the storage resource cluster includes multiple storage nodes, each storage node is composed of one or more physical machines (such as cloud disk servers) for providing storage resources such as disks, and the computing resources and storage resources are logically separated. The cloud management platform is composed of multiple servers for providing management of the above-mentioned computing and storage node clusters, and the server of the cloud management platform records and maintains the mapping relationship information between the client virtual machine and the service resources in the cloud physical node, and the mapping relationship information recorded and maintained may specifically include the corresponding relationship between "client ID (such as client address)-ID of the virtual machine on the client" and "cloud physical node-intranet IP address / virtual IP address corresponding to the resource on the node-resource identifier (such as CPU number, address interval of memory area, etc.)".
[0102] Among them, for the virtual machine created on the client, after the cloud management platform allocates corresponding CPU, memory and other computing resources from a computing node, the allocated computing resources can be logically understood as the cloud virtual machine corresponding to the client virtual machine. For the convenience of management, the cloud management platform will allocate an intranet IP address / virtual IP address to each cloud virtual machine. One physical machine of the cloud computing node can be divided and run with one or more cloud virtual machines. In addition to computing resources, the client virtual machine will usually also purchase corresponding storage resources (such as cloud disks) from the server side such as the cloud to store its related data to support the normal operation of the business. In view of this, the cloud management platform will also mount the storage resources purchased by the user under the intranet IP address / virtual IP address corresponding to the computing resources applied for by the user, and form a complete cloud virtual machine based on the associated computing resources and storage resources.
[0103] After obtaining the first billing indication information from the client, the cloud management platform can determine all computing resources that the first virtual machine does not need to use in the shutdown state based on the above-mentioned mapping relationship information maintained, or it can combine the above-mentioned mapping relationship information and the computing resources actually consumed by the system process running of the first virtual machine in the suspended state detected to determine some computing resources that the first virtual machine does not need to use in the suspended state.
[0104] Step 103: Release the second resource of the server, and control the second resource to be in a reallocatable state.
[0105] After determining that the first virtual machine does not need to use the second resource in the first state, the server releases the second resource from the first resource occupied by the first virtual machine on the server side to release the first virtual machine from occupying the second resource on the server side and control the second resource to be in a reallocatable state.
[0106] Among them, based on the first low power consumption state of the first virtual machine of the client, that is, the shutdown state, the server releases all computing resources in the first resources (storage resources + computing resources) occupied by it, such as releasing all CPU, memory and other computing resources occupied by it.
[0107] Based on the second low power consumption state of the first virtual machine of the client, namely the suspended state, the server releases part of the computing resources in the first resources (storage resources + computing resources) occupied by it, such as releasing part of the CPU, memory and other computing resources occupied by it.
[0108] By releasing the second resource of the server, the occupation of the second resource of the server by the first virtual machine is released. At the same time, since the first virtual machine does not need to use the second resource in the first state (such as shutdown or suspension), it will not affect the operation of the first virtual machine. In addition, the released part of the resources can be managed uniformly by the server, and when there is a demand, the released part of the resources can be allocated and sold to other client users.
[0109] After releasing all or part of the computing resources occupied by the first virtual machine in the cloud, the cloud management platform still reserves the intranet IP address / virtual IP address of the cloud virtual machine for the first virtual machine.
[0110] Step 104: Stop charging the first virtual machine for usage of the second resource.
[0111] At the same time, the server stops charging the first virtual machine for the use of the second resource released by the server, thereby achieving the purpose of stopping charging for resources that the first virtual machine on the client does not need to use when it is in a low-power state such as shutdown / suspended.
[0112] Optionally, a server, such as a corresponding server in a cloud management platform, may provide the above-mentioned first billing indication information (such as a metadata tag with a corresponding value) to the order business line through a message queue, and the order business line stops billing for the second resource of the first virtual machine based on this information.
[0113] During implementation, the client or its virtual machine can automatically execute operations such as triggering and sending (sending to the server) the first billing indication information based on the event of the virtual machine entering the first state. Therefore, for the client user, when its business traffic is at a low peak, the corresponding resources can be free of charge by shutting down or suspending at least part of the virtual machines without deleting the virtual machines. This not only reduces user costs, but also makes it convenient for users to start resources and use virtual machines at any time. In addition, since the server can continue to sell the released computing resources to other client users, waste of server resources is avoided.
[0114] In the prior art, when a client virtual machine (such as a cloud host) executes a shutdown operation, the computing resources on the server side occupied by it will also be released, but resources will be reported when released, so that the server side locks the released resources in the host to achieve logical occupation of them and ensure that they are not occupied by other users (of course, the locked resources will continue to be charged for use). Subsequently, when the client virtual machine is started from the shutdown state, the locked resources in the original host machine on the server are enabled for the virtual machine; in the present application, when the client virtual machine executes a shutdown (normal shutdown or forced shutdown) or suspension operation, the physical computing resources occupied by it on the server side will also be released, but resources will not be reported, so the resources will not be locked, and the virtual machine in the shutdown / suspended state will not form a logical occupation of these resources, so that these resources can continue to be sold to other users.
[0115] This embodiment releases relevant resources on the server side and stops the virtual machine's usage billing of the resources based on the billing indication information triggered by the client based on the first state of its virtual machine. Since the power consumption of the virtual machine in the first state is lower than that in the second state, the server side releases relevant resources and stops billing when the client virtual machine is in a low power consumption state (such as shutdown, suspension), without having to rely on the deletion of the client virtual machine. In this way, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (switching to a high power consumption state) without having to re-create the virtual machine, thereby flexibly responding to the client's different needs for resource billing at different times, reducing user costs, and facilitating users to start resource-using virtual machines at any time, while avoiding waste of server-side resources.
[0116] In an optional embodiment of the present application, if Figure 3 As shown, the charging control method applied to the server may further include the following processing steps after step 104:
[0117] Step 105: Obtain second charging indication information of the client.
[0118] The second charging indication information is information triggered by the first virtual machine during the process of entering the second state or after entering the second state.
[0119] As described above, the second state is the state of normal operation of the first virtual machine. After the first virtual machine starts to enter the second state from the first state such as shutdown or suspension, it is easy to understand that the resources released in the first state before starting from the server side, that is, the second resources, need to be started to maintain the normal operation of the system processes and business processes of the first virtual machine in the second state.
[0120] To solve this problem, the first virtual machine triggers the second charging indication information during or after entering the second state to instruct the server to allocate resources, start and perform charging control on the first virtual machine.
[0121] The server correspondingly obtains the second charging indication information of the client, and performs subsequent processing based on the second charging indication information to implement the required resource allocation, startup and charging control for the first virtual machine. The second charging indication information obtained by the server may specifically include the relevant value of the metadata tag enable_track_resource mentioned above.
[0122] Step 106: Determine whether the first physical machine has enough of the second resource;
[0123] The first physical machine is the host machine where the second resource is located before the second resource is released, that is, the original host machine of the second resource. The first physical machine can be a server in the cloud for providing computing resources such as CPU and memory.
[0124] Step 107: If it is determined that the second resource is available, allocate the second resource from the first physical machine to the first virtual machine.
[0125] Step 108: If it is determined that the second resource is not available, allocate the second resource from the second physical machine to the first virtual machine.
[0126] After the first virtual machine is started, it is prioritized to determine whether the original host machine of the released second resource has sufficient second resources (such as CPU, memory and other computing resources). Furthermore, it is prioritized to determine whether the original second resources released in the original host machine are occupied by other virtual machines. If not, the original second resources are directly enabled and allocated to the first virtual machine. If occupied, it is further determined whether other resources of the original host machine have sufficient second resources. If so, the corresponding second resources are enabled from the original host machine. If not, the required second resources are allocated to the first virtual machine from the second physical machine with sufficient resources.
[0127] Specifically, when the original host machine does not have enough of the second resource, offline migration can be performed on the cloud virtual machine, migrating the cloud virtual machine from the original host machine to a physical machine with sufficient resources, namely, the second physical machine.
[0128] Among them, migrating the cloud virtual machine from the original host machine to a physical machine with sufficient resources, namely the second physical machine, means: dividing the second resources (such as CPU, memory and other computing resources) from the second physical machine, and binding the divided second resources to the intranet IP address / virtual IP address reserved by the cloud for the first virtual machine, and updating the new binding information to the mapping relationship information maintained by the cloud platform.
[0129] The cloud computing resources and storage resources (such as cloud disk resources) bound to the intranet IP address / virtual IP address together constitute the cloud virtual machine that the first virtual machine relies on in the cloud to provide service resources. And from the perspective of the client, since the intranet IP address / virtual IP address of the corresponding cloud virtual machine does not change during the migration process, the state switching of the client virtual machine (such as from normal operation → shutdown, suspension, from shutdown, suspension → normal operation) will not bring about changes to the cloud virtual machine, so the client virtual machine does not need to perform any adaptive processing (such as adjusting the connection, etc.), and it also reduces user costs.
[0130] It should be noted that when the original released second resource on the original host machine has been occupied by other virtual machines and the second resource continues to be divided from other resources of the original host machine, it is also necessary to bind the newly divided second resource to the intranet IP address / virtual IP address reserved by the server for the cloud virtual machine of the first virtual machine, and update the new binding information to the mapping relationship information maintained by the cloud platform.
[0131] Step 109: Billing the first virtual machine for use of the second resource.
[0132] After the virtual machine is started and the second resource is enabled, billing for the use of the second resource by the first virtual machine begins.
[0133] During implementation, a server, such as a corresponding server in a cloud management platform, can provide the above-mentioned second billing indication information (such as a metadata tag with a corresponding value) to the order business line through a message queue, and the order business line starts to bill the second resources of the first virtual machine based on this information.
[0134] This embodiment supports users to release server-side computing resources by shutting down or suspending the virtual machines on their physical devices without deleting the virtual machines. It allows users to respond to changes in business traffic more flexibly while saving user costs. At the same time, resources in the shutdown / suspended free state can also be sold to other users, which will not cause idleness and waste of server-side resources.
[0135] In an optional embodiment of the present application, if Figure 4As shown, the charging control method applied to the server may further include the following processing steps after step 104:
[0136] Step 110: Allocate the released second resource to a second virtual machine based on a resource allocation policy.
[0137] The second virtual machine and the first virtual machine may be virtual machines created on the same client or different clients, which is not limited.
[0138] As described above, the server-side second resource released for the first virtual machine can be sold to other users because the resource has not been reported and the first virtual machine has not logically occupied it. The server can allocate the second resource released for the first virtual machine to the second virtual machine based on its resource allocation policy.
[0139] Optionally, the resource allocation strategy may be: preferentially allocating required computing resources to the virtual machines from computing node physical machines that occupy less resources.
[0140] In this embodiment, by not reporting the released service resources, the virtual machine no longer logically occupies the released resources in the first state, and accordingly can support flexible management of the released resources (such as selling them to other users, etc.), thereby improving the management flexibility of service resources on the server side and reducing the waste of service resources.
[0141] In an optional embodiment of the present application, if Figure 5 As shown, the charging control method applied to the server may further include the following processing steps after step 104:
[0142] Step 111: Obtain configuration change indication information sent by the client when the first virtual machine is in a first state.
[0143] Optionally, the configuration change indication information includes resource configuration information for upgrading or downgrading resources of the first virtual machine, and is used to instruct the server to upgrade or downgrade the server resources occupied by the first virtual machine.
[0144] Step 112: Record the configuration change indication information.
[0145] After obtaining the indication information, the server records the configuration change indication information, such as recording the obtained resource configuration information for upgrading or downgrading configuration in the configuration information database of the cloud management platform.
[0146] Step 113: Based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server to a third resource.
[0147] When the server obtains the above-mentioned configuration change indication information from the client when the first virtual machine is in the first state, since in the first state the first virtual machine does not actually occupy resources that it does not need to use (of course the server does not charge for the resources either), the server only needs to record the configuration change indication information in this state, and there is no need to perform an upgrade or downgrade operation on the backend resources of the first virtual machine in the first state. Afterwards, after the first virtual machine switches from the first state to the second state, such as starting the first virtual machine from a shutdown or suspended state, the backend service resources of the first virtual machine are upgraded or downgraded according to the relevant configuration information in the indication information, such as increasing the memory originally occupied by SIZE1 to a memory of SIZE2 (SIZE2>SIZE1).
[0148] In synchronization with this, in the case of upgrading or downgrading the configuration, the above-maintained mapping relationship information needs to be updated.
[0149] It should be noted that, in traditional technology, no matter in what state (such as the first state) the configuration change indication information from the client is received, the server, such as the corresponding server of the cloud management platform, will directly perform virtual machine upgrade or downgrade processing based on the information, thereby realizing real-time upgrade or downgrade of the virtual machine's back-end service resources. In the present embodiment, when the server receives the configuration change indication information from the client in the first state, it only records it and waits until the first virtual machine switches to the second state before performing the matching upgrade or downgrade processing, which can effectively save user costs (in the first state, even if the configuration is upgraded, it will not actually occupy new resources) and avoid waste of server-side service resources.
[0150] Matching the above-mentioned charging control method applied to the server, the present application also discloses a charging control method applied to the client, see Figure 6 The flowchart of the charging control method is shown, and the method may include the following processing steps:
[0151] Step 601: Obtain the status of a first virtual machine created on the client.
[0152] In this embodiment, optionally, the first virtual machine may obtain its own state information based on the detection of events such as shutdown, suspension, and startup of its virtual machine system.
[0153] However, the invention is not limited to this. In actual applications, a client device, such as a user's laptop, can also detect events such as shutting down, suspending, and starting the virtual machine created on the device, so that the client can know the status of the virtual machine created by the client.
[0154] In this embodiment, the former implementation is preferably adopted, that is, the first virtual machine detects the power on / off and suspend events of its own system and accordingly obtains its own status.
[0155] Step 602: trigger first charging indication information based on a first state of the first virtual machine; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state.
[0156] The first state includes a first low power consumption state (shutdown) and a second low power consumption state (suspend), and the second state is the normal operating state of the virtual machine. For more detailed information about the first state and the second state, please refer to the description of the relevant embodiments above, which will not be repeated here.
[0157] Optionally, the first virtual machine may trigger the first charging indication information when entering a first low power consumption state (power-off state) or entering a second low power consumption state (suspended state).
[0158] As described above, this embodiment adds a metadata tag enable_track_resource to the virtual machine, and uses different values of the metadata tag to indicate different states of the virtual machine, different billing requirements, and other information. The metadata tag and its value logic for different states are added to the processing code of the shutdown process or suspension process of the virtual machine to support the automatic assignment of the metadata tag corresponding to the current state during the shutdown or suspension process of the virtual machine, and generate the first billing indication information carrying at least the value information of the metadata tag.
[0159] Step 603: Send the first billing indication information to the server on the service side to instruct the server to release the second resource on the service side and stop charging the first virtual machine for the use of the second resource; wherein the released second resource is in a reallocatable state.
[0160] The second resource is a resource that is determined by the server from the first resource of the server on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state.
[0161] After the first virtual machine generates the first billing indication information during the shutdown or suspension process, the first billing indication information is further sent to the server, such as to the corresponding server of the cloud management platform, etc. After receiving the information, the server releases the second resource that is not needed by the first virtual machine in the first state (shutdown or suspension) based on the information, and stops the first virtual machine from charging for the use of the second resource. At the same time, the server no longer reports and locks the second resource, so that it can be sold to other users.
[0162] For details of the processing on the server side, please refer to the description of the billing control method applied to the server side in the above text, which will not be repeated here.
[0163] This embodiment realizes the release of server-side related resources and the cessation of billing when the client virtual machine is in a low power consumption state (such as shutdown, suspension), without relying on the deletion of the client virtual machine. In this way, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (switching to a high power consumption state) without having to re-create the virtual machine, thereby flexibly responding to the client's different needs for resource billing at different times, reducing user costs, facilitating users to start the resource-using virtual machine at any time, and avoiding waste of server resources.
[0164] In an optional embodiment of the present application, if Figure 7 As shown, the above-mentioned charging control method applied to the client may further include the following processing steps after step 603:
[0165] Step 604: The first virtual machine triggers second charging indication information during or after entering the second state.
[0166] Optionally, when the first virtual machine is turned on from a shutdown or suspended state to switch to a normal operating state, the first virtual machine may check and modify the value of the above-mentioned metadata tag enable_track_resource during the startup process or at the end of the startup, and change it from a value indicating "free of charge for shutdown / suspended" (such as "0" or "2") to a value indicating "charges for startup" (such as "1"), thereby generating a second billing indication information containing the metadata tag information.
[0167] Step 605: Send the second billing indication information to the server to instruct the server to allocate the second resource from the service end to the first virtual machine; wherein, in the second state, the system process and the business process of the first virtual machine run normally.
[0168] Afterwards, the first virtual machine sends the second billing indication information to the server, such as to the corresponding server of the cloud management platform, so that the server allocates and enables the required second resources for the first virtual machine based on the second billing indication information to support the normal operation of the system process and business process of the first virtual machine.
[0169] Similarly, during implementation, the metadata tag enable_track_resource and its assignment logic in the corresponding state can be added to the virtual machine startup process to support triggering and sending the second billing indication information to the server during the virtual machine startup process or when the startup is completed.
[0170] In addition, when the client performs a system reinstallation operation on a virtual machine with a shutdown / suspend free-of-charge function, and starts the virtual machine after the reinstallation is completed, the startup logic is similar to the process of starting the virtual machine system from a shutdown state. The value of the metadata tag enable_track_resource carried in the startup process is also assigned to a value indicating "startup charge" (such as "1"), and then the second billing indication information containing the metadata tag information is generated and sent to the server. The server enables the corresponding resources for it (such as allocating the original released resources of the original host machine for activation or performing resource reallocation and activation based on offline migration, etc.) and performs resource usage billing.
[0171] For details of the processing on the server side, please refer to the relevant description of the billing control method applied to the server side in the above text, which will not be repeated here.
[0172] In this embodiment, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (such as switching to a high power consumption state) without having to recreate the virtual machine. This can flexibly respond to the client's different needs for resource billing at different times, reduce user costs, and facilitate users to start the resource-using virtual machine at any time, while avoiding waste of server resources.
[0173] In an optional embodiment of the present application, if Figure 8 As shown, the above-mentioned charging control method applied to the client may further include the following processing steps after step 603:
[0174] Step 606: When the first virtual machine is in the first state, send configuration change indication information to the server to instruct the server to record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server to a third resource.
[0175] During implementation, the user can perform configuration management such as upgrading or downgrading the virtual machine created on the client based on the virtual machine management software running on the client. Accordingly, the user can perform relevant configuration operations based on the interface or dialog box on the virtual machine management software to send the above-mentioned configuration change indication information to the server when the first virtual machine is in the first state.
[0176] The configuration change indication information includes resource configuration information used to upgrade or downgrade the configuration of the first virtual machine, and is used to instruct the server to upgrade or downgrade the server resources occupied by the first virtual machine.
[0177] After obtaining the indication information, the server only records the configuration change indication information while the first virtual machine is in the first state. Subsequently, after the first virtual machine switches from the first state to the second state, such as after starting the first virtual machine from a shutdown or suspended state, the server upgrades or downgrades the backend service resources of the first virtual machine according to the relevant configuration information in the indication information.
[0178] In this embodiment, when the virtual machine is in the first state and configuration change indication information for upgrading or downgrading is sent to the server, the server only records and processes the indication information in the first state, and then waits until the first virtual machine enters the second state before executing the matching upgrading or downgrading processing, which can effectively save user costs and avoid waste of server-side service resources.
[0179] Corresponding to the above-mentioned charging control method applied to the server, the embodiment of the present application also discloses a charging control device applied to the server, such as Fig. 9 As shown, the charging control device includes:
[0180] The first acquisition unit 901 is used to acquire first charging indication information of the client, where the first charging indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0181] A determining unit 902 is configured to determine, from among first resources of a server on which creation and operation of the first virtual machine depend, a second resource that is not needed by the first virtual machine in the first state;
[0182] A releasing unit 903, configured to release the second resource of the server and control the second resource to be in a reallocatable state;
[0183] The billing control unit 904 is used to stop charging the first virtual machine for usage of the second resource.
[0184] In an optional implementation of the embodiment of the present application, the first acquisition unit 901 is specifically configured to:
[0185] Receiving first charging indication information triggered and sent by the first virtual machine during the process of entering a first low power consumption state or entering a second low power consumption state;
[0186] Wherein, the first state includes the first low power consumption state and the second low power consumption state;
[0187] In the first low power consumption state, the business process and the system process of the first virtual machine stop running; in the second low power consumption state, the business process of the first virtual machine stops running and the system process keeps running.
[0188] In an optional implementation of the embodiment of the present application, the first resource of the server on which the creation and operation of the first virtual machine depends includes computing resources and storage resources;
[0189] In the first low power consumption state, the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on;
[0190] In the second low power consumption state, the second resources that the first virtual machine does not need to use include some computing resources in the first resources that the first virtual machine depends on.
[0191] In an optional implementation of the embodiment of the present application, if Fig.10 As shown, the charging control device may further include:
[0192] The allocation unit 905 is used to: obtain the second billing indication information of the client; determine whether the first physical machine has enough of the second resource; the first physical machine is the host machine where the second resource is located before the second resource is released; if it is determined that the second resource is available, allocate the second resource from the first physical machine to the first virtual machine and lock the second resource; if it is determined that the second resource is not available, allocate the second resource from the second physical machine to the first virtual machine and lock the second resource; and trigger the billing control unit 904 to start billing the first virtual machine for the use of the second resource;
[0193] The second charging indication information is information triggered by the client based on an event that the first virtual machine enters a second state; in the second state, the first virtual machine runs a system process and a business process.
[0194] In an optional implementation of the embodiment of the present application, the allocation unit 905 may also be used to: allocate the released second resource to the second virtual machine based on a resource allocation policy;
[0195] The second virtual machine and the first virtual machine are virtual machines created on the same client or different clients.
[0196] In an optional implementation of the embodiment of the present application, if Fig.11 As shown, the billing control device may also include: a configuration change unit 906, used to: obtain configuration change indication information sent by the client when the first virtual machine is in the first state; record the configuration change indication information; and based on the event of the first virtual machine entering the second state, adjust the first resource that the first virtual machine depends on on the server to a third resource.
[0197] For the billing control device applied to the server disclosed in the embodiment of the present application, since it corresponds to the billing control method applied to the server disclosed in the corresponding embodiments above, the description is relatively simple. For relevant similarities, please refer to the description of the billing control method applied to the server in the corresponding embodiments above, which will not be described in detail here.
[0198] Corresponding to the above-mentioned charging control method applied to the client, the embodiment of the present application also discloses a charging control device applied to the client, such as Fig.12 As shown, the charging control device includes:
[0199] The second acquisition unit 1201 is used to acquire the state of the first virtual machine created on the client;
[0200] The triggering unit 1202 is configured to trigger first charging indication information based on an event that the first virtual machine enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state;
[0201] The sending unit 1203 is used to send the first charging indication information to the server of the service end, so as to instruct the server to release the second resource of the service end and stop the first virtual machine from charging for the use of the second resource; wherein the second resource after release is in a reallocatable state;
[0202] The second resource is a resource that is determined by the server from the first resource of the server on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state.
[0203] In an optional implementation of the embodiment of the present application, the trigger unit 1202 is specifically configured to:
[0204] The first charging indication information is triggered by the first virtual machine in the process of entering a first low power consumption state or entering a second low power consumption state;
[0205] The sending the first charging indication information to the server at the service end includes:
[0206] The first virtual machine sends the first billing indication information to the server;
[0207] Wherein, the first state includes the first low power consumption state and the second low power consumption state;
[0208] In the first low power consumption state, the business process and the system process of the first virtual machine stop running; in the second low power consumption state, the business process of the first virtual machine stops running and the system process keeps running.
[0209] In an optional implementation of the embodiment of the present application, the triggering unit 1202 may also be used to: trigger the second charging indication information by the first virtual machine during the process of entering the second state or after entering the second state;
[0210] The sending unit 1203 may also be used to: send the second charging indication information to the server to instruct the server to allocate the second resource from the service end to the first virtual machine;
[0211] Wherein, in the second state, the first virtual machine runs a system process and a business process.
[0212] In an optional implementation of the embodiment of the present application, the sending unit 1203 may also be used to:
[0213] When the first virtual machine is in the first state, configuration change indication information is sent to the server to instruct the server to record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server side to a third resource.
[0214] As for the billing control device applied to the client disclosed in the embodiment of the present application, since it corresponds to the billing control method applied to the client disclosed in the corresponding embodiments above, the description is relatively simple. For relevant similarities, please refer to the description of the billing control method applied to the client in the corresponding embodiments above, which will not be described in detail here.
[0215] In addition, the present application embodiment also provides a server, such as Fig.13 As shown, the server at least includes:
[0216] The first memory 1301 is used to store a first computer instruction set;
[0217] The first computer instruction set may be implemented in the form of a computer program.
[0218] The first memory 1301 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0219] The first processor 1302 is configured to implement any of the charging control methods applied to the server provided in the above embodiments by executing the instruction set stored in the first memory.
[0220] The first processor 1302 can be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, etc.
[0221] In addition, the above-mentioned server may also include components such as a communication interface and a communication bus. The first memory, the first processor and the communication interface communicate with each other through the communication bus.
[0222] The communication interface is used for communication between the server and other devices (such as the device corresponding to the CDN root node). The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0223] In this embodiment, when executing the first computer instruction set stored in the first memory, the first processor in the server releases the relevant resources on the server side and stops the virtual machine from charging for the resource usage according to the billing indication information triggered by the client based on the first state of its virtual machine. Since the power consumption of the virtual machine in the first state is lower than that in the second state, the server-side related resources are released and the charging is stopped when the client virtual machine is in a low power consumption state (such as shutdown, suspension), without relying on the deletion of the client virtual machine. In this way, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (switching to a high power consumption state) without having to re-create the virtual machine, thereby flexibly responding to the client's different needs for resource billing at different times, reducing user costs, and facilitating users to start the resource-using virtual machine at any time, while avoiding waste of server-side resources.
[0224] The present application also discloses an electronic device, such as Fig.14 As shown, the electronic device at least includes:
[0225] The second memory 1401 is used to store a second computer instruction set;
[0226] The second computer instruction set can also be implemented in the form of a computer program.
[0227] The second processor 1402 is configured to implement any charging control method applied to a client as disclosed in the above embodiments by executing an instruction set stored in the second memory.
[0228] In addition, the electronic device may also include components such as a communication interface and a communication bus. The second memory, the second processor and the communication interface communicate with each other via the communication bus.
[0229] The hardware structure of the second memory, the second processor, the communication bus, and the communication interface in the electronic device is similar to the hardware structure of the first memory, the first processor, the communication bus, and the communication interface of the server in the above-mentioned embodiment. The relevant similar parts can be found in the description of the server embodiment and will not be described in detail here.
[0230] In addition, an embodiment of the present application further discloses a computer-readable storage medium, which stores a first computer instruction set. When the first computer instruction set is executed by a processor, it implements any billing control method applied to a server as provided in the above embodiments.
[0231] The embodiment of the present application further discloses another computer-readable storage medium, in which a second computer instruction set is stored. When the second computer instruction set is executed by a processor, any billing control method applied to a client provided in the above embodiments is implemented.
[0232] When the instruction sets stored in the above two computer-readable storage media are running, it is possible to release server-side related resources and stop billing when the client virtual machine is in a low-power state (such as shutdown, suspension), without relying on the deletion of the client virtual machine. In this way, the client can start the resource-using virtual machine at any time through a simple virtual machine state switching operation (switching to a high-power state) without having to re-create the virtual machine, thereby flexibly responding to the client's different needs for resource billing at different times, reducing user costs, facilitating users to start resource-using virtual machines at any time, and avoiding waste of server resources.
[0233] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0234] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0235] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0236] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0237] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A charging control method, characterized in that: Applied to a server at a service end, the method comprises: Obtaining first billing indication information sent by the client, where the first billing indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state; wherein the billing indication information carries a metadata tag, and different values of the metadata tag indicate different states of the virtual machine and different billing requirements; Determine, from the first resources of the server on which the creation and operation of the first virtual machine depend, a second resource that is not needed by the first virtual machine in the first state; Releasing the second resource of the server, and controlling the second resource to be in a reallocatable state; Stopping billing of usage of the second resource by the first virtual machine; The obtaining first charging indication information of the client includes: Receiving first charging indication information triggered and sent by the first virtual machine during the process of entering a first low power consumption state or entering a second low power consumption state; The first state includes the first low power consumption state and the second low power consumption state; the first resources of the server on which the creation and operation of the first virtual machine depend include computing resources and storage resources; In the first low power consumption state, the service process and the system process of the first virtual machine stop running, and the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on; In the second low power consumption state, the service process of the first virtual machine stops running, the system process keeps running, and the second resources not needed by the first virtual machine include some computing resources in the first resources that the first virtual machine depends on; Also includes: Obtaining configuration change indication information sent by the client when the first virtual machine is in a first state; Recording the configuration change indication information; Based on an event that the first virtual machine enters the second state, the first resource that the first virtual machine depends on on the server is adjusted to a third resource.
2. The method according to claim 1, characterized in that: After stopping charging of the first virtual machine for usage of the second resource, the method further includes: Obtaining second charging indication information of the client; Determine whether a first physical machine has enough of the second resource; the first physical machine is a host machine where the second resource is located before the second resource is released; If it is determined that the second resource is available, allocating the second resource from the first physical machine to the first virtual machine, and locking the second resource; If it is determined that the resource is not available, allocating the second resource from the second physical machine to the first virtual machine, and locking the second resource; charging the first virtual machine for use of the second resource; The second charging indication information is information triggered by the client based on an event that the first virtual machine enters a second state; in the second state, the first virtual machine runs a system process and a business process.
3. The method according to claim 1, characterized in that After releasing the second resource of the server, the method further includes: Allocating the released second resource to a second virtual machine based on a resource allocation policy; The second virtual machine and the first virtual machine are virtual machines created on the same client or different clients.
4. A charging control method, characterized in that: Applied to a client, the method comprises: Acquire the status of a first virtual machine created on the client; Based on an event that the first virtual machine enters a first state, first billing indication information is triggered; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state; wherein the billing indication information carries a metadata tag, and different values of the metadata tag indicate different states of the virtual machine and different billing requirements; Sending the first billing indication information to a server at the service end to instruct the server to release the second resource at the service end and stop charging the first virtual machine for the use of the second resource; wherein the second resource after release is in a reallocatable state; The second resource is a resource that is determined by the server from the server-side first resource on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state; The triggering of the first charging indication information based on the event that the first virtual machine enters the first state includes: first charging indication information triggered and sent by the first virtual machine during the process of entering the first low power consumption state or entering the second low power consumption state; The first state includes the first low power consumption state and the second low power consumption state; the first resources of the server on which the creation and operation of the first virtual machine depend include computing resources and storage resources; In the first low power consumption state, the service process and the system process of the first virtual machine stop running, and the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on; In the second low power consumption state, the service process of the first virtual machine stops running, the system process keeps running, and the second resources not needed by the first virtual machine include some computing resources in the first resources that the first virtual machine depends on; Also includes: When the first virtual machine is in the first state, configuration change indication information is sent to the server to instruct the server to record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server side to a third resource.
5. The method according to claim 4, characterized in that The triggering of the first charging indication information based on the event that the first virtual machine enters the first state includes: The first virtual machine triggers the first charging indication information during a process of entering a first low power consumption state or a second low power consumption state; The sending the first charging indication information to the server at the service end includes: The first virtual machine sends the first charging indication information to the server.
6. The method according to claim 5, characterized in that After sending the first charging indication information to the server at the service end, the method further includes: The first virtual machine triggers second charging indication information during or after entering the second state; Sending the second charging indication information to the server to instruct the server to allocate the second resource to the first virtual machine from the service end; Wherein, in the second state, the first virtual machine runs a system process and a business process.
7. A charging control device, characterized in that: Applied to a server at a service end, the device comprises: A first acquisition unit is used to acquire first billing indication information sent by a client, wherein the first billing indication information is information triggered by the client based on an event that a first virtual machine on the client enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state; wherein the billing indication information carries a metadata tag, and different values of the metadata tag indicate different states of the virtual machine and different billing requirements; a determining unit, configured to determine, from the first resources of the server on which the creation and operation of the first virtual machine depend, a second resource that is not needed to be used by the first virtual machine in the first state; A releasing unit, used for releasing the second resource of the server and controlling the second resource to be in a reallocatable state; A billing control unit, used to stop billing the first virtual machine for use of the second resource; The first acquiring unit acquires first charging indication information of the client, including: Receiving first charging indication information triggered and sent by the first virtual machine during the process of entering a first low power consumption state or entering a second low power consumption state; The first state includes the first low power consumption state and the second low power consumption state; the first resources of the server on which the creation and operation of the first virtual machine depend include computing resources and storage resources; In the first low power consumption state, the service process and the system process of the first virtual machine stop running, and the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on; In the second low power consumption state, the service process of the first virtual machine stops running, the system process keeps running, and the second resources not needed by the first virtual machine include some computing resources in the first resources that the first virtual machine depends on; Also includes: A configuration change unit is used to obtain configuration change indication information sent by the client when the first virtual machine is in a first state, record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server to a third resource.
8. A charging control device, characterized in that: Applied to a client, the device comprises: A second acquisition unit, configured to acquire a state of a first virtual machine created on the client; a triggering unit, configured to trigger first billing indication information based on an event that the first virtual machine enters a first state; the power consumption of the first virtual machine in the first state is lower than the power consumption in the second state; wherein the billing indication information carries a metadata tag, and different values of the metadata tag indicate different states of the virtual machine and different billing requirements; A sending unit, configured to send the first charging indication information to a server at a service end, so as to instruct the server to release the second resource at the service end and stop charging the first virtual machine for the use of the second resource; wherein the second resource after release is in a reallocatable state; The second resource is a resource that is determined by the server from the first resource of the server on which the creation and operation of the first virtual machine depend and that is not needed by the first virtual machine in the first state; The triggering unit triggers the first charging indication information based on the event that the first virtual machine enters the first state, including: first charging indication information triggered and sent by the first virtual machine during the process of entering the first low power consumption state or entering the second low power consumption state; The first state includes the first low power consumption state and the second low power consumption state; the first resources of the server on which the creation and operation of the first virtual machine depend include computing resources and storage resources; In the first low power consumption state, the service process and the system process of the first virtual machine stop running, and the second resources that the first virtual machine does not need to use include all computing resources in the first resources that the first virtual machine depends on; In the second low power consumption state, the service process of the first virtual machine stops running, the system process keeps running, and the second resources not needed by the first virtual machine include some computing resources in the first resources that the first virtual machine depends on; The sending unit is also used to send configuration change indication information to the server when the first virtual machine is in the first state, so as to instruct the server to record the configuration change indication information, and based on the event that the first virtual machine enters the second state, adjust the first resource that the first virtual machine depends on on the server side to a third resource.
9. A server, characterized in that: include: A first memory, used for storing a first computer instruction set; The first processor is used to implement the billing control method as described in any one of claims 1-3 by executing the instruction set stored in the first memory.
10. An electronic device, characterized in that: include: A second memory, used for storing a second computer instruction set; The second processor is used to implement the billing control method as described in any one of claims 4 to 6 by executing the instruction set stored in the second memory.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a first computer instruction set, and when the first computer instruction set is executed by a processor, the charging control method according to any one of claims 1 to 3 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a second computer instruction set, and when the second computer instruction set is executed by the processor, the billing control method according to any one of claims 4 to 6 is implemented.
