Skip to content

Commit 3a24309

Browse files
authored
[ruby/rack] Set puma workers to 1.25 * nproc (#10442)
WEB_CONCURRENCY=auto sets the number of workers to the number of processors. Setting it to 1.25 the number of processors seems to perform better.
1 parent 4bf8626 commit 3a24309

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

frameworks/Ruby/rack/config/puma.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if ENV.fetch('WEB_CONCURRENCY') == 'auto'
1+
if ENV.fetch('WEB_CONCURRENCY').to_i > 1
22
before_fork do
33
Sequel::DATABASES.each(&:disconnect)
44
end

frameworks/Ruby/rack/rack.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ RUN bundle install --jobs=8
1717

1818
COPY . .
1919

20-
ENV WEB_CONCURRENCY=auto
2120
ENV MAX_THREADS=5
2221

2322
EXPOSE 8080
2423

25-
CMD bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080 -e production
24+
CMD export WEB_CONCURRENCY=$(($(nproc)*5/4)) && \
25+
bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080 -e production

0 commit comments

Comments
 (0)