github.com/anycable/anycable-go@v1.5.1/features/broadcasts.benchfile (about)

     1  launch :rpc, "bundle exec anyt --only-rpc"
     2  wait_tcp 50051
     3  
     4  launch :anycable, "./dist/anycable-go"
     5  wait_tcp 8080
     6  
     7  BENCHMARK_COMMAND = <<~CMD
     8    websocket-bench broadcast --concurrent 40 --sample-size 100 \
     9    --step-size 200 --payload-padding 200 --total-steps 4 \
    10    --wait-broadcasts 30 \
    11    ws://localhost:8080/cable --server-type=actioncable
    12  CMD
    13  
    14  run :bench, BENCHMARK_COMMAND
    15  
    16  result = stdout(:bench)
    17  
    18  if result =~ /Missing received broadcasts: expected (\d+), got (\d+)/
    19    expected = Regexp.last_match[1].to_i
    20    actual = Regexp.last_match[2].to_i
    21  
    22    if (actual / expected.to_f) < 0.9
    23      fail "Received less than 90% of expected broadcasts: #{actual} / #{expected}"
    24    end
    25  end