https://github.com/anycable/simple-cable-app
Minimal ActionCable/AnyCable application which could be deployed on Heroku
https://github.com/anycable/simple-cable-app
Last synced: 12 months ago
JSON representation
Minimal ActionCable/AnyCable application which could be deployed on Heroku
- Host: GitHub
- URL: https://github.com/anycable/simple-cable-app
- Owner: anycable
- Created: 2018-04-28T14:22:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-05T02:58:47.000Z (almost 4 years ago)
- Last Synced: 2025-02-26T00:47:55.925Z (over 1 year ago)
- Language: Ruby
- Size: 2.68 MB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Cable
Minimal ActionCable/AnyCable application which could be deployed on Heroku
and also a playground for performance experiments.
## Deployment
```sh
# 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
```
## Integration Tests
You can use [wsdirector](https://github.com/palkan/wsdirector) to verify your deployment:
```sh
wsdirector features/broadcast.yml wss://simple-cable-app.herokuapp.com/cable -s 10
```
See `features/` folder for available scenarios.
## Benchmarking/testing
Use [websocket-bench](https://github.com/anycable/websocket-bench) for stress testing.
For example, to run `broadcast` scenario you use the predefined options:
```ruby
cat benchmarks/broadcast.opts | xargs websocket-bench broadcast
...
```
Use [ACLI](https://github.com/palkan/acli) to connect to Action Cable server from your terminal.
## Heap capturing
- Run server with `DUMP=1` (`DUMP=1 bundle exec puma -p 8080` or `DUMP=1 bundle exec anycable --server-command="anycable-go --port 8080" -r ./anycable.rb`)
- Do some stress (see `benchmarks/simulate.rb`)
- Connect to a server passing `?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`)
- Run `ruby etc/heapme.rb tmp/heap.json` to generate a `heap.png` (like the one below)
