News for hackers. Stuff that matters.
Re:How we spent $30k in Firebase in less than 72 hours by t0mbstone on Wednesday August 01, 2018 @08:32PM (#17668327)
This is why infinitely scaling pay-as-you-go cloud services terrify me.

I refuse to use a service like this unless it gives me the ability to automatically cap costs and alert me when thresholds are met.

All it takes is a rogue line of code in an endless loop or something, and you are bankrupt.

Their site seems pretty basic. I'm struggling to understand why they couldn't just run it with something like Postgres for less than $100 a month on AWS?

Re:How we spent $30k in Firebase in less than 72 hours by itcmcgrath on Wednesday August 01, 2018 @09:01PM (#17668471)
Product Manager for Cloud Firestore here. It's worth noting we do have the ability to set hard daily caps, as well as budgets that can have alerts tied to them. It's something we also looking at ways to improve it.
Re:How we spent $30k in Firebase in less than 72 hours by alasdair_ on Wednesday August 01, 2018 @09:09PM (#17668509)
>Product Manager for Cloud Firestore here. It's worth noting we do have the ability to set hard daily caps, as well as budgets that can have alerts tied to them. It's something we also looking at ways to improve it.

Google Cloud user here. A warning: If you ever happen to get, say, frontpage on reddit or techcrunch or other big boost to publicity, your site could be down until the next billing cycle (i.e. 24 hours) and you will have no way to fix it.

This bit me hard one day with appengine and lost us a ton of converting traffic, even though we tried to get the limit increased within ten minutes of the spike (and well before our limit was hit).

Re:How we spent $30k in Firebase in less than 72 hours by itcmcgrath on Wednesday August 01, 2018 @09:20PM (#17668558)
Urgh, that's terrible! That definitely shouldn't be the case. I'd love for you to send me any support case you had so I can review.

Even if the front door of the system didn't help you, we definitely shouldn't have been able to get you in a good state much quicker. My profile has Twitter and my DMs are open (I can give you my email there too).

Doing my kids dinner, so responses might be slightly delayed.

Re:How we spent $30k in Firebase in less than 72 hours by cheeze on Thursday August 02, 2018 @12:03AM (#17669161)
This is exactly why I can't trust Google services though. The services are rock solid, but far far too often do I see folks who have to reach out to a dev on Twitter or their friend at Google to get a simple billing error resolved correctly.

Its a problem with most cloud providers, but Google seems to be notorious for it.

Re:How we spent $30k in Firebase in less than 72 hours by deadbunny on Thursday August 02, 2018 @07:50AM (#17670746)
In my experience none of those folks are paying for support.
Re:How we spent $30k in Firebase in less than 72 hours by welanes on Thursday August 02, 2018 @04:07AM (#17669950)
From my experience Firebase are different. They're now a part of Google but support has been excellent anytime I needed it - both before and after they were acquired.
Re:How we spent $30k in Firebase in less than 72 hours by Humdeee on Thursday August 02, 2018 @08:54AM (#17671029)
It's quite the phenomenon. Reaching out via social media to garner a company's attention when all other avenues have been exhausted... what a world we live in.

"Company ignoring you? Send out a tweet, that'll work!"

And it blows my mind that it actually does. It's very sad.

Re:How we spent $30k in Firebase in less than 72 hours by stickfigure on Thursday August 02, 2018 @02:02AM (#17669511)
This is a pretty common train of thought, but it's not really a question of deciding between "my bill will explode!" and "my app will go down!"

You just really have to put some serious thought into what your daily limits should be, and add some reasonable alerting to detect surges. The tools are there and they're not terribly hard to use. It just tends to be an afterthought for most developers because this doesn't look like a customer feature.

Without these sorts of automated scaled services, the traditional behavior is "your app goes down". This is a big improvement!

Re:How we spent $30k in Firebase in less than 72 hours by jliptzin on Thursday August 02, 2018 @09:15AM (#17671142)
No, if your app is failing in a way that a page view now costs $1.00 instead of $0.0001 for example then the application should go down.
Re:How we spent $30k in Firebase in less than 72 hours by onion2k on Thursday August 02, 2018 @01:52AM (#17669475)
Your app shouldn't just fail if an API is unavailable. You should code things to fail gracefully. In the case of a traffic spike replacing the front end with an email capture form and a message saying "things are really popular right now, how about we remind you about this tomorrow (with a discount code!)" works well.

This is hard for some things, but your startup failing because you didn't want to do it is much harder in the end.

Re:How we spent $30k in Firebase in less than 72 hours by asadjb on Thursday August 02, 2018 @03:03AM (#17669698)
Most applications have atleast 1 SPOF, the DB. Just because the DB is now the Firebase API doesn't change anything.

It would be very difficult to build products in a reasonable amount of time if everything has to be coded defensively. I can build my app quicker, and remain sane, if I assume that the DB will always be available, and just fail if the DB isn't there. Same for things like S3 (which I think had only 1 large scale failure in recent history), Redis, etc...

There are APIs which can be unavailable and you need to work around those. For me, these are mostly third party services that I don't control. But then again, I'm not building the next Netflix. I don't have enough engineers to build an app that works with a chaos monkey!

Not the best approach for all applications, but has been good enough for most projects I've worked on. Just my 2 cents.

Re:How we spent $30k in Firebase in less than 72 hours by benguild on Wednesday August 01, 2018 @09:32PM (#17668605)
Yeah, that would happen with the Google Maps API before. 150k request limit was not enough for a front-paging, and there was no rollover.
Re:How we spent $30k in Firebase in less than 72 hours by iamgopal on Wednesday August 01, 2018 @09:13PM (#17668518)
So basically we want to have cake and eat it too.
Re:How we spent $30k in Firebase in less than 72 hours by paranoidrobot on Wednesday August 01, 2018 @09:22PM (#17668564)
This seems like an overly cynical/snarky response.

It's not an unreasonable request that for services which advertise the ability to scale up and down on demand, that the billing and billing limits should also be able to respond similarly.

Re:How we spent $30k in Firebase in less than 72 hours by badlucklottery on Wednesday August 01, 2018 @10:51PM (#17668933)
>that the billing and billing limits should also be able to respond similarly

How so? With a pay-as-you-go system, firing off warnings and giving a projection of their future costs (which is hard when startups tend to have spikey traffic) is about as good as you can do.

Edit: I should add that the common solution to controlling your billing in situations like this is having some overflow path built into your beta app ("Sorry, we're not taking new users at the moment" or the like).

Re:How we spent $30k in Firebase in less than 72 hours by Dylan16807 on Thursday August 02, 2018 @12:23AM (#17669219)
The problem is that the user gets those alerts, tries to change the limit they set, and it doesn't work. That is definitely not as good as can be done.
Re:How we spent $30k in Firebase in less than 72 hours by ajmurmann on Wednesday August 01, 2018 @09:16PM (#17668533)
Or have it be adjustable within a reasonable time frame?
Re:How we spent $30k in Firebase in less than 72 hours by ShaneOG on Wednesday August 01, 2018 @09:31PM (#17668602)
A current happy Google Cloud customer here, who also received the Startup credits. When you have credits on your account none of the alerts or budgets work (at least they didn't when I was using it). The only thing you could do is look at your figures daily and plan/scale based on the running total.
Re:How we spent $30k in Firebase in less than 72 hours by magnetic on Thursday August 02, 2018 @01:36AM (#17669426)
How did you get your Startup credits?
Re:How we spent $30k in Firebase in less than 72 hours by ShaneOG on Thursday August 02, 2018 @10:23AM (#17671577)
My company was part of a partner acceleration program, however you can apply to be part of the Google Cloud for Startups program here[1], without needing to be in an accelerator.

[1] https://cloud.google.com/developers/startups/

Re:How we spent $30k in Firebase in less than 72 hours by magnetic on Thursday August 02, 2018 @02:27PM (#17674095)
Thanks guys. Appreciated
Re:How we spent $30k in Firebase in less than 72 hours by purerandomness on Thursday August 02, 2018 @07:45AM (#17670726)
Not OP, but when our startup was accepted into https://www.thefamily.co/ (which is basically a European YC), amongst other perks, we got a huge amount of AWS credits. I'm sure other incubators/accelerators do similar offers for GCE/AWS.
Re:How we spent $30k in Firebase in less than 72 hours by mickronome on Wednesday August 01, 2018 @09:34PM (#17668625)
I would very much like to have something like Google authenticator, but for billing. With the ability so set it as alarms on my phone (and coworkers), preferably with some smarts to detect short usage spikes.

In essence, settings and updating amount, rate and velocity ( speed of rate change ) caps on the fly.

Then I can set whatever tight limit I want to, and not worry about burning through too much cash because of some simple coding, or config error.

A bug almost cost us several tens of thousands of BigQuery costs when a dev accidentally repeated a big query every 5 seconds in an automated script, and while we still had budget warnings, it still cost us a fair bit of money. Even after this, I found it tricky to set/catch budgets for single services. I think I had to use stackdriver to be able to get any kind of warning.

It was in the ’blinking lights and sirens’- territory fast!

Re:How we spent $30k in Firebase in less than 72 hours by tkrupicka on Thursday August 02, 2018 @02:03AM (#17669515)
Hey! This might not be the best place to contact you, but my team is currently in crisis from a nasty Android Firestore bug. When the user's device switches networks it loses the real-time event listeners and in some cases doesn't re-establish until the app is reinstalled. We submitted a bug report and source for an app with the issue but haven't heard anything in a week. We love the product otherwise, but I thought I'd bring it to your attention.
Re:How we spent $30k in Firebase in less than 72 hours by puf on Thursday August 02, 2018 @02:41PM (#17674229)
Hey there. Thanks for letting us know. We unfortunately don't have a fix for this at the moment. We've seen reports on network connections not being reestablished, but have been unable to reproduce it so far. If you've filed a bug report, the best way to help us reproduce it is by adding details to the report. That then also gives our team a way to get back in touch with you once they're able to reproduce (and then fix) the problem. Thanks again for the report!
Re:How we spent $30k in Firebase in less than 72 hours by snowwolf on Thursday August 02, 2018 @09:42AM (#17671276)
How about having default conservative alerts built in for new accounts (not caps, just alerts). That way people who forget to set them will be reminded the first time they get one.

An account that goes from $0 spend to $30k in 72 hours should really trigger some kind of flag - even internally within google. What if they didn't have any kind of grant and weren't able to pay?

Re:How we spent $30k in Firebase in less than 72 hours by kylec on Thursday August 02, 2018 @12:23AM (#17669218)
Are the caps on by default? If not, they should be.
Re:How we spent $30k in Firebase in less than 72 hours by superfrank on Thursday August 02, 2018 @12:46AM (#17669279)
> This is why infinitely scaling pay-as-you-go cloud services terrify me.

It's been a little over a year since I used Firebase in production, so maybe this has changed, but the funny thing is Firebase DB doesn't infinitely scale, despite them advertising that it does.

The Firebase DB caps out at 100k active connections and according to them (at the time) it's a technological limit on their part, so they cannot go higher even if they wanted to.

When we brought this up, they told us they were technically unlimited because you could shard your data into different DBs if you needed more connections, which is like saying all restaurants are all you can eat because you can keep buying more food.

Re:How we spent $30k in Firebase in less than 72 hours by itcmcgrath on Thursday August 02, 2018 @12:59AM (#17669320)
Note this is about Cloud Firestore, not Firebase RTDB. It's very different infra. We announced our beta limits increased to 1M concurrent connections at the Next 18 conference, and we'll continue to improve from there.
Re:How we spent $30k in Firebase in less than 72 hours by fefb on Thursday August 02, 2018 @01:10AM (#17669350)
The link posted is talking about the Firestore and not the Real Time. Firestore is in beta state that has a beta limit of 100k sim. connections, probably off beta it will be able to handle more connections. The Real Time has 100K limit and is a centralized db.
Re:How we spent $30k in Firebase in less than 72 hours by tgsovlerkhgsel on Wednesday August 01, 2018 @11:21PM (#17669037)
How do pay-as-you-go cloud providers handle DoS attacks (the "smart" ones that simulate a lot of expensive legit-looking traffic, not simple volumetric ones)?

That's the thing that terrifies me. If I'm using S3/Cloud Storage etc., I'm getting charged for each GB of outbound traffic, and I have to assume that the bandwidth available to serve my files is almost infinite.

Re:How we spent $30k in Firebase in less than 72 hours by bufferoverflow on Thursday August 02, 2018 @02:09AM (#17669539)
You should rate-limit and cache the potentially expensive paths of your app. There's no real way to protect against a clever DDoS, someone will have to eat the costs.
Re:How we spent $30k in Firebase in less than 72 hours by zwily on Thursday August 02, 2018 @08:33AM (#17670940)
You can’t really rate limit server-side with Firebase. If a client has read-permission on a data node, an attacker can just read from there as many times as they want.

There are some ways to limit writing using the rules engine but you’ll still get charged for failed writes. :)

Only real way to rate limit firebase that I know of is to put some sort of proxy service in between, but then you lose a lot of the advantage of using FB in the first place.

Re:How we spent $30k in Firebase in less than 72 hours by jliptzin on Thursday August 02, 2018 @09:02AM (#17671069)
I will also stay far away from these services. As a child post points out, if you do set a cap, you run the risk of cutting off a legitimate spike in high quality traffic. How do you tell the system to shut off due to an error and stay on during a spike in normal traffic? You can’t, unless you have someone watching it at all hours.

That’s why I prefer to just rent whole machines on AWS. If I accidentally have some code stuck in an infinite loop making some O(1) call, don’t charge me $10,000 for that when it costs you nothing. If it’s actually consuming electricity and significant resources, I’ll know quickly because my service will go down, as it should, not scale infinitely until my company is bankrupt.

Re:How we spent $30k in Firebase in less than 72 hours by everdev on Wednesday August 01, 2018 @08:35PM (#17668349)
Even with a cap, a rogue line or a legitimate surge in traffic could shut down your app.

It's endless bill monitoring and budget approval.

I'll stick to a flat rate DO droplet.

Re:How we spent $30k in Firebase in less than 72 hours by marktangotango on Wednesday August 01, 2018 @09:15PM (#17668529)
What’s the difference between a cap limiting your traffic and server cpu maxed out, or db connection pool or ... limiting your traffic?
Re:How we spent $30k in Firebase in less than 72 hours by Something1234 on Wednesday August 01, 2018 @09:33PM (#17668616)
One bankrupts you, the other just has a minor hiccup with a few lost customers that day.
Re:How we spent $30k in Firebase in less than 72 hours by ithkuil on Wednesday August 01, 2018 @09:55PM (#17668699)
a (cost) cap is a feature designed to prevent you from going bankrupt but at the expense of not recovering from the surge after you deplete the cap until the end of the cap granularity.

So, if the cost cap is defined as $n per day, once you deplete it you'll be down for the rest of the day (or if you take some manual action to increase the cap, if the cloud provider supports it).

This problem is a function of the granularity. Imagine a system that let you say:

"I want to spend max $n per second with a extra burst of $m per day/week"

You adjust your "$n" to match the throughput you'd have if you had a fixed size "pay what you provision" system and reserve $m for lucky events as landing on HN.

The amount of planning you have to do is similar to the traditional resource allocation, but with the benefit of paying less than provisioned if you're not getting all that traffic.

Re:How we spent $30k in Firebase in less than 72 hours by vbezhenar on Wednesday August 01, 2018 @11:52PM (#17669125)
Is it possible to make a similar approach in cloud? Something like "if traffic goes up, scale up until $5/month and then don't scale further, let it be slow (or even better throw errors)". Would be the best of both worlds.
Re:How we spent $30k in Firebase in less than 72 hours by Xorlev on Thursday August 02, 2018 @12:12AM (#17669185)
For services that are pay per request, this is effectively a hard cap.

For more capacity based services, sure, but it's more likely to be down than just slow. When systems are run at their limit they rarely operate the way they did with a little less traffic.

Re:How we spent $30k in Firebase in less than 72 hours by heavenlyblue on Wednesday August 01, 2018 @08:55PM (#17668440)
Well, a rogue line could potentially as much shut down your app hosted in DO.
Re:How we spent $30k in Firebase in less than 72 hours by tgsovlerkhgsel on Wednesday August 01, 2018 @11:11PM (#17669002)
That's the thing though: If you're a big company, your site being down is much scarier than a 100x bill.

When you're an individual, the potential for a $10k bill is much scarier than your hobby project going down.

When you're a small org/startup, the potential for a $75k bill is probably still scarier than your site going down.

Re:How we spent $30k in Firebase in less than 72 hours by heavenlyblue on Saturday August 04, 2018 @04:59PM (#17688405)
Well, then the issue with the Amazon Lambda is not that of it's ability to scale, but that of it's default not to limit your spending.
Re:How we spent $30k in Firebase in less than 72 hours by ghaff on Wednesday August 01, 2018 @08:50PM (#17668421)
From what I understand, AWS at least is pretty good about giving you at least one "get out of jail free" card if things go awry.

Caps are tough though. I can certainly understand a use case that would want a hard circuit breaker that just kills everything it can once it hits a certain threshold. Sort of; you presumably don't want everything on S3, for example, to be deleted.

On the other hand, moving up the scale of serious businesses, I can imagine it would be hard to specify circuit breakers (rather than just alerts) and you get into issues of terminating services that affect all sorts of other services across the entire account.

Re:How we spent $30k in Firebase in less than 72 hours by itcmcgrath on Wednesday August 01, 2018 @09:06PM (#17668494)
Caps are definitely hard, getting them right as both a feature as well as setting them as a customer is still an art. This holds true for 'flat rate' too, where your trading correct sizing vs downtime when either get code wrong or get unexcepted success. I've been involved in all these situations so I definitely emphasize.

We had daily hard caps and budgets alerts, but it's still an area we can do better.

(Disclaimer: Product Manager for Cloud Firestore)

Re:How we spent $30k in Firebase in less than 72 hours by thieving_magpie on Wednesday August 01, 2018 @09:00PM (#17668461)
There's nothing guaranteed about a "get out of jail free" card, so factoring that into your decision making is probably a bad road to go down.
Re:How we spent $30k in Firebase in less than 72 hours by ghaff on Wednesday August 01, 2018 @09:45PM (#17668664)
I'm not suggesting that. For a lot of casual users I'm not sure that cloud services are necessarily the best approach for an externally-facing service. They may well be better with a VPS that has a hard resources/dollar limit.

Perhaps cloud providers should have some sort of hard circuit breaker option (though it won't help for some things like storage) but it's probably not a priority as not a lot of businesses--their primary customers--would be OK with effectively hitting the power button for their entire cloud account if they exceed some dollar amount that someone or other configured a couple of years ago.

Re:How we spent $30k in Firebase in less than 72 hours by vuln on Wednesday August 01, 2018 @09:10PM (#17668511)
You only have to be 'terrified' if you don't write good code. Maybe people should actually test their code before pushing it to production?

It's not firebase's fault you ran bad code and have a huge bill. They have bills to pay also. Think they can tell their vendors 'sorry we can pay you this week. A customer ran up a 30k bill and they can't pay it. So we can't pay you right now. but lol bad code right? '

Re:How we spent $30k in Firebase in less than 72 hours by dang on Wednesday August 01, 2018 @09:37PM (#17668635)
Re:How we spent $30k in Firebase in less than 72 hours by JoJoJoboop on Wednesday August 01, 2018 @09:39PM (#17668643)
Well, since Firebase has lowered the barrier of entry with their easy setups, I think it is justified to expect at least some developers to make mistakes.

I don't blame Firebase at all though -- great product.