Skip to content

Conversation

@byroot
Copy link
Contributor

@byroot byroot commented Jan 9, 2024

I may be off, but it seems to be that in the overwhelming majority of use cases, one will want a fixed number of threads rather than a mix/max, and the --threads CLI argument already allow to pass a single number.

I such I think it would simplify many configs.

I may be off, but it seems to be that in the overwhelming
majority of use cases, one will want a fixed number of threads
rather than a mix/max, and the `--threads` CLI argument
already allow to pass a single number.

I such I think it would simplify many configs.
Copy link
Member

@dentarg dentarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dentarg
Copy link
Member

dentarg commented Jan 9, 2024

Some quick tests I ran:

~/src/puma fixed-thread-config
arm64 $ echo 'threads 5; app { [200, {}, ["OK"]] }' | ruby -Ilib bin/puma --config /dev/stdin --port 0 --log-requests
Puma starting in single mode...
* Puma version: 6.4.2 (ruby 3.2.2-p53) ("The Eagle of Durango")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 10063
* Listening on http://0.0.0.0:57352
Use Ctrl-C to stop
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2024-01-09 09:45:08 +0100 ===
- Goodbye!

~/src/puma fixed-thread-config
arm64 $ git co master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

~/src/puma master
arm64 $ echo 'threads 5; app { [200, {}, ["OK"]] }' | ruby -Ilib bin/puma --config /dev/stdin --port 0 --log-requests
/Users/dentarg/src/puma/lib/puma/dsl.rb:490:in `threads': wrong number of arguments (given 1, expected 2) (ArgumentError)
  from /dev/stdin:1:in `_load_from'
  from /Users/dentarg/src/puma/lib/puma/dsl.rb:133:in `instance_eval'
  from /Users/dentarg/src/puma/lib/puma/dsl.rb:133:in `_load_from'
  from /Users/dentarg/src/puma/lib/puma/configuration.rb:239:in `block in load'
  from /Users/dentarg/src/puma/lib/puma/configuration.rb:239:in `each'
  from /Users/dentarg/src/puma/lib/puma/configuration.rb:239:in `load'
  from /Users/dentarg/src/puma/lib/puma/launcher.rb:54:in `initialize'
  from /Users/dentarg/src/puma/lib/puma/cli.rb:66:in `new'
  from /Users/dentarg/src/puma/lib/puma/cli.rb:66:in `initialize'
  from bin/puma:8:in `new'
  from bin/puma:8:in `<main>'

~/src/puma master
arm64 $ echo 'app { [200, {}, ["OK"]] }' | ruby -Ilib bin/puma --config /dev/stdin --port 0 --log-requests --threads 5
Puma starting in single mode...
* Puma version: 6.4.2 (ruby 3.2.2-p53) ("The Eagle of Durango")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 10371
* Listening on http://0.0.0.0:57366
Use Ctrl-C to stop
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2024-01-09 09:45:36 +0100 ===
- Goodbye!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants