0

Since trying out ActionCable in a a local, dev environment. I have noticed the application slowing down and frequently hanging.

If I run netstat I see many connections, created by action cable. Is this expected and normal?

 netstat -atn | grep 3000
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52163        ESTABLISHED
tcp4       0      0  127.0.0.1.52163        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52161        ESTABLISHED
tcp4       0      0  127.0.0.1.52161        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52159        ESTABLISHED
tcp4       0      0  127.0.0.1.52159        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52157        ESTABLISHED
tcp4       0      0  127.0.0.1.52157        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52155        ESTABLISHED
tcp4       0      0  127.0.0.1.52155        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52152        ESTABLISHED
tcp4       0      0  127.0.0.1.52152        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  127.0.0.1.3000         127.0.0.1.52146        ESTABLISHED
tcp4       0      0  127.0.0.1.52146        127.0.0.1.3000         ESTABLISHED
tcp4       0      0  *.3000                 *.*                    LISTEN
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51682        TIME_WAIT
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51688        TIME_WAIT
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51684        TIME_WAIT
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51686        TIME_WAIT
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51667        TIME_WAIT
tcp4       0      0  127.0.0.1.3000         127.0.0.1.51690        TIME_WAIT

I have tried changing the eager loading, but it doesn't seem to change this behaviour

config.eager_load = true
port5432
  • 5,889
  • 10
  • 60
  • 97
  • 1
    how you are maintaining the connections – Tushar Pal Jul 11 '17 at 07:40
  • Just using ActionCable default settings for a simple notification – port5432 Jul 11 '17 at 09:33
  • 1
    so that will not be the problem bcoz you are using default setting so it's created multiple connection .To avoid it you can use configuration of production by setting up production conf. development: adapter: async test: adapter: async production: adapter: redis url: redis://10.10.3.153:6381 channel_prefix: appname_production – Tushar Pal Jul 11 '17 at 09:45
  • Could you let us know which server you are using in development? I'd hazard a guess that if you were to move to Puma in development the problem would be resolved. – stef Jul 11 '17 at 13:09
  • @stef I'm using Puma with Rails 5.1 – port5432 Jul 12 '17 at 05:42

1 Answers1

0
production:
 adapter: redis
 url: redis://redis.example.com:6379

local: &local
 adapter: redis
 url: redis://localhost:6379

development: *local
test: *local

https://www.phusionpassenger.com/library/config/standalone/action_cable_integration/

Follow the link

Async Adapter

The async adapter is intended for development/testing and should not be used in production.

Redis Adapter

Action Cable contains two Redis adapters: "normal" Redis and Evented Redis. Both of the adapters require users to provide a URL pointing to the Redis server. Additionally, a channel_prefix may be provided to avoid channel name collisions when using the same Redis server for multiple applications. See the Redis PubSub documentation for more details.

PostgreSQL Adapter

The PostgreSQL adapter uses Active Record's connection pool, and thus the application's config/database.yml database configuration, for its connection. This may change in the future.

Tushar Pal
  • 503
  • 6
  • 16