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

[WINDOWS] - MappedByteBuffer.force is extremely slow on Windows #251

Closed
simerplaha opened this issue Aug 26, 2020 · 0 comments
Closed

[WINDOWS] - MappedByteBuffer.force is extremely slow on Windows #251

simerplaha opened this issue Aug 26, 2020 · 0 comments

Comments

@simerplaha
Copy link
Owner

simerplaha commented Aug 26, 2020

val buffer: MappedByteBuffer = ...
buffer.force() //expensive

The force function is costly on Windows. This function is needed to guarantee memory-mapped writes are flushed to disk to recover from fatal machine crashes. But forcing this function for all use-cases is probably not needed so we can make this configurable. Currently force is invoked right before a memory-mapped file is closed (Pre-close) but this can be deferred to background threads that manage clearing and deleting memory-mapped files. I'm thinking the following configurations would cover all use-cases. Another option to log out time taken by force for benchmarking/debugging might be useful.

  • Disabled - disables force
  • Pre-close - invokes force before the mmap file is closed
  • Pre-clear - invokes force before the mmap file's MappedByteBuffer is cleared from memory.
  • Pre-delete - invoked force before deleting a mmap file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant