0

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?

kurupt_89
  • 103

1 Answers1

2

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.

  • Hey @Lee David Chung Lin thanks, for the pricing it would be $5 per 1000 text records. Where a text record = 1000 characters. Sorry, I should have clarified that. – kurupt_89 Feb 09 '20 at 01:13
  • I've edited my question to include that part – kurupt_89 Feb 09 '20 at 01:15
  • @kurupt_89 I already took that into account. Please read that yellow block you cited yourself. A snippet of 110 characters is still going to count as 1 request. – Lee David Chung Lin Feb 09 '20 at 01:20
  • Hey @Lee David Chung Lin, thanks. So in your answer you've got 1 snippet =1 request =$5 but its actually 1000 snippets = $5 as 1 snippet is < 1000 characters and 1000 characters = 1 text record. I think that's where the confusion is - 1000 text records = $5 not 1000 characters = $5 – kurupt_89 Feb 09 '20 at 01:26
  • No, you got it wrong. 1000 characters $\neq 1$ text record. Read the yellow example. one for the first request (800)... so the 800 characters is one request, then two for the second request (1,500) so the 1500 characters is more than 1000 so counts as 2 requests. – Lee David Chung Lin Feb 09 '20 at 01:29
  • Sorry I should clarrify a bit more. So from their pricing page heres what they say: A text record is plain text of up to 1,000 Unicode characters (including whitespace and any markup such as HTML or XML tags). – kurupt_89 Feb 09 '20 at 01:32
  • and at the top of the yellow section I have $5.00 per 1,000 text records – kurupt_89 Feb 09 '20 at 01:32
  • Well, it's still the same, $1$ snippet of 110 characters is 1 request, it's only scaling down to 1 request being $5/1000$ dollars. Just divide everything by 1000. – Lee David Chung Lin Feb 09 '20 at 01:34
  • If I'm sending 1 snippet thats less than 1000 chars. A request would actually just be 1 text record. So 1000 requests would be $5 – kurupt_89 Feb 09 '20 at 01:34
  • You really should have add in the beginning that "records means snippets, or tweets, or messages", cuz from the yellow block , it reads as if they use "record" and "request" interchangeably (and I very deliberately viewed the "$5 per 1000 records" as a typo (replace it with "1000 characters"), since in the end it is the request that counts). They also gave bad examples though. They should have included examples with multiple records within one request. – Lee David Chung Lin Feb 09 '20 at 01:43
  • Anyway, the calculation is updated. Please see if that makes sense to you. – Lee David Chung Lin Feb 09 '20 at 01:45
  • Yeah I agree their examples are confusing. Thanks a lot @Lee David Chung, and apologies for the confusion :). Your answer looks good to me thanks for taking the time to verify. – kurupt_89 Feb 09 '20 at 01:50