-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add new module API flag to bypass command validation #1357
Add new module API flag to bypass command validation #1357
Conversation
18763c9
to
c54ba74
Compare
c54ba74
to
24e6573
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1357 +/- ##
============================================
- Coverage 71.13% 70.95% -0.19%
============================================
Files 123 123
Lines 65531 65533 +2
============================================
- Hits 46616 46496 -120
- Misses 18915 19037 +122
|
Open a pr for documentation of this: valkey-io/valkey-doc#192 |
The PR comes from a performance issue about current VM_Replicated, then could you pls provide the result how much performance improvement on this PR? |
I don't see notable performance improvement in the multiple tests (1. benchmark 2. CPU utilization, 3. CPU profiling with perf) so I wonder if it is worth introducing this new API. @hwware @hpatro 1. BenchmarkWith validation
Bypass validation
2. CPU utilization
With validation
Bypass validation
3. Performance profiling with
|
@valkey-io/core-team Do you think this is a proper solution? |
I added another CPU utilization test to push around 90% |
fd2cbc0
to
1f41ddd
Compare
New performance test showing performance increase. |
The new module api, if the command does not exist, the server will crash, right? Are we considering adding flags to the client to bypass some checks? For example, a trusted client flag? |
@enjoy-binbin I may be wrong, but I believe the primary can replica anything. The replica receiving it will try to execute it and will fail with an error which is normally just ignored. But there is a config that makes the replica crash:
What do you mean? The module can send stuff to the replication stream even no actually command was sent by any real client. A module is always trusted. A module can do all kinds of dangerous things that can crash the server. |
right, sorry about this confusing wording, i got the context mixed up (reading other discussions at the same time). anyway, what i means is that, can we add flags to the client, or like ctx flags then can bypass some internal checks? i am not sure about it though, i am not that good at module, i am ok with the new module api if needed. |
@valkey-io/core-team can we settle on the |
1f41ddd
to
67dbe62
Compare
@valkey-io/core-team nudge! |
Add it to next meeting agenda |
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.
Implementation LGTM.
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.
Looks good to me as well, just minor suggestions.
Signed-off-by: Seungmin Lee <[email protected]>
6c68898
to
08bd13b
Compare
Previous approval no longer relevant
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.
When we discussed ValkeyModule_SetModuleOptions
, it seems we forgot that there is no getter for these options.
Signed-off-by: Seungmin Lee <[email protected]>
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.
Nice! @valkey-io/core-team please double check the new updates. The surface area is much smaller, just a new option VALKEYMODULE_OPTIONS_SKIP_COMMAND_VALIDATION
.
I guess it doesn't need to be a major decision anymore. |
@madolson We made the decision about this new option in the last core team meeting, right? I think we can consider it approved. |
We've had apparent consensus in the past but we didn't make it explicit. In the worst case I would like the folks to have the notification and they can choose to ignore it. |
Issue #1175
Problem
Performance degradation occurs due to the sanity check(lookupCommandByCString) in the VM_Replicate function, which converts const char* into sds and free them for command dictionary lookup. This check is mainly used for debugging purpose, but it is unnecessary for trusted modules. The user seeks a way to bypass this check for performance gains.
Solution
Introduce a new SKIP_COMMAND_VALIDATION option which allows individual modules to opt out of command validation
Test
Unit test