-
Notifications
You must be signed in to change notification settings - Fork 291
Improve hset and hdel performance with RedisPipeline. #647
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
This PR just check-in test code, according to discussion result, if we decide to have this improve, we also need improve hdel and remove the lua script. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
const std::vector<FieldValueTuple> &values); | ||
|
||
template<typename InputIterator> | ||
void formatHMSET(const std::string &key, |
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.
formatHMSET is internal API, only use by sonic-swss-common project;
https://github.com/search?q=org%3AAzure+formatHMSET&type=code
This comment was marked as resolved.
This comment was marked as resolved.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
common/redispipeline.h
Outdated
@@ -61,6 +62,26 @@ class RedisPipeline { | |||
return r.release(); | |||
} | |||
|
|||
redisReply *pushHSET(const std::string& key, const std::map<std::string, std::string> &values) |
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.
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.
Fixed, moved to RedisCommand class.
@@ -1,6 +1,7 @@ | |||
#pragma once | |||
|
|||
#include <string> | |||
#include <queue> |
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.
RedisPipeline using std::queue but not include the header file.
So some time when include this header file will report build error.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
#### Why I did it 1.Change redis hmset command to hset because HMSET deprecated after redis 4.0.0: https://redis.io/commands/hmset/ 2.Improve DBConnector::hmset and DBConnector::del method performance. Currently swsscommon implement hmset and del by LUA script, however change to use RedisPipeline can improve performance by 20%: RedisPipeline hmset: 0.228743 LUA hmset: 0.260371 #### How I did it Change hmset and del to use RedisPipeline. #### How to verify it Pass all test case. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog #### Link to config_db schema for YANG module changes #### A picture of a cute animal (not mandatory but encouraged)
Why I did it
1.Change redis hmset command to hset because HMSET deprecated after redis 4.0.0:
https://redis.io/commands/hmset/
2.Improve DBConnector::hmset and DBConnector::del method performance.
Currently swsscommon implement hmset and del by LUA script, however change to use RedisPipeline can improve performance by 20%:
RedisPipeline hmset: 0.228743
LUA hmset: 0.260371
How I did it
Change hmset and del to use RedisPipeline.
How to verify it
Pass all test case.
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)