In this article we will consider how a cloud server resource usage for billing is collected and reported, and the difference between getting cloud server resource usage for billing and collecting real-time resource performance statistics from the Virtuozzo node.

Basic Terminology

Instance Manager (IM) - the core component of the Cloud Infrastructure module.

Instance Manager database (IM DB) - the database that stores Instance Manager data.

Virtuozzo dispatcher - the component responsible for collecting real-time resource performance statistics from a cloud server.

OA Operations database - the database that stores Odin Automation operations data.

Resource limits - cloud server resource values defined by the customer within the limits defined by the OACI service plan.

Cloud Server States Affecting Resource Usage Reporting

Cloud server creation. When the IM (also known as PACI-im service) receives a request for creation of a cloud server with certain limits (defined by the customer), it communicates with the Virtuozzo dispatcher for cloud server creation, and saves the cloud server's resource limits in the IM DB. These values are stored in the IM DB and used as a resource usage. For example: you purchased a cloud server with the following configuration: CPU 1000 MHz, RAM 512 MB, Disk Space 10 GB. These values will be saved in the IM DB and will be reported until they are changed by a customer request or autoscale.

Cloud server reconfiguration. When you change cloud server configuration, the changes of resource limits together with date and time are saved in the IM DB. For example, you have increased CPU, RAM and Disk Space. These new values are saved in the IM DB and will be reported as a resource usage starting from this moment.

Cloud server resource autoscaling. In case of high/low load, cloud server resources are automatically adjusted depending on the autoscaling settings you specified and resource limit changes. These new values are saved in the IM DB and will be reported as resource usage starting from this moment.

Every hour the IM requests data about resource limit changes (these data represent the resource usage) from the IM DB and reports them to OA Operations database. For example, if RAM limit at 1:00 AM is 128 MB and at 1:45 AM is increased to 512 MB, the IM will report the following: 128 MB*0.75 h+512 MB*0.25 h = 96 MBh + 128 MBh = 224 MBh

OA Operations database accumulates and stores resource usage data as unit_of_measure * h. It shows how long a particular amount of resource is used in hours. The following cloud server resources are stored in OA Operations database:

  • CPU usage (MHzh)
  • RAM usage (MBh)
  • Disk space usage (MBh)
  • Bandwidth (Kbpsh)

All cloud server resources listed above should be configured in the service plan as Additive and Measurable. The Measurable parameter is used to allow resource overuse. The Additive parameter implies that resource usage is accounted for the subscription period only - it increases during the period and is reset at the end.

At the end of the month, OA Billing requests resource usage data from the OA Operations database and calculates the price for one month of use. The price for a unit is defined in the OACI service plan.

Resource usage price for month ($) = resource usage (UOM*h) * price for unit ($)

For example: 1 GB of RAM costs $1. A customer buys a cloud server with 128 MB of RAM. After 2 weeks the customer buys an additional RAM and gets a total of 512 MB of RAM.

Price for the first two weeks for 128 MB of RAM = (128 MB*14 days*24 hours)/1024 MB*$1 = $42

Price for the rest of the month for 512 MB of RAM = (512 MB*16 days*24 hours)/1024 MB*$1 = $192

Total price at the end of the month = $42+$192 = $234

alttext

Blocks highlighted in orange on this scheme reflect the components responsible for autoscaling and collecting real-time resource performance data to display charts in the control panel (not for billing purposes).

Autoscaling and Real-Time Resource Performance Statistics

OACI agent (SNMPD) – an agent running on a Virtuozzo node with the SNMPD service.

Purpose:

  • collecting real-time resource performance data from Virtuozzo dispatcher via Virtuozzo SDK and sending UDP packages to the IM. The default period of collecting and sending data is 5 minutes. Real-time resource performance data are used to display charts in the control panel.
  • keeping and checking autoscaling rules, sending RAM/CPU resize requests to the IM in case of high/low usage.
  • VE state backwards synchronization: reflecting the actual VE state in OA CP, in case it was changed by Virtuozzo tools or directly from inside the VE.

In case of RAM and CPU high/low load, the OACI agent checks the autoscaling rules and sends the corresponding request to the IM. The IM communicates with the Virtuozzo dispatcher to resize the cloud server.

Requires: open port 161 UDP, SNMPD service.

Logs: /var/log/paciagent.log (on Virtuozzo nodes)

Configuration file location:

/etc/snmp/snmpd.local.conf

/etc/paciagent.conf

If SNMPD is down, autoscaling will be affected. For example, you have set the following autoscaling rule for a cloud server: if RAM load is higher than 80% for 5 min, increase it to 8192 MB. If SNMPD is down during a high RAM load, the cloud server won’t be resized.

Backup and Image Space Usage Collection

The IM collects the actual usage of disk space used for storing backups and images on the Backup node via Virtuozzo SDK. For example, if a customer has purchased 50 GB of backup space and uses only 30 GB, the IM will report the actual usage – 30 GB - to the OA Operations database. The same process works for images.

The following cloud server resources are stored in the OA Operations database:

  • Backup space usage (MBh)
  • Image space usage (MBh)

The price calculation is the same as for the other cloud server resources described above.

Will Resource Usage Collection Be Affected if One of the Services is Down?

If for some reason the IM is down, you won't be able to change the cloud server's resource limits but this won't affect resource usage data. The OACI service controller (located on OA Management Node) keeps the date and time of the last successful data report from the IM. When the IM is up and running again, the OACI service controller will send the IM a request for cloud server resource limit changes for the period of time when no data were reported. For example, if the IM was down for 2 hours, at the next report time data for the two hours will be requested. So, no data will be lost.

If the IM DB is down, you won't be able to change the cloud server resource limits but again it won't affect resource usage data reporting. This case is similar to the described above.

If SNMPD is down, it will affect billing, in case VE state is changed manually directly inside VE. OACI will not become aware that VE has been stopped, if the action was not initated from CP. So resource usage will be accounted until the state is fixed: either manually or by starting the snmpd service on the Virtuozzo node.

If SNMPD is down, it will affect autoscaling but not the resource usage collecting for billing. Let's consider an example showing how the price is calculated depending on the SNMPD state (up/down).

1 GB of RAM costs $1. A customer buys a cloud server with 128 MB of RAM. On the 15th day of the month the load increases and RAM is resized to 256 MB according to the autoscaling rules. The load stays high for two days and afterwards returns to the previous level.

Price for the first two weeks for 128 MB of RAM = (128 MB*14 days*24 hours)/1024 MB*$1 = $42

Price for two days for 256 MB of RAM = (256 MB*2 days*24 hours)/1024 MB*$1 = $12

Price for the rest of the month for 128 MB of RAM = (128 MB*14 days*24 hours)/1024 MB*$1 = $42

Total price at the end of the month = $42+$12+$42 = $96

If the SNMPD had been down, RAM would not have been resized because of the high load, and the total price would have been (128 MB*30 days*24 hours)/1024 MB*$1 = $90. Although we received a different total price, this doesn't mean that SNMPD influences the collection of data for billing, it affects the autoscaling which leads to the price difference at the end.

Internal content