openedx / openedx/openedx-core

Add compression support for Content

Open
#153 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

data model
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
  1. Rename the text field to uncompressed_text.
  2. Create a new BinaryField for compressed_text.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.