Skip to content

Automatically opt-out of multi-mmap support by testing support#7618

Merged
timvisee merged 1 commit intodevfrom
auto-disable-multi-mmap-at-runtime
Dec 2, 2025
Merged

Automatically opt-out of multi-mmap support by testing support#7618
timvisee merged 1 commit intodevfrom
auto-disable-multi-mmap-at-runtime

Conversation

@timvisee
Copy link
Member

@timvisee timvisee commented Nov 26, 2025

Depends on #7614

Fixes #7610, #6676

Automatically opt-out of using multiple memory maps on the same file if the runtime support check for it fails at startup. This way users don't have to specify QDRANT_NO_MULTI_MMAP and it should work out of the box.

We already had this check in place to log a warning on environments that suffer from this problem.

I am definitely not proud of how the result of the check ends up in MULTI_MMAP_IS_SUPPORTED. Please let me know if you have a better suggestion for it.

When starting on an unsupported environment, users will see this warning in the logs:

2025-11-26T14:48:21.920579Z  WARN memory::mmap_ops: Not using multi-mmap due to limited support, you may see reduced performance

Tasks

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

@timvisee
Copy link
Member Author

timvisee commented Dec 1, 2025

I did some manual testing with Docker/WSL on Windows. Good news, these changes work!

Without this patch

On Windows, I start a Qdrant container like this with a bind mount:

docker run --rm -it -p 6333:6333 -p 6334:6334 -v /c/Users/timvisee/qdrant/storage:/qdrant/storage:z qdrant/qdrant

Then I upsert points:

docker run -it --rm --net=host qdrant/bfb:dev ./bfb --skip-wait-index --indexing-threshold 0

After I restart the container, vector data is gone an reports all zeroes:

Screenshot From 2025-12-01 17-23-05

With this patch

When using this patch, we now see a warning printed in the logs (4th line) telling us multi-mmap is disabled on this environment:

Screenshot From 2025-12-01 17-14-54

Then, after upserting again, vector data survives any number of container restarts!

Screenshot From 2025-12-01 17-24-04

Base automatically changed from disable-multi-mmap-at-runtime to dev December 1, 2025 17:34
@timvisee timvisee force-pushed the auto-disable-multi-mmap-at-runtime branch from e32b48c to 7cc7405 Compare December 1, 2025 17:35
@timvisee timvisee marked this pull request as ready for review December 1, 2025 17:35
@timvisee timvisee requested review from coszio, ffuugoo and xzfc December 1, 2025 17:36
coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai bot Dec 1, 2025
});

/// If multi-mmap support is checked at Qdrant startup, the result is stored in this cell.
pub static MULTI_MMAP_SUPPORT_CHECK_RESULT: OnceLock<bool> = OnceLock::new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to disregard this stylistic comment.

This intermediate global variable should be possible to avoid by wrapping the above logic in a function, and use it to set MULTI_MMAP_IS_SUPPORTED directly after doing the check in main.rs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully get what you mean. Mind to open a PR on top on dev as proposal?

}

// Opt-out if environment variable is set
if supported && std::env::var_os("QDRANT_NO_MULTI_MMAP").is_some_and(|val| !val.is_empty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a config option rather than an env var?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, though it'd be a bit harder to propagate.

Since I deem this an experimental feature (which we don't know enough about yet), I vote to not put it in settings and keep it as undocumented variable.

Once we know more about this, both in terms of behavior and uses cases, we can still promote it to proper setting.

What do you think?

I'll merge this one now. But if you'd still prefer a setting, we can always do that in a follow-up PR.

@timvisee timvisee merged commit 747da0e into dev Dec 2, 2025
15 checks passed
@timvisee timvisee deleted the auto-disable-multi-mmap-at-runtime branch December 2, 2025 09:32
@timvisee timvisee mentioned this pull request Dec 3, 2025
1 task
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.

4 participants