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

Reduce delay between peer reviews #5743

Open
sivaraam opened this issue May 26, 2024 · 14 comments · May be fixed by #5897
Open

Reduce delay between peer reviews #5743

sivaraam opened this issue May 26, 2024 · 14 comments · May be fixed by #5897
Assignees
Milestone

Comments

@sivaraam
Copy link
Member

sivaraam commented May 26, 2024

What is the user problem or growth opportunity you want to see solved?

The overall Peer Review screen incurs a lot of delays. This is observed even on good internet connections. As a consequence, the usability of this on a throttled connection is questionable. We should explore if there are ways to improve this situation.

How do you know that this problem exists today? Why is this important?

The peer review screen takes a few seconds in order to load the image to be currently reviewed by the user. The fix for this is important as it would help improve the usability of the feature and would make it accessible to a wider range of users.

Who will benefit from it?

All users. Especially those who are on limited connection environments would benefit out of this.

Anything else you would like to add?

This has been reported by a user here.

Here's a screen recording shared by the user showcasing the delay and the following is the supplementary note about the video:

It started spinning after I approved the photo. I hit the skip button just to show that nothing was happening

@sivaraam
Copy link
Member Author

The first part of this enhancement would be to identify which part contributes to the slow loading of the image in the first place. Is it because a full-size image is being loaded? Or is a thumbnail itself taking several seconds due to some factor?

@nicolas-raoul
Copy link
Member

Actually, peer review becomes slower and slower. After reviewing a few dozen images, it takes several minutes between each review.

@sivaraam
Copy link
Member Author

Looks like we should generalise this enhancement as "identify and correct slowness issues in peer review", then.

@sivaraam sivaraam changed the title Improve peer review image load speed Reduce delay berween peer reviews May 27, 2024
@nicolas-raoul nicolas-raoul changed the title Reduce delay berween peer reviews Reduce delay between peer reviews May 27, 2024
@RitikaPahwa4444
Copy link
Collaborator

Is this happening because we check if the image has been reviewed already from a database table?

@sivaraam
Copy link
Member Author

It could be a reason. The matter is that no one is certain about the actual cause of the slowness. Someone would have to figure out the same. If you're interested in doing so, feel free to 🙂

@nicolas-raoul
Copy link
Member

Just a wild guess (I have not checked the code), but if the algorithm is like below, it is no surprise that it becomes slower and slower:

  1. Retrieve last 20 uploads, pick a random one and forget the rest.
  2. Check whether the user has never reviewed that upload. If yes review it, else go back to step 1.

@RitikaPahwa4444
Copy link
Collaborator

RitikaPahwa4444 commented May 28, 2024

I'd added that table, so I thought we're reading the db too frequently. But we're seemingly following the same algorithm as Nicolas has mentioned, so it's about frequent network calls too.

Not sure if this is because I'm using a different device, but the app isn't even fetching the very first image for me. I won't term this as slow but rather call it non-functional. Is the MediaWiki API working?

I'm using the version that's available on the Play Store. I'll try prodDebug from the latest main in some time. I'm running the app on API level 34.

@sivaraam
Copy link
Member Author

sivaraam commented May 28, 2024

I think the API works fine. It loads the image for me but after some delay of few seconds after the title appears.

Screenshot_2024-05-28-22-04-57-56_d5db3f3edc380047609fe9c266f7c566

@RitikaPahwa4444
Copy link
Collaborator

I'd cleared storage to check if it's happening with a large table. Skipped that image, and others started appearing quickly. Now it's gets stuck on a few pictures, I skip them to review other images.

@sivaraam
Copy link
Member Author

I do notice the images taking several seconds (5-10 sometimes) to load. It might be because we load a full-sized image rather than a thumbnail. We could explore loading a thumb in the review screen and show the full-sized image on a tap.

In any case, I suppose you should be able to see the full-sized image load properly when you tap on the image.

@psh
Copy link
Collaborator

psh commented Jun 8, 2024

What I am seeing is that the ReviewActivity runRandomizer() method is getting called many times (in one test, 30+ times), and there are (at worst) a couple of hundred API calls going on until it finds the next image to review. Each API call is taking 150-250ms each, so you can imagine how long it took for some of the slow images to appear!

@nicolas-raoul
Copy link
Member

Thanks Paul for identifying the root cause!

So the task here is to re-implement the way we find the next image to review, using what API calls (for context the feature was implemented during a hackathon). We should probably make 1 API call to retrieve like 50 pictures to review, then cache the results and use them locally as long as they are not over 1 day old.

@sivaraam sivaraam added this to the 5.1.0 milestone Jun 9, 2024
@amyWenhui
Copy link

Hi, I'm also very interested in this issue. Would it be possible to assign it to me? I'd be happy to contribute to it as well.

@nicolas-raoul
Copy link
Member

@amyWenhui It is yours, thanks! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants