Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test WEB_CONCURRENCY calculation for larger dyno sizes #1555

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions spec/hatchet/profile_d_scripts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@
OUTPUT
end

# Performance-L-RAM
app.run_multi(list_concurrency_envs_cmd, heroku: { size: 'performance-l-ram', type: 'web' }) do |output, _|
expect(output).to eq(<<~OUTPUT)
Python buildpack: Detected 30720 MB available memory and 4 CPU cores.
Python buildpack: Defaulting WEB_CONCURRENCY to 9 based on the number of CPU cores.
DYNO_RAM=30720
WEB_CONCURRENCY=9
OUTPUT
end

# Performance-XL
app.run_multi(list_concurrency_envs_cmd, heroku: { size: 'performance-xl', type: 'web' }) do |output, _|
expect(output).to eq(<<~OUTPUT)
Python buildpack: Detected 63488 MB available memory and 8 CPU cores.
Python buildpack: Defaulting WEB_CONCURRENCY to 17 based on the number of CPU cores.
DYNO_RAM=63488
WEB_CONCURRENCY=17
OUTPUT
end

# Performance-2XL
app.run_multi(list_concurrency_envs_cmd, heroku: { size: 'performance-2xl', type: 'web' }) do |output, _|
expect(output).to eq(<<~OUTPUT)
Python buildpack: Detected 129024 MB available memory and 16 CPU cores.
Python buildpack: Defaulting WEB_CONCURRENCY to 33 based on the number of CPU cores.
DYNO_RAM=129024
WEB_CONCURRENCY=33
OUTPUT
end

# Check that WEB_CONCURRENCY is preserved if set, but that we still set DYNO_RAM.
app.run_multi(list_concurrency_envs_cmd, heroku: { env: 'WEB_CONCURRENCY=999', type: 'web' }) do |output, _|
expect(output).to eq(<<~OUTPUT)
Expand Down
3 changes: 3 additions & 0 deletions vendor/WEB_CONCURRENCY.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# - Standard-2X / Private-S / Shield-S: 4 (capped by the 1 GB available memory)
# - Performance-M / Private-M / Shield-M: 5 (based on the 2 CPU cores)
# - Performance-L / Private-L / Shield-L: 17 (based on the 8 CPU cores)
# - Performance-L-RAM / Private-L-RAM / Shield-L-RAM: 9 (based on the 4 CPU cores)
# - Performance-XL / Private-XL / Shield-XL: 17 (based on the 8 CPU cores)
# - Performance-2XL / Private-2XL / Shield-2XL: 33 (based on the 16 CPU cores)
#
# To override these default values, either set `WEB_CONCURRENCY` as an explicit config var
# on the app, or pass `--workers <num>` when invoking gunicorn/uvicorn in your Procfile.
Expand Down