Fly Machine doesn't follow fly.toml changes for concurrency limits

I have an existing app that’s hitting the default concurrency limits. I updated the limits in fly.toml, a new version of the app deployed, but I still see the limit warning on the monitor logs:

  [services.concurrency]
    hard_limit = 250
    soft_limit = 200
    type = "requests"

https://github.com/manasites/starrail/blob/main/fly.core.toml

I checked with fly config display -a starrail to confirm that the toml is read correctly:

image

But I’m still getting the warning on the old 25 connection limit:

sea [warn] Instance *** reached hard limit of 25 concurrent connections. This usually indicates your app is not closing connections properly or is not closing them fast enough for the traffic levels it is handling. Scaling resources, number of instances or increasing your hard limit might help.

Is there something else I need to do for the updated concurrency limits to take?

From General to Questions / Help

Looking into this is a bit more, is it because we have both a http_service and services section in fly.toml?

hi @xHomu ,

I think this is indeed because you have conflicting / overlapping service definitions.

You have both an http_service and a plain service definition, both pointing to the same internal port, and exposing the same external ports.

So it’s likely your limit configuration is applying to the services section only, and the http_service section is taking precedence.

In general, not a great idea to have conflicting service definitions! So I would remove one of them and set the limits up in the remaining one.

  • Daniel
1 Like

Thanks for confirming, @roadmr!

Deleting the [[services]] definition and use http_service.concurrency got everything working nicely!

primary_region = "sea"
kill_signal = "SIGINT"
kill_timeout = "5s"

[build]
  dockerfile = "core.Dockerfile"

[env]
  PORT = "8080"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  processes = ["app"]
  [http_service.concurrency]
    type = "requests"
    soft_limit = 800
    hard_limit = 1000

[[vm]]
  cpu_kind = "shared"
  cpus = 1
  memory_mb = 512

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