diff options
author | schneems <richard.schneeman@gmail.com> | 2016-01-14 13:05:41 -0600 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2016-01-29 15:58:37 -0600 |
commit | 5563c329eee5febc22a3330e16fe8a6899d42fe2 (patch) | |
tree | a62ef71a36c3f90ca58341a6f01e81da86c99be7 /actionpack/lib/action_dispatch/railtie.rb | |
parent | 9e4534c4730b8e8ed5c249d4bf3527fb597a1a98 (diff) | |
download | rails-5563c329eee5febc22a3330e16fe8a6899d42fe2.tar.gz rails-5563c329eee5febc22a3330e16fe8a6899d42fe2.tar.bz2 rails-5563c329eee5febc22a3330e16fe8a6899d42fe2.zip |
Add Default Puma Config
When the `puma` command is run without any configuration options it will detect presence of a `config/puma.rb` file and use that. Currently there is discrepancy between `puma` command and `rails server` but Evan said it would be reasonable to add in reading in config from the default location. I am working on that right now as a feature in puma/puma.
Why do we need this? By default Puma uses 16 threads, and by default ActiveRecord only has 5 threads. Due to the architecture of AR it is guaranteed that if you're running with fewer DB connections than your server has threads you will hit `ActiveRecord::ConnectionTimeoutError ` eventually if your app gets modest amounts of traffic. Since we are providing a default webserver, we should provide reasonable configuration for that webserver.
This PR does a few things, first it sets the default Puma thread count to 5 to mach ActiveRecord's default. It sets the default environment to `"development"` and the default port to 300 so that booting the server with `$ puma` will give you the same default port as `rails server`. It is worth mentioning that by reading in from `PORT` environment variable this config can work with containerized deployments, such as on Heroku.
We are not using worker processes by default, that way JRuby and windows devs can use this configuration without modification. I went ahead and included a default `on_worker_boot`. It won't be used unless a worker count is specified, that means this config will not use it. Even though it's not being used now It will make someone who wants to try modifying their config to run extra workers easier.
cc/ @pixeltrix
Diffstat (limited to 'actionpack/lib/action_dispatch/railtie.rb')
0 files changed, 0 insertions, 0 deletions