Reputation: 141
I am using firebase hosting and functions together to convert PDF TO IMAGE.
For that i wrote a function which takes the file and converts the pdf upload it storage, generates a signedURL and returns it to the user.
In hosting i wrote a rewrite which redirects request from /ecc to ecc function.
Setup worked Well. Website is up and running.
But when i asked a small group of 100 people to use it.
Then firebase functions started throwing err 429 which is too many requests.
Is there any limit on executing functions in 100 Seconds ?
This is the log:
Error: quota exceeded (Quota exceeded for quota group 'CPUMilliSecondsNonbillable' and limit 'CPU allocation in function invocations per 100 seconds' of service 'cloudfunctions.googleapis.com' for consumer 'project_number:992192007775'.); to increase quotas, enable billing in your project at https://console.cloud.google.com/billing?project=myProject. Function cannot be executed. {"serviceContext":{"service":"ecc"},"context":{"reportLocation":{"functionName":"ecc","lineNumber":0,"filePath":"file"}}}
And in Firebase pricing it says that 125K invocation per month is free but with 40K GB and CPU seconds.
So if i have a function with execution time of 10 seconds i can call only 4000 functions per month ? and with that 16 calls per 100 seconds Limit. where are other 121K function?
Updated Information from Quotas
It's really a head banging thing to understand the limits here this is the main quota page
FUNCTION EXECUTION TIME IS 10 SECOND. AND I'LL CALCULATE THINGS ON THAT.
1,2. CPU allocation in function Invocation PerDay
: 150K
.
first two are same for some reason.
3. CPU allocation in function invocation per 100 seconds
: 100k(0.1% CurrentUsage)
.
means per 100 second i can "invoke" 10k function.
4. Function invocation per 100 seconds
:50
. Okay Leave The 3rd Point aside.
5. Read Request Per Day
: 50
Maybe same as 4th ?
6. Function invocation per day
: 5000
I was having a dream until 4th point opened my eyes.
7. Write request per day
: 1000
Function deployment maybe ?
8. Write request per 100 seconds
: 20
That's Okay.
Now with all that in mind i can say i can execute 50 functions per 100 seconds.
What my error was QUOTA EXCEEDED 'CPU allocation in function invocations per 100 seconds'
but as per the QUOTA the CPU ALLOC IN FUN INV PER 100 SECOND is 100K !!! ??
How it even exceeded the limit ?
as i said my function execution is about 5-10 seconds and with the invocation limit, maximum seconds would be 500.
What is going on ?, Why QUOTA is exceeding ?
what's the difference beetwen Read
and Invoking
a function ?
Upvotes: 1
Views: 2261
Reputation: 2477
From the error it seems that you have exceeded the quota for Firebase Functions (CPU) per month and as you are using free tier then it's only 40K per month.
Using Firebase Functions in Free tier (Spark) is very limited and it's only for Node 8.
To resolve this you need to upgrade to Blaze plan (pay as you go). which also has free tier:
CPU --> Free up to 200K/month
Please, read more about this here
Upvotes: 1