status-im / status-mobile

a free (libre) open source, mobile OS for Ethereum
https://status.app
Mozilla Public License 2.0
3.91k stars 984 forks source link

App is unresponsive for a few seconds right after login #20283

Open flexsurfer opened 5 months ago

flexsurfer commented 5 months ago

After login we fetch all the communities, big communities have a lot of data and it might take up to a tens of a second to load and "parse" them, and app is unresponsive for that time

There are the steps to fix that:

Actual results

Can be consistently replicated in some Android devices.

https://github.com/status-im/status-mobile/assets/46027/dd8de18d-48b0-474f-bf24-a548b1acf527

yqrashawn commented 5 months ago

This also happens to discover community. I guess featured communities will be mostly large communities in the future.

https://github.com/status-im/status-mobile/blob/develop/src/status_im/contexts/communities/discover/events.cljs#L78

flexsurfer commented 5 months ago

Related issue, with some numbers https://github.com/status-im/status-mobile/issues/20231

ilmotta commented 4 months ago

This week I will give this issue a shot because the freezing can put the app in an unrecoverable state and the user may need to close, reopen the app, and realize they need to wait before pressing on buttons for many seconds, which is a bit too much to ask from users (this is what happened to me and @pavloburykh)

If I don't find any quick solution I'll at least try to paste results that help us pinpoint the actual cause. Could be an amalgamation of causes, in which case it will be difficult...

flexsurfer commented 4 months ago

this one is very effective and quick solution https://github.com/status-im/status-mobile/issues/20285

ilmotta commented 3 months ago

@flexsurfer This issue has been largely mitigated because we eliminated the bottleneck to process upfront all community members after login. I remember @pavloburykh also saw significant improvements on midrange Android phones. Even though there are other potential improvements, can we consider this issue sufficiently solved and close the issue? Or are we still seeing long freezes?

flexsurfer commented 3 months ago

I am looking at it from a technical perspective and believe there is still room for improvement, but we can ask @pavloburykh what he thinks. Given the current situation, my opinion is that communities should be disabled on mobile devices, and therefore, this task is no longer relevant.

ilmotta commented 3 months ago

Given the current situation, my opinion is that communities should be disabled on mobile devices, and therefore, this task is no longer relevant.

We may end up disabling communities on mobile, but seems premature now. One reason @flexsurfer is that community features drive retention as we can see from user's messages. And some users are installing the desktop app, enabling the flag to manage communities and creating their own communities, which is nice because they can provide valuable feedback to us.

ulisesmac commented 1 month ago

Is this still reproducible?

It'd be great if we share some big communities to join to properly replicate the bug

CC: @ilmotta @flexsurfer

flexsurfer commented 1 month ago

yes, still reproducible

ilmotta commented 1 month ago

yes, still reproducible

Which device do you see a problem @flexsurfer? Overall, how many communities, which communities? How long do you experience the unresponsiveness, still seconds as the issue title says?

With an iPhone and a mid-range Android device I don't experience any lag to login, with the Status app present.

@ulisesmac can you experience a long freeze, maybe up to seconds as the issue reports?

ulisesmac commented 1 month ago

@ilmotta I can't reproduce it, but I'm not joined to big communities and I don't have low-end phones to test.

Probably QA can provide some giant communities to properly check if this issue can be closed or addressed.

pavloburykh commented 1 month ago

@ilmotta I can't reproduce it, but I'm not joined to big communities and I don't have low-end phones to test. Probably QA can provide some giant communities to properly check if this issue can be closed or addressed.

@ulisesmac @ilmotta @flexsurfer I do not experience any significant response delay right after login on my Android (see the video attached below). I would say this issue https://github.com/status-im/status-mobile/issues/21358 is more critical in terms of performance and UI experience.

@ulisesmac regarding the community, you can use Status community to test performance issues.

https://github.com/user-attachments/assets/66895da6-dd69-473f-a380-dfe7c20e3dbc

ilmotta commented 1 month ago

I would say this issue https://github.com/status-im/status-mobile/issues/21358 is more critical in terms of performance and UI experience.

Agreed @pavloburykh 👍🏼


@flexsurfer could you provide clear steps to reproduce App is unresponsive for a few seconds right after login? When the issue was created many months ago, the problem was easy to reproduce, but we made improvements and now we can't reproduce anymore. But if you can reproduce, please provide the steps, otherwise let's close the issue 👍🏼 The subtasks you identified, such as investigate how size of the json could be reduced can be separate issues once we close this one, because they seem more like nice to have from a tech debt perspective. Thanks!

ilmotta commented 1 month ago

Hey @flexsurfer @ulisesmac I found a suspicious piece of code (from a discussion in another issue):

https://github.com/status-im/status-mobile/blob/020d5cc1c124f9bd2e8931d5275102a7b093d573/src/status_im/contexts/profile/login/events.cljs#L56

This place initializes the messenger, and the response from status-go can be huge for the wakuext_startMessenger. But we ignore the response completely. The thing is that we are not passing :js-response true, which means we are recursively converting everything to CLJS data structures. This could be a problem for lower-end devices.

ulisesmac commented 2 weeks ago

I'd like to check the specs of our lowest end device officially supported, based on it we can start checking what we need to be optimized.

@ilmotta Do you know which one is it?

ilmotta commented 2 weeks ago

I'd like to check the specs of our lowest end device officially supported, based on it we can start checking what we need to be optimized.

@ilmotta Do you know which one is it?

@ulisesmac, although we could come up with a list of low-end devices we should support, nobody has done that yet.

I exported from Google Play the entire list of devices and attached here. In this list I removed the column saying the total count of users because many devices only have one user and I wanted to keep the data more anonymous.

As you can see in the CSV, it's not easy to come up with a list of low-end devices because we would need to match the devices in the CSV with some kind of database ranking devices in terms of performance.

The other (somewhat doable) solution would be to sort the top 30-100 devices in terms of user base and manually pick the devices that we know are low(ish) end, but we might need to re-run this analysis every ~6 months. If you have access to the Status Google Play Console, here's the URL https://play.google.com/console/u/0/developers/5603645361004062962/app/4972412211066356276/devices?mode=supportedDevices&sortBy=INSTALLS&order=DESC

devices.csv

ilmotta commented 2 weeks ago

I'd like to check the specs of our lowest end device officially supported

Still on this topic @ulisesmac, to clarify, there's no official device support list. What we have is an open and ever changing list of devices from users who installed Status. This is the list I shared.

The question you raise is an important and recurring one. I agree we should have this definition, but there's a larger discussion to have. What does official support means? Should we QA on old devices? Should we profile in these low-end and old devices?

The top 50-100 devices in the CSV includes models from 2018. I couldn't find any from 2017, but I didn't look super carefully.

I have an old Android Motorola G5 that would be considered low-end device from 2017 ago and Status runs badly on it and would easily run out of memory (2GB RAM) with more usage for sure, not to count the pressure on the battery because Status v2 can be hungry depending on the amount of data the user has.

ulisesmac commented 2 weeks ago

I'll inspect the list and look for a way to compare them based on their performance. I'll also check if we could replicate their perf in an Android emulator. 🤔

For performance, yes, I think we could measure in a low end Android device, we can also consider the market size, as we know, in developing conutries these low-end devices are widely used.

Thank you for sharing the list!