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

PublisherAsBlockingIterable LinkedBlockingQueue -> SpscBlockingQueue #2384

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Scottmitch
Copy link
Member

@Scottmitch Scottmitch commented Oct 1, 2022

Motivation:
LinkedBlockingQueue allows for multiple producers and multiple consumers.
It uses LockSupport park in offer and unpark in take. LockSupport unpark
on the EventLoop thread has been shown to impact throughput during benchmarks.

SpscBlockingQueue (yield_count == 1)

Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  291045 requests in 30s
Requests/sec: 9701.50
Transfer/sec: -
OK: 291045
KO: 0

SpscBlockingQueue (yield_count == 2)

Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  328586 requests in 30s
Requests/sec: 10952.87
Transfer/sec: -
OK: 328586
KO: 0

LinkedTransferQueue

Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  289396 requests in 30s
Requests/sec: 9646.53
Transfer/sec: -
OK: 289396
KO: 0

@Scottmitch Scottmitch force-pushed the spsc_blocking_queue branch 2 times, most recently from b5163cf to 0a1fbdd Compare October 2, 2022 15:44
@Scottmitch Scottmitch changed the title [wip] PublisherAsBlockingIterable LinkedBlockingQueue -> SpscBlockingQueue PublisherAsBlockingIterable LinkedBlockingQueue -> SpscBlockingQueue Oct 2, 2022
@Scottmitch Scottmitch marked this pull request as ready for review October 2, 2022 15:46
@Scottmitch Scottmitch marked this pull request as draft October 2, 2022 17:47
@Scottmitch Scottmitch force-pushed the spsc_blocking_queue branch 2 times, most recently from 24eb4f4 to 091d729 Compare October 3, 2022 04:57
@Scottmitch Scottmitch marked this pull request as ready for review October 3, 2022 05:22
@Scottmitch Scottmitch marked this pull request as draft October 3, 2022 15:50
@Scottmitch Scottmitch force-pushed the spsc_blocking_queue branch 6 times, most recently from 4c8807d to 349f085 Compare October 4, 2022 15:53
@Scottmitch
Copy link
Member Author

LinkedTransferQueue also does Thread.yield and provides similar results for yield_count == 1 ... lets start with this queue first: #2386

@Scottmitch Scottmitch force-pushed the spsc_blocking_queue branch 4 times, most recently from f698774 to d46403b Compare October 6, 2022 05:56
Motivation:
LinkedBlockingQueue allows for multiple producers and multiple consumers.
It uses LockSupport park in offer and unpark in take. LockSupport unpark
on the EventLoop thread has been shown to impact throughput during benchmarks.

SpscBlockingQueue (yield_count == 1)
```
Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  291045 requests in 30s
Requests/sec: 9701.50
Transfer/sec: -
OK: 291045
KO: 0
```

SpscBlockingQueue (yield_count == 2)
```
Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  328586 requests in 30s
Requests/sec: 10952.87
Transfer/sec: -
OK: 328586
KO: 0
```

LinkedTransferQueue
```
Running 30s test @ http://localhost:8080/medium, using 'ServiceTalkGrpcBlockingClientStrAgg' client
  1024 threads and 1024 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency       -          -       -           -
    Req/Sec     0.01k        -     0.01k         -
  289396 requests in 30s
Requests/sec: 9646.53
Transfer/sec: -
OK: 289396
KO: 0
```
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.

2 participants