Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Cloud Run adds min instances feature for latency-sensitive apps (cloud.google.com)
90 points by anirudhmurali on Dec 11, 2020 | hide | past | favorite | 62 comments


Yesssss. Right now I have a cron that hits my app every minute to keep it warm. However even with that I see cold starts every now and then. This removed that problem.

It’s so surprising that AWS and Azure don’t have an equivalent to GCP cloud run.

Being able to run a container on demand with a custom image with whatever language and dependencies you want is amazing.

I’ve spun up browsers for snapshotting and seeing a page like a real browser. Cloud run scale from 0 is absolutely magical.

This is what serverless ought to be. Cloud run + firestore makes it possible to build pretty scalable apps with little effort and pretty cheap to run.


Yeah this setup is the biggest advantage I see to the cloud vs self hosted - the possibility of far more efficient resource usage due to things like cloud run, lambda, etc.

I dream of a day when the underlying “cloud” is completely commoditized and interoperable, and your code will run wherever is cheapest, and the cost actually becomes less than self hosting.


Agree with most points made. Though interested to know where's your cron running? - is it one of your self-hosted servers or are you using some service for it like freshping.io?


Use google cloud scheduler for the cron. It’s the most expensive part of my stack at 15c/month.


AWS added container support to Lambda recently.


It’s not the same as cloud run though. Cloud run just needs a thing listening on $PORT environment variable. That’s the only interface needed to the container. The rest is totally agnostic to knowing that it’s inside cloud run.


Ah I see. So there's no need to write an interface that accepts the event object? It's all HTTP on Google Cloud Run?

Do you have to gracefully shutdown the container or does Google just kill the container once it gets a response?


So if there's something always running .... isn't the same as having on always on server (with auto scaling of some sort)?


When a container is kept warm via " min-instances" but is not receiving requests ("idle"), its CPU costs 10x less than when it's actively processing requests, see pricing: https://cloud.google.com/run/pricing


I don't see the pricing for idle billable time disclosed on that site, only an indication that there is pricing. Am I missing it, or alternatively, could it be clarified?


Interesting, if an idle CPU costs 10x less, it ends up costing the same as 1 GB of memory, which amounts to about US$ 6/month each (Tier 1 pricing).

For an app with low usage, you start getting a price that can compete with Heroku.


How is this cost saving achieved? At the risk of being reductive, surely the container is either in memory and ready to serve requests or it isn't?


You still pay for RAM, just not CPU.


It seems they want to replace their managed AppEngine service through Cloud Run in the long run.


Cloud run is developed by the same team that built AppEngine. They share the same technical leadership and a lot of the technical stacks, for example, billing and security (gVisor).

I dont think it's that simple to replace one service with another. It requires a lot of very sensitive dealing with external customers. And one cannot (easily) use the typical "Google deprecation" on a Cloud service offering, either.

So it's complicated. But your impression is not too far from the inclination.


I’d imagine google would at-least make both appEngine run on the same core primitives that cloud run uses. So while the public facing api is the same, the internals are replaced. At-least that’s how I’d approach it. Deprecate app-engine in that it will be infinitely supported until the last customer, but all new stuff is advocated to be used on cloud run.


This definitely appears to be their trajectory.

One would assume transition from AppEngine to Cloud Run would be directed by establishing a pricing differential that incentivises moving off AppEngine.


Yes but still marginally easier to get it up and running


My god, we are reinventing FastCGI again.


Cloud run can execute multiple requests against the same container at the same time.

With the FaatCGI paradigm, you have to spin up separate process per simultaneous request.


That's how CGI works, but FastCGI has no such restriction, at least not inherently.

Web server implementations may vary, but Apache at least allows sending many concurrent requests to a single FastCGI backend process: http://httpd.apache.org/docs/trunk/mod/mod_proxy_fcgi.html


``` package main

import ( "fmt" "log" "net/http" )

func init() { setupDBConnection(dbName) }

func handler(w http.ResponseWriter, r *http.Request) {

    fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}

func main() { fmt.Println("Processing your serverless request") http.HandleFunc("/", handler) log.Fatal(http.ListenAndServe(":8080", nil)) }

```

This code snippet is an example of "Run bootstrapping logic once, and reuse it across Min Instances".

Assuming the boostrapping logic refers to the `init()` function that connects to DB. Does Cloud Run looks for init() in a Golang app to invoke?

I cannot seem follow the code's logic and its connection with the stated purpose.

Did I miss anything?



