Method: Puma::DSL#threads
- Defined in:
- lib/puma/dsl.rb
#threads(min, max = min) ⇒ Object
Configure the number of threads to use to answer requests.
It can be a single fixed number, or a min and a max.
The default is the environment variables PUMA_MIN_THREADS / PUMA_MAX_THREADS (or MIN_THREADS / MAX_THREADS if the PUMA_ variables aren’t set).
If these environment variables aren’t set, the default is “0, 5” in MRI or “0, 16” for other interpreters.
583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'lib/puma/dsl.rb', line 583 def threads(min, max = min) min = Integer(min) max = Integer(max) if min > max raise "The minimum (#{min}) number of threads must be less than or equal to the max (#{max})" end if max < 1 raise "The maximum number of threads (#{max}) must be greater than 0" end [:min_threads] = min [:max_threads] = max end |