Skip to content

Instantly share code, notes, and snippets.

@jpcamara
Last active October 1, 2024 03:51
Show Gist options
  • Save jpcamara/449ba40cb10a1ed7d93a8e1ee7f6b509 to your computer and use it in GitHub Desktop.
Save jpcamara/449ba40cb10a1ed7d93a8e1ee7f6b509 to your computer and use it in GitHub Desktop.
# first window
bundle install
bundle exec bento --falcon
# second window
make wsdirector # works
SCENARIO=broadcast make wsdirector # works
make anyt-falcon # works
./websocket-bench broadcast ws://localhost:8080/cable \
--concurrent 8 \
--sample-size 100 \
--step-size 200 \
--payload-padding 200 \
--total-steps 10 \
--origin http://0.0.0.0 \
--server-type=actioncable
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:57-04:00] clients: 200 95per-rtt: 4ms min-rtt: 1ms median-rtt: 1ms max-rtt: 4ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:57-04:00] clients: 400 95per-rtt: 5ms min-rtt: 1ms median-rtt: 1ms max-rtt: 5ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 600 95per-rtt: 8ms min-rtt: 1ms median-rtt: 1ms max-rtt: 8ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 800 95per-rtt: 36ms min-rtt: 0ms median-rtt: 1ms max-rtt: 37ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 1000 95per-rtt: 1ms min-rtt: 1ms median-rtt: 1ms max-rtt: 2ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 1200 95per-rtt: 1ms min-rtt: 1ms median-rtt: 1ms max-rtt: 1ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 1400 95per-rtt: 14ms min-rtt: 1ms median-rtt: 1ms max-rtt: 14ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 1600 95per-rtt: 16ms min-rtt: 1ms median-rtt: 1ms max-rtt: 20ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
[2024-09-30T22:41:58-04:00] clients: 1800 95per-rtt: 2ms min-rtt: 1ms median-rtt: 1ms max-rtt: 3ms
200 / 200 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
100 / 100 [--------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
Missing received broadcasts: expected 1100000, got 22333
[2024-09-30T22:42:00-04:00] clients: 2000 95per-rtt: 4ms min-rtt: 1ms median-rtt: 1ms max-rtt: 5ms
module Async
class Executor
class Timer < Data.define(:task)
def shutdown = task.stop
end
private attr_reader :semaphore
def initialize(max_size: 10)
# @semaphore = ::Async::Semaphore.new(max_size)
@queue = Queue.new
Thread.new do
Async do
loop do
block = @queue.pop
Async do
block.call
end
end
end
end
end
def post(task = nil, &block)
# task ||= block
# semaphore.async(&task)
@queue.push(block)
end
def timer(interval, &block)
task = Async do
loop do
sleep(interval)
block.call
end
end
Timer.new(task)
end
def shutdown
@executor.shutdown
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment