Reduce Discovery django admin loading times

Description

Hi team,

Lately the PC team has seen Discovery taking a lot of time to load, specially when it comes to course run pages such as https://discovery.edx.org/admin/course_metadata/courserun/21473/change/

We believe it might be due to the fact that each time we open one of these, the page has to load all of the Staff that's on our database.

Could you take a look and see if there would be a way to reduce the loading time? This is becoming quite a time-consuming process for PCs, especially given that we use Discovery regularly.

Thank you!

Steps to Reproduce

None

Activity

Show:
Gerard Alarcón Montserrat
March 9, 2021, 3:27 PM

Confirmed! Thank you all so much for your work on this!

Gerard Alarcón Montserrat
March 9, 2021, 9:32 AM
Edited

It’s looking much much better (takes about 4 seconds to load). Thank you so much! I’ll check in with the rest of the team to confirm that Discovery is loading faster for them too.

Wajeeha Khalid
March 9, 2021, 9:27 AM

Uzair has made page render optimization to 5 fields as mentioned ^
Can you please review and confirm if we are good with this update and page loads are promising now?

Uzair Rasheed
March 8, 2021, 2:05 PM

Background

Lately the PC team has seen Discovery taking a lot of time to load, specially when it comes to course run pages.
e.g: https://discovery.edx.org/admin/course_metadata/courserun/21473/change/

Investigation

This was happening because of the fact that django-admin needs to fetch all of the related data to populate admin page(provided above) for each course_run.In order to optimize the page load time, there was a need to fetch only relevant data.During the discovery, following fields are identified which would be fetched only on-demand:

  1. draft_version in Inline Seat Model.

  2. upgrade_deadline in Inline Seat Model.

  3. 'Staff' list.

  4. 'Transcript Languages' list.

  5. 'Video Translation Languages` list.

Actions

  1. draft_version and currency fields inside Inline Seat Model are added to raw_id_fields.Now, they would be loaded only on demand.

  2. A custom widget is added to the CourseRunAdmin which will give suggestions as per the input of three characters and load only on selection.

PR link:

fyi:

Wajeeha Khalid
March 5, 2021, 6:55 AM

Moved it back to ready for dev to optimize staff and other fields that we have discussed in our check-in call.
Once you make these changes please comment here what different approaches have you taken to improve this load time including the one that you have already done.

Done

Story Points

3

Assignee

Uzair Rasheed

Reporter

Gerard Alarcón Montserrat

Reach

Group(s)

Impact

None

Platform Area

None

Customer

None

Partner Manager

None

URL

None

Contributor Name

None

Groups with Read-Only Access

None

Actual Points

None

Category of Work

None

Platform Map Area (Levels 1 & 2)

Administrator Experiences - Catalog Management and Publishing

Platform Map Area (Levels 3 & 4)

Publisher & Catalog Publishing Tools

Sprint

None

Priority

CAT-4