Skip to content

Commit 037b691

Browse files
authored
[ruby/roda] Let Puma decide the number of workers (#10119)
1 parent 419e625 commit 037b691

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

frameworks/Ruby/roda-sequel/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gem "sequel", "~> 5.67"
66
gem "roda", "~> 3.66"
77
gem "tilt", "~> 2.1", require: "tilt/erb"
88
gem "cgi" # Make sure the h plugin uses the faster CGI.escape_html
9+
gem "concurrent-ruby"
910

1011
group :mysql, optional: true do
1112
gem 'trilogy', '~> 2.9', platforms: [:ruby, :windows]

frameworks/Ruby/roda-sequel/Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ GEM
33
specs:
44
bigdecimal (3.1.9)
55
cgi (0.5.0)
6+
concurrent-ruby (1.3.5)
67
erubi (1.13.1)
78
iodine (0.7.58)
89
json (2.13.2)
@@ -28,6 +29,7 @@ PLATFORMS
2829

2930
DEPENDENCIES
3031
cgi
32+
concurrent-ruby
3133
erubi (~> 1.12)
3234
iodine (~> 0.7)
3335
json (~> 2.8)
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
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
7+
8+
before_fork do
9+
Sequel::DATABASES.each(&:disconnect)
10+
end

frameworks/Ruby/roda-sequel/roda-sequel-postgres.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN bundle install --jobs=8
1616

1717
ENV DBTYPE=postgresql
1818

19+
ENV WEB_CONCURRENCY=auto
1920
EXPOSE 8080
2021

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

frameworks/Ruby/roda-sequel/roda-sequel.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN bundle install --jobs=8
1717

1818
ENV DBTYPE=mysql
1919

20+
ENV WEB_CONCURRENCY=auto
2021
EXPOSE 8080
2122

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

0 commit comments

Comments
 (0)