-
Couldn't load subscription status.
- Fork 1
Change the encoding to JS encoder #275
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
|
Impressive performance gains! Please confirm that I'm getting you correctly:
If I got it right, then the results confirm that the JS-side encoding is indeed the way we want. After all, the whole encoding code is already there (so the wrapper part is thinner), and we lose no performance due to that. |
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.
Woah, what a giant piece of useful work! Keep going, let's make our wrapper even thinner and, at the same time, faster! ✨ 🚀
When looking at the execution time - yes, for this specific n. I would need to run more benchmarks to determine if this will be the case for higher number of executed queries. (Remember that we had a lower starting point, but slightly steeper increase before)
Yes
The difference for the non-concurrent benchmark is within the run to run variance, so I'm unable to determine if there is any meaningful difference there |
ff02ee3 to
474caaa
Compare
The following changes were made: - Change the CQL unset to JS undefined value, to allow easier transfer of the data to Rust layer. - Extend how the type information look to match the type object, returned from the Rust layer.
aaeb4be to
f003c7f
Compare
Convert the rust Complex type to an object of the type expected by the JS encoder. This commit is copied from #275 PR
lib/types/cql-utils.js
Outdated
| let fistSupport = type.getFirstSupportType(); | ||
| let secondSupport = type.getSecondSupportType(); | ||
| let otherTypes = type.getInnerTypes(); | ||
| if (fistSupport != 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.
ditto: not really resolved
Convert the rust Complex type to an object of the type expected by the JS encoder.
Add a rust type, that stores already serialized, null or unset values. This struct implements the trait that converts: - JS `undefined` to CQL `unset` - JS `null` to CQL `null` - JS Buffer to serialized CQL value
Change the client to use js serialization, instead of the current hybrid approach.
This mostly changes checks for error types and messages.
This removes most of the old encoding logic
Replace PreparedStatementWrapper with strings, when executing prepared statements, when calling endpoint to execute queries. With this change we only return expected types for prepared statements, instead of the whole PreparedStatementWrapper object from the Rust. This change introduces a speed improvement when executing queries through executeConcurrent, and does not slow down other endpoints.
And remove the Unprovided variant from CqlType enum. This is some additional cleanup that is possible after #275
And remove the Unprovided variant from CqlType enum. This is some additional cleanup that is possible after #275
And remove the Unprovided variant from CqlType enum. This is some additional cleanup that is possible after #275
The old one is no longer used, since merging #275. The new type guessing is the same one that was used in the DSx driver
With the implementation of #275, type guessing is done in the Encoder, instead of the separate extracted function. This commit removes that unused code.
The goal of this PR is to change the current encoding approach (as described in #257) to Approach 1.
Currently, UDTs are not supported because the proper type information conversion has not yet been implemented.UDTs are supported in this PR.This PR also introduces a change to the prepared execute API of the Rust wrapper. It replaces PreparedStatementWrapper with strings when executing prepared statements during query execution at the endpoint. With this change, we only return expected types for prepared statements, instead of the whole PreparedStatementWrapper object from Rust.
This change was introduced for performance reasons, as it results in an improvement when executing queries
through executeConcurrent, and does not slow down other endpoints.
Testing
This PR was tested locally with Cassandra integration tests, on top of the CI running the Scylla integration tests (see #244)
Encoding issues
#257
By changing the encoder, the following issues would be fixed:
fixes #89
fixes #167
fixes #200
fixes #233
fixes #215 (Type guessing is done inside encoder)
With proper type conversion, this PR fixes #245
Performance
While the core part of this PR (replacing encoders) yields a decent speedup, it is only with the other optimisation that we reach the same speed as the test implementation of the other approach.
Performance of the baseline (main):
Performance for this implementation:
This + Strings instead of Prepared Statement Wrappers:
Performance of the alternative implementation (see Approach 2 in #257)
Performance of the DataStax driver:
Regular insert, this with Prepared Statement Wrapper
Regular insert, this with String