1
votes

so up until mid 2018 there have been complaints about performance issues with Firebase Cloud Functions and Google CFs (which are the same under the hood I believe). Like these ones:

https://github.com/googleapis/google-cloud-node/issues/2374

https://github.com/firebase/firebase-functions/issues/161

I remember seeing that a simple Hello World example had a response time of 500ms - 800ms. EDIT: I know about cold starts, but as described in the GitHub issues cold starts were not the main problem. A Firebase Cloud Functions would randomly take up to 10s to respond which looked like a problem within Firebase.

I am currently considering building a project with Firebase and would like to build a REST API with Firebase cloud functions - but bad performance would be a deal breaker.

What's the current status? Do these problems still occur?
None of these GitHub issues were properly answered by Google, but also no more users have complained ever since …

2
If the slowness appears randomly, that does sound like a cold start to me, since it's not possible to predict when a new server instance will be allocated. - Doug Stevenson
While I think this is a good question I am not sure it's a good question for SO. It's really related to server performance and not really related to a specific coding issue - which is what SO is for - so there's nothing we can post code-wise to 'correct' the issue. It's also a bit open ended since I have not experienced any kind of significant performance issues in general with Firebase products - Cloud Functions or other. I would suggest crafting a specific use case, test it, and then if you are seeing performance issues work with Firebase support as they are the ones that can correct it. - Jay

2 Answers

1
votes

Cold start times are a fact of life for serverless backends such as Cloud Functions. It's due to the way server instances are automatically scaled up and down to handle load in a cost-effective way. You can always expect that the first request to a new server instance will take some amount of time longer than the subsequent requests that get directed to that same server instance. That amount of time will be variable depending on a number of factors, including the type of trigger, and what all needs to happen with the first request.

If you want to learn more about Cloud Functions scale, what you can expect as a result, and what you can do to mitigate cold starts, watch my video series on the matter.

0
votes

Cloud Functions for Firebase are Google cloud Functions with a wrapper to allow them to integrate better with other Firebase products. Therefor it is expected a small loss of performance.

The important part to decide which one to use is more to what are you integrating the most. If your project is running in Firebase, uses firebase authentication etc then Cloud Functions for Firebase is the best choice.

On the other hand if you are using Google Cloud Platform Products then Google Cloud Funtions is the best choice.