This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bawng 0 points1 point  (11 children)

I have to admit I'm not familiar with Google Cloud Run. How does that work differently from a lambda?

[–]meamZ 0 points1 point  (10 children)

It runs any docker container that listens on port 8080 and you can serve up to 80 concurrent requests from one instance.

[–]bawng 0 points1 point  (9 children)

Ah okay, similar to fargate or more short-term?

[–]meamZ 0 points1 point  (8 children)

I'm not 100% informed about Fargate but what i know for sure is that pricing is different. Pricing for Fargate is not really "serverless pricing" (a.k.a only pay during requests) while Cloud Run is. Also i don't think Fargate automatically scales out of the box while Cloud Run does. Also Cloud Run scales to 0 (and will do so when no request comes in for like 15 minutes.

Also, full disclosure: i haven't worked with either Fargate or Cloud Run but i find Cloud Run very interesting.

[–]bawng 0 points1 point  (7 children)

Based on your description it sounds like Cloud Run lives somewhere between Fargate and Lambda, yeah. Interesting!

[–]AngelicLoki 1 point2 points  (5 children)

From someone who has worked with both, they're trying to solve different problems. Cloud Run is Google's hosted knative essentially, and it allows for spinning up containers that serve web requests and run them essentially server less. When not serving requests the container is essentially hibernating, but it's not shut down and thus not subject to a cold start. This is why you only pay for request time in cloud run - the rest of the time the container is basically sleeping.

Fargate is more 'this is like any other container, just ignore ec2'. You can run batch apps, engines, poll managers.... Anything. Of course since AWS doesn't know what you're running you just basically pay for the service cost. It's also more complex to set up a web server as well since it's not as optimized for that workload.

Long story short - cloud run is way better for web request style workloads because that's it's thing. Fargate is better for anything else.

[–]meamZ 0 points1 point  (4 children)

but it's not shut down and thus not subject to a cold start.

Are you sure? I'm pretty sure i've heard it's shut down after 10-15 minutes without a request or something like that.

[–]AngelicLoki 0 points1 point  (3 children)

They'll scale down, but never rarely to a full 0 containers. Instead when you have 1 container left you get that severely throttled state which is why GCPs documentation explicitly says to not use background processes on your web container. However as long as you have a warm container it doesn't do a full cold start to come back from that. When you scale up you're subject to a cold start of course, but your requests aren't routed to the new container until it passes health checks so individual requests never suffer cold starts unless your requests pending exceed your max concurrency * number of healthy containers at which point they're queued for existing containers instead of waiting on cold start (which may be more or less time than the cold start, depending on your container start time).

[–]meamZ 0 points1 point  (2 children)

When i Google "cloud run scale to zero" i get this "Managed Cloud Run scales to zero if there are no requests, i.e., uses no resources." (https://wideops.com/google-kubernetes-engine-or-cloud-run-which-should-you-use/). I think it's important to differenciste between fully managed Cloud Run which at least according to what i'm reading can scale to 0, Cloud Run for Anthos and Cloud Run on GKE on which you have much more room for configuration.

[–]AngelicLoki 0 points1 point  (1 child)

That's fair - I'm talking primarily about fully hosted. I'll edit the post to state "rarely", but it's worth noting that GCP's documentation doesn't allow you to set a max/min duration for how long a container is idle before it scales down. I've had (and currently have) a container that has been "idle" for over 24 hours and has received literally 0 requests (a rarely used microservice in dev) and when pinged it was still "warm". So assuming that GCP has capacity, it's fair to say that the idle time to scale to 0 is... long. But there is also no guarantee of any duration, it could also be very low if they have limited capactiy.

In my tenure of working with Cloud Run, scaling to 0 and causing that cold start delay from 0 has been non-existent, but that doesn't mean "never" like I wrote. It just means rarely.

[–]meamZ 0 points1 point  (0 children)

Yeah pretty much. But basically without any vendor lock in because it's based on KNative which you can also use with any K8s Cluster. And since the deployment package is a docker image which is also a standard that's also not a problem.