openedx / openedx/openedx-core
Add compression support for Content
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10
- Forks
- 32
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 12
Description
This came up in https://github.com/openedx/openedx-learning/pull/149
I was looking through some example course data and there are a handful of Capa problems that weigh in at ~13-14 KB. But when compressed with zlib, that goes down to about 2K–the larger problems tend to be that way because they have a lot of Python code and HTML table markup, both of which compress really well.
General plan
- Rename the text field to uncompressed_text.
- Create a new BinaryField for compressed_text.
- Create a cached property text that knows how to switch between the two.
At the time we write to Content, we run zlib compression on the text and decide whether to use the compressed or uncompressed field for this row. The other field is left null. When we first introduce this feature, we can run it as a data migration, though that wouldn't be a requirement.
Pruning is still the more important feature for controlling the content size growth.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked pull request 149 and the Content model. Trace how text is currently stored and read, then assess the proposed uncompressed_text, compressed_text, and cached text behavior. Done means writes choose between zlib-compressed and uncompressed storage while reads continue through text, with existing data considered through a migration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100