Firebase functions getting slow over time

152 views
Skip to first unread message

Arneesh Aima

unread,
Apr 27, 2021, 8:35:02 AM4/27/21
to Firebase Google Group
My firebase function has been getting slower over time, if suppose a function was taking 2 min to process 500 items, now it is talking like 6-7 minutes to process the same number of items. This functions is being used continuously, so I wanted to confirm is it something similar to a server where garbage gets collected overtime it things aren't cleared properly, on a server we can just SSH inside and clear stuff, but what is the best possible way to do this on a  firebase function, also if there is some other reason for my functions getting slow over time? The first thing that came to my mind was memory leak but could be some other reasons, also what is the best possible way to remedy this? Any suggestion would be appreciated.

Kato Richardson

unread,
Apr 27, 2021, 11:41:11 AM4/27/21
to Firebase Google Group
Arneesh,

This is much more likely to be related to the amount of data being loaded from your database and related performance characteristics than any Functions infrastructure. We couldn't operate at the scale of Google if we didn't garbage collect and clean up unused resources effectively.

☼, Kato

On Tue, Apr 27, 2021 at 5:34 AM Arneesh Aima <arnee...@gmail.com> wrote:
My firebase function has been getting slower over time, if suppose a function was taking 2 min to process 500 items, now it is talking like 6-7 minutes to process the same number of items. This functions is being used continuously, so I wanted to confirm is it something similar to a server where garbage gets collected overtime it things aren't cleared properly, on a server we can just SSH inside and clear stuff, but what is the best possible way to do this on a  firebase function, also if there is some other reason for my functions getting slow over time? The first thing that came to my mind was memory leak but could be some other reasons, also what is the best possible way to remedy this? Any suggestion would be appreciated.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4b960846-30ad-4bcc-9530-38eec4d1964bn%40googlegroups.com.


--

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

Arneesh Aima

unread,
Apr 28, 2021, 5:54:17 AM4/28/21
to Firebase Google Group
Kato

But the function hasn't changed for months. If a function reads suppose 1000 items from a database and takes 2 minutes to process them, if it hasn't been changed then why would it take 4 minutes to process 1000 items after a few months? Because the function is exactly the same, it is reading from the same database. If the function is working properly then it might be scalability issue on the side of Firestore, which should be managed and scaled automatically under my subscription plan. Similar thing happened last year when I raised an issue regarding the stack trace of firebase functions logs, I was told that it couldn't happen and I should check my implementation for any bugs but after a few days https://issuetracker.google.com/issues/155215191 was registered on the bug tracker and was fixed after a few months. I just want to know if there r some other factors that could be causing this and like I explained above, the function is same, number of items being read is same and database is the same then why would it start taking more time to execute the same operation after a few months.

Kato Richardson

unread,
Apr 28, 2021, 11:12:25 AM4/28/21
to Firebase Google Group
The likely outcome is that the amount of data being read has increased over time. If you can show some minimal code and logs that demonstrate otherwise, recommend filing a bug against support so we can investigate.

One interesting way to isolate this would be to run the code that normally executes in the function in a different environment and see if it achieves similar results. Assuming that rules out a data scale issue, then the next thing to rule out would be any setup code the Function executes during initialization, and finally checking to ensure that the most recent versions of the libs are included to rule out any known/resolved issues with the SDKs.

☼, Kato

Reply all
Reply to author
Forward
0 new messages