📜 ⬆️ ⬇️

How our billing works

We recently updated our billing system and now is the time to tell how the money is being written off in the cloud. It will be interesting to users, because now the money is written off not instantly, but according to a rather specific algorithm. The most important from a practical point of view is at the end of the article.


We have divided accounting and billing , or, in bureaucratic language, an automatic accounting system and an automatic calculation system.

The automatic accounting system (accounting) considers how much what component of the virtual machine consumed resources. And who owns this virtual machine, what money to take, etc. - this is not his headache. Moreover, he even knows nothing about the word "cloud".
It works very close to the hypervisor. For example, the values ​​of processor time and memory are read directly from the hypervisor, and the counters of disks and traffic from the performance counters of block (network) devices in dom0.

Note that the account does not know anything about “today,” “yesterday,” “for the week,” etc. - he just counts the counter. Which grows up non-decreasingly for the entire life of the machine. Next, however, added another service that collects data for graphs, but does not participate in the process of writing off money.

Next comes the billing. Billing, in turn, does not know anything about virtualization, xen'e, the nuances of blktap work, etc. All he does is capture the fact of consumption of an object belonging to a given user and deducts the consumption from the client’s cloud account for it . He also performs the unpleasant work of the “executioner”, turning off the machines for non-payment and deleting the machines of those who do not pay more than 7 days.


Write-offs are carried out upon the occurrence of an important condition: the amount of write-offs and the amount of write-offs are expressed in whole numbers. In other words, we never write off 0.5 penny. And never take money for 1.33 MB. From these conditions, the so-called multiplicity threshold arises , that is, the minimum amount of resources for which funds will be written off.

Here are these thresholds:

ResourceVolumeMinimum amount debited
CPU40 seconds1 kopek
Memory62.5 GB * s (17 MB * h)1 kopek
Network125 MB2/8 kopecks (rx / tx)
Disk10MB1 kopek
IOPS50,000 pieces1 kopek
Disk storage8 PB * s (2.22GB * h, 925 MB * day)1 kopek

Important: until the required volume is accumulated, we do not take money from the client. In the case of memory, processor and disk operations, this is not so noticeable, but with the network - quite. Actually, it is because of the apparent peculiarities of traffic billing that this article appeared.

Until you have 125MB of traffic, his readings are zero. Likewise, until two hours of disk storage passes, we don’t charge money for a gigabyte disk.


Not really. Of course, if you never pick up 125 MB of traffic during the life of the car, you don’t owe us anything.

However, the counters are not reset to us, so if you downloaded 120 MB a year ago, and 5 MB a year later, then at that very moment we will take a couple of kopecks from you.

Difference with Opsox

(I do not like signalers, sorry).
We do NOT round up traffic to either the lower or the lower. Accounting goes up to byte, payment - up to 125Mb. The accuracy of the billing does not change the amount paid for resources - it changes just the moment when the funds will be written off.

Source: https://habr.com/ru/post/106553/

All Articles