benefits of cloud run over function gen2

what is the difference in function gen2 and cloud run. function gen2 is also using cloud run background .

both have 60 min timeout.

so what are the additional benefit that cloud run is providing .

which one will be more costly if we use 10 times each month for 60 min each .using 4 cpu. just rough estimate

Hi @gcloudLearning ,

Both are complimentary since Cloud Function 2nd Gen is built on Cloud Run and shares resource quotas and limits with Cloud Run.

See from this blog,

The second generation of Cloud Functions is built on the enhanced infrastructure of Cloud Run, the decision of which product to use doesn’t need to be a cause for analysis-paralysis. You can be immediately productive by writing simple code and deploying it quickly to Cloud Functions, and evolving it into a more complex web service later, by migrating it to Cloud Run, whose extra control is very easy to unlock.

Choosing between the two depends on the app that you want to build. You can check this video.

Cloud Run handles the instantiation of instances (scaling) of the user’s container, seamlessly based on parameters specified by the user. It also supports the deployment of source code (rather than containers) through client-side (gcloud, Pantheon) experiences which integrates with Cloud Build.

For more information in Cloud Run, you may refer to this link.

In Cloud Run you can use any programming languages if you can build a container image from it however in Cloud Functions you can only use a number of supported programming languages.

To learn more about Cloud Function and the comparison between the 2 versions, you can go to this documentation.

You can use the Google Cloud Pricing Calculator to calculate and compare cost.
According to Cloud Run pricing impact,

If you choose the CPU to be allocated only during request processing, you are charged per request and only when the instance processes a request. If you choose the CPU always allocated setting, you are charged for the entire lifecycle of the instance. See the Cloud Run pricing tables for details.> Google’s Recommender automatically looks at traffic received by your Cloud Run service over the past month, and will recommend switching from CPU allocated during requests to CPU always allocated, if this is cheaper>

Hope this helps.

2 Likes

@anjelisa If I may help, the calculator link URL seems to be broken.

I also have a similar question, no Idea if I should post as another thread, but here goes. If cloud functions gen1 fulfills my needs. would a migration to gen2 be of any benefit? from a cost perspective. Thanks

1 Like