I got an error when deploying after change cpu setting of cloud run(with cloud functions 2nd gen) to unthrottled,
Since Cloud Functions Gen 2 are powered by Cloud Run, they appear as Cloud Run services. For a Cloud Run service to have always on CPU (unthrottled), it needs to have allocated at least 1 CPU and 512MiB of memory.
I tested deploying a Gen 2 function and by default it had allocated less than the required resources for unthrottled CPU. I then updated the function with enough resources to enable it:
gcloud beta run services update <FUNCTION_NAME> --region <REGION> --cpu 1 --memory=512Mi --no-cpu-throttling
Here is the command reference for the full set of flags.
Thank you for reply.
The reason I asked was I got the error when redeploying cloud functions after update cpu unthrottled option on cloud run service.
I already know how to change cpu option after deploy once. 😞
Can you explain more about the use case of your function? Do you need unthrottled CPU usage for a specific resource intensive task? In that case, a GCE instance could be more appropriate for you.
Otherwise, you can submit a feature request to incorporate these command options to Cloud Functions Gen 2, which is worth mentioning are in preview phase, and might not be feature-complete as of this time.