What does "dfw [warn] Instance reached connections hard limit of 25" mean?

I saw this in my logs and don’t know what it means:

2021-07-16T13:20:56.614499379Z proxy[6e3ab6c3] dfw [warn] Instance reached connections hard limit of 25

Should I be concerned? What can I do about this?

1 Like

This means the app has as many connections to a particular VM as its allowed. When this happens, we route requests to the next closest VM with capacity.

There are settings in fly.toml that control this, you’ll see a soft limit (which controls scaling) and a hard limit, which is what you hit. You can likely set that very high if your app is lightweight. Like 100-200.

1 Like

Sweet :+1:

What could happen if I set it to something too high, like 1000?

Worst case is we overload your app process, which will make the app unresponsive for people.

1 Like

@kentcdodds what did you do in the end for this? Also do you have any idea what could be causing it?

The reason I am asking is because I am having issues with my production app. Staging app which is also on fly works without issue.
So I also had the same warning as you and then the app works for a minute or 2 and then i get those errors:

023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] healthcheck ❌ {

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] error: PrismaClientUnknownRequestError:

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] Invalid `prisma.user.count()` invocation:

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] Error occurred during query execution:

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42P05), message: "prepared statement \"s2\" already exists", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("prepare.c"), line: Some(412), routine: Some("StorePreparedStatement") }) }), transient: false })

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at Pn.handleRequestError (/myapp/node_modules/@prisma/client/runtime/library.js:171:7103)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at Pn.handleAndLogRequestError (/myapp/node_modules/@prisma/client/runtime/library.js:171:6358)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at Pn.request (/myapp/node_modules/@prisma/client/runtime/library.js:171:6237)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at async Promise.all (index 0)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at loader3 (/myapp/build/index.js:19643:12)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at Object.callRouteLoaderRR (/myapp/node_modules/@remix-run/server-runtime/dist/data.js:52:16)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at callLoaderOrAction (/myapp/node_modules/@remix-run/router/router.ts:3550:16)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at async Promise.all (index 0)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at loadRouteData (/myapp/node_modules/@remix-run/router/router.ts:2983:19)

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] at queryImpl (/myapp/node_modules/@remix-run/router/router.ts:2762:20) {

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] clientVersion: '4.14.1'

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] }

2023-05-26T07:55:45.922 app[148ed433fe93d8] ams [info] } 

I’d suggest opening a new post, but here’s what I have: kentcdodds.com/fly.toml at 98aeb1796526a95aeb166103d5097023ae2e2c23 · kentcdodds/kentcdodds.com · GitHub