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

Fetching attendances for large sections is slow #408

Open
smartspot2 opened this issue Apr 14, 2023 · 1 comment
Open

Fetching attendances for large sections is slow #408

smartspot2 opened this issue Apr 14, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers sev4 Normal severity - System impaired

Comments

@smartspot2
Copy link
Member

This should be investigated further, but when fetching attendances for large sections (for reference, I have a section of ~40 people), the request takes ~2 seconds to load. A similar load time can be observed when fetching the student roster list.

The same can be reproduced locally with a section of 30 people with all attendance objects populated from 3 months, where sections occur 2 times per week. The request time is fast without any attendance objects populated though.

This is likely due to a very inefficient query/filter in the viewset, but should be investigated further for the root cause and possible solutions.

@smartspot2 smartspot2 added bug Something isn't working good first issue Good for newcomers sev4 Normal severity - System impaired labels Apr 14, 2023
@joshualiao
Copy link

joshualiao commented Oct 10, 2023

The path for fetching attendances is inefficient.

The pseudocode is:

  1. Filter requesting user's banned sections.
  2. Get all sections, minus the banned sections, filtered on if the section matches the user's mentor, student, or coordinator status.
  3. From this list of sections, find the one the request desires.
  4. Serialize the SectionOccurrences attached to the section, and each sectionOccurrence is just the serialization of set of Attendances attached to each section occurrence
    -> Each attendance serialization pulls sectionOccurrence and student info, and return attendance object.

The easiest optimization should just be to pull the specified section ID first?

@joshualiao joshualiao self-assigned this Oct 10, 2023
@joshualiao joshualiao removed their assignment Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers sev4 Normal severity - System impaired
Projects
None yet
Development

No branches or pull requests

2 participants