Skip to content

Commit

Permalink
Some minor puma tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
christiannelson committed May 7, 2019
1 parent ce23d2a commit 6d5c972
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
# https://devcenter.heroku.com/articles/heroku-local#set-up-your-local-environment-variables

PORT=3000

# PUMA_WORKERS=1
PUMA_THREADS=5
RAILS_MAX_THREADS=5
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Several common features and operational parameters can be set using environment
* `PORT` - Port to listen on (default: 3000).
* `WEB_CONCURRENCY` - Number of puma workers to spawn (default: 1).
* `RAILS_MAX_THREADS` - Threads per worker (default: 5).
* `RAILS_MIN_THREADS` - Threads per worker (default: 5).
* `DB_POOL` - Number of DB connections per pool (i.e. per worker) (default: RAILS_MAX_THREADS or 5).
* `RAILS_LOG_TO_STDOUT` - Log to standard out, good for Heroku (default: false).
* `RAILS_SERVE_STATIC_FILES` - Serve static assets, good for Heroku (default: false).
Expand Down
7 changes: 4 additions & 3 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
port ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
Expand Down

0 comments on commit 6d5c972

Please sign in to comment.