Skip to content

Commit

Permalink
pub benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubwro committed Sep 28, 2023
1 parent a89bffd commit 5368090
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/consts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const DEFAULT_CONNECT_ARGS = (
headers = true,
nkey = nothing
)
const OUTBOX_SIZE = 1000000
const OUTBOX_SIZE = 10000000
const SOCKET_CONNECT_DELAYS = Base.ExponentialBackOff(n=1000, first_delay=0.5, max_delay=1)
const SUBSCRIPTION_CHANNEL_SIZE = 10000

Expand Down
17 changes: 17 additions & 0 deletions test/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,21 @@ end
unsubscribe(sub; connection)
@info "$counter requests / second."
NATS.status()
end

@testset "Publisher benchmark." begin
connection = NATS.connect(async_handlers = false, default = false)

tm = Timer(1.0)
counter = 0
while isopen(tm)
if Base.n_avail(connection.outbox) > 5000
sleep(0.001)
continue
end
publish("zxc"; payload = "Hello world!!!!!", connection)
counter = counter + 1
end

@info "Published $counter messages."
end

0 comments on commit 5368090

Please sign in to comment.