Skip to content

Support OPFSWriteAheadVFS, concurrent reads#930

Merged
simolus3 merged 5 commits intomainfrom
opfs-concurrent-reads
Apr 20, 2026
Merged

Support OPFSWriteAheadVFS, concurrent reads#930
simolus3 merged 5 commits intomainfrom
opfs-concurrent-reads

Conversation

@simolus3
Copy link
Copy Markdown
Contributor

@simolus3 simolus3 commented Apr 14, 2026

This adds an option to use the new OPFSWriteAheadVFS VFS under WASQLiteVFS.

Unlike the existing VFS implementations, this one supports concurrent reads through a write-ahead log. To make use of that in the PowerSync SDK, we use a simple concurrency setup:

  1. When the VFS is enabled, we spawn two dedicated workers by default instead of one. On the second worker, we open the database in read-only mode. On WASQLiteOpenFactoryOptions, the additionalReaders option can be used to increase the amount of dedicated readers.
  2. In AsyncConnectionPool, we may use a read worker for read locks if available. Since the read pool is typically fairly small and we expect most queries to be reads, we also use the write connection for reads (giving us concurrent queries even with only one additional worker).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: 49dc34d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@powersync/web Minor
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 force-pushed the opfs-concurrent-reads branch from 9f83de6 to 2c3f243 Compare April 14, 2026 14:36
@simolus3 simolus3 marked this pull request as ready for review April 14, 2026 14:57
@simolus3 simolus3 changed the title WIP: Support OPFSWriteAheadVFS, concurrent reads Support OPFSWriteAheadVFS, concurrent reads Apr 14, 2026
@simolus3 simolus3 requested a review from Chriztiaan April 20, 2026 08:15
@Chriztiaan
Copy link
Copy Markdown
Contributor

This looks awesome!

@simolus3 simolus3 merged commit 756a0cf into main Apr 20, 2026
11 checks passed
@simolus3 simolus3 deleted the opfs-concurrent-reads branch April 20, 2026 09:47
@benitav benitav added the Product Visibility This requires documentation changes and or announcing. label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product Visibility This requires documentation changes and or announcing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants