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

perf: provide option to query asset using storage default url or through the LMS #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Danyal-Faheem
Copy link
Contributor

fixes #99.

A change was introduced in #91 where instead of accessing the url method on the storage backend, we would proxy the assets through the LMS. This was done to generalize the backend and allow for it to work out of the box with external storages such as S3.

However, as pointed out in #99, this can lead to some degraded performance as compared to just accessing scorm files directly from an external storage. Hence, we provide an option to change this behaviour and it is up to the user to choose them.

The default option will be proxying through the LMS as it does not require any extra setup.

An important concept necessary here is that the url method must be defined on the storage if the DEFAULT_STORAGE_URL option is set to true.

@Danyal-Faheem Danyal-Faheem requested a review from ziafazal March 7, 2025 14:43
@Danyal-Faheem Danyal-Faheem changed the title feat: provide option to query asset using storage default url or through the LMS perf: provide option to query asset using storage default url or through the LMS Mar 7, 2025
…gh LMS

This was provided as proxying assets through the LMS can be slower than directly accessing from external storage
The default value will be to proxy assets through the LMS as it is more reliable
@Danyal-Faheem Danyal-Faheem force-pushed the danyal/storage-url-option branch from 2060ed7 to e6f8fda Compare March 7, 2025 14:45
Copy link
Collaborator

@ziafazal ziafazal left a comment

Choose a reason for hiding this comment

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

@Danyal-Faheem for looking into it. I have a suggestion.

@@ -420,14 +383,20 @@ def extract_package(self, package_file):
def index_page_url(self):
if not self.package_meta or not self.index_page_path:
return ""

if not self.xblock_settings.get("DEFAULT_STORAGE_URL", False):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should use S3_QUERY_AUTH setting to determinse whetere we should serve static assets vis lms or not. because this setting is used for signing urls in case of private bucket.

Suggested change
if not self.xblock_settings.get("DEFAULT_STORAGE_URL", False):
if self.xblock_settings.get("S3_QUERY_AUTH",True)

@@ -55,43 +55,6 @@ def _(text):
@XBlock.wants("settings")
@XBlock.wants("user")
class ScormXBlock(XBlock, CompletableXBlockMixin):
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

why we need to remove this docstring?

@@ -106,6 +106,19 @@ This should be added both to the LMS and the CMS settings. Instead of a function
Note that the SCORM XBlock comes with extended S3 storage support out of the box. See the following section:

Default storage URL
Copy link
Collaborator

Choose a reason for hiding this comment

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

This additional setting is not needed we can rely on S3_QUERY_AUTH

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

Successfully merging this pull request may close these issues.

Degraded Performance loading scorm statics files
2 participants