Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 27, 2025

This PR addresses issue #6262 where Qdrant was loading all vector indexes into RAM, causing excessive memory consumption.

Problem

  • Qdrant was loading all indexes into memory by default
  • Memory usage was 1.5GB for a single project with Qwen3-Embedding-8B model
  • Memory consumption scaled linearly with multiple projects

Solution

Implemented memory-efficient configuration for Qdrant:

  • Configure vectors and HNSW indexes to use on-disk storage by default
  • Add memory-mapped file support for segments larger than 50k vectors
  • Reduce HNSW search parameter (ef) from 128 to 64 for memory efficiency
  • Add configuration options to allow users to customize memory optimization settings

Changes

  • Modified QdrantVectorStore to accept memory optimization configuration
  • Added on_disk: true for both vectors and HNSW indexes in collection creation
  • Configured memory-mapped file thresholds for efficient memory usage
  • Added new configuration options to CodeIndexConfigManager
  • Updated type definitions to include new configuration options
  • Updated all affected tests to handle new constructor parameters

Testing

  • All existing tests pass
  • Memory optimization is enabled by default but can be disabled if needed
  • Configuration options allow fine-tuning of memory vs performance trade-offs

Fixes #6262


Important

Configure Qdrant to use on-disk storage and optimize memory usage with new configuration options and tests.

  • Behavior:
    • Configure Qdrant to use on-disk storage for vectors and HNSW indexes by default in QdrantVectorStore.
    • Add memory-mapped file support for segments larger than 50k vectors.
    • Reduce HNSW search parameter ef from 128 to 64 for memory efficiency.
    • Add configuration options for memory optimization in CodeIndexConfigManager.
  • Configuration:
    • Update codebase-index.ts to include new memory optimization settings.
    • Modify config-manager.ts to handle new configuration options.
  • Testing:
    • Update tests in config-manager.spec.ts and service-factory.spec.ts to handle new configuration parameters.
    • Add tests in qdrant-client.spec.ts to verify memory optimization settings.
  • Misc:
    • Update QdrantVectorStore constructor to accept memory optimization settings.

This description was created by Ellipsis for dab65f3. You can customize this summary. It will automatically update as commits are pushed.

- Add memory optimization configuration to QdrantVectorStore
- Configure vectors and HNSW indexes to use on-disk storage by default
- Add memory-mapped file support for segments larger than 50k vectors
- Reduce HNSW search parameter (ef) from 128 to 64 for memory efficiency
- Add configuration options for memory optimization settings
- Update type definitions to include new configuration options
- Update all affected tests to handle new constructor parameters

Fixes #6262
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 27, 2025 01:11
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 27, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 27, 2025
@daniel-lxs
Copy link
Member

This PR left the scope of the issue

@daniel-lxs daniel-lxs closed this Jul 29, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 29, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

code index load all project index into RAM

4 participants