I wonder how this compares to Cloudflare Workers Unbound https://blog.cloudflare.com/introducing-workers-unbound/


Cloudflare workers both bundled and unbound run on v8 isolates. While they’re performant you can only use JavaScript. Js that works with cloudflare’s v8 version.

With google cloud run it’s effectively running your container. You can use whatever language you want, whatever apt dependencies you need, whatever Linux flavor (ubuntu/alpine/busybox) e.t.c

In that sense cloud run is the more generic serverless platform. The devs can indeed say “it works on my machine, so let’s ship my machine and scale it up as needed and hibernate when not in use”


Create a problem -> Create a solution -> That create a problem -> Create a solution -> That creates a problem -> create a ...

The big quesation is how derived we can be of actual value creation before wheels stop spinning...


Just curious but not enough to read the documentation, is there a max setting or can I easily bankrupt my competitors with Apache bench running on a raspberry pi?


There's both a max number of containers setting and a max concurrency limit per container setting.

FWIW, I do wish Google added some way to more explicitly prevent abuse with the containers. I had to take down my Cloud Run containers because people found ways to automate access to my services without rate limits, and Google's solution to that was to use a proxy which sorta defeats the point of using Cloud Run.


Apigee is just such a heavy-weight thing. It feels like API Gateway plus Lambda w/ Containers will provide what you want, though, serverless and easy to set up. You can rate-limit per "usage plan" etc.


Since each instance can handle multiple requests, it might be hard to bankrupt someone with a low-powered box.

There's also a standard quota limit for replicas: 1,000 per Service.

https://cloud.google.com/run/quotas


This is a response to this AWS Lambda launch, over a year later: https://aws.amazon.com/blogs/compute/new-for-aws-lambda-pred...


Cloud Run is for containers, not functions, and it's the next evolution of App Engine.

The GCP equivalent to Lambda is Cloud Functions.


Did Cloud Functions launch the equivalent to Lambda launch yet?


No, but would love to see it.


Compared to AWS, the big thing cloud run and cloud functions are missing is per millisecond billing. Per 100ms billing is too wide grained. AWS lambda has per ms billing and it makes a big difference if your using a perf optimized language like golang or rust.


Does this apply to Firebase functions as well?


Firebase functions is essentially same as google cloud functions. In my personal experience cloud run starts up much faster compared to cloud functions even on a cold start. The min instances feature makes it even faster.


Unfortunately not.


AppEngine has had scale-to-zero for 15 years, but instead of having a coherent product strategy, why not just launch a different competing product every year which is missing features that already exist? AppEngine vs Cloud Functions vs Cloud Run, the reasons these all exist at the same time is not because it makes any sense for customers, but because Google PMs get promoted for launching new things rather than supporting existing products.


I disagree. App Engine is nothing like Cloud Functions/Run. The former is a better fit for your entire app stack (think Heroku) while the latter is for ad-hoc.

As for Cloud Functions and Cloud Run, the way you deploy is completely different. Cloud Run is strictly meant for containers.


I don't think the 3 products are serving as diverse a set of use cases as you think...

> The former is a better fit for your entire app stack (think Heroku) while the latter is for ad-hoc.

There's no product reason why App Engine couldn't start deploying custom containers.

> As for Cloud Functions and Cloud Run, the way you deploy is completely different. Cloud Run is strictly meant for containers.

AWS Lambda (arguably the "inspiration" for Cloud Functions) just announced support for custom containers. Cloud Functions could too. And then you essentially have Cloud Run.


> There's no product reason why App Engine couldn't start deploying custom containers.

There better not be because it already does: https://cloud.google.com/appengine/docs/flexible/custom-runt...


> App Engine is nothing like Cloud Functions/Run.

This isn't true. App Engine Flexible is in fact very similar to Cloud Run, and my understanding is that it runs on the same infrastructure. In fact, App Engine Flexible "Custom Runtime", which lets you load a docker container in App Engine, is very similar to Cloud Run.

FWIW, though, as a user of App Engine Flexible for Node, I'm very glad this Cloud Run option now exists.


I've switched newer projects from app engine flexible to cloud run. I do think the underlying infrastructure is slightly different but for the better. If I remember correctly, app engine was using VMs vs pure containers. Deploys to app engine took me 10 min start to finish, but cloud run is around 3.

I used to use a combination of app engine standard and flexible depending on requirements, but I feel like cloud run gives me the benefits of both.


I would be interested in something like AWS Lambda@Edge or Cloud Workers from Google. Love to run a simple script close the visitor's location e.g. from Belgium DC instead of US DC etc


