Search code examples
node.jsfirebasefunctiongoogle-cloud-functionslimit

Firebase Cloud function: how many users can the same function (onCall) serve? With how many resources can it serve them?


Hy everyone. I have only one "onCall" firebase function but it is called many times by all users. Every single function can be called 3000 times per second as the documentation says. Since mine needs 5 seconds then would I have 600 calls per second available?

Since my function manipulates images and needs to store them in the tmp folder of the server (or virtual machine). I happened to get an error message telling me that I have exceeded the allowable memory for the function. I fixed the function trying to take up less memory and now it works. My question is this: assuming the memory available for the function is X, and the call requires X / 2 memory, does that mean I can only have two simultaneous function calls (so as not to run out of X memory)?

Also, I'm not sure how much this X is. Thanks in advance.


Solution

  • Cloud Functions auto-scale up and down to meet the load.

    On Cloud Functions only a single instance of your function will ever run in parallel on a single container. So that indeed means your code has the full resources of that container each time it runs.