-
Notifications
You must be signed in to change notification settings - Fork 345
Fix low performance of mmap rwmode #620
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
Conversation
|
to fix issue: #551 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes low performance issues in the mmap read-write mode by implementing a singleton pattern for MMapRWManager and introducing block-based memory mapping. The key performance improvement comes from avoiding the creation of new mmap instances for each read/write operation.
- Implements singleton pattern for MMapRWManager instances per data file
- Introduces block-based memory mapping with LRU caching for better memory management
- Adds comprehensive test coverage for edge cases and cross-block operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| rwmanger_mmap.go | Core implementation of singleton MMapRWManager with block-based mapping and LRU caching |
| rwmanager_mmap_test.go | Updated and expanded tests for the new MMapRWManager implementation |
| file_manager.go | Simplified MMapRWManager creation to use the new singleton pattern |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@bigboss2063 all comments resolved. |
|
Thanks! |
Before fix:

After fix:

fix design:
before fix, for each get / write operation will generate a new mmap instance, it will make operation very slow.
after that, we make mmapRWManager as a singleton for each data file. And for each mmapRWManager, I split data file as many part of mmap.