Firebase Realtime Database is so slow

1,190 views
Skip to first unread message

Marcin Kasprzykowski

unread,
Apr 22, 2020, 8:32:00 AM4/22/20
to Firebase Google Group
Hi All,

I tried my luck with Firebase Realtime Database. I created 2D project from scratch, copied google-services.json into Assets directory and imported package 'FirebaseDatabase.unitypackage'. Unity took a long time to configure all dependencies but it finally got that done. However since then my project starts very slowly (~20sec). Once it starts, it also lags a bit in 5-10 initial seconds.

Apart from Firebase my project contains nothing more than an initial 2D template. Did you also encounter such scenario? Do you know what could help with that poor performance?

Thank you in advance for any help

Patrick Martin

unread,
Apr 22, 2020, 3:52:02 PM4/22/20
to Firebase Google Group
Hi Marcin!

Part of your issue sounds related to this, which unfortunately is still an open bug. If you have anything to add there, the team would love more input! Part of the trouble is that there's been some difficulty reproducing it, so any information about your setup would be super helpful. If you don't mind filling out these fields that I've copy/paste'ed from the GitHub issue template, it helps formalize everything:
### Please fill in the following fields:
Unity editor version: 
Firebase Unity SDK version: 
Source you installed the SDK (.unitypackage or Unity Package Manager):
Firebase plugins in use (Auth, Database, etc.):
Additional SDKs you are using (Facebook, AdMob, etc.): 
Platform you are using the Unity editor on (Mac, Windows, or Linux): 
Platform you are targeting (iOS, Android, and/or desktop): 
Scripting Runtime (Mono, and/or IL2CPP):
### Please describe the issue here:
(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)
### Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
What's the issue repro rate? (eg 100%, 1/5 etc)

So I have tried to repro your issue, and have found that just counting in my head a difference of ~3 to ~5 seconds from pressing play to being active between an empty project and one with just RTDB installed. The profiler seemed to indicate that a good amount of time was in loading assemblies, so perhaps just the size of the Firebase code accounts for that. I'm assuming that I'm seeing something completely different than you are.

I would be curious about a couple of other things. Could you post any editor logs you might have, especially with verbose logging enabled (under Assets/External Dependency Manager/Android Resolver):

Screen Shot 2020-04-22 at 1.42.58 PM.png


Also, is there anything interesting about your Assets/ directory? As in not using meta files, parts of Assets/ being readonly, multiple google-services.json files, &c? Do you see the dependency resolution window every run, or is it just the first time?

Screen Shot 2020-04-22 at 1.40.08 PM.png

I'd also be curious if you see different behaviour between normal resolution and gradle integration:
make sure this is checked:
Screen Shot 2020-04-22 at 1.35.37 PM.png


And click this button in your Build Settings:
Screen Shot 2020-04-22 at 1.47.42 PM.png

My reasoning is that by default, native dependencies are dumped into Assets/Plugins/Android/. Maybe by enabling gradle integration, which means that the normal Android build process will handle dependency resolution, Unity won't try to process Android libraries.

So:
  1. Really sorry this is happening, hopefully the team can find the source of your issues
  2. Any information about your setup is helpful, especially those in the issue template I posted
  3. Editor logs in verbose mode would be super helpful
  4. Weird hunch that probably won't lead anywhere: can you try enabling gradle resolution if you haven't already
Thanks for reaching out!
--Patrick

Marcin Kasprzykowski

unread,
Apr 23, 2020, 12:31:51 PM4/23/20
to Firebase Google Group
Hi Patrick!

Thanks a lot for your interest. Actually I already abandoned SDK approach in favor of REST API which works like a charm. But nevertheless let's give this issue a try!

My answers:

### Please fill in the following fields:
Unity editor version: 2019.3.6f1
Firebase Unity SDK version: 6.13.0

Source you installed the SDK (.unitypackage or Unity Package Manager):
Firebase plugins in use (Auth, Database, etc.): Realtime database
Additional SDKs you are using (Facebook, AdMob, etc.): nothing more. It also occurs on fresh 2D template that contains nothing else (with 100% repro)
Platform you are using the Unity editor on (Mac, Windows, or Linux): Win 8.1 Ent
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): .net 4.6

### Please describe the issue here:
I created 2D project from scratch, copied google-services.json into Assets directory and imported package 'FirebaseDatabase.unitypackage'. Unity took a long time to configure all dependencies but it finally got that done. However since then my project starts very slowly (~10sec). Once it starts, it also lags a bit in 5-10 initial seconds once the scene is shown.

### Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? yes
What's the issue repro rate? (eg 100%, 1/5 etc) its 100%

My worse than yours lag times could partially be accounted to quite old machine I am using:
Intel Core i5-2400 @3.10GHz, 8GB RAM, ancient SSD.
Today it looks better though (<10s). However after lagging on Play, it still lags again once the scene is shown. 

I attached my verbose log.

My assets are empty except for SDK (screen attached).


I appreciate your good will, take care!
Marcin
Editor.log
Reply all
Reply to author
Forward
0 new messages