-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Ensure Redis Proxy can follow redirection when doing request mirroring #8606
Conversation
Add CompositeArray to allow the RedisConnPool to maintain a shared_ptr to the request and to avoid copying the request. Added performance test Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
I took the liberty of adding some markdown quotes to your PR description so the table is legible. But below the table can you summarize your conclusions from it? |
master merge needed. |
drive by comment from description: does it make sense to flag-control this performance trade-off, as you indicated there are cases where the new approach is slower. Maybe that describes someone's use-case for which this is a regression? |
I think most of the cost is from creating the new shared_ptr, I think I can work around this and improve the performance. I'll report back. |
# Conflicts: # source/extensions/clusters/redis/redis_cluster_lb.cc # source/extensions/filters/network/redis_proxy/conn_pool_impl.cc Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Ok, I've update the code and the microbenchmark result. It's looking much better. |
# Conflicts: # source/extensions/filters/network/redis_proxy/command_splitter_impl.cc # source/extensions/filters/network/redis_proxy/conn_pool.h # source/extensions/filters/network/redis_proxy/conn_pool_impl.h # test/extensions/filters/network/redis_proxy/command_splitter_impl_test.cc # test/extensions/filters/network/redis_proxy/mocks.h Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
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.
Henry, can you split out the composite array change into an independent PR? I think this PR is convolving multiple changes and it's a bit big. That would be easier to review and comment on. Thank you!
/wait
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
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.
At a high level LGTM, just one readability comment. I would strongly recommend getting either @msukalski or @FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg to do an in depth review.
/wait
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
Signed-off-by: Henry Yang <hyang@lyft.com>
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.
I think this is an excellent simplification and can merge as is.
That said, have you had a chance to run it in your test environment and run some generated traffic against? Would be good to have confirmation on both simple and fragmented requests that it works as expected.
Signed-off-by: Henry Yang <hyang@lyft.com>
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 with small nit, thanks!
/wait
|
||
EXPECT_CALL(active_request, cancel()); | ||
request->cancel(); | ||
// Common::Redis::RespValuePtr resp_value = std::make_unique<Common::Redis::RespValue>(); |
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.
del commented out code, here and elsewhere.
Signed-off-by: Henry Yang <hyang@lyft.com>
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.
Thanks!
void createShared(Common::Redis::RespValueSharedPtr request) { | ||
for (uint64_t i = 1; i < request->asArray().size(); i += 2) { | ||
auto single_set = std::make_shared<const Common::Redis::RespValue>( | ||
request, Common::Redis::Utility::SetRequest::instance(), i, i + 2); |
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.
"i + 2" looks like a typo. See #9541
Description: Currently the Redis redirection logic is part of the command splitter, this has the consequence that shadow traffic to other clusters are not able to follow the redirection responses. Part of the challenge of the change is that the original request is the storage of the original request, as it could be destroyed before the redirection command is received.
The solution is refactoring the redirection logic into the Redis ConnPool. This greatly simplify the redirection logic. Also the connection pool is the only entity that can meaningfully manage the connections to upstream and correctly drain the connections. This also require storing a shared_ptr to the incoming request with the connection pool.
Risk Level: High
Testing: Add unit tests
Docs Changes: Updated
Release Notes: Updated