Skip to content

Commit

Permalink
Set benchmark concurrency levels to 1, 10, 20, 50
Browse files Browse the repository at this point in the history
  • Loading branch information
slashdotdash committed Jan 5, 2018
1 parent 20d7525 commit dc51b3c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,23 @@ Example output:

```
## AppendEventsBench
append events, single writer 100 10170.26 µs/op
append events, 10 concurrent writers 20 85438.80 µs/op
append events, 100 concurrent writers 2 1102006.00 µs/op
benchmark name iterations average time
append events, single writer 100 20288.68 µs/op
append events, 10 concurrent writers 10 127416.90 µs/op
append events, 20 concurrent writers 5 376836.60 µs/op
append events, 50 concurrent writers 2 582350.50 µs/op
## ReadEventsBench
read events, single reader 1000 1578.10 µs/op
read events, 10 concurrent readers 100 16799.80 µs/op
read events, 100 concurrent readers 10 167397.30 µs/op
benchmark name iterations average time
read events, single reader 500 3674.93 µs/op
read events, 10 concurrent readers 50 44653.98 µs/op
read events, 20 concurrent readers 20 73927.55 µs/op
read events, 50 concurrent readers 10 188244.80 µs/op
## SubscribeToStreamBench
benchmark name iterations average time
subscribe to stream, 1 subscription 100 27687.97 µs/op
subscribe to stream, 10 subscriptions 50 56047.72 µs/op
subscribe to stream, 20 subscriptions 10 194164.40 µs/op
subscribe to stream, 50 subscriptions 5 320435.40 µs/op
```

## Contributing
Expand Down
10 changes: 7 additions & 3 deletions bench/storage/append_events_bench.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ defmodule AppendEventsBench do
end

bench "append events, single writer" do
EventStore.append_to_stream(UUID.uuid4, 0, bench_context)
append_events(bench_context, 1)
end

bench "append events, 10 concurrent writers" do
append_events(bench_context, 10)
end

bench "append events, 100 concurrent writers" do
append_events(bench_context, 100)
bench "append events, 20 concurrent writers" do
append_events(bench_context, 20)
end

bench "append events, 50 concurrent writers" do
append_events(bench_context, 50)
end

defp append_events(events, concurrency) do
Expand Down
12 changes: 7 additions & 5 deletions bench/storage/read_events_bench.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ defmodule ReadEventsBench do
end

bench "read events, single reader" do
{:ok, _} = EventStore.read_stream_forward(bench_context)

:ok
read_stream_forward(bench_context, 1)
end

bench "read events, 10 concurrent readers" do
read_stream_forward(bench_context, 10)
end

bench "read events, 100 concurrent readers" do
read_stream_forward(bench_context, 100)
bench "read events, 20 concurrent readers" do
read_stream_forward(bench_context, 20)
end

bench "read events, 50 concurrent readers" do
read_stream_forward(bench_context, 50)
end

defp read_stream_forward(stream_uuid, concurrency) do
Expand Down
8 changes: 6 additions & 2 deletions bench/storage/subscribe_to_stream_bench.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ defmodule SubscribeToStreamBench do
subscribe_to_stream(bench_context, 10)
end

bench "subscribe to stream, 100 subscriptions" do
subscribe_to_stream(bench_context, 100)
bench "subscribe to stream, 20 subscriptions" do
subscribe_to_stream(bench_context, 20)
end

bench "subscribe to stream, 50 subscriptions" do
subscribe_to_stream(bench_context, 50)
end

defp subscribe_to_stream(events, concurrency) do
Expand Down

0 comments on commit dc51b3c

Please sign in to comment.