Is it feasible to split all commands into two parts to improve performance? The first part, which includes parameter validation and content checks (non-memory operations), could be processed in the I/O thread, while the second part involving concurrency-sensitive operations would be handled in the main thread.
example(And maybe can split setGenericCommand?):
void setCommand(client *c) {
robj *expire = NULL;
int unit = UNIT_SECONDS;
int flags = OBJ_NO_FLAGS;
========================= proc in iothread ===============================
if (parseExtendedStringArgumentsOrReply(c,&flags,&unit,&expire,COMMAND_SET) != C_OK) {
return;
}
c->argv[2] = tryObjectEncoding(c->argv[2]);
========================= proc in iothread ===============================
setGenericCommand(c,flags,c->argv[1],&(c->argv[2]),expire,unit,NULL,NULL);
}
Comment From: wclmxxs
@sundb @ShooterIT What do you think?
Comment From: sundb
@wclmxxs Theoretically, it is feasible, but how much benefit will it actually bring? Argument parsing is generally not a bottleneck. We can make a POC to verify it.
Comment From: wclmxxs
@sundb I want to make sure that I can use ./memtier_benchmark --data-size 521 --ratio 1:1 --key-pattern R:R --key-minimum=1 --key-maximum 3000000 --test-time 60 -c 50 -t 13 --hide-histogram -x 3 for performance testing.
Comment From: sundb
@wclmxxs, sure. Additionally, you can use the --command
option to specify a specific command. I think it is more suitable for this case.