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

Investigate using Crossbeam lock-free queue + threads #30

Closed
56quarters opened this issue Dec 7, 2016 · 1 comment
Closed

Investigate using Crossbeam lock-free queue + threads #30

56quarters opened this issue Dec 7, 2016 · 1 comment
Assignees
Milestone

Comments

@56quarters
Copy link
Owner

There seems to be a fair amount of locking going on in the threadpool we're using. This, combined with how short the actual tasks to run are mean using a thread pool doesn't actually seem to make anything faster.

Let's investigate using the lock-free queue in Crossbeam along with some sort of custom thread worker. It's probably sufficient to only run a single thread worker as well.

http://aturon.github.io/crossbeam-doc/crossbeam/sync/struct.MsQueue.html

@56quarters 56quarters added this to the 0.9.0 milestone Dec 7, 2016
@56quarters 56quarters changed the title Investigate using Crossbean lock-free queue + threads Investigate using Crossbeam lock-free queue + threads Dec 7, 2016
@56quarters
Copy link
Owner Author

Performance looks promising so far.

test test_benchmark_statsdclient_count_async_buffered_udp ... bench:         502 ns/iter (+/- 160)
test test_benchmark_statsdclient_count_buffered_udp       ... bench:         391 ns/iter (+/- 131)
test test_benchmark_statsdclient_count_cb_buffered_udp    ... bench:         344 ns/iter (+/- 254)
test test_benchmark_statsdclient_count_nop                ... bench:         165 ns/iter (+/- 3)
test test_benchmark_statsdclient_count_udp                ... bench:       2,960 ns/iter (+/- 151)

The "cb" benchmark is the one that uses crossbeam.

56quarters added a commit that referenced this issue Dec 19, 2016
Implement an async MetricSink (QueuingMetricSink) that sends metrics
to a wrapped sink that runs in a separate thread. Communicate between
the sink and separate thread via a lock-free Crossbeam queue.

Fixes #30
56quarters added a commit that referenced this issue Dec 19, 2016
Implement an async MetricSink (QueuingMetricSink) that sends metrics
to a wrapped sink that runs in a separate thread. Communicate between
the sink and separate thread via a lock-free Crossbeam queue.

Fixes #30
56quarters added a commit that referenced this issue Dec 19, 2016
Implement an async MetricSink (QueuingMetricSink) that sends metrics
to a wrapped sink that runs in a separate thread. Communicate between
the sink and separate thread via a lock-free Crossbeam queue.

Fixes #30
56quarters added a commit that referenced this issue Dec 21, 2016
Implement an async MetricSink (QueuingMetricSink) that sends metrics
to a wrapped sink that runs in a separate thread. Communicate between
the sink and separate thread via a lock-free Crossbeam queue.

Fixes #30
@56quarters 56quarters self-assigned this Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant