-
Notifications
You must be signed in to change notification settings - Fork 95
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
Replace mutex in autopaho with atomic pointer #279
Comments
Can you please provide more information re "lock contentions", have you identified a performance issue in a real application which this change fixes? I'm open to the use of |
The lock contentions stem from upper layer application, where there are many Go routines that Publish/Subscribe/Unsubscribe through the client. But with current Subscribe/Unsubscribe (and to certain extent Publish, as async Publish doesn't return broker ack) as blocking operations until ack from broker, funneling them through a single channel is not viable. |
And has the change to |
Is your feature request related to a problem? Please describe.
Autopaho currently use mutex for Publish/Subscribe/etc. It can lead to lock contentions.
Describe the solution you'd like
Replace mutex with atomic.Pointer. Put cli, connUp, and connDown into one struct, so it can be stored in one atomic operation.
Additional context
Here is the implementation, only autopaho/auto* are modified.
The text was updated successfully, but these errors were encountered: