Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize App Startup by Background Loading of Firebase Remote Config #697

Merged
merged 4 commits into from
Jul 26, 2023

Conversation

nilsreichardt
Copy link
Member

@nilsreichardt nilsreichardt commented Jul 21, 2023

Description

In this pull request, we made significant changes to the way our application fetches and activates the Firebase Remote Config data to improve app start-up times.

Previously, our app fetched Firebase Remote Config data during its start-up sequence. This fetch-and-activate approach was a major contributor to the 11 seconds startup time our app was experiencing.

We have now moved the Firebase Remote Config fetch process to execute in the background after the application has started. This ensures that the app is not blocked waiting for these config values during startup. The fetched config values are activated on the next app launch.

This change has led to a considerable improvement in app startup times. Initial tests show startup times have dropped to just 2 seconds, down from 11 seconds - a more than 5x improvement.

Disadvantages in this strategy

The disadvantage in this strategy is that the values activated on the next launch. When there is a critical change, the user doesn't receive the values immediately. However, since we started Sharezone, 5 years ago, we never had this case. Therefore, I think it's overkill to trade bad app start times against the possibility to update critical values maybe someday.

Benchmarks

 Name  Time
 Before the changes  11 seconds
After the changes  2 seconds

The app start is now 5,5x faster than before when using an EDGE connection.

Demo

(In the benchmarks table, I removed the time I needed to open the emulator and click the "stop" button)

Before

Screen.Recording.2023-07-21.at.12.20.44.mov

After

Screen.Recording.2023-07-21.at.12.24.15.mov

Using the values for the next start

Screen.Recording.2023-07-21.at.12.54.26.mov

Related Tickets

Fixes #696

@docs-page
Copy link

docs-page bot commented Jul 21, 2023

To view this pull requests documentation preview, visit the following URL:

docs.page/sharezoneapp/sharezone-app~697

Documentation is deployed and generated using docs.page.

@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Visit the preview URL for this PR (updated for commit 787a3e0):

https://sharezone-test--pr697-fetch-remote-config-tqkxc9kh.web.app

(expires Wed, 02 Aug 2023 11:14:42 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b

Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, see comments

Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like the new approach.

Couldn't initialize be synchronous now? void initialize(...)

@nilsreichardt
Copy link
Member Author

Couldn't initialize be synchronous now? void initialize(...)

Yes, good catch!

@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 26, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 26, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue Jul 26, 2023
Merged via the queue into main with commit 692138b Jul 26, 2023
17 checks passed
@nilsreichardt nilsreichardt deleted the fetch-remote-config-in-the-background branch July 26, 2023 15:20
@Jonas-Sander Jonas-Sander mentioned this pull request Sep 18, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sharezone takes a long time to start with a poor internet connection
2 participants