-
Notifications
You must be signed in to change notification settings - Fork 7
feat: default to newClientImplementation #97
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
base: main
Are you sure you want to change the base?
Conversation
| /// Which we don't get logs for currently. | ||
| newClientImplementation: false, | ||
| clientConfiguration: SyncClientConfiguration( | ||
| requestLogger: SyncRequestLoggerConfiguration( |
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.
Unfortunately, SyncRequestLoggerConfiguration is not marked as experimental. This could be considered a breaking change.
We should do some more investigation to see if we could possibly support logs with WebSockets.
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.
That is a good point, but I think in practice logging with WebSockets is tough since everything is in binary anyway. We probably need something custom here (even if we get the ktor Logging plugin to log for WebSockets, we'd log RSocket frames which is probably not that useful).
We could also consider an option on the Rust sync client to emit logs for lines it has received, since it has a bson decoder and a serializable IR for sync lines.
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.
I believe the logging should currently only be used for the /sync/stream and write-checkpoint routes.
IIRC the standard logging does not expose the server sent events in realtime for the HTTP method. The main options were:
infoWhich includes the URL and method of the requestheaderstheinfoabove plus the requests headersbodywhich is the entire body (I recently discovered this) - not on a per message level, only logs once the request is completed, for the/sync/streammethod this is essentially a memory hog waiting to happen.
Having similar functionality - or even more improved functionality when it comes to the body - would be nice for WebSockets. I agree, due to the differences in the implementation, I imagine we'd need to implement our own layer for this.
The main question is if we should delay the switching of the default implementation until we implement this (if we decide to implement it).
I get the feeling that a strong notice for the change in functionality should outweigh the potentially large memory usage of the old implementation.
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.
I get the feeling that a strong notice for the change in functionality should outweigh the potentially large memory usage of the old implementation.
I agree with this, we should clearly mention this in the changelog and release notes.
Overview
We currently have two options for connecting to the PowerSync service:
newClientImplementationin Swift)Previously, the Rust client has been an experimental opt-in feature.
The Rust client has been stable for a while now and is the primary target for new features. The underlaying Kotlin SDK now uses the Rust client as the default from v1.9.0.
This updates the default implementation to be the Rust client (
newClientImplementation= true). The option to disable the Rust client, and fall back to the legacy client is now deprecated.Improvements
The old client uses HTTP streams to connect to the PowerSync service. The underlaying networking library currently has an issue which can cause high memory usage when streaming large volumes of data.
The
newClientImplementationuses a WebSocket communication layer which has an additional backpressure layer. This results in stable memory usage when streaming large amounts of data.Potentially Breaking Changes
The WebSocket layer does not currently support reporting networking logs via
SyncRequestLoggerConfiguration. Code relying onSyncRequestLoggerConfigurationwill no longer report any logs.