File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed
Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 1- # frozen_string_literal: true
2-
31require_relative 'auto_tune'
4- require 'etc'
5- require 'sequel'
62
73# FWBM only... use the puma_auto_tune gem in production!
8- num_workers , num_threads = auto_tune
9- num_threads = [ num_threads , 32 ] . min
10-
11- before_fork do
12- Sequel ::DATABASES . each ( &:disconnect )
13- end
4+ _ , num_threads = auto_tune
145
156if RUBY_PLATFORM == 'java'
167 num_threads = 512
178 num_workers = 0
189end
1910
20- workers num_workers
21- threads num_threads , num_threads
11+ threads num_threads
12+
13+ before_fork do
14+ Sequel ::DATABASES . each ( &:disconnect )
15+ end
Original file line number Diff line number Diff line change @@ -42,10 +42,8 @@ class HelloWorld
4242 </html>'
4343
4444 def initialize
45- if defined? ( Puma )
46- num_workers , num_threads = auto_tune
47- num_threads = [ num_threads , 32 ] . min
48- max_connections = num_workers * num_threads
45+ if defined? ( Puma ) && ( threads = Puma . cli_config . options . fetch ( :max_threads ) ) > 1
46+ max_connections = threads
4947 else
5048 max_connections = 512
5149 end
Original file line number Diff line number Diff line change @@ -19,5 +19,6 @@ RUN bundle install --jobs=8
1919COPY . .
2020
2121EXPOSE 8080
22+ ENV WEB_CONCURRENCY=auto
2223
2324CMD bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080 -e production
You can’t perform that action at this time.
0 commit comments