That would be nice although Google CDN even without any compute is pretty slow compared to cloudflare.

Google has many data centers around the world. I don’t see why they can have cloud run automatically select the data center closest to the user and spin up the container there. That would deffo solve a lot of problems.


Actually, App Engine is a LOT like Cloud Functions/Run. You have some code that you want to run in the Cloud and you don't want to worry about server ops.

Whether that's your "whole stack" or something "ad-hoc" is a totally arbitrary distinction. Your "whole stack" will almost certainly involve external concerns, and your "ad-hoc" concerns will almost certainly grow in complexity until they converge on the same spot.

AppEngine is also running containers via gvisor.

The distinction is being driven by PMs and marketers but not by the needs of customers. What end-users need is one well-supported tool, not 8 separate tools with uncertainty about which one will receive future support and matrices and flowcharts to decide between them.


> The distinction is being driven by PMs and marketers but not by the needs of customers.

This is not true. It came directly from customer needs -- customers were looking for an effortless way to run containers without having to deal with orchestrators like k8s or be locked into frameworks like AppEngine.

I've used Cloud Run for a bunch of projects, and it's fantastic.


Worse than that. Its AppEngine Standard vs AppEngine Flex vs Cloud Functions vs Cloud Run vs KNative (Cloud Run, but different).

Oh and if you used AppEngine Standard, you can't move to Flex as Flex came with a whole new set of libraries. And Flex to CloudRun didn't exactly have a seamless migration.

Along the way they changed multiple internals with deprecation causing code base changes. Such-as Memecache, ImageAPI, Monitoring price changes.

I can't imagine any enterprise who's used the ecosystem continuing. The sheer number of architecture impacting changes leads to huge operational overhead costs to maintain applications running on this infrastructure.


Everything above. Friends don't let friends use App Engine, and by extension, fringe GCloud services they could break or shitcan at literally any moment

The technology of a vendor is way less important than its culture. So far Gcloud seems to understand that. Maybe the App Engine team is outside that org


> Everything above. Friends don't let friends use App Engine, and by extension, fringe GCloud services they could break or shitcan at literally any moment

Not sure why you think they can shitcan them at literally any moment. Although GCP's track record of deprecation is of course far worse than AWS's, they do make and adhere to promises in their terms of service that, in most cases, they will give at least 12 months before deprecating services which have reached general availability. This includes both App Engine and Cloud Run, minus any features that have not yet reached general availability and minus one very fair documented exception for App Engine.

Details:

https://cloud.google.com/terms/deprecation

https://cloud.google.com/terms <-- search for "Discontinuation of Services"

Disclosure: I used to work for Google, including the GCP team, but I haven't worked for Google in over 5 years and am not speaking for Google here.


That’s false. The policy only covers services being turned down. A-la Google reader style. Not api changes. Not forced sdk/software upgrades. Or pricing changes.


It does cover backwards incompatible API changes - read the second link I provided:

>Further, Google will notify Customer at least 12 months before significantly modifying a Customer-facing Google API in a backwards-incompatible manner.

What are you referring to with forced sdk/software changes? Maybe it's the same exception I mentioned for App Engine when a previously supported language runtime goes out of support by the upstream language community?

As for the famous Google App Engine price hike everyone likes to point to, the lower price was only at a pre-general availability launch stage.

You're right that they don't make any specific guarantees that they won't hike prices on short notice, but within the scope of Google Cloud Platform features that have already reached general availability, when have they done that?


As it happens, Cloud Run is App Engine under the hood. It's a Knative-compatible skin.

Cloud Run for Anthos is a different product, which is the OSS Knative code running on GKE.


Wondering where this magic lives in the stack. Is this possible in Knative? Just elaborate ctl-Z?



Does this open the door to having websockets on cloud run?


No cloud run is only for http requests only. Not even push. You want to use this for short lived requests. Web sockets need more persistent connections.

Although may be there is a way I don’t know.


It was a limitation before but maybe not soon (they would have already mentioned it).

Knative in your own cluster supports it but I want scale to zero instead of paying for a cluster.

They say that it supports sockets but not bi-directional. You can't send messages back up the socket which we're using for GQL mutations


This is probably not a response to the other story this week about a start-up that got a $70k bill from Google cloud erroneously:

https://news.ycombinator.com/item?id=25372336


This feature doesn't cap your costs. It's to reduce/eliminate cold start times for your containers.


How would a min amount of cloud run processes be a response to a billing issue born from a series of unfortunate events?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: