-
Notifications
You must be signed in to change notification settings - Fork 1
Introduce CachingSession instead of Session #155
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
Conversation
08f9da7
to
4f08298
Compare
d0d471c
to
7a1a8c8
Compare
4f08298
to
9bf7852
Compare
9bf7852
to
ed21797
Compare
f5de2c4
to
b727505
Compare
b727505
to
b8bf151
Compare
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/session.rs:27
- [nitpick] The new field is named 'cache_size' in SessionOptions while the corresponding JavaScript option is called 'maxPrepared'. For consistency, consider aligning the naming between the Rust and JavaScript sides.
pub cache_size: Option<u32>,
5712c85
to
6f4c9e6
Compare
b8bf151
to
9fb315b
Compare
9fb315b
to
4e72e2e
Compare
4e72e2e
to
a11aeab
Compare
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.
Pull Request Overview
This PR introduces a caching session to optimize the execution of prepared statements, adds a new cache_size option for sessions, and updates the client options to support a new maxPrepared parameter with a default cache size of 512.
- Replaces Session with CachingSession in the session wrapper and adjusts method calls accordingly.
- Introduces a new cache_size field in SessionOptions with a default of 512.
- Updates client-options.js to change the default maxPrepared value and maps it to the Rust option cacheSize.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/session.rs | Replaces Session with CachingSession and adds cache_size handling. |
lib/client-options.js | Updates maxPrepared default and maps it to cacheSize in Rust options. |
Comments suppressed due to low confidence (2)
lib/client-options.js:670
- [nitpick] The naming of the cache option is inconsistent between JS (maxPrepared) and Rust (cache_size); consider unifying the naming conventions for clarity.
rustOptions.cacheSize = options.maxPrepared;
lib/client-options.js:332
- The default value for maxPrepared is now set to null, which may conflict with the PR's intent to change the default cache value from 500 to 512; please verify that the fallback to DEFAULT_CACHE_SIZE in the Rust code is sufficiently handling this scenario or consider aligning the default value.
maxPrepared: null,
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.
One small thing. Otherwise LGTM
I will try to run benchmarks for this PR in a moment |
a11aeab
to
2bd4fbb
Compare
This PR introduces caching session for optimizing the execution of prepared statements. It also adds support for the maxPrepared option of
Client
and changes the default value of the cache from500
to512
.Slightly improves performance and significantly improves amount of transferred data (number of packet measured with wireshark):
Before:
2.74 milion packets transferred
After:
1.47 milion packets transferred