Skip to content

Fix new sync client with RNQS #636

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

Merged
merged 2 commits into from
Jun 18, 2025
Merged

Fix new sync client with RNQS #636

merged 2 commits into from
Jun 18, 2025

Conversation

simolus3
Copy link
Contributor

For reasons I don't fully understand, the array buffers we get from the RSocket package can't be passed to RNQS directly (it doesn't recognize them as array buffers and binds parameters to null). So, we copy once more.

I've also used this to benchmark syncing 1M rows once more (using RNQS with the demo todolist app and again with the barebones op-sqlite app). The sync is with an app launched using pnpm ios on an simulator and a sync service + Postgres on localhost. I've reinstalled the app before each run. Note that the checkpoint applies extremely slowely on the todolist app because there are FTS5 triggers.

Implementation Time downloading Time until data availability
Baseline (RNQS + JS) 234.2s 312.5s
Rust (RNQS + Rust) 61.6s (-73% 😎 ) 139s (still -55%)
Rust and OP-sqlite 47s (-80% from baseline, -23% from RNQS) (not measured, different schema)

I thought fine-tuning the backpressure handling with RSocket might speed things up even further (and there's still a bit of a "stop and go" behavior visible from sync progress), but increasing the local buffer or raising the watermark did not improve things. Anyway, the results are very promising already.

@simolus3 simolus3 requested a review from stevensJourney June 18, 2025 15:43
Copy link

changeset-bot bot commented Jun 18, 2025

🦋 Changeset detected

Latest commit: 450b2c9

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

This PR includes changesets to release 1 package
Name Type
@powersync/react-native 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

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance improvements are amazing!

@simolus3 simolus3 merged commit f878609 into main Jun 18, 2025
9 checks passed
@simolus3 simolus3 deleted the fix-rnqs-sync branch June 18, 2025 15:57
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.

2 participants