Closed moguchev closed 3 weeks ago
Please add a descriptive commit message to your commit.
I would recommend to use atomic.Pointer
instead, please take a look this paper
Since HostInfo
experiance mostly read access, referred solution is going to be up to 90 times
faster than this one.
@moguchev - can you refresh the PR, addressing above comments?
@moguchev - can you refresh the PR, addressing above comments?
Yes, I’ll do it
@moguchev , I have given a try to atomic update
, it is too intrusive and is going to create lot's of conflict with upstream
, so it is better not to do that
Thanks @moguchev for your contribution!
1.14.2 was released with your contribution @moguchev - thanks again!
I know that there is comment by @zariel to reduce locking.
I didn't thoroughly refactor the code, but I found fast and cheap optimization in functions
(*HostInfo).HostName
and(*HostInfo).HostNameAndPort
.In our case of https://github.com/scylladb/gocql/pull/164
(*HostInfo).HostName
leads to spending a lot of time in Lock... Also inQueryObserver
andBatchObserver
we calls public methods ofHostInfo
(HostName
,HostNameAndPort
) for metrics and we have a lot of mutex locks.