Giter Site home page Giter Site logo

rmq-ws-test's Introduction

rmq-ws-test

Testbed to isolate rabbitmq/websocket interaction

Setup local copy of this sample project

  • git clone
  • ensure the version of ruby and the gemset are consistent
  • bundle install

Install NodeJS (if not installed)

An installation of NodeJS is required, but there are no other external dependencies. See Benchmarking Web Socket servers with wsbench

After install, check the version of node installed with:

node -v

The version should be >= 0.8.21

Install wsbench tool

The source of this tool is available at https://github.com/pgriess/wsbench, and there are outstanding pull requests for patches, but the author doesn't seem to be willing to accept them for some reason.

  1. Manually apply PR5 if it has not been merged: pgriess/wsbench#5

  2. Manually apply PR8 if it has not been merged: pgriess/wsbench#8

  3. Ensure that the wsbench file ix executable:

chmod +x wsbench

Start Thin webserver

bundle exec thin start -C thin.yml

Use wsbench to generate websocket traffic

node wsbench -c 5 -r 10 ws://localhost:8080/websocket

This attempts to connect 5 times to the web socket.

Errors

Sample logfile contents:

>> Writing PID to thin.8080.pid
>> Using rack adapter
New AMQP connection.
WebSocket opened
WebSocket closed
Channel 1 opened.
WebSocket opened
Channel 3 opened.
Closing amqp channel 3
WebSocket closed
amqp channel 3 closed.
WebSocket opened
WebSocket closed
>> Exiting!
/Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amq-client-0.9.12/lib/amq/client/async/adapter.rb:248:in `send_frame': Trying to send frame through a closed connection. Frame is #<AMQ::Protocol::MethodFrame:0x007fe8eb85b570 @payload="\x00\x14\x00\n\x00", @channel=3>, method class is AMQ::Protocol::Channel::Open (AMQ::Client::ConnectionClosedError)
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amq-client-0.9.12/lib/amq/client/async/channel.rb:110:in `open'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amqp-0.9.9/lib/amqp/channel.rb:914:in `open'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amqp-0.9.9/lib/amqp/channel.rb:235:in `block in initialize'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/eventmachine-1.0.1/lib/em/deferrable.rb:48:in `call'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/eventmachine-1.0.1/lib/em/deferrable.rb:48:in `callback'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amq-client-0.9.12/lib/amq/client/async/adapters/event_machine.rb:112:in `on_open'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/amqp-0.9.9/lib/amqp/channel.rb:234:in `initialize'
	from /Users/wchrisjohnson/code/rmq-ws-test/web_socket_app.rb:16:in `new'
	from /Users/wchrisjohnson/code/rmq-ws-test/web_socket_app.rb:16:in `block (3 levels) in <top (required)>'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/em-websocket-0.3.8/lib/em-websocket/connection.rb:22:in `call'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/em-websocket-0.3.8/lib/em-websocket/connection.rb:22:in `trigger_on_open'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/em-websocket-0.3.8/lib/em-websocket/handler.rb:18:in `run'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/em-websocket-0.3.8/lib/em-websocket/connection.rb:116:in `dispatch'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/em-websocket-0.3.8/lib/em-websocket/connection.rb:73:in `receive_data'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/eventmachine-1.0.1/lib/eventmachine.rb:187:in `run_machine'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/eventmachine-1.0.1/lib/eventmachine.rb:187:in `run'
	from /Users/wchrisjohnson/code/rmq-ws-test/web_socket_app.rb:4:in `<top (required)>'
	from /Users/wchrisjohnson/code/rmq-ws-test/wrapper_app.rb:3:in `require_relative'
	from /Users/wchrisjohnson/code/rmq-ws-test/wrapper_app.rb:3:in `<top (required)>'
	from /Users/wchrisjohnson/code/rmq-ws-test/config.ru:1:in `require'
	from /Users/wchrisjohnson/code/rmq-ws-test/config.ru:1:in `block in <main>'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
	from /Users/wchrisjohnson/code/rmq-ws-test/config.ru:1:in `new'
	from /Users/wchrisjohnson/code/rmq-ws-test/config.ru:1:in `<main>'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `eval'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `load'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/rack/adapter/loader.rb:42:in `for'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/thin/controllers/controller.rb:169:in `load_adapter'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/thin/controllers/controller.rb:73:in `start'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/bin/thin:23:in `load'
	from /Users/wchrisjohnson/.rvm/gems/ruby-1.9.3-p374@rmq-ws-test/bin/thin:23:in `<main>'

RabbitMQ logfile entries:

=INFO REPORT==== 4-Mar-2013::00:28:14 ===
accepting AMQP connection <0.4446.4> (localhost:51997 -> localhost:5672)

=INFO REPORT==== 4-Mar-2013::00:28:25 ===
accepting AMQP connection <0.4465.4> (localhost:51999 -> localhost:5672)

=ERROR REPORT==== 4-Mar-2013::00:28:25 ===
AMQP connection <0.4465.4> (running), channel 3 - error:
{amqp_error,channel_error,"expected 'channel.open'",'queue.bind'}

=WARNING REPORT==== 4-Mar-2013::00:28:25 ===
closing AMQP connection <0.4446.4> (localhost:51997 -> localhost:5672):
connection_closed_abruptly

=INFO REPORT==== 4-Mar-2013::00:28:25 ===
closing AMQP connection <0.4465.4> (localhost:51999 -> localhost:5672)

The error can be prevented by removing/commenting out the channel close logic inside the web_socket_app.

rmq-ws-test's People

Contributors

wchrisjohnson avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.