Minimal ActionCable/AnyCable application which could be deployed on Heroku and also a playground for performance experiments.
# Create app
heroku create simple-cable-app
# We need Redis for pub/sub
heroku addons:create heroku-redis
# Configure buildpacks
heroku buildpacks:add https://github.com/anycable/heroku-anycable-go
heroku buildpacks:add heroku/ruby
heroku config:set ANYCABLE_DEPLOYMENT=true
# (optionally) Use anycable-go with mruby support
# and log stats in Librato format
heroku config:set HEROKU_ANYCABLE_GO_VERSION=0.6.4-mrb
heroku config:set ANYCABLE_METRICS_LOG_FORMATTER=etc/anycable_librato_logger.rb
git push heroku master
You can use wsdirector to verify your deployment:
wsdirector features/broadcast.yml wss://simple-cable-app.herokuapp.com/cable -s 10
See features/
folder for available scenarios.
Use websocket-bench for stress testing.
For example, to run broadcast
scenario you use the predefined options:
cat benchmarks/broadcast.opts | xargs websocket-bench broadcast
...
Use ACLI to connect to Action Cable server from your terminal.
DUMP=1
(DUMP=1 bundle exec puma -p 8080
or DUMP=1 bundle exec anycable --server-command="anycable-go --port 8080" -r ./anycable.rb
)benchmarks/simulate.rb
)?dump=1
param (e.g., using ACLI: acli -u "ws://localhost:8080/cable?dump"
) to dump the current ObjectSpace
into a file (tmp/heap.json
)ruby etc/heapme.rb tmp/heap.json
to generate a heap.png
(like the one below)