Skip to content

Consider avoiding Concurrent.processor_count when setting default background_worker_threads #2297

Closed

Description

Issue Description

Since #1155 we have the ability to configure background_worker_threads which currently defaults to `Concurrent.processor_count. However, this config is likely to be too high in a shared hosting environment, leading to unnecessary memory usage. It may make sense to change the default to, say, a static 1 or 3 and add documentation about how best to configure?

See also: https://github.com/rails/rails/pull/50669/files#diff-e25cab4832f078ca2f9dffa8918f895c8474f8086878e4ced9f5795131fc2de2R32

/cc @st0012

Feel free to disregard, since this is easy to correct, but in my case I was surprised at the impact lowering from 8 to 1 made on my memory use on Heroku.

Reproduction Steps

$ heroku run rails c
Running rails c on ⬢ APP_NAME... up, run.4033 (Standard-1X)
Loading production environment (Rails 7.1.3.2)
irb(main):001> Concurrent.processor_count
=> 8

Expected Behavior

Consider defaulting to a static/lower number of background_worker_threads.

Actual Behavior

Defaults to Concurrent.processor_count.

Ruby Version

3.3.3

SDK Version

5.17.3

Integration and Its Version

No response

Sentry Config

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions