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

[#11015] Break down question result fetch by section for scalability #11017

Conversation

moziliar
Copy link
Contributor

@moziliar moziliar commented Mar 6, 2021

Fixes #11015

Outline of Solution

Using the existing group by section toolkit, this PR breaks down per question result fetch into one or more result fetch by question and section.

By the nature of the section size limit, we can upper bound the sheer number of responses fetched per api call, therefore mitigating the OOM and GAE timeout issue caused by large courses where a question could consist of too many responses.

Pending stress test to confirm if this solution solves any reasonably sized question response set per section. The prime factor for such consideration is the size of the response (say, essay question which consists of 500 words minimally).

Update

Also initiates the splitting of backend response fetch by giver and receiver. A trichotomy enum ResultFetchType along the data path is used as a common object propagated along UI, Logic and Storage layers for a cleaner look.

The rationale behind the backend changes is to upper bound the number of responses fetched via this way, utilizing the section size limit of 100. By allowing fetching by section but for both giver and receiver, the size of the return could be higher considering a chained fetch.

@moziliar moziliar added the s.ToReview The PR is waiting for review(s) label Mar 6, 2021
@moziliar moziliar force-pushed the 11015-break-down-question-result-fetch-by-section-for-scalability branch from 336b198 to f24dfd0 Compare March 6, 2021 19:04
Copy link
Contributor

@daongochieu2810 daongochieu2810 left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Member

@teikjun teikjun left a comment

Choose a reason for hiding this comment

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

The code looks good to me! 👍
Do you know what might be causing the e2e tests to fail? I've checked out the error logs but I'm still unsure about how we can fix it.

Anyways, I'm currently adding the circular progress indicator (as planned in #11015) - will make a PR against this branch soon.

@moziliar
Copy link
Contributor Author

Thanks @daongochieu2810 @teikjun !

I am still investigating the e2e failure too. It will take quite awhile unfortunately. Will update again if there's anything to change in order to pass the test.

@moziliar
Copy link
Contributor Author

@teikjun i've identified the problem and it appears that the problem also involves the unfinished Question Stats type definition in the frontend. @wkurniawan07 I see that you left the TODO there, should we tackle that first before carrying on with this PR?

The issue with the current code is that it naively overwrites the current question's data with each section's data; it should be an append operation that incrementally adds in the data of one question from each sections; the blocker here appears to be statistics which is in the form of string json now.

@wkurniawan07
Copy link
Member

I highly doubt it's the issue. The only time where statistics is obtained from back-end is when the question type is contribution. All other statistics are calculated on demand based on available data.

@moziliar
Copy link
Contributor Author

@wkurniawan07 yup. Do you think I can just jsonify the string and perform concat before throwing it back as a string as a temporary measure?

@moziliar moziliar force-pushed the 11015-break-down-question-result-fetch-by-section-for-scalability branch 2 times, most recently from 1556af4 to e8550e4 Compare March 17, 2021 03:23
@moziliar moziliar force-pushed the 11015-break-down-question-result-fetch-by-section-for-scalability branch from 7806ca4 to 6d7bd35 Compare March 17, 2021 16:43
@madanalogy
Copy link
Contributor

Removing on hold status as #11037 closed due to inactivity

@madanalogy madanalogy added s.Ongoing The PR is being worked on by the author(s) and removed s.OnHold The issue/PR's validity has been put on hold pending some other event labels Sep 13, 2021
@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 8 days). 🐌 😢
Hope someone can get it to move forward again soon...

@daongochieu2810
Copy link
Contributor

@moziliar kind reminder on this PR

@moziliar
Copy link
Contributor Author

Will pick it up within the week. Thanks for the reminder.

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 8 days). 🐌 😢
Hope someone can get it to move forward again soon...

@hhdqirui
Copy link
Member

@moziliar kind reminder on this PR.

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

1 similar comment
@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@t-cheepeng
Copy link
Contributor

@moziliar kind reminder on this PR.

@moziliar
Copy link
Contributor Author

moziliar commented Nov 4, 2021

Sorry for leaving this PR hanging for so long; I might need some time to reconcile it with a recent change.

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 8 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

4 similar comments
@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 9 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 8 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

3 similar comments
@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@madanalogy
Copy link
Contributor

Closed in favour of #11567

@madanalogy madanalogy closed this Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.Ongoing The PR is being worked on by the author(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize frontend result page fetching