Skip to content

Conversation

ormsbee
Copy link
Contributor

@ormsbee ormsbee commented Jan 19, 2025

Checking the entrypoints for the XBlock class we want for a given tag name is relatively expensive. We mitigate this by caching the mapping of tags to classes in Plugin.load_class(). But before this commit, we weren't caching failed lookups, i.e. the situation where there is no XBlock that maps to a given tag. This meant that if a course had many instances of a type of XBlock that is not installed on the given server, we would be constantly scanning entrypoints to look for our non-existent XBlock subclass. This really slows down things like the Studio course outline page.

The fix here is to store failed lookups as None values in the PLUGIN_CACHE.

@ormsbee
Copy link
Contributor Author

ormsbee commented Jan 19, 2025

Fixes #811

FYI @openedx/interest-performance

@ormsbee ormsbee added the performance Relates to improving latency/throughput or reducing resource usage label Jan 19, 2025
Checking the entrypoints for the XBlock class we want for a given tag
name is relatively expensive. We mitigate this by caching the mapping
of tags to classes in Plugin.load_class(). But before this commit, we
weren't caching failed lookups, i.e. the situation where there is no
XBlock that maps to a given tag. This meant that if a course had many
instances of a type of XBlock that is not installed on the given
server, we would be constantly scanning entrypoints to look for our
non-existent XBlock subclass. This really slows down things like the
Studio course outline page.

The fix here is to store failed lookups as None values in the
PLUGIN_CACHE.
@ormsbee ormsbee force-pushed the perf-cache-load-class-misses branch from 53b85fa to 24e4409 Compare January 21, 2025 15:35
@ormsbee ormsbee merged commit 25560fb into openedx:master Jan 22, 2025
10 checks passed
@ormsbee ormsbee deleted the perf-cache-load-class-misses branch January 22, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Relates to improving latency/throughput or reducing resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants