Auto-downscaling closes live websocket connections

My machine boots up when it receives a websocket connection, but it downscales after a couple of minutes, even with an active websocket connections (sending a few messages/second).

It seems to be kept alive as long as new connections are made regularly however.

2023-08-08T20:57:18.550 proxy [148ed127a21389] waw [info] Downscaling app doomed2-game-server-staging in region waw from 1 machines to 0 machines. Automatically stopping machine 148ed127a21389 

This is my config:

[[services]]
  internal_port = 2052
  protocol = "tcp"
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

  [services.concurrency]
    type = "connections"
    hard_limit = 50
    soft_limit = 30

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

The documentation says

if the Machine has no traffic (a load of 0), then the proxy stops the Machine

Doesn’t it see long-standing connections?

Hi,
I got the same issue, not yet solved, with weird downscaling and rebooting even if there are active users https://community.fly.io/t/app-restarting-every-5-minutes/14709

I’ve pushed a possible fix. Can you let us know if it helped?

1 Like

Thank you! That fixed it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.