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

Lots of /profile requests from Android clients #6952

Open
richvdh opened this issue Aug 26, 2022 · 7 comments
Open

Lots of /profile requests from Android clients #6952

richvdh opened this issue Aug 26, 2022 · 7 comments
Labels
A-Performance O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@richvdh
Copy link
Member

richvdh commented Aug 26, 2022

Whenever a new user joins a big room like Matrix HQ, we see lots of GET /_matrix/client/r0/profile/<userid> requests from Element-android useragents. But all the information that the client needs should be in the join event (indeed, the "profile" probably isn't even what you want, since users may have different displaynames/avatars in different rooms).

What is the reason for these requests?

@richvdh
Copy link
Member Author

richvdh commented Aug 26, 2022

cf matrix-org/synapse#12921

@turt2live
Copy link
Member

(this also seems to happen when a user posts a message)

@bmarty
Copy link
Member

bmarty commented Aug 30, 2022

When the Android SDK detects a membership event, it forces a fetch of the user profile, to mitigate issue of outdated User data. The Sync response does not contain information about the user profile, but just room member, and user can change their profile data per room.
That said we had a bug which is currently been fixed, we where fetching several times the same profile data. This will be fixed in the release 1.4.36 by this commit: a7666e2

If this is happening when a user send a message, this is probably another bug. Please confirm.

By the way it's good to see such issues coming from server maintainers. Thanks!

@richvdh
Copy link
Member Author

richvdh commented Aug 30, 2022

The Sync response does not contain information about the user profile, but just room member, and user can change their profile data per room.

Not quite following you here. The sync response should contain the user's full membership event, which should include their avatar_url and displayname for that room. Are you seeing you need their full profile (ie, their "global" displayname and avatar)? What for?

@bmarty
Copy link
Member

bmarty commented Aug 30, 2022

Are you seeing you need their full profile (ie, their "global" displayname and avatar)? What for?

They are needed for instance for the invite people screen, but not only. The original issue is #1715, there is #5321 too.

@richvdh
Copy link
Member Author

richvdh commented Aug 30, 2022

OK I see, thanks for the background.

The problem is that having every android user make a /profile request every time there is an m.room.member is putting quite a lot of load on the servers in the room. (Note: Synapse doesn't cache remote profiles, so it makes requests to the remote server.) I'd be keen that we find an alternative solution if possible.

In the case of the "invite people" screen - I'd expect clients to use the user directory endpoint, which returns up-to-date profile data.

@Florian14 Florian14 added A-Performance S-Major Severely degrades major functionality or product features, with no satisfactory workaround O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience T-Defect Something isn't working: bugs, crashes, hangs and other reported problems S-Minor Impairs non-critical functionality or suitable workarounds exist and removed S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Aug 31, 2022
@bmarty
Copy link
Member

bmarty commented Aug 31, 2022

...make /profile request every time there is an m.room.member

We make a profile request if the m.room.member data differs from what is stored locally, to ensure an up to date local DB. Also previously User info was kept up to date using the data received with the Presence information (display name and avatar), but since this is disabled on matrix.org, we had to find a (or rather another!) workaround.

Ideally profile information changes would come in the sync response, but this is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Performance O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

No branches or pull requests

4 participants