INCATools / INCATools/ontology-access-kit
Reduce S3 egress costs for bbop-sqlite database downloads
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 198
- Forks
- 35
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 1
Description
Problem
OAK downloads SQLite databases from https://s3.amazonaws.com/bbop-sqlite/{name}.db.gz. Every time a user's cache expires, the full file is re-downloaded even if nothing has changed on S3. For popular ontologies (GO, Uberon, HP, etc.) this generates significant egress costs.
Current state
- Default cache TTL increased from 1 week to 1 month (#879)
- No HTTP conditional requests (ETag / If-Modified-Since) — every refresh is a full download
- S3 URL is hardcoded in
SqlImplementation.__post_init__
Proposed improvements (incremental)
Phase 1 — Decouple the download URL
- Introduce a configurable base URL (e.g.
OAKLIB_SQLITE_BASE_URLenv var or config) instead of hardcodinghttps://s3.amazonaws.com/bbop-sqlite/ - This lets us switch providers (CloudFront, R2, GCS, etc.) without a code release as pricing changes
- Could also support mirrors or institutional caches
Phase 2 — HTTP conditional requests
- Use
If-Modified-Since/If-None-Match(ETag) headers when checking for updates - S3 already returns
Last-ModifiedandETagheaders, so aHEADor conditionalGETwould return304 Not Modifiedwith near-zero egress when the file hasn't changed - This means we could shorten the cache TTL again without cost penalty
Phase 3 — Delta/incremental updates (longer term)
- Explore whether we can avoid downloading full .db.gz files entirely
- Options: rsync-style deltas, SQLite diff/patch, or a lighter index file that indicates what changed
Related
- #879 — increased default cache TTL to 1 month
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 at SqlImplementation.post_init, where the S3 URL is hardcoded, and trace the existing cache and download path. First agree which proposed phase is in scope and how configuration or conditional requests should be tested; done should include the selected behavior without requiring the later delta-update exploration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, sqlite
- Domain
- backend, cloud, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100