News for hackers. Stuff that matters.
Re:Building a high-scale chat server on Cloud Run by thesandlord on Tuesday March 09, 2021 @08:13PM (#26406620)
I think some people are missing the point when comparing this to a traditional VM setup. Yes it is way more expensive, but it lets you deploy something that works in 10 minutes vs messing with VMs and auto-scaling groups and all that jazz.

If you are a GCP or AWS or bare metal expert that can set this thing up in their sleep, that's great but the majority of people can really benefit from a PaaS like GCR.

Because Cloud Run uses vanilla Docker containers, once you have validated the idea you can move to GKE or VMs or a server under your desk or whatever. And if it never takes off, that's fine too because you didn't spend a ton of time investing in making it work.

Ahmet if you are reading this (hi) it would be REALLY cool to see something like using GKE for the base load and dynamically bursting to GCR to fill in the gaps. Not sure if this possible with GCLB today, but would be super cool.

(Disclaimer: I used to work on this team at Google.)

Re:Building a high-scale chat server on Cloud Run by dilyevsky on Tuesday March 09, 2021 @09:07PM (#26406941)
At this price point hiring a dedicated dev seems like a no brainer. Also using GCR name for this is a bit weird when there’s already another GCP container product with the same exact name.
Re:Building a high-scale chat server on Cloud Run by thesandlord on Tuesday March 09, 2021 @10:11PM (#26407318)
Yeah but the price starts at $0 and scales linearly with traffic.

> Also using GCR name for this is a bit weird when there’s already another GCP container product with the same exact name.

Very true! Naming is hard

Re:Building a high-scale chat server on Cloud Run by blandflakes on Tuesday March 09, 2021 @11:58PM (#26407931)
And Google seems especially bad at it.
Re:Building a high-scale chat server on Cloud Run by dodobirdlord on Wednesday March 10, 2021 @02:02AM (#26408642)
The approach of branding things as Google Cloud XYZ makes for really homogeneous acronyms. It solves the problem that AWS has with terrible names (what the hell is a “Redshift”?) by giving everything a boring name, but in exchange you get GCS being the acronym for Google Cloud Storage, Google Cloud Spanner, Google Cloud Search, Google Cloud SQL...
Re:Building a high-scale chat server on Cloud Run by boxysean on Wednesday March 10, 2021 @03:36AM (#26409147)
> The name means to shift away from Oracle, red being an allusion to Oracle, whose corporate color is red and is informally referred to as "Big Red.

I learned this recently and thought I'd share! From https://en.m.wikipedia.org/wiki/Amazon_Redshift

Re:Building a high-scale chat server on Cloud Run by blandflakes on Wednesday March 10, 2021 @08:13AM (#26410857)
I actually don't mind the acronymed stuff so much. My primary complaint is that the names are so generic that you can't differentiate the products by name except by memorizing them. For example:

* BigQuery vs BigTable (though, there are at least some hints in these)

* Cloud Storage vs Filestore vs Datastore vs Firestore (vs Firebase? How are these related?)

I can of course make an effort to keep these straight, but then having to clarify in every design convo because my manager can't, or having a hard time googling (lol) things germane to the product I'm on, etc, is just a huge hassle.

Re:Building a high-scale chat server on Cloud Run by dilyevsky on Wednesday March 10, 2021 @11:34AM (#26413021)
Agree about firestore vs filestore but if a manager doesn’t know what bigtable is I’d probably consider leaving
Re:Building a high-scale chat server on Cloud Run by arthurcolle on Wednesday March 10, 2021 @02:27AM (#26408764)
Clearly we should start using emoji triplets for service names... easy to read/remember, and easy to type out on modern systems
Re:Building a high-scale chat server on Cloud Run by throwaway3699 on Wednesday March 10, 2021 @05:52AM (#26409958)
Spanner is also a bad name for a database. They should've called it Bigertable.
Re:Building a high-scale chat server on Cloud Run by dilyevsky on Wednesday March 10, 2021 @11:32AM (#26413005)
A. It’s not even correct b. It’s a terrible name bc it will get confused in code/configs all the time
Re:Building a high-scale chat server on Cloud Run by ehsankia on Tuesday March 09, 2021 @11:12PM (#26407679)
In general I agree, but I think this is more an issue of the example, or rather the fact that there's a cap of 250 connections per Cloud Run instance. For something as barebone as chat clients, that really seems to be under utilizing even the single vCPU on the smallest instance.
Re:Building a high-scale chat server on Cloud Run by ec109685 on Wednesday March 10, 2021 @12:21AM (#26408077)
Clearly the right answer is to let customers go beyond 250 concurrent (maybe scale based on size of function).

Get CloudRun handling the C10k problem and you’ll really have something.

Re:Building a high-scale chat server on Cloud Run by steren on Wednesday March 10, 2021 @12:37AM (#26408160)
Cloud Run PM here. WebSockets are in Preview. We've been working on increasing concurrency for GA.
Re:Building a high-scale chat server on Cloud Run by rad_gruchalski on Tuesday March 09, 2021 @08:26PM (#26406712)
> And if it never takes off, that's fine too because you didn't spend a ton of time investing in making it work.

But if it “takes off” while you are caught with your pants down and you have no clue, you are stuffed with a friggin $60k bill and potentially have to remortgage your house.

Re:Building a high-scale chat server on Cloud Run by thesandlord on Tuesday March 09, 2021 @09:00PM (#26406891)
1) you can cap the max instances in GCR. You can put a limit of like 2 instances and ramp it up gradually.

2) it's 60k for a full month running at 100% capacity. Chances are you will notice this.

This blog post is showing the upper limits of GCR, not the typical use case.

Re:Building a high-scale chat server on Cloud Run by minimaxir on Tuesday March 09, 2021 @08:33PM (#26406747)
That's why businesses use expected cost to make business decisions. The odds of it taking off are very, very low.

And in the rare case it does, the infra is relatively portable (Docker container) and can be moved to a more-suitable VMs in less than the full month.

Re:Building a high-scale chat server on Cloud Run by bushbaba on Tuesday March 09, 2021 @11:34PM (#26407800)
In that case why not use digital ocean or similar cheap VM offering. Cheaper, scales in near term. And provides a path forward to a more enterprise stack if necessary.

I think people underestimate the serving capabilities of a few VMs coupled with caching/cdn.

Re:Building a high-scale chat server on Cloud Run by ALittleLight on Tuesday March 09, 2021 @11:01PM (#26407602)
But if it doesn't really take off - why do you need it? The main benefit of easy scaling strikes me as the scaling, but if you don't want to scale too much for cost reasons...
Re:Building a high-scale chat server on Cloud Run by jillesvangurp on Wednesday March 10, 2021 @03:17AM (#26409027)
Exactly, you can repurpose much of your build pipeline and simply boot the same docker image using a vm or scaling group of vms with a single command.

The cost of switching to something else if you actually need to is minimal. I improvised it a few weeks ago when I realized that doing background jobs wasn't something I should be doing on cloud run (it gets throttled). I added an endpoint that processed a data import in the background and that just wouldn't work in cloudrun. So, I wrote a script that runs the same container on a vm and then shuts it down. Took me about 10 minutes to write and it zipped through the import in a few minutes. For a proper setup, you'd want to use terraform or similar to provision the vms but that's not particularly challenging. Basically you point your provisioned infrastructure at your docker container and it will run it.

Very few businesses will ever see a quarter million concurrent users doing anything on their services. If you have that challenge, you can afford a few full time devops people to get you whatever infrastructure you need to handle this.

We've been running on cloud run since August. Standout features for me:

- it created a working CI/CD pipeline for me from my github repository with minimal effort and sane defaults. I got the service up and running within 20 minutes of me deciding to give it a try. I was so impressed with this that I decided on the spot to continue using it. That 20 minutes of devops time is technically the largest expense we've had so far on this setup as we mostly stay below the freemium threshold and it's otherwise a zero maintenance thing for us. Merge to master ... code deploys & runs. We've done this hundreds of times in the last months.

- comes with proper logging, monitoring, etc. tooling with absolutely no additional effort. I don't consider running blind an option so this stuff is usually not optional for me.

- we have no cloud run specifics in our github repository beyond the cloud build yml file. There is no vendor lock in. If you need a cheap way to run your docker container; this is it. Infrastructure is a blackbox that you get as a service. That's how infrastructure should be these days.

- once we got in to the test program; web sockets have been great as well. We just launched that feature a few days ago.

- low cost, low hassle, yet ticks all the boxes on the operational front. This is important to me as we don't have 24x7 people on staff and I hate having to deal with outages on a weekend or at night (as the CTO, I'm basically the person that gets to deal with this).

- I've been involved with devops on other projects. It can be a serious time sink. It certainly has sucked up months of my time. Many projects end up having several full time people dealing with that at typically premium consulting rates. Days of tinkering with terraform, chasing stackoverflow posts, reading piles and piles of documentation, etc. It just never ends. That stuff costs magnitudes more than you are likely to spend on hosting in your first year. Even the most expensive fancy AWS setup is a rounding error compared to that. Cloud run on the other hand is dead easy to setup and dirt cheap for small setups. It's great way to defer devops cost; potentially indefinitely.

Re:Building a high-scale chat server on Cloud Run by plesiv on Wednesday March 10, 2021 @03:32AM (#26409126)
Thank you for an informative comment. One question:

> I realized that doing background jobs wasn't something I should be doing on cloud run (it gets throttled)

What do you mean by "it gets throttled". Do you mean that you exceed the CPU/memory limit in a container. Maybe you just have to plan the capacity for the background jobs: connections vs CPU vs memory. We use Cloud Run for background jobs with 0 issues.

Re:Building a high-scale chat server on Cloud Run by jillesvangurp on Wednesday March 10, 2021 @11:29AM (#26412965)
We ran with 0 hosts so in between requests, we had a lot of things failing or getting killed. The pattern of firing up a background thread from a request, returning immediately, and processing in the background simply did not work for us. The same logic worked fine elsewhere so it really was the environment. You can't really use it like a stateful environment.

In some cases we saw no evidence of the job even starting because the whole thing died right after the request returned. In other cases it would start but never finish. The actual import jobs weren't that big even. It was just super flaky.

The whole problem went away as soon as we gave it a dedicated vm. All I did was run the same container and then trigger the same request via a curl command sshed into the vm. Ugly but it got the job done.

Re:Building a high-scale chat server on Cloud Run by 0xy on Tuesday March 09, 2021 @09:12PM (#26406965)
If it takes off and you're supporting millions of customers, a $60k infra bill is an amazing problem to have.

"Oh no, we're too popular!". Who says this?

Re:Building a high-scale chat server on Cloud Run by etxm on Wednesday March 10, 2021 @12:06AM (#26407988)
We had a logging service that cost us 30k / mo.

$60/k for your breadwinner seems like a deal.

Re:Building a high-scale chat server on Cloud Run by layoric on Wednesday March 10, 2021 @03:11AM (#26408991)
I personally see the flip side, the original logging service at 30k/mo is totally wild. How much data was being logged/searched if you don't mind me asking?
Re:Building a high-scale chat server on Cloud Run by etxm on Wednesday March 10, 2021 @09:56AM (#26411826)
About 300-600GB / hr. Data retention was based on a few different rules but could be stored for up to a month.

30k was ingress and ETL, that amount didn’t include storage. Not sure what storage costs were off-hand.

Re:Building a high-scale chat server on Cloud Run by layoric on Wednesday March 10, 2021 @05:04PM (#26416940)
Thanks for sharing, that's a lot of logs but another good example of how linear scaling costs hurts. A lot cheaper than standard AWS CloudWatch which reckons it would be $200k+ a month.. but though 600GB an hr is not an easy problem to solve but that is a hell of a premium on both.
Re:Building a high-scale chat server on Cloud Run by asdfsfkwqe on Tuesday March 09, 2021 @08:49PM (#26406831)
If you can constantly have 250k concurrent users. I don't think money would be an issue at that time.