Google Cloud (over)Run: How a free trial experiment ended with a $72,000 bill overnight
- Reference: 1607611101
- News link: https://www.theregister.co.uk/2020/12/10/google_cloud_over_run/
- Source link:
"I jumped out of the bed, logged into Google Cloud Billing, and saw a bill for ~$5,000," Chauhan [1]wrote on his company's blog. "Super stressed, and not sure what happened, I clicked around, trying to figure out what was happening. I also started thinking of what may have happened, and how we could possibly pay the $5K bill. The problem was, every minute the bill kept going up. After two hours, it settled at a little short of $72,000."
It was especially surprising that it happened to Chauhan, who is ex-Google and even spent two years as "Technical Program Manager, Payments". What happened?
The idea was to try out a service that scraped web pages and stored the results in a database. The team found that Cloud Run, a GCP service to run containers, would timeout while scraping a page.
Chauhan wrote: "I suggested using POST requests (with URL as data) to send jobs to an instance, and [to] use multiple instances in parallel instead of using one instance serially. Because each instance in Cloud Run would only be scraping one page, it would never time out, process all pages in parallel (scale), and also be highly optimized because Cloud Run usage is accurate to milliseconds."
The ex-Google man reflected that he missed the possibility of pages that link back to each other, causing "infinite recursion." It should not have mattered too much, though: he set a billing budget of $7.00 and had a Firebase database on a free plan. "The worst case we imagined was exceeding the daily free Firestore limits," he said. Further, the credit card for the account had a spending limit of $100.
Unfortunately, a [2]billing budget "does not automatically cap Google Cloud or Google Maps Platform usage/spending," according to the docs.
While Chauhan was asleep after a day of testing, Google sent an automated email informing him that his free Firebase plan had been "upgraded due to activity in Google Cloud" and that this "initiated billing" for the project.
He discovered multiple issues with the GCP cost controls. "Billing takes about a day to be synced, and that's why we noticed the charges the next day," Chauhan said. Next, the "Firebase Dashboard took more than 24 hours to update," he said. This meant that the dashboard showed usage within the daily limit, when it was, he said, "86 million percentage points" more than what was shown.
The GCP Cloud Run defaults also played their part. "The max-instances is preset to 1,000, and concurrency set to 80," he said. If he had corrected this to small values like 2 and 1, the bill shock would not have occurred.
Thanks to these settings, "running [out] this version of Hello World deployment on Cloud Run made 116 billion reads and 33 million writes to Firestore," said Chauhan.
Most of the cost was down to Firebase read operations, even at just $0.06 per 100,000. Multiply that by 116 billion and you get $69,600. There was also the small matter of 16,000 hours of Cloud Run Compute time, partly because the application did not delete the services but left them "in background process".
The performance of the buggy code was impressive in its way. "At the peak, Firebase was able to handle about one billion reads per minute," he said, while Cloud Run with concurrency "can handle 9 million requests per minute".
"Fail fast, learn fast with cloud is a bad idea," Chauhan concluded. "If you count the number of pages in GCP documentation, it's probably more than pages in [a] few novels. Understanding pricing, usage, is not only time consuming, but requires a deep understanding of how cloud services work."
There is a happy ending. "After going through our lengthy doc on this incident sharing our side of the story, various consults, talks, and internal discussions, Google let go of our bill as a one-time gesture," said Chauhan.
Such leniency cannot be relied upon. Auto-scaling and on-demand computing has downsides, and working out what something will cost is [3]challenging . Caution is advised. ®
Get our [4]Tech Resources
[1] https://blog.tomilkieway.com/72k-1/
[2] https://cloud.google.com/billing/docs/how-to/budgets
[3] https://www.theregister.com/2020/09/03/cloud_control_costs/
[4] https://whitepapers.theregister.com/
And this is why you always set up your cloud tests with a shell corporation.
They can't collect from a corp with no assets.
VISA gift cards
Always sign up for these sort of offers with those top-up visa cards
Ideally with no link to your real name / email address or bank details
Re: VISA gift cards
"... VISA gift cards
Always sign up for these sort of offers with those top-up visa cards
Ideally with no link to your real name / email address or bank details..."
I am not sure how this works in other countries but here in the UK, I don't believe that it has been possible to get even a top-up card without passing ID checks for anti-money laundering for some time now.
Isn't being able to manage costs one of the benefits of Cloud?
Google managed the costs just fine
Their invoice went out as expected
"Unfortunately, a billing budget "does not automatically cap Google Cloud or Google Maps Platform usage/spending," according to the docs."
and that... is a crappy thing.
Wait till we have contract manufacturing in the cloud.
Get a sign wrong and wake up to a queue of trucks delivering 2^32-1 prototypes
Not so free after all
free Firebase plan had been "upgraded due to activity in Google Cloud" and that this "initiated billing"
Wow! Instead of an expected shut-off of services, Google's real policy is to very unexpectedly put the customer on the butcher's hook.
Re: Not so free after all
Just like credit card companies, who set a credit limit, and then "generously" increase it because you've almost reached it & will clearly need more.
Re: Not so free after all
Which is why you *always* sign up for "free" services with a disposable, Pay As You Go, generic credit card that is in no way linked to your real financial accounts.
If the "free" service suddenly pulls a Google & tries to bill you umpteen zillion dollars "in error", they get yanked up short when the ~100 bucks you've given it goes poof & the card stops working. Sure you're out the hundred, but not the life destroying, financial devestating, "OMFG! I'm bankrupt!" apocalypse they've tried to ram up your arse.
You can calmly, cooly, dispassionately discuss the proper billing for the services with them confident in the knowledge that, if they refuse to behave, you can just give them TheFinger & walk away. They can scream & gnash their teeth all they want, you don't have to pay them another bloody red cent.
This lesson brought to you by personal experience with the likes of BMG/Collumbia CD music club trying to rape me for thousands of dollars in "free" music I never ordered. I had to send them a certified, registered letter from a lawyer informing them of the U.S.Postal rules that anything not ordered by the recipient is legally a *free gift* and the recipient is under no legal obligation to pay for any of it. Even AFTER that little smack upside the head they STILL kept sending me "free" CD's for YEARS. I had over a dozen 400 CD wallet binders full of music I didn't have to pay a cent for because the company couldn't get it through their head that "I used a disposable CC to start this ''free'' trial. I completed the contract, canceled my account, & you idiots kept sending me stuff... At Your Own Expense. I'm under no legal requirement to pay for ANY of it. So if you want to keep it up, go for it, I enjoy free music!"
No sympathy from me
It's idiots like this that cause parts of the web to fall over for the rest of us. The idiot may have been able to get away with not paying a bill to Google but 19 billion requests went somewhere and even if it didn't crash a web-site it will have wasted energy.
Let's do the timewarp?
OK, so how many people thought this was a "Who, Me?" a few days early (or late)?
Would have made a good one too...
Surely though...
On though there should be a way to force, come hell or high water a hard spend limit. If the service goes past that... Down she goes.
Something like the clowdy version of an electric meter. Once the credit's all gone, out goes the lights.
Is it really so hard to manage?
Re: Surely though...
"Is it really so hard to manage?"
No! But Google don't give a crap whether you live or die so long as the money is coming in, which means they will bill you and hope you pay even if it means selling your granny for cat food.
There is a happy ending. "After going through our lengthy doc on this incident sharing our side of the story, various consults, talks, and internal discussions, Google let go of our bill as a one-time gesture," said Chauhan.
And how many people did he know inside to get this attention? If I did the same I'm pretty sure I'd be told where to file the check.