Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit instance count of firebase functions

I use following firebase cli command to deploy my firebase functions

firebase deploy --only functions

How can I limit the number of instances for functions, when deployed like this? It looks like gcloud command has --max-instances option to limit instances, but couldn't find anything like this for firebase cli.

like image 978
Lahiru Chandima Avatar asked Nov 18 '20 05:11

Lahiru Chandima


People also ask

How to increase Firebase limit?

To increase quotas above the defaults listed here, go to the Cloud Functions Quotas Page, select the quota(s) you want to modify, click EDIT QUOTAS, supply your user information if prompted, and enter the new quota limit for each quota you selected. These affect the total amount of resources your functions can consume.

How to increase sms quota in Firebase?

if daily sms are exceeding limit go to : firebase console > open settings > open usage and billing check your daily limit.

How does Cloud functions scale?

Cloud Functions scales by creating new instances of your function. Each of these instances can handle only one request at a time, so large spikes in request volume might result in creating many instances.

How many requests can handle a single cloud function?

Cloud Run has the capability to handle up to 80 concurrent requests with the same instance. At the opposite, Cloud Functions create as many instances as the concurrent requests.


Video Answer


1 Answers

You can set the maxInstances when you write the function, using runWith and passing in RuntimeOptions

Something like this:

 functions
.runWith({maxInstances: 3})
.https.onCall(() => {});
like image 142
nathan Avatar answered Sep 24 '22 19:09

nathan