-
Notifications
You must be signed in to change notification settings - Fork 985
Description
The problem/use-case that the feature addresses
Avoid performance hit in VM_Replicate function call.
Description of the feature
My team recently was trying to optimize the performance of our module. We found this function call lookupCommandByCString inside VM_Replicate to taking a lot of CPU time.
https://github.com/valkey-io/valkey/blob/unstable/src/module.c#L3539-L3540
The main reason is that it allocates memory to convert const char * into sds, then perform a dict lookup. From VM_Replicate function, it looks like it is just doing a sanity check without using it for anything else. My guess is the purpose is to protect the engine from running a 3rd party module. However, the protection seems induces too much performance penalty. If we develop our in-house module and don't run other modules, could we bypass this check to avoid performance hit. Is it possible to add a config flag "trust-module-replication" to bypass this check?
Alternatives you've considered
We considered VM_ReplicateVerbatim, but we sometimes needs to rewrite the command during replication. So we could not use it.
Additional information
Any additional information that is relevant to the feature request.