Performance running emulators

129 views
Skip to first unread message

Airton LUCIANO Aragão

unread,
Apr 6, 2021, 5:11:08 AM4/6/21
to fireba...@googlegroups.com
Hi.

I tried to use Firebase local emulators with functions running at nodejs and Flutter at Android Studio but it was impracticable because of terrible performance.

Is there any alternative or technique to avoid this? 

Thanks

Sam Stern

unread,
Apr 6, 2021, 5:54:46 AM4/6/21
to Firebase Google Group
Hi Airton,

Can you explain a little more about what the performance problem is?  If your computer is feeling generally sluggish you may want to try using VSCode to develop Flutter apps rather than Android Studio, it's *much* less resource intensive. Another thing you can do is use a real Android device instead of an emulator, which takes some load away from your computer.

Unfortunately I can't offer any performance tips on how to make the emulators perform better, the Functions emulator uses a swarm of lightweight Node processes which can't be slimmed down much further.

- Sam

--
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/CAAU2uKGJWkH0TXbsfBYF%2B3EwR%2B%2BQXH89AOEtcWatByVynXWW0g%40mail.gmail.com.

Airton LUCIANO Aragão

unread,
Apr 6, 2021, 11:51:33 AM4/6/21
to fireba...@googlegroups.com
Hi Sam.

Thanks a lot for guiding me...

I tried with a Smartphone and things appear to be really better. Input data at the real device seems to be normal. At the device emulator  it's terrible.

The problem now is that there is a message about  connect failed with ip 10.0.2.2 8080. I am using the same configuration that I used with the virtual device.

May you help me with this? 

Sam Stern

unread,
Apr 6, 2021, 11:58:38 AM4/6/21
to Firebase Google Group
Ah yes I should have thought of that before, sorry! So "10.0.2.2" is a special IP address you can use in emulators which says 'let me access the localhost of the host computer'.

When running on a real device you need to do a few things:

1 - Make sure the devices are on the same WiFi network
They'll need to be able to talk to each other over the local network

2 - Determine the local IP address of the computer running the emulators
Follow steps like these to get your local IP address

3 - Change the firebase.json file to use the new host when you start the emulators
So let's say your local IP is 192.168.1.7 you can do this in your firebase.json

{
  "emulators": {
    "functions": {
        "host": "192.168.1.7",
        "port": 5001
     }
}

4 - Update your Android code
Finally wherever you're calling useEmulator() make sure to pass "192.168.1.7" (or whatever your real IP is) where you previously passed "10.0.2.2"

- Sam


Airton LUCIANO Aragão

unread,
Apr 6, 2021, 2:09:57 PM4/6/21
to fireba...@googlegroups.com
Hi.

I followed everything but it continues not working. I am a little bit confused about which internal IP to choose. Is it that used at wifi network ?

Please, note at this error message that there is something strange following the "from" word.

cause=java.net.ConnectException: failed to connect to /127.0.1.1 (port 8080) from /:: (port 45605):

Thanks



--
       Airton LUCIANO Aragão

Airton LUCIANO Aragão

unread,
Apr 7, 2021, 12:04:18 AM4/7/21
to fireba...@googlegroups.com
Hi Sam

I used the "real" ip address and everything worked like a charm rsrsrsrs.

Thanks a lot !!!!!! 
--
       Airton LUCIANO Aragão

Sam Stern

unread,
Apr 7, 2021, 4:35:14 AM4/7/21
to Firebase Google Group
That's great news thanks for following up!

- Sam

Reply all
Reply to author
Forward
0 new messages