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

Refactored wal code #348

Merged
merged 10 commits into from
Jun 14, 2023
Merged

Refactored wal code #348

merged 10 commits into from
Jun 14, 2023

Conversation

merlimat
Copy link
Collaborator

Existing WAL implementation is based on external library that was imported here for convenience. The main problems with that implementation are:

  • Keeping a cache of the segments entirely in memory
  • When a segment is accessed, the whole file is scanned and inserted in memory
  • The memory usage when there are many shards in a server can get quite high (eg: ~2 GB for ~16 shards)
  • There is significant GC overhead (the buffers are kept for quite some time in memory and then thrown away)
  • Trimming/Truncating the log implies making expensive copies of the segments, instead of just aligning the trimming at the segment level.

Implemented simple wal mechanism using mmap to have efficient cached access for multiple readers, without using excessive memory.

@merlimat merlimat merged commit 0d6b5ef into streamnative:main Jun 14, 2023
@merlimat merlimat deleted the wal-refactoring branch June 14, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant