Skip to content
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

Do not acquire KafkaClient lock for read-only operations #1730

Merged
merged 1 commit into from Mar 7, 2019

Conversation

dpkp
Copy link
Owner

@dpkp dpkp commented Mar 6, 2019

In an effort to reduce the surface area of lock coordination, and thereby hopefully reduce lock contention, I think we can remove locking from the read-only KafkaClient methods: connected, is_disconnected, in_flight_request_count, and least_loaded_node . Given that the read data could change after the lock is released but before the caller uses it, the value of acquiring a lock here does not seem high to me.


This change is Reviewable

Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Makes complete sense, and the implementation looks good.

I would probably copy your PR description text (which is quite helpful) into your commit message as well, so that it's easier for someone spelunking git blame in the future.

@dpkp dpkp merged commit 7a99013 into master Mar 7, 2019
@dpkp dpkp deleted the reduce_client_locks branch March 7, 2019 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants