Sha256: 62dd104b1b8d18f4b2e6fcaf401ce3625dc76f7bbfaac0e30ecb0ff80c0d1239
Contents?: true
Size: 1.65 KB
Versions: 5
Compression:
Stored size: 1.65 KB
Contents
#!/usr/bin/env ruby # Example benchmark scripts: # # websocket-bench broadcast ws://127.0.0.1:3000/ --concurrent 10 --sample-size 100 --server-type binary --step-size 1000 --limit-percentile 95 --limit-rtt 250ms --initial-clients 1000 # # websocket-bench broadcast ws://127.0.0.1:3000/ --concurrent 10 --sample-size 100 --step-size 1000 --limit-percentile 95 --limit-rtt 250ms --initial-clients 1000 --server-type json # Dir.chdir(File.expand_path(File.join('..', '..', 'lib'), __FILE__)) require 'bundler/setup' require 'plezi' class ShootoutApp CHANNEL = "shootout".freeze # the default HTTP response def index "This application should be used with the websocket-shootout benchmark utility." end def on_open subscribe CHANNEL end # we won't be using AutoDispatch, but directly using the `on_message` callback. def on_message data if data[0] == 'b' # binary publish(CHANNEL, data) data[0] = 'r' write data return end cmd, payload = JSON(data).values_at('type', 'payload') if cmd == 'echo' write({type: 'echo', payload: payload}.to_json) else publish(CHANNEL, ({type: 'broadcast', payload: payload}.to_json)) write({type: "broadcastResult", payload: payload}.to_json) end rescue puts "Incoming message format error - not JSON?" end end Plezi.route '*', ShootoutApp # # def cycle # puts `websocket-bench broadcast ws://127.0.0.1:3000/ --concurrent 10 --sample-size 100 --server-type binary --step-size 1000 --limit-percentile 95 --limit-rtt 250ms --initial-clients 1000` # sleep(2) # puts `wrk -c4000 -d15 -t12 http://localhost:3000/` # true # end # sleep(10) while cycle
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
plezi-0.16.4 | bin/ws_shootout |
plezi-0.16.3 | bin/ws_shootout |
plezi-0.16.2 | bin/ws_shootout |
plezi-0.16.1 | bin/ws_shootout |
plezi-0.16.0 | bin/ws_shootout |