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

Use sync/atomic.Pointer in zed.Context #4736

Merged
merged 1 commit into from
Aug 2, 2023
Merged

Conversation

nwt
Copy link
Member

@nwt nwt commented Aug 1, 2023

Context.Missing, Quiet, and StringTypeError are relatively expensive because they synchronize via Context.mu, and mutex overhead is relatively high. Change those methods to synchronize using atomic.Pointer, which has lower overhead than a mutex.

Context.Missing, Quiet, and StringTypeError are relatively expensive
because they synchronize via Context.mu, and mutex overhead is
relatively high.  Change those methods to synchronize using
atomic.Pointer, which has lower overhead than a mutex.
@nwt nwt requested a review from a team August 1, 2023 20:52
@nwt nwt merged commit 1d67316 into main Aug 2, 2023
3 checks passed
@nwt nwt deleted the atomic.Pointer-in-zed.Context branch August 2, 2023 20:34
@philrz
Copy link
Contributor

philrz commented Aug 18, 2023

@nwt: I've spotted what look like some statistically significant deltas in the Autoperf trend that correlate with this PR. I know the changes here were intended to approve performance so this is probably not a surprise, but figured I'd report the specifics to confirm that they line up with expectations.

The first is marked by the right-side red/vertical dotted line shown in this screenshot where the time to run these particular queries came down from ~6 minutes to ~4.5 minutes. It also looks like memory usage improved, e.g., "sys" memory down from ~95 MB to ~85 MB. The specific queries:

host_p==36 or port_num==36 or id.orig_p==36 or id.resp_p==36 or data_channel.resp_p==36 or p==36 or bound_p==36 | count() by _path | sort _path
host_p==80 or port_num==80 or id.orig_p==80 or id.resp_p==80 or data_channel.resp_p==80 or p==80 or bound_p==80 | count() by _path | sort _path

image

The other visible delta shows up on the memory side but not run time. These queries look like:

notice==true | count()
timedout==false | count()

image

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.

3 participants