Skip to content

Commit 403b0f6

Browse files
authored
[ruby/sinatra] Let Puma decide the number of workers (#10120)
1 parent 037b691 commit 403b0f6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

frameworks/Ruby/sinatra-sequel/config/mri_puma.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
require_relative 'auto_tune'
22

33
# FWBM only... use the puma_auto_tune gem in production!
4-
num_workers, num_threads = auto_tune
4+
_, num_threads = auto_tune
55

6-
workers num_workers
7-
threads num_threads, num_threads
6+
threads num_threads
87

98
before_fork do
109
Sequel::DATABASES.each(&:disconnect)

frameworks/Ruby/sinatra/sinatra-postgres.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ WORKDIR /sinatra
1313
ENV BUNDLE_WITH=postgresql:puma
1414
RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile
1515

16+
ENV WEB_CONCURRENCY=auto
1617
ENV DBTYPE=postgresql
1718

1819
EXPOSE 8080

frameworks/Ruby/sinatra/sinatra.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile
1515

1616
ENV DBTYPE=mysql
1717

18+
ENV WEB_CONCURRENCY=auto
1819
EXPOSE 8080
1920

2021
CMD bundle exec puma -C config/mri_puma.rb -b tcp://0.0.0.0:8080 -e production

0 commit comments

Comments
 (0)