-
Notifications
You must be signed in to change notification settings - Fork 552
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
net: Cache value of local address #15931
net: Cache value of local address #15931
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.
PR body and the commit say:
Fixes: #15898
That would close the issue but I think this commit only partially addresses a subset of the issues?
@@ -133,6 +133,7 @@ connection::connection( | |||
, _hook(hook) | |||
, _name(std::move(name)) | |||
, _fd(std::move(f)) | |||
, _local_addr(_fd.local_address()) |
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.
Doing this always is fine I guess as most connections are kafka rpc connections so we will need this sooner than later anyway?
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.
The logic is that the local address will never change for the duration of the instance, therefore it is safe to cache
Removing the |
- Performance testing has shown excessive CPU time is spent when local_address() is called within a tight loop, this has been tracked down to the fact that ss::file_desc::local_address() invokes a system call, getsockname. - To mitigate this issue, the connection class now caches the value of local address upon instantiation. - Partially fixes: redpanda-data#15898
1cc1d1b
9570cfa
to
1cc1d1b
Compare
Failure is #15893 |
/backport v23.3.x |
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.
👍
Performance testing has shown excessive CPU time is spent when local_address() is called within a tight loop, this has been tracked down to the fact that ss::file_desc::local_address() invokes a system call, getsockname.
To mitigate this issue, the connection class now caches the value of local address upon instantiation.
Relates to: audit logging perf overhead #15898
Backports Required
Release Notes
Improvements