Draft: In-memory writeahead file system#1041
Draft
simolus3 wants to merge 4 commits into
Draft
Conversation
|
simolus3
force-pushed
the
web-statement-cache
branch
from
July 21, 2026 10:01
b3d72f1 to
ce91dfe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As a follow-up to #1029 (see in particular the discussion in #1029 (comment)), this adds a multi-threaded variant of the in-memory file system with support for concurrent reads / writes.
To use this,
import { InMemoryWriteAheadLogPool } from '@powersync/web/in-memory-wal-experiment';and open PowerSync databases with theopened: new InMemoryWriteAheadLogPool({ numWorkers: 2 })option.This implementation avoids navigator locks and and doesn't give databases a name, each instance is a fresh and completely independent database instance. For the most part, this VFS works like the OPFS write-ahead VFS, except that:
Mapwe can send between workers.Semaphoreinstead.memcpy.There are a few things still to do here. For example, the current checkpointing logic triggers from very small WAL sizes and could likely use some fine-tuning. This also doesn't support batched statements yet and doesn't expose options to configure page cache or prepared statement cache sizes.