# Cloud-based billing modeling

CloudReports (hereinafter I ask you to consider all coincidences of names with real companies as random) provides a cloud service for preparing reports in the cloud. Consider the business task of modeling the calculation of the cost of the formation of such services. For a deeper understanding of the situation, consider, as an example, the real FastReports product available in the open-source version for generating reports (you can download the demo version on the company's website for free). Take the Employees demo report. We modify the

report. To do this, add another page to the report (Page2)

On the code page, the

Run the report and scroll to the last page

As a simple model, we can consider a linear one, then the report construction cost is calculated by the formula

where a_i is the set of some weighting factors, b_i is the billing parameter. For example, we choose as key parameters when calculating the cost: The amount of memory usage (Physical memory usage = Pm), CPU load time (Total processor time = Tt) and the number of pages in the report (Pages = P)

a_1 is a coefficient that is selected based on marketing model and has a dimension of ruble / bit, provided that Pm is measured in bits. Suppose the following tariffs are set.

We calculate

where the processor time is rounded to 4 seconds.

In reality, the choice may be more difficult, we leave this task outside the scope of this article - we give just an example: you charge the first 100 pages for 101-199 rubles per 0.50 kopecks, everything above 200 is not charged or charged at 0.10 kopecks. The point of this example is to show that there are countless marketing options.

An important part of cloud reporting is their licensing. Let us give an example, a client purchases a package of 100 reports. Each report has its own unique code. The structure of each report can be developed at the discretion of the client. When selling a package of licenses for 100 reports, the client deposits a certain amount into his personal account. You can take into account each run of the report and take a fixed amount S + Fix for it in addition to the resource consumed, then before starting the report, you must specify its unique key in response to this request, the license server will take into account this run and reduce the counter by one. If the license has expired, then the launch of the report will be refused. Sales are possible with an unlimited number of launches or with periodic updates, when a license is issued for 10 thousand launches,