Skip to content

Use ts::bravo::shared_mutex for host status lock#13367

Open
masaori335 wants to merge 1 commit into
apache:masterfrom
masaori335:asf-master-bravo-host-status
Open

Use ts::bravo::shared_mutex for host status lock#13367
masaori335 wants to merge 1 commit into
apache:masterfrom
masaori335:asf-master-bravo-host-status

Conversation

@masaori335

Copy link
Copy Markdown
Contributor

HostStatus lookups sit on the parent-selection hot path and are overwhelmingly reads, so replace the ink_rwlock with the reader-biased BRAVO shared_mutex for better read scaling under contention. Readers take ts::bravo::shared_lock (Token-aware); writers use std::scoped_lock.

HostStatus lookups sit on the parent-selection hot path and are
overwhelmingly reads, so replace the ink_rwlock with the reader-biased
BRAVO shared_mutex for better read scaling under contention. Readers
take ts::bravo::shared_lock (Token-aware); writers use std::scoped_lock.
@masaori335 masaori335 added this to the 11.0.0 milestone Jul 7, 2026
@masaori335 masaori335 self-assigned this Jul 7, 2026
Copilot AI review requested due to automatic review settings July 7, 2026 23:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the HostStatus synchronization primitive on the parent-selection hot path, replacing the legacy ink_rwlock with the reader-biased ts::bravo::shared_mutex to improve read-side scaling under contention.

Changes:

  • Replace ink_rwlock with ts::bravo::shared_mutex in HostStatus.
  • Convert write locking to RAII (currently via std::scoped_lock) and read locking to ts::bravo::shared_lock.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/proxy/HostStatus.cc Removes manual rwlock init/destroy and converts call sites to BRAVO shared/exclusive RAII locking.
include/proxy/HostStatus.h Switches the lock member type and include to ts::bravo::shared_mutex / tsutil/Bravo.h.

Comment thread src/proxy/HostStatus.cc
Comment thread src/proxy/HostStatus.cc
Comment thread src/proxy/HostStatus.cc
Comment on lines +336 to 340
ts::bravo::shared_lock<ts::bravo::shared_mutex> lock(host_status_rwlock);

auto it = hosts_statuses.find(std::string(name));
lookup = it != hosts_statuses.end();
if (lookup) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like pre-existing issue. I'll cover this in another PR to clarify scope of changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants