Skip to content

Conversation

@dzuelke
Copy link
Contributor

@dzuelke dzuelke commented Jan 13, 2026

The Ruby buildpack sets the WEB_CONCURRENCY env var at app boot based on the current dyno size if the (deprecated) SENSIBLE_DEFAULTS mode is enabled, so long as the user hasn't specified a custom value via the app's config vars.

Now, in addition to setting the WEB_CONCURRENCY env var, the buildpack will also set WEB_CONCURRENCY_SET_BY=heroku/ruby to allow the app, other boot time scripts, or humans more easily differentiate between a user and a buildpack provided WEB_CONCURRENCY (and determine which buildpack actually set it).

In addition to assisting with debugging, this allows for UX improvements in other buildpacks such as the PHP buildpack, which can now check for WEB_CONCURRENCY_SET_BY in its boot time Apache/Nginx heroku-php-... scripts to ignore WEB_CONCURRENCY in cases where users have ordered the buildpacks on their app in the wrong order (the "primary" language is supposed to be listed last, otherwise the wrong concurrency value will be used).

See also:
heroku/heroku-buildpack-nodejs#932
heroku/heroku-buildpack-php#883
heroku/heroku-buildpack-python#2015

GUS-W-20882005

The Ruby buildpack sets the `WEB_CONCURRENCY` env var at app boot based on the
current dyno size if the (deprecated) `SENSIBLE_DEFAULTS` mode is enabled, so
long as the user hasn't specified a custom value via the app's config vars.

Now, in addition to setting the `WEB_CONCURRENCY` env var, the buildpack will
also set `WEB_CONCURRENCY_SET_BY=heroku/ruby` to allow the app, other boot time
scripts, or humans more easily differentiate between a user and a buildpack
provided `WEB_CONCURRENCY` (and determine which buildpack actually set it).

In addition to assisting with debugging, this allows for UX improvements in
other buildpacks such as the PHP buildpack, which can now check for
`WEB_CONCURRENCY_SET_BY` in its boot time Apache/Nginx `heroku-php-...` scripts
to ignore `WEB_CONCURRENCY` in cases where users have ordered the buildpacks on
their app in the wrong order (the "primary" language is supposed to be listed
last, otherwise the wrong concurrency value will be used).

See also:
heroku/heroku-buildpack-nodejs#932
heroku/heroku-buildpack-python#2015

GUS-W-20882005
@schneems
Copy link
Contributor

schneems commented Jan 13, 2026

Thanks! I can approve and merge this around the 24th. I think we should track usage and deprecate/remove instead of continuing to add fetures here. This feature was never promoted and I doubt it's highly used.

Other libraries like puma have their own WEB_CONCURRENCY=auto features. We can invest in documenting our cgroups settings so they can "do it right" and do an audit of top libraries to see that they're doing the right thing ™️

edmorley added a commit to heroku/heroku-buildpack-python that referenced this pull request Jan 13, 2026
The Python buildpack sets the `WEB_CONCURRENCY` env var at app boot
based on the current dyno size, so long as the user hasn't specified
a custom value via the app's config vars.

Now, in addition to setting the `WEB_CONCURRENCY` env var, the buildpack
will also set `WEB_CONCURRENCY_SET_BY=heroku/python` to allow the app,
other boot time scripts, or humans more easily differentiate between
user and buildpack provided `WEB_CONCURRENCY` values (plus determine
which buildpack actually set it).

In addition to assisting with debugging, this allows for UX improvements
in other buildpacks such as the PHP buildpack, which can now check for
`WEB_CONCURRENCY_SET_BY` in its boot time Apache/Nginx `heroku-php-...`
scripts - helping detect the case where users have ordered the buildpacks
on their app in the wrong order. (The "primary" language is supposed to be
listed last, otherwise the wrong concurrency value will be used.)

See also:

- heroku/heroku-buildpack-php#883
- heroku/heroku-buildpack-nodejs#932
- heroku/heroku-buildpack-ruby#1700

GUS-W-20866598.
@dzuelke
Copy link
Contributor Author

dzuelke commented Jan 14, 2026

Yeah, totally realize it's a deprecated feature for the Ruby buildpack, I just figured we'd still want parity across buildpacks for this case, at least until SENSIBLE_DEFAULTS is removed :)

@edmorley edmorley removed the request for review from a team January 15, 2026 16:09
This feature is deprecated, let's see how many people still rely on it.
@schneems schneems force-pushed the web-concurrency-set-by branch from 736566b to 8114279 Compare January 26, 2026 14:57
@schneems schneems enabled auto-merge (squash) January 26, 2026 15:10
@schneems schneems merged commit 88d5afd into main Jan 26, 2026
4 checks passed
@schneems schneems deleted the web-concurrency-set-by branch January 26, 2026 15:11
@heroku-linguist heroku-linguist bot mentioned this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants