-
Notifications
You must be signed in to change notification settings - Fork 562
feat(hash): add the support of HSETEXPIRE command (HSET + EXPIRE) #2750
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
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. cc @git-hulk
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.
LGTM, it would be great if we can add a few test cases for this command in the further PR.
writing test cases, will push here as soon i'm done |
Yeah it's better to include test cases in this PR. |
@PragmaTwice @git-hulk pushed unit tests. |
I just found one issue about the command name: HSETEX. HSETEX can be HSET + EXPIRE, but it also can be HSET + HEXPIRE (with the hash field expiration). Redis doesn't have this command (and, potentially will add this command in the future). Dragonfly has this command (https://www.dragonflydb.io/docs/command-reference/hashes/hsetex), which means HSET + HEXPIRE (e.g. So if we add this, there's a potentially semantic inconsistence: if Redis add it in the future and the Redis one means HSET + HEXPIRE, we'll have a trouble, i.e. we will be incompatible to Redis, otherwise incompatible to previous version of Kvrocks. (and also confuse our users.) cc @git-hulk Maybe we can rename it to HSETEXPIRE. |
Good finding. I didn't notice Dragonfly had this command. |
Great! Let's change it to HSETEXPIRE. cc @ltagliamonte-dd |
@PragmaTwice @git-hulk Rename addressed via 6f28ae0 |
|
New Command HSETEX (HSET+EXPIRE):
Adding a command that sets an hash key and adds also TTL.
this reduces I/O and improves drastically the performances over pipelining or LUA functions.
This is a common request feature/cmd redis/redis#2905
From my local tests with 8 workers, 600 client connections, over 4 executions on the same dataset.
(branch, TTL, results):
kvrocks/unstable, NO TTL: 392,346,350,346 seconds -> avg -> 358.50 s
kvrocks/unstable, 30d TTL HSET+EXPIRE pipeline: 481,532,483,525 seconds -> avg -> 505.25 s
kvrocks/unstable, 30d TTL using function: 549,499,491,488 seconds -> avg -> 506.75 s
kvrocks/setExpire, 30d TTL with HSETEX: 398,348,342,393 -> avg -> 370.25s