I got a basic maths question, just looking to double check the numbers I came up with.

40 Views Asked by At

I'm trying to work out the costs of using a google cloud service when processing some data.

The pricing thats more relevant to my case is:

$5.00 per 1,000 text records

If the text provided in a AutoML Natural Language request contains more than 1,000 characters, it counts as one text record for each 1,000 characters. For example, if you send three requests to AutoML Natural Language that contain 800, 1,500, and 600 characters respectively, you would be charged for four text records: one for the first request (800), two for the second request (1,500), and one for the third request (600).

1 text record will equal 1000 characters

So I've got snippets of text where the average length of a snippet will be 110 characters.

And let's say I have 1 million snippets.

If its $5 per 1000 text records, then I do this:

5 / 1000 = 0.005 (not sure what the mathematical name of what this is called?)

I can then work out the cost of sending 1 million snippets as:

1 000 000 * 0.005 = $5000

This looks correct to me, I can confirm by working with a smaller number e.g. 10 000 snippets = 10 000 text records so 10 000 * 0.005 = $50


So now I want to optimise on cost. I can group snippets so rather than sending 110 characters per request. I have code in place to group snippets so that I can send more text per request. Which in most cases won't be exactly 1000 characters, but close. So to keep it simple, let's assume I'm grouping them by 1000 characters.

So what I'll do is simply, divide the total number of characters sent by 1000 and I get this.

1 000 000 * 110 = 110000000 - Total number of characters

110000000 / 1000 = 110 000 - group by 1000 characters

110 000 * 0.005 = $550

If my maths is correct, I'll be saving $4450. Can someone please confirm that my maths is correct?

1

There are 1 best solutions below

12
On BEST ANSWER

If I understand the setting correctly:

Without grouping

$1$ snippet $= 110$ characters $< 1000$ characters
$\implies 1$ snippet $= 1$ request $= \$\frac5{1000}$

Totally $1$ milion snippets $= 1$ million requests $\times \$\frac5{1000} = \$5000$ , five thousand dollars.

With grouping

Nine $1$ snippets grouped together $= 990$ characters $< 1000$ characters
$\implies 9$ snippets $ = 1$ request $= \$\frac5{1000}$

Totally $1$ million snippets $= \dfrac{1000000}9$ request $\times \$\frac5{1000} = \dfrac{5000}9$ dollars $ \approx \$555$ , five hundred fifty-five dollars.

Basically you bring the cost down to one-ninth of the un-grouped case.

Savings $= 5000 - \dfrac{5000}9$ dollars $\approx \$4444$ , four thousand and hundred forty-four dollars.