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

feat(server): lower library scan memory usage #7939

Merged
merged 5 commits into from Mar 14, 2024
Merged

Conversation

mertalev
Copy link
Contributor

@mertalev mertalev commented Mar 14, 2024

Description

This PR drastically lowers RAM consumption for scans on large libraries with four optimizations:

  1. Batched queueing for asset scanning
  2. Trie data structure instead of set
  3. Conditionally delete from trie instead of keeping a separate list for full refresh
  4. Streamed glob

How Has This Been Tested?

Successfully imported a library with 1.5 million assets and observed much lower RAM usage than described in #7373

Fixes #7373

memory_usage

Copy link

cloudflare-pages bot commented Mar 14, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b6fe574
Status: ✅  Deploy successful!
Preview URL: https://163afa61.immich.pages.dev
Branch Preview URL: https://feat-crawl-trie.immich.pages.dev

View logs

@mertalev mertalev merged commit d67cc00 into main Mar 14, 2024
24 checks passed
@mertalev mertalev deleted the feat/crawl-trie branch March 14, 2024 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Out of memory when scanning libraries with >1M assets
2 participants