Performance of Cloud Functions for Firebase

783 views
Skip to first unread message

sund...@gmail.com

unread,
Mar 30, 2017, 9:30:53 AM3/30/17
to Firebase Google Group
Hi everyone!

I'm interested in evaluating the performance of using Cloud Functions for Firebase, so I've set up a simple function with basically the same code as this example from Firebase. What the function does is that is simply listens for new messages at a certain node in Firebase, and then sends a push notification to the receiver of that message.


Next, I wrote a script that bombards the messages node by adding x new children there every second. I found out that the function seems to be able to handle up to about 40 new messages per second, anything more than that and the notifications start to lag more and more behind. This seems like pretty poor performance – too poor for us to use in production – and I wonder what the bottleneck might be here. Of course, Functions are still in beta, but according to the documentation, each function should be able to run 400 concurrent invocations.


Did anyone else here encounter performance problems with Cloud Functions for Firebase (or Firebase in general for that matter). If so, what might the bottlenecks be?

Kato Richardson

unread,
Mar 30, 2017, 10:56:50 AM3/30/17
to Firebase Google Group
Hello,

I think you should definitely be able to handle more than 40 requests, but I don't have any hard numbers to substantiate that. It is a beta product, but I still think it should do more.

It may help to reduce the moving parts there and see if the results change. For example, do you see the same if you do an HTTP based function which returns a simple hello world? Is it specific to listening on the Realtime Database? For example, if you remove FCM from the equation do they still lag? If you add logging, can you isolate the part of the process that takes the most time per op?

Seems like we might be able to narrow the possibilities considerably with some simplification and tinkering.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4754895f-151c-4071-9447-6f0657ebfd19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

shashwat gupta

unread,
Apr 1, 2017, 6:26:10 PM4/1/17
to Firebase Google Group
I tried google functions for image downloading from external link and image processing.sometimes it takes minutes for processing small size images.Whereas setting up on our own server makes it done within few seconds.

Very poor performance on google functions

sund...@gmail.com

unread,
Apr 5, 2017, 10:28:35 AM4/5/17
to Firebase Google Group
Hello Kato and thank you for your answer. Sorry for my slow response, but I have finally had the time to do some more investigating.

When I created a super-simple function, which simply listens for child added events to a node and deletes these children one by one as they appear, I did indeed observe much better performance. This simplified function seems to be able to handle roughly 500 events per second (maybe more), so it is at least 10x faster than the push example. 

I think that we can therefore conclude that the bottleneck is either the actual sending of the push notifications or the lookup times for when the function needs to access other data nodes in Firebase (besides the child that triggered the event). It seems that I have nearly exceeded the data quota allowed by Firebase now, so further testing will have to wait for a while!

Best regards, Gustav


Den torsdag 30 mars 2017 kl. 16:56:50 UTC+2 skrev Kato Richardson:
Hello,

I think you should definitely be able to handle more than 40 requests, but I don't have any hard numbers to substantiate that. It is a beta product, but I still think it should do more.

It may help to reduce the moving parts there and see if the results change. For example, do you see the same if you do an HTTP based function which returns a simple hello world? Is it specific to listening on the Realtime Database? For example, if you remove FCM from the equation do they still lag? If you add logging, can you isolate the part of the process that takes the most time per op?

Seems like we might be able to narrow the possibilities considerably with some simplification and tinkering.

☼, Kato

On Thu, Mar 30, 2017 at 5:11 AM, <sund...@gmail.com> wrote:
Hi everyone!

I'm interested in evaluating the performance of using Cloud Functions for Firebase, so I've set up a simple function with basically the same code as this example from Firebase. What the function does is that is simply listens for new messages at a certain node in Firebase, and then sends a push notification to the receiver of that message.


Next, I wrote a script that bombards the messages node by adding x new children there every second. I found out that the function seems to be able to handle up to about 40 new messages per second, anything more than that and the notifications start to lag more and more behind. This seems like pretty poor performance – too poor for us to use in production – and I wonder what the bottleneck might be here. Of course, Functions are still in beta, but according to the documentation, each function should be able to run 400 concurrent invocations.


Did anyone else here encounter performance problems with Cloud Functions for Firebase (or Firebase in general for that matter). If so, what might the bottlenecks be?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4754895f-151c-4071-9447-6f0657ebfd19